]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFtrackerMI.cxx
Implemented Copy() function for all esd objects to allow for assignment of AliESDEven...
[u/mrichter/AliRoot.git] / TOF / AliTOFtrackerMI.cxx
index 0bb5fb65801e2857f75701722eee0fced3d89fac..d5f7adbdf134a46fb0f37ad34e6838de69605d0e 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-// AliTOFtracker Class
-// Task: Perform association of the ESD tracks to TOF Clusters
-// and Update ESD track with associated TOF Cluster parameters 
-//
-//--------------------------------------------------------------------
+
+//-----------------------------------------------------------------//
+//                                                                 //
+//   AliTOFtracker Class                                           //
+//   Task: Perform association of the ESD tracks to TOF Clusters   //
+//   and Update ESD track with associated TOF Cluster parameters   //
+//                                                                 //
+//-----------------------------------------------------------------//
 
 #include <Rtypes.h>
-#include "AliTOFtrackerMI.h"
-#include "AliTOFtrack.h"
+
 #include "TClonesArray.h"
-#include "TError.h"
-#include "AliTOFdigit.h"
-#include "AliTOFGeometry.h"
-#include "AliTOF.h"
-#include "AliRun.h"
-#include "AliModule.h"
+//#include "TGeoManager.h"
+#include "TTree.h"
 #include "TTreeStream.h"
-#include "AliTOFcluster.h"
+
+//#include "AliRun.h"
+#include "AliESDEvent.h"
+#include "AliESDtrack.h"
+
+#include "AliTOFRecoParam.h"
 #include "AliTOFcalib.h"
+#include "AliTOFcluster.h"
+#include "AliTOFGeometry.h"
+#include "AliTOFtrackerMI.h"
+#include "AliTOFtrack.h"
+#include "AliTOFpidESD.h"
+
+class TGeoManager;
+
+extern TGeoManager *gGeoManager;
 
 ClassImp(AliTOFtrackerMI)
 
 //_____________________________________________________________________________
-AliTOFtrackerMI::AliTOFtrackerMI(AliTOFGeometry * geom, Double_t parPID[2]) { 
+AliTOFtrackerMI::AliTOFtrackerMI():
+  fRecoParam(0x0),
+  fGeom(0x0),
+  fPid(0x0),
+  fN(0),
+  fNseeds(0),
+  fNseedsTOF(0),
+  fngoodmatch(0),
+  fnbadmatch(0),
+  fnunmatch(0),
+  fnmatch(0),
+  fR(379.), 
+  fTOFHeigth(15.3),  
+  fdCut(3.), 
+  fDx(1.5), 
+  fDy(0), 
+  fDz(0), 
+  fTracks(0x0),
+  fSeeds(0x0),
+  fDebugStreamer(0x0)
+ { 
   //AliTOFtrackerMI main Ctor
 
-  //fHoles=true;
-  fNseeds=0;
-  fNseedsTOF=0;
-  fngoodmatch=0;
-  fnbadmatch=0;
-  fnunmatch=0;
-  fnmatch=0;
-  fGeom = geom;
-  fTOFpid = new AliTOFpidESD(parPID);
-  fR=378.; 
-  fTOFHeigth=15.3;  
-  fdCut=3.; 
-  fDy=AliTOFGeometry::XPad(); 
-  fDz=AliTOFGeometry::ZPad(); 
-  fDx=1.5; 
-  fSeeds=0x0;
-  fTracks=0x0;
-  fN=0;
-  fDebugStreamer = new TTreeSRedirector("TOFdebug.root");   
-  //Init(); // temporary solution to know about Holes/no Holes
-  fHoles=geom->GetHoles();
+   fRecoParam=new AliTOFRecoParam();
+   fGeom=new AliTOFGeometry();
+   Double_t parPID[2];   
+   parPID[0]=fRecoParam->GetTimeResolution();
+   parPID[1]=fRecoParam->GetTimeNSigma();
+   fPid=new AliTOFpidESD(parPID);
+   fDy=AliTOFGeometry::XPad(); 
+   fDz=AliTOFGeometry::ZPad(); 
+   fDebugStreamer = new TTreeSRedirector("TOFdebug.root");   
 }
 //_____________________________________________________________________________
-AliTOFtrackerMI::AliTOFtrackerMI(const AliTOFtrackerMI &t):AliTracker() { 
+AliTOFtrackerMI::AliTOFtrackerMI(const AliTOFtrackerMI &t):
+  AliTracker(),
+  fRecoParam(0x0),
+  fGeom(0x0),
+  fPid(0x0),
+  fN(0),
+  fNseeds(0),
+  fNseedsTOF(0),
+  fngoodmatch(0),
+  fnbadmatch(0),
+  fnunmatch(0),
+  fnmatch(0),
+  fR(379.), 
+  fTOFHeigth(15.3),  
+  fdCut(3.), 
+  fDx(1.5), 
+  fDy(0), 
+  fDz(0), 
+  fTracks(0x0),
+  fSeeds(0x0),
+  fDebugStreamer(0x0)
+ { 
   //AliTOFtrackerMI copy Ctor
 
-  fHoles=t.fHoles;
   fNseeds=t.fNseeds;
   fNseedsTOF=t.fNseedsTOF;
   fngoodmatch=t.fngoodmatch;
   fnbadmatch=t.fnbadmatch;
   fnunmatch=t.fnunmatch;
   fnmatch=t.fnmatch;
-  fGeom = t.fGeom;
-  fTOFpid = t.fTOFpid;
+  fRecoParam = t.fRecoParam;
+  fGeom=t.fGeom;
+  fPid = t.fPid;
   fR=t.fR; 
   fTOFHeigth=t.fTOFHeigth;  
   fdCut=t.fdCut; 
@@ -89,15 +130,15 @@ AliTOFtrackerMI& AliTOFtrackerMI::operator=(const AliTOFtrackerMI &t)
 { 
   //AliTOFtrackerMI assignment operator
 
-  this->fHoles=t.fHoles;
   this->fNseeds=t.fNseeds;
   this->fNseedsTOF=t.fNseedsTOF;
   this->fngoodmatch=t.fngoodmatch;
   this->fnbadmatch=t.fnbadmatch;
   this->fnunmatch=t.fnunmatch;
   this->fnmatch=t.fnmatch;
+  this->fRecoParam = t.fRecoParam;
   this->fGeom = t.fGeom;
-  this->fTOFpid = t.fTOFpid;
+  this->fPid = t.fPid;
   this->fR=t.fR; 
   this->fTOFHeigth=t.fTOFHeigth;  
   this->fdCut=t.fdCut; 
@@ -120,29 +161,13 @@ AliTOFtrackerMI::~AliTOFtrackerMI(){
     //fDebugStreamer->Close();
     delete fDebugStreamer;
   }
-  delete fTOFpid;
+  delete fRecoParam;
+  delete fGeom;
+  delete fPid;
 }
 
 //_____________________________________________________________________________
-/*
-void AliTOFtrackerMI::Init() { 
-
-// temporary solution to know about Holes/no Holes, will be implemented as 
-// an AliTOFGeometry getter
-
-  AliModule* frame=gAlice->GetModule("FRAME"); 
-
-  if(!frame) {
-    Error("Init","Could Not load FRAME! Assume Frame with Holes \n");
-    fHoles=true;
-  } else{
-    if(frame->IsVersion()==1) {fHoles=false;}    
-    else {fHoles=true;}      
-  }
-}
-*/
-//_____________________________________________________________________________
-Int_t AliTOFtrackerMI::PropagateBack(AliESD* event) {
+Int_t AliTOFtrackerMI::PropagateBack(AliESDEvent* event) {
   //
   // Gets seeds from ESD event and Match with TOF Clusters
   //
@@ -214,7 +239,7 @@ Int_t AliTOFtrackerMI::PropagateBack(AliESD* event) {
 
 
   //Make TOF PID
-  fTOFpid->MakePID(event);
+  fPid->MakePID(event);
 
   if (fSeeds) {
     fSeeds->Delete();
@@ -242,13 +267,13 @@ void AliTOFtrackerMI::CollectESD() {
     AliESDtrack *t =(AliESDtrack*)fSeeds->UncheckedAt(i);
     if ((t->GetStatus()&AliESDtrack::kTPCout)==0)continue;
 
-    // TRD good tracks, already propagated at 371 cm
+    // TRD good tracks, already propagated at 372 cm
 
     AliTOFtrack *track = new AliTOFtrack(*t); // New
     Double_t x = track->GetX(); //New
 
     if (((t->GetStatus()&AliESDtrack::kTRDout)!=0 ) && 
-        ( x >= fGeom->RinTOF()) ){
+        ( x >= AliTOFGeometry::RinTOF()) ){
       track->SetSeedIndex(i);
       t->UpdateTrackParams(track,AliESDtrack::kTOFout);    
       new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
@@ -260,8 +285,7 @@ void AliTOFtrackerMI::CollectESD() {
     // Propagate the rest of TPCbp  
 
     else {
-      if(track->PropagateToInnerTOF(fHoles)){ // temporary solution
-       //      if(track->PropagateToInnerTOF(fGeom->GetHoles())){
+      if(track->PropagateToInnerTOF()){ // temporary solution
        track->SetSeedIndex(i);
        t->UpdateTrackParams(track,AliESDtrack::kTOFout);    
        new(aTOFTrack[fNseedsTOF]) AliTOFtrack(*track);
@@ -309,7 +333,7 @@ void AliTOFtrackerMI::MatchTracksMI(Bool_t mLastStep){
   
   Int_t nSteps=(Int_t)(fTOFHeigth/0.1);
 
-  AliTOFcalib *calib = new AliTOFcalib(fGeom);
+  AliTOFcalib *calib = new AliTOFcalib();
 
   //PH Arrays (moved outside of the loop)
   Float_t * trackPos[4];
@@ -356,12 +380,12 @@ void AliTOFtrackerMI::MatchTracksMI(Bool_t mLastStep){
     //
     //propagat track to the middle of TOF
     //
-    Float_t xs = 378.2;  // should be defined in the TOF geometry
+    Float_t xs = 379.2;  // should be defined in the TOF geometry
     Double_t ymax=xs*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());  
     Bool_t skip=kFALSE;
     Double_t ysect=trackTOFin->GetYat(xs,skip);
     if (skip){
-      xs = 372.;
+      xs = 373.;
       ymax=xs*TMath::Tan(0.5*AliTOFGeometry::GetAlpha());
       ysect=trackTOFin->GetYat(xs,skip);
     }
@@ -553,14 +577,14 @@ void AliTOFtrackerMI::MatchTracksMI(Bool_t mLastStep){
     ind[2]=cgold->GetDetInd(2);
     ind[3]=cgold->GetDetInd(3);
     ind[4]=cgold->GetDetInd(4);
-    Int_t calindex = calib->GetIndex(ind);
+    Int_t calindex = AliTOFGeometry::GetIndex(ind);
     t->SetTOFCalChannel(calindex);
 
     t->SetTOFInfo(info);
     t->SetTOFsignal(tof2);
     t->SetTOFcluster(cgold->GetIndex());  
     AliTOFtrack *trackTOFout = new AliTOFtrack(*t); 
-    trackTOFout->PropagateTo(378.);
+    trackTOFout->PropagateTo(379.);
     t->UpdateTrackParams(trackTOFout,AliESDtrack::kTOFout);    
     t->SetIntegratedLength(length[igold]);
     t->SetIntegratedTimes(times[igold]);
@@ -589,7 +613,7 @@ void AliTOFtrackerMI::MatchTracksMI(Bool_t mLastStep){
 
 //   TBranch *branch=dTree->GetBranch("TOF");
 //   if (!branch) { 
-//     Error("LoadClusters"," can't get the branch with the TOF digits !\n");
+//     AliError(" can't get the branch with the TOF digits !");
 //     return 1;
 //   }
 
@@ -702,7 +726,7 @@ Int_t AliTOFtrackerMI::InsertCluster(AliTOFcluster *c) {
   //This function adds a cluster to the array of clusters sorted in Z
   //--------------------------------------------------------------------
   if (fN==kMaxCluster) {
-    Error("InsertCluster","Too many clusters !\n");
+    AliError("Too many clusters !");
     return 1;
   }
 
@@ -747,7 +771,7 @@ Float_t AliTOFtrackerMI::GetLinearDistances(AliTOFtrack * track, AliTOFcluster *
   cind[2]= cluster->GetDetInd(2);
   cind[3]= cluster->GetDetInd(3);
   cind[4]= cluster->GetDetInd(4);
-  Float_t tiltangle  = fGeom->GetAngles(cluster->GetDetInd(1),cluster->GetDetInd(2))/kRaddeg;  //tiltangle  
+  Float_t tiltangle  = AliTOFGeometry::GetAngles(cluster->GetDetInd(1),cluster->GetDetInd(2))/kRaddeg;  //tiltangle  
 
   Float_t cpos[3];  //cluster position
   Float_t cpos0[3];  //cluster position
@@ -764,8 +788,8 @@ Float_t AliTOFtrackerMI::GetLinearDistances(AliTOFtrack * track, AliTOFcluster *
   //
   Double_t v0[3];
   Double_t dir[3];
-  track->GetGlobalXYZ(v0[0],v0[1],v0[2]);
-  track->GetPxPyPz(dir[0],dir[1],dir[2]);
+  track->GetXYZ(v0);
+  track->GetPxPyPz(dir);
   dir[0]/=track->GetP();
   dir[1]/=track->GetP();
   dir[2]/=track->GetP();