PREAN/TFndTrack.cxx

00001 // @(#)fROOT/PREAN:$Name:  $:$Id: TFndTrack.cxx,v 1.8 2007/10/02 09:00:08 Diego_Faso Exp $
00002 // Author: Diego Faso <mailto:faso@to.infn.it>, 2007/01/08
00003 
00005 //                             TFndTrack                                //
00007 //                                                          //
00008 // Vertices are needed by tracks, so they are defined here: //
00009 //  see TFndVertex                                          //
00010 //                                                          //
00012 //                                                          //
00013 // The FINUDA event (from DST) is structure in this way:    //
00014 //                                                          //
00015 //  EVENT (info [ev-num,run-num,ev-time,trigger,...])       //
00016 //    |                                                     //
00017 //    +-> List of Tracks from K-                            //
00018 //    +-> List of Tracks from K+                            //
00019 //    +-> List of Vertices (if different from K_stop)       //
00020 //                                                          //
00021 // The link between tracks and vertices (not K-stop) is     //
00022 //  made via the VertexID (track data-member):              //
00023 //     fVertexID == -1 ===> track directly from K_stop      //
00024 //     fVertexID >=  0 ===> track from other kind of vertex //
00025 //                   fVertexID: entry of the vertices array //
00026 //                                                          //
00027 //                                                          //////////
00028 //                                                                  //
00029 // Relationship between tracks and vertex:                          //
00030 //    vertex->tracks                                                //
00031 //      (the vertex is always the starting point of related tracks) //
00032 //                                                                  //
00033 // Vertex PID is referred to the particle the track starts from.    //
00034 //                                                                  //
00035 //                                                          //////////
00036 //                                                          //
00037 // NOTE: (Sept 22, 2007)                                    //
00038 //   The vertex implementation is still in progress:        //
00039 //    Waiting for fidarc implementation to be completed...  //
00040 //                                                          //
00042 
00043 #include "TFndTrack.h"
00044 
00045 ClassImp(TFndVertex)
00046   
00047 //_______________________
00048 TFndVertex::TFndVertex():
00049   fPID(),fPosition(),
00050   fDistFromPrimary(),fZtollerance()
00051 {
00052   Reset();
00053 }
00054 
00055 //_______________________
00056 TFndVertex::~TFndVertex()
00057 {  
00058   Reset();  
00059 }
00060 
00061 //_______________________
00062 void TFndVertex::Reset(){
00063   // reset all data-members
00064   fPID = 0;
00065   bzero(fPosition,sizeof(fPosition));
00066   fDistFromPrimary = -1;
00067   fZtollerance = -1;
00068 }
00069 
00073 
00074 ClassImp(TFndTrack)
00075   
00076 //_______________________
00077 TFndTrack::TFndTrack():
00078   fVertexID(),
00079   fCharge(),fChargeAmbig(),fFwd(),
00080   fStart(),fStop(),
00081   fTOF(),fEnergy(),
00082   fNumOfHits(),fPath(),
00083   fPR_Helix(),fPR_MomVert(),
00084   fFitErr(),fLength(),fChiSq(),
00085   fFit_MomVert(),fFit_MomVertErr(),
00086   fDeDx(),fCorr_DeDx(),
00087   fExtrapolated(),fBackTrack(),
00088   fType(),fDistVert(),
00089   fIsimCos(),fOsimCos(),fLmd1Cos(),fLmd2Cos(),
00090   fSpecMom()
00091 {
00092   Reset();
00093 }
00094 
00095 //_______________________
00096 TFndTrack::~TFndTrack(){
00097 
00098   Reset();
00099 }
00100 
00101 
00102 //_______________________
00103 void TFndTrack::Reset(){
00104   // reset all data-members
00105 
00106   fVertexID = -1;
00107   fCharge = -2;
00108   fChargeAmbig = kFALSE;
00109   fFwd = kFALSE;
00110 
00111   for(Int_t i = (Int_t)E_Trk_X; i < (Int_t)E_Trk_Vect_End; i++ ){
00112     fStart[i] = 0;
00113     fStop[i] = 0;
00114   }
00115   // ---
00116   fTOF = 0;
00117   fEnergy = 0;
00118   
00119   fNumOfHits = 0;
00120   fPath = 0;  
00121   
00122   for(Int_t i = (Int_t)E_Hel_Xc; i < (Int_t)E_Hel_Geo_End; i++ ) fPR_Helix[i] = 0;
00123   for(Int_t i = (Int_t)E_Hel_Mom; i < (Int_t)E_Hel_Mom_End; i++) fPR_MomVert[i] = 0;
00124   // ---
00125   
00126   // by fitting process and extrapolation
00127   fFitErr = 0;
00128   fLength = 0;
00129   
00130   for(Int_t i = (Int_t)E_Trk_ChiSq_DEV; i < (Int_t)E_Trk_ChiSq_End; i++) fChiSq[i] = 0;
00131   
00132   for(Int_t i = (Int_t)E_Hel_Mom; i < (Int_t)E_Hel_Mom_End; i++){
00133     fFit_MomVert[i] = 0; // fitted momentum
00134     fFit_MomVertErr[i] = 0; // errors on fitted momentum
00135   }  
00136   for(Int_t i=0;i<2;i++) fDeDx[i] = 0;
00137   for(Int_t i=0;i<4;i++) fCorr_DeDx[i] = 0;
00138 
00139   fExtrapolated = kFALSE;
00140   for(Int_t i = (Int_t)E_Trk_Bcktrk_NormAng; i < (Int_t)E_Trk_Bcktrk_End; i++ ){
00141     fBackTrack[i] = 0;
00142   }
00143 
00144   // --- support for short tracks
00145   fType = 0;
00146   fDistVert = 0;
00147   // 
00148   fIsimCos = 0;
00149   fOsimCos = 0;
00150   fLmd1Cos = 0;
00151   fLmd2Cos = 0;
00152   fSpecMom = 0;
00153 
00154 }
00155 
00156 //_______________________
00157 void TFndTrack::EvalTrack(){
00158   
00159 #ifndef FIDA_USE_SHORT
00160   Error("EvalTrack","This method is meaningful is you are not using short tracks!");
00161   return;
00162 #endif
00163 
00164   fNumOfHits = 0;
00165   fFwd = kFALSE;
00166   
00167   if(fType == 0) return; // no hit: nothing to do...
00168   
00169   Int_t isi = (Int_t)(fType%10);
00170   Int_t osi = (Int_t)(fType%100) - isi;
00171   Int_t lm1 = (Int_t)(fType%1000) - osi - isi;
00172   Int_t lm2 = (Int_t)(fType%10000) - lm1 - osi - isi; 
00173   Int_t stb = fType - lm2 - lm1 - osi - isi;
00174   
00175   osi = osi / 10;
00176   lm1 = lm1 / 100;
00177   lm2 = lm2 / 1000;
00178   stb = stb / 10000;
00179 
00180   //   cout << "isi: " << isi << endl;
00181   //   cout << "osi: " << osi << endl;
00182   //   cout << "lm1: " << lm1 << endl;
00183   //   cout << "lm2: " << lm2 << endl;
00184   //   cout << "stb: " << stb << endl;
00185   
00186   fNumOfHits += isi;
00187   fNumOfHits += osi;
00188   fNumOfHits += lm1;
00189   fNumOfHits += lm2;
00190   fNumOfHits += stb;
00191   
00192   // --- fwd evaluation
00193   if(isi == 0 && fNumOfHits > 1) fFwd = kTRUE;
00194 
00195   //   cout << "fNumOfHits: " << fNumOfHits << endl;
00196   //   cout << "FWD       : " << fFwd << endl;
00197   //   cout << "FitVal    : " << fFitErr << endl;
00198   //   cout << "--- --- ---" << endl;
00199   
00200   // --- momentum inside spectrometer
00201   fSpecMom = fFit_MomVert[TFndTrack::E_Hel_Mom] - 
00202     fBackTrack[TFndTrack::E_Trk_Bcktrk_dPtgt_spline] - 
00203     fBackTrack[TFndTrack::E_Trk_Bcktrk_dPtgt_spline_cor];
00204 }
00205 
00206 //_______________________
00207 void TFndTrack::SetPath(UInt_t tofi,UInt_t isim,UInt_t osim,UInt_t lmd_inn,UInt_t lmd_out,UInt_t tofo){
00208   // --- description of "path" [hex code] (zero in case of missing hit):
00209   //      digit 0: TOFINO slab (1-12) [0x1  - 0xC]
00210   //      digit 1: ISIM module (1- 8) [0x1  - 0x8]
00211   //      digit 2: OSIM module (1-10) [0x11 - 0xA]
00212   //      digit 3: INN LMD dch (1- 8) [0x1  - 0x8]
00213   //      digit 4: OUT LMD dch (1- 8) [0x1  - 0x8]
00214   //      digits 5-6: TOFONE slab (1-72) [0x1  - 0x48]
00215   //      digit 7: free
00216   
00217   fPath = 0;
00218   
00219   // --- tofino
00220   UInt_t tmp_v = tofi;
00221   tmp_v = tmp_v & 0xF;  
00222   fPath = fPath | tmp_v;
00223   
00224   // --- isim
00225   tmp_v = isim;
00226   tmp_v = tmp_v & 0xF;  
00227   fPath = fPath | (tmp_v << 4);
00228   
00229   // --- osim
00230   tmp_v = osim;
00231   tmp_v = tmp_v & 0xF;  
00232   fPath = fPath | (tmp_v << 8);
00233   
00234   // --- lmd inner
00235   tmp_v = lmd_inn;
00236   tmp_v = tmp_v & 0xF;  
00237   fPath = fPath | (tmp_v << 12);
00238   
00239   // --- lmd outer
00240   tmp_v = lmd_out;
00241   tmp_v = tmp_v & 0xF;  
00242   fPath = fPath | (tmp_v << 16);
00243   
00244   // --- tofone
00245   tmp_v = tofo;
00246   tmp_v = tmp_v & 0xFF;  
00247   fPath = fPath | (tmp_v << 20);
00248   
00249 }
00250 
00251 //_______________________
00252 UInt_t TFndTrack::GetPath(UInt_t &tofi,UInt_t &isim,UInt_t &osim,UInt_t &lmd_inn,UInt_t &lmd_out,UInt_t &tofo){
00253   // the encoded path is returned,
00254   // single detector channels are passed for reference (see arguments)  
00255 
00256   tofi =    GetPath_Tofino();
00257   isim =    GetPath_Isim();
00258   osim =    GetPath_Osim();
00259   lmd_inn = GetPath_Lmd_Inn();
00260   lmd_out = GetPath_Lmd_Out();
00261   tofo =    GetPath_Tofone();
00262   
00263 
00264   return fPath;
00265 }
00266 
00267 //_______________________
00268 UInt_t TFndTrack::GetPath_Tofino(){
00269 
00270   UInt_t res =  (fPath & 0xF);
00271   return res;
00272 }
00273 
00274 //_______________________
00275 UInt_t TFndTrack::GetPath_Isim(){
00276   
00277   UInt_t res = ( (fPath & 0xF0)     >> 4 );
00278   return res;
00279 }
00280 
00281 //_______________________
00282 UInt_t TFndTrack::GetPath_Osim(){
00283   
00284   UInt_t res = ( (fPath & 0xF00)    >> 8 );
00285   return res;
00286 }
00287 
00288 //_______________________
00289 UInt_t TFndTrack::GetPath_Lmd_Inn(){
00290   
00291   UInt_t res = ( (fPath & 0xF000)   >> 12 );
00292   return res;
00293 }
00294 
00295 //_______________________
00296 UInt_t TFndTrack::GetPath_Lmd_Out(){
00297   
00298   UInt_t res = ( (fPath & 0xF0000)  >> 16 );
00299   return res;
00300 }
00301 
00302 //_______________________
00303 UInt_t TFndTrack::GetPath_Tofone(){
00304   
00305   UInt_t res = ( (fPath & 0xFF00000)  >> 20 );
00306   return res;
00307 }
00308 
00309 //_______________________
00310 void TFndTrack::PrintData(Int_t depth){
00311 
00312   if(depth < 1){
00313     Warning("PrintData","Nothing to print if depth < 1.");
00314     return;
00315   }
00316   
00317   TString msg = "";
00318   TString clin = "";
00319 
00320   clin.Form("\n --- --- --- TRACK  data --- --- ---\n"); msg+=clin;
00321  
00322   clin.Form("  -> Charge ........: %.0f\n",fCharge); msg+=clin;
00323   clin.Form("  -> Charge ambig.  : %i\n",(Int_t)(fChargeAmbig)); msg+=clin;
00324   clin.Form("  -> Time Of Flight : %.2f\n",fTOF); msg+=clin;
00325 
00326   if(fCharge == E_Trk_Neut){
00327     clin.Form("  -> Evaluated energy: %.2f\n",fEnergy); msg+=clin;
00328     return;
00329   }
00330 
00331   clin.Form("  -> Is forward: %i\n",fFwd); msg+=clin;
00332   clin.Form("  -> Num. of hits: %d\n",fNumOfHits); msg+=clin;
00333   clin.Form("  -> Path code: 0X%x\n",fPath); msg+=clin;
00334 
00335   if(depth >= 2){
00336     clin.Form("  --> Start point: (%.3f, %.3f, %.3f); time: %.3f\n",
00337               fStart[E_Trk_X],
00338               fStart[E_Trk_Y],
00339               fStart[E_Trk_Z],
00340               fStart[E_Trk_T]
00341               ); 
00342     msg+=clin;
00343     clin.Form("  --> Stop point : (%.3f, %.3f, %.3f); time: %.3f\n",
00344               fStop[E_Trk_X],
00345               fStop[E_Trk_Y],
00346               fStop[E_Trk_Z],
00347               fStop[E_Trk_T]
00348               );
00349     msg+=clin;
00350   }
00351 
00352   if(depth >= 3){
00353     clin.Form("  ---> Start point dir-cos.: (%.3f, %.3f, %.3f)\n",
00354               fStart[E_Trk_cosX],
00355               fStart[E_Trk_cosY],
00356               fStart[E_Trk_cosZ]
00357               );
00358     msg+=clin;
00359     clin.Form("  ---> Stop point dir-cos. : (%.3f, %.3f, %.3f)\n",
00360               fStop[E_Trk_cosX],
00361               fStop[E_Trk_cosY],
00362               fStop[E_Trk_cosZ]
00363               );
00364     msg+=clin;
00365   }
00366   // ---
00367   clin.Form("             --- P.R. ---\n"); msg+=clin;
00368 
00369   if(depth >= 3){
00370     clin.Form("  ---> P.R. Helix (Xc, Yc, R): %.3f, %.3f, %.3f\n",
00371               fPR_Helix[E_Hel_Xc],
00372               fPR_Helix[E_Hel_Yc],
00373               fPR_Helix[E_Hel_R]
00374               );
00375     msg+=clin;
00376   }
00377   if(depth >= 2){
00378     clin.Form("  --> P.R. Mom (mom, lambda, phi): %.3f, %.3f, %.3f\n",
00379               fPR_MomVert[E_Hel_Mom],
00380               fPR_MomVert[E_Hel_Lam],
00381               fPR_MomVert[E_Hel_Phi]
00382               );
00383     msg+=clin;
00384   }
00385 
00386   // ---
00387   clin.Form("             --- FIT ---\n"); msg+=clin;
00388   
00389   clin.Form("  -> Fitting error code: %d\n",fFitErr); msg+=clin;
00390   
00391   if(depth >= 2){
00392     clin.Form("  --> Fitted Length: %.3f\n",fLength); msg+=clin;
00393     clin.Form("  --> Fit Chi^2 (DEV,RES,LOST,STEREO): %.3f, %.3f, %.3f, %.3f\n",
00394               fChiSq[E_Trk_ChiSq_DEV],
00395               fChiSq[E_Trk_ChiSq_RES],
00396               fChiSq[E_Trk_ChiSq_LOSTstb],
00397               fChiSq[E_Trk_ChiSq_STEREOstb]
00398               );
00399     msg+=clin;
00400   }
00401 
00402   clin.Form("  -> Fit Mom (mom, lambda, phi): %.3f, %.3f, %.3f\n",
00403             fFit_MomVert[E_Hel_Mom],
00404             fFit_MomVert[E_Hel_Lam],
00405             fFit_MomVert[E_Hel_Phi]
00406             );
00407   msg+=clin;
00408   
00409   if(depth >= 2){
00410     clin.Form("  --> Fit Mom Err. (mom, lambda, phi): %.3f, %.3f, %.3f\n",
00411               fFit_MomVertErr[E_Hel_Mom],
00412               fFit_MomVertErr[E_Hel_Lam],
00413               fFit_MomVertErr[E_Hel_Phi]
00414               );    
00415     msg+=clin;
00416   }
00417   
00418   clin.Form("  -> ISIM dE/dx : %.3f\n", fDeDx[0]); msg+=clin;
00419   clin.Form("  -> OSIM dE/dx : %.3f\n", fDeDx[1]); msg+=clin;
00420   //
00421   clin.Form("  -> ISIM corr. dE/dx : %.3f\n", fCorr_DeDx[0]); msg+=clin;
00422   clin.Form("  -> OSIM corr. dE/dx : %.3f\n", fCorr_DeDx[1]); msg+=clin;
00423   clin.Form("  -> LMD1 corr. dE/dx : %.3f\n", fCorr_DeDx[2]); msg+=clin;
00424   clin.Form("  -> LMD2 corr. dE/dx : %.3f\n", fCorr_DeDx[3]); msg+=clin;
00425 
00426   
00427   clin.Form("         --- BACK-TRACKING ---\n"); //fExtrapolated
00428   clin.Form("  -> Extrapolation performed        : %i\n",  (Int_t) (fExtrapolated) ); msg+=clin;
00429   if(fExtrapolated){
00430     clin.Form("  -> BackTracking (Norm-Angle)      : %.3f\n", fBackTrack[E_Trk_Bcktrk_NormAng]); msg+=clin;
00431     clin.Form("  -> BackTracking (Surf-Approach)   : %.3f\n", fBackTrack[E_Trk_Bcktrk_SurfApproach]); msg+=clin;
00432     clin.Form("  -> BackTracking (Max-Approach)    : %.3f\n", fBackTrack[E_Trk_Bcktrk_MaxApproach]); msg+=clin;
00433     clin.Form("  -> BackTracking (Surf-Plane-path) : %.3f\n", fBackTrack[E_Trk_Bcktrk_SurfPlanePath]); msg+=clin;
00434     clin.Form("  -> BackTracking (Extrap-distance) : %.3f\n", fBackTrack[E_Trk_Bcktrk_ExtrDist]); msg+=clin;
00435     if(depth >= 2){
00436       clin.Form("  --> BackTracking (Delta P)         : %.3f\n", fBackTrack[E_Trk_Bcktrk_dPtgt_spline]); msg+=clin;
00437       clin.Form("  --> BackTracking (Delta P - cor.)  : %.3f\n", fBackTrack[E_Trk_Bcktrk_dPtgt_spline_cor]); msg+=clin;
00438       clin.Form("  --> BackTracking (geant PID code)  : %.0f\n", fBackTrack[E_Trk_Bcktrk_pid]); msg+=clin;
00439     }
00440   }
00441   clin.Form("  -> Track TYPE : %.d\n", fType); msg+=clin;
00442   clin.Form("  -> Dist_vert  : %.3f\n", fDistVert); msg+=clin;
00443   clin.Form("  -> Dir-cos-ISIM : %.3f\n", fIsimCos); msg+=clin;
00444   clin.Form("  -> Dir-cos-OSIM : %.3f\n", fOsimCos); msg+=clin;
00445   clin.Form("  -> Dir-cos-LMD1 : %.3f\n", fLmd1Cos); msg+=clin;
00446   clin.Form("  -> Dir-cos-LMD1 : %.3f\n", fLmd2Cos); msg+=clin;
00447   clin.Form("  -> Spec.Mom.    : %.3f\n", fSpecMom); msg+=clin;
00448   clin.Form(" --- --- --- --- --- --- --- --- ---\n"); msg+=clin;
00449   
00450   Printf(msg.Data());
00451 }

Generated on Tue Oct 16 15:40:47 2007 by  doxygen 1.5.2