Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

NeutrinoFitObject.C

Go to the documentation of this file.
00001 
00002 // Class NeutrinoFitObject
00003 //
00004 // Author: Jenny Boehme
00005 // Last update: $Date: 2005/01/12 10:11:45 $
00006 //          by: $Author: blist $
00007 // 
00008 // Description: class for jets with (E, theta, phi) in kinematic fits
00009 //               
00011 
00012 #include"jbltools/kinfit/NeutrinoFitObject.h"
00013 #include <cmath>
00014 #include <cassert>
00015 #include <algorithm>
00016 
00017 using std::sqrt;
00018 using std::sin;
00019 using std::cos;
00020 
00021 // constructor
00022 NeutrinoFitObject::NeutrinoFitObject(double E, double theta, double phi,  
00023                            double DE, double Dtheta, double Dphi, 
00024                            double m) {
00025   setMass (m);
00026   setParam (0, E, false);
00027   setParam (1, theta, false);
00028   setParam (2, phi, false);
00029 }
00030 
00031 // destructor
00032 NeutrinoFitObject::~NeutrinoFitObject() {}
00033 
00034 const char *NeutrinoFitObject::getParamName (int ilocal) const {
00035   switch (ilocal) {
00036     case 0: return "E";
00037     case 1: return "theta";
00038     case 2: return "phi";
00039   }
00040   return "undefined";
00041 }
00042 
00043 //setters
00044 bool NeutrinoFitObject::setParam (int i, double par_, bool measured_ ) {
00045   if (i < 0 || i > 2) {
00046     std::cerr << "NeutrinoFitObject::setParam: Illegal i=" << i << std::endl;
00047     return false;
00048   }
00049   measured[i] = measured_;
00050   return setParam (i, par_);
00051 };  
00052 
00053 bool NeutrinoFitObject::setParam (int i, double par_ ) {
00054   switch (i) {
00055     // Energy: positive, greater than mass
00056     case 0: par[0] = (par_ >= mass) ? par_ : mass;
00057             return (par_ >= mass);
00058     // theta: between 0 and pi
00059     case 1: par[1] = (par_ >= 0 && par_ < M_PI) ? 
00060                       par_ : std::acos (std::cos (par_));
00061             return true;          
00062     // phi: between -pi and pi
00063     case 2: par[2] = (std::abs(par_) <= M_PI) ? 
00064                      par_ : std::atan2 (std::sin (par_), std::cos (par_));
00065             return true;          
00066     default: std::cerr << "NeutrinoFitObject::setParam: Illegal i=" << i << std::endl;
00067   }
00068   return false;
00069 };  
00070 
00071 // these depend on actual parametrisation!
00072 double NeutrinoFitObject::getPx() const {
00073   return getP() * cos(par[2]) * sin(par[1]);
00074 }
00075 double NeutrinoFitObject::getPy() const {
00076   return getP() * sin(par[2]) * sin(par[1]);
00077 }
00078 double NeutrinoFitObject::getPz() const {
00079   return getP() * cos(par[1]);
00080 }
00081 double NeutrinoFitObject::getE() const {return std::abs(par[0]);}
00082 
00083 
00084 double NeutrinoFitObject::getDPx(int ilocal) const {
00085   double result;
00086   if (ilocal == 0) {                                 // d px / dE
00087     result = par[0]/getP() * cos(par[2]) * sin(par[1]);
00088   } 
00089   else if (ilocal == 1) {                                 // d px / d theta
00090     result = getP() * cos(par[2]) * cos(par[1]);
00091   }  
00092   else if (ilocal == 2) {                                 // d px / d phi
00093     result =  -getP() * sin(par[2]) * sin(par[1]);
00094   }  
00095   return result; 
00096 }
00097 
00098 double NeutrinoFitObject::getDPy(int ilocal) const {
00099   double result;
00100   if (ilocal == 0) {                                 // d py / dE
00101     result = par[0]/getP() * sin(par[2]) * sin(par[1]);
00102   } 
00103   else if (ilocal == 1) {                                 // d py / d theta
00104     result =  getP() * sin(par[2]) * cos(par[1]);
00105   }  
00106   else if (ilocal == 2) {                                 // d py / d phi
00107     result =  getP() * cos(par[2]) * sin(par[1]);
00108   }  
00109   return result; 
00110 }
00111 
00112 double NeutrinoFitObject::getDPz(int ilocal) const {
00113   double result;
00114   if (ilocal == 0) {                                 // d pz / dE
00115     result = par[0]/getP() * cos(par[1]);
00116   } 
00117   else if (ilocal == 1) {                                 // d pz / d theta
00118     result = -getP() * sin(par[1]); 
00119   }  
00120   else if (ilocal == 2) {                                 // d pz / d phi
00121     result = 0; 
00122   }  
00123   return result; 
00124 }
00125 double NeutrinoFitObject::getD2Px(int ilocal1, int ilocal2) const {
00126   double result = 0;
00127   if (ilocal1 > ilocal2) std::swap (ilocal1, ilocal2);
00128   assert (ilocal1 >= 0 && ilocal1 <= ilocal2);
00129   assert (ilocal2 >= 0 && ilocal2 <= NPAR);
00130   if (ilocal1 == 0) { 
00131     if (ilocal2 == 0) {                            
00132       result = -mass/std::pow(par[0]*par[0]-mass*mass,1.5) * cos(par[2]) * sin(par[1]);
00133     }
00134     else if (ilocal2 == 1) { 
00135       result = par[0]/getP() * cos(par[2]) * cos(par[1]);
00136     }
00137     else if (ilocal2 == 2) { 
00138       result = -par[0]/getP() * sin(par[2]) * sin(par[1]);
00139     }
00140   } 
00141   else if (ilocal1 == 1) { 
00142     if (ilocal2 == 1) {                             
00143     result = -getP() * cos(par[2]) * sin(par[1]);
00144     }
00145     else if (ilocal2 == 2) {
00146       result = -getP() * sin(par[2]) * cos(par[1]);
00147     }
00148   }  
00149   else if (ilocal1 == 2) {  
00150     if (ilocal2 == 2) {                                
00151       result =  -getP() * cos(par[2]) * sin(par[1]);
00152     }
00153   }  
00154   return result;
00155 }
00156 double NeutrinoFitObject::getD2Py(int ilocal1, int ilocal2) const {
00157   double result = 0;
00158   if (ilocal1 > ilocal2) std::swap (ilocal1, ilocal2);
00159   assert (ilocal1 >= 0 && ilocal1 <= ilocal2);
00160   assert (ilocal2 >= 0 && ilocal2 <= NPAR);
00161   if (ilocal1 == 0) { 
00162     if (ilocal2 == 0) {                            
00163       result = -mass/std::pow(par[0]*par[0]-mass*mass, 1.5) * sin(par[2]) * sin(par[1]);
00164     }
00165     else if (ilocal2 == 1) { 
00166       result = par[0]/getP() * sin(par[2]) * cos(par[1]);
00167     }
00168     else if (ilocal2 == 2) { 
00169       result = par[0]/getP() * cos(par[2]) * sin(par[1]);
00170     }
00171   } 
00172   else if (ilocal1 == 1) { 
00173     if (ilocal2 == 1) {                             
00174       result = -getP() * sin(par[2]) * sin(par[1]);
00175     }
00176     else if (ilocal2 == 2) {
00177       result =  getP() * cos(par[2]) * cos(par[1]);
00178     }
00179   }  
00180   else if (ilocal1 == 2) {  
00181     if (ilocal2 == 2) {                                
00182       result = -getP() * sin(par[2]) * sin(par[1]);
00183     }
00184   }  
00185   return result;
00186 }
00187 double NeutrinoFitObject::getD2Pz(int ilocal1, int ilocal2) const {
00188   double result = 0;
00189   if (ilocal1 > ilocal2) std::swap (ilocal1, ilocal2);
00190   assert (ilocal1 >= 0 && ilocal1 <= ilocal2);
00191   assert (ilocal2 >= 0 && ilocal2 <= NPAR);
00192   if (ilocal1 == 0) { 
00193     if (ilocal2 == 0) {                            
00194       result = -mass/std::pow(std::abs(par[0]*par[0]-mass*mass), 1.5) * cos(par[1]);
00195     }
00196     else if (ilocal2 == 1) { 
00197       result = -par[0]/getP() * sin(par[1]);
00198     }
00199   } 
00200   else if (ilocal1 == 1) { 
00201     if (ilocal2 == 1) {                             
00202       result = -getP() * cos(par[1]); 
00203     }
00204   }  
00205   return result;
00206 }
00207 double NeutrinoFitObject::getD2E (int ilocal1, int ilocal2) const {
00208   double result = 0;
00209   if (ilocal1 == 0 && ilocal2 == 0) result = 1;
00210   return result;
00211 }
00212 
00213 double NeutrinoFitObject::getDE(int ilocal) const {
00214   double result;
00215   if (ilocal == 0) {                                 // d E / dE
00216     result = 1.; 
00217   }  
00218   else  {                                 // d E / d theta, phi
00219     result = 0;
00220   } 
00221   return result; 
00222 }
00223           
00224 void NeutrinoFitObject::addToGlobalDerMatrix (int idim, double c, double *M) const {
00225   assert (0);
00226 
00227 }

Generated on Fri Sep 14 17:38:21 2007 for Kinfit by doxygen 1.3.2