AliTOFRecoParam instantiation: moved in the TOF tracker(s) (Chiara)
authordecaro <decaro@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 3 Sep 2008 09:15:04 +0000 (09:15 +0000)
committerdecaro <decaro@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 3 Sep 2008 09:15:04 +0000 (09:15 +0000)
TOF/AliTOFReconstructor.cxx
TOF/AliTOFReconstructor.h
TOF/AliTOFtracker.cxx
TOF/AliTOFtracker.h
TOF/AliTOFtrackerMI.cxx
TOF/AliTOFtrackerMI.h
TOF/AliTOFtrackerV1.cxx
TOF/AliTOFtrackerV1.h

index 560b134..9391914 100644 (file)
@@ -156,12 +156,26 @@ void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
 //_____________________________________________________________________________
 AliTracker* AliTOFReconstructor::CreateTracker() const
 {
-// create a TOF tracker
+
+  // 
+  // create a TOF tracker using 
+  // TOF Reco Param collected by STEER
+  //
 
   TString selectedTracker = GetOption();
+  AliTracker *tracker;
   // use MI tracker if selected
-  if (selectedTracker.Contains("MI")) return new AliTOFtrackerMI();
-  if (selectedTracker.Contains("V1")) return new AliTOFtrackerV1();
-  return new AliTOFtracker();
+  if (selectedTracker.Contains("MI")) {
+    tracker = new AliTOFtrackerMI();
+  }
+  // use V1 tracker if selected
+  if (selectedTracker.Contains("V1")) {
+    tracker =  new AliTOFtrackerV1();
+  }
+  else {
+    tracker = new AliTOFtracker();
+  }
+  return tracker;
 
 }
index 7cd5e49..adfa625 100644 (file)
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "AliReconstructor.h"
+#include "AliTOFRecoParam.h"
 
 class TTree;
 
 class AliESDEvent;
 class AliRawReader;
-
 class AliTOFcalib;
 
 class AliTOFReconstructor: public AliReconstructor {
@@ -40,6 +40,8 @@ public:
   {FillESD((TTree*)NULL,clustersTree,esd);}
   virtual void         FillESD(TTree*, TTree*, AliESDEvent*) const {}
 
+  static const AliTOFRecoParam* GetRecoParam() { return dynamic_cast<const AliTOFRecoParam*>(AliReconstructor::GetRecoParam(3)); } // getting RecoParam obj
+
 private:
   AliTOFcalib    *fTOFcalib;    // pointer to TOF calib class
 
index ae3fedb..ade63ec 100644 (file)
@@ -43,9 +43,9 @@
 #include "AliTrackPointArray.h"
 #include "AliCDBManager.h"
 
-#include "AliTOFcalib.h"
 #include "AliTOFpidESD.h"
 #include "AliTOFRecoParam.h"
+#include "AliTOFReconstructor.h"
 #include "AliTOFcluster.h"
 #include "AliTOFGeometry.h"
 #include "AliTOFtracker.h"
@@ -92,16 +92,9 @@ AliTOFtracker::AliTOFtracker():
    
    // Gettimg the geometry 
    fGeom= new AliTOFGeometry();
-   // Read the reconstruction parameters from the OCDB
-   AliTOFcalib* calib=new AliTOFcalib();
-   fRecoParam = (AliTOFRecoParam*)calib->ReadRecParFromCDB("TOF/Calib",-1);
-   if(fRecoParam->GetApplyPbPbCuts())fRecoParam=fRecoParam->GetPbPbparam();
-   Double_t parPID[2];   
-   parPID[0]=fRecoParam->GetTimeResolution();
-   parPID[1]=fRecoParam->GetTimeNSigma();
-   fPid=new AliTOFpidESD(parPID);
+
    InitCheckHists();
-   delete calib;
+
 }
 //_____________________________________________________________________________
 AliTOFtracker::AliTOFtracker(const AliTOFtracker &t):
@@ -214,6 +207,20 @@ Int_t AliTOFtracker::PropagateBack(AliESDEvent* event) {
   // Gets seeds from ESD event and Match with TOF Clusters
   //
 
+  // initialize RecoParam for current event
+
+  AliInfo("Initializing params for TOF... ");
+
+  fRecoParam = AliTOFReconstructor::GetRecoParam();  // instantiate reco param from STEER...
+  if (fRecoParam == 0x0) { 
+    AliFatal("No Reco Param found for TOF!!!");
+  }
+  //fRecoParam->Dump();
+  if(fRecoParam->GetApplyPbPbCuts())fRecoParam=fRecoParam->GetPbPbparam();
+  Double_t parPID[2];   
+  parPID[0]=fRecoParam->GetTimeResolution();
+  parPID[1]=fRecoParam->GetTimeNSigma();
+  fPid=new AliTOFpidESD(parPID);
 
   //Initialise some counters
 
@@ -580,7 +587,7 @@ void AliTOFtracker::MatchTracks( Bool_t mLastStep){
 
     AliDebug(2, Form("%7i     %7i     %10i     %10i  %10i  %10i      %7i",
                     iseed,
-                    fnmatch,
+                    fnmatch-1,
                     TMath::Abs(trackTOFin->GetLabel()),
                     c->GetLabel(0), c->GetLabel(1), c->GetLabel(2),
                     idclus)); // AdC
index 898062a..9d86ca6 100644 (file)
@@ -66,10 +66,10 @@ private:
  Float_t  GetTimeZerofromT0(AliESDEvent* event) const; // T0 from T0
  Float_t  CorrectTimeWalk(Float_t dist,Float_t tof); // Time Walk correction
 
- AliTOFRecoParam* fRecoParam;           // Pointer to TOF Recon. Pars
- AliTOFGeometry*  fGeom;                 // Pointer to TOF geometry
- AliTOFpidESD*    fPid;               // Pointer to TOF PID
- AliTOFcluster *fClusters[kMaxCluster];  // pointers to the TOF clusters
+ const AliTOFRecoParam* fRecoParam;     // Pointer to TOF Recon. Pars
+ AliTOFGeometry*  fGeom;                // Pointer to TOF geometry
+ AliTOFpidESD*    fPid;                 // Pointer to TOF PID
+ AliTOFcluster *fClusters[kMaxCluster]; // pointers to the TOF clusters
 
  Int_t fN;              // Number of Clusters
  Int_t fNseeds;         // Number of track seeds  
index d5031e8..fdbb62a 100644 (file)
@@ -31,7 +31,7 @@
 #include "AliESDtrack.h"
 
 #include "AliTOFRecoParam.h"
-#include "AliTOFcalib.h"
+#include "AliTOFReconstructor.h"
 #include "AliTOFcluster.h"
 #include "AliTOFGeometry.h"
 #include "AliTOFtrackerMI.h"
@@ -68,12 +68,6 @@ AliTOFtrackerMI::AliTOFtrackerMI():
  { 
   //AliTOFtrackerMI main Ctor
 
-   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");   
@@ -180,6 +174,20 @@ Int_t AliTOFtrackerMI::PropagateBack(AliESDEvent* event) {
   // Gets seeds from ESD event and Match with TOF Clusters
   //
 
+  // initialize RecoParam for current event
+
+  AliInfo("Initializing params for TOF... ");
+
+  fRecoParam = AliTOFReconstructor::GetRecoParam();  // instantiate reco param from STEER...
+  if (fRecoParam == 0x0) { 
+    AliFatal("No Reco Param found for TOF!!!");
+  }
+  //fRecoParam->Dump();
+  if(fRecoParam->GetApplyPbPbCuts())fRecoParam=fRecoParam->GetPbPbparam();
+  Double_t parPID[2];   
+  parPID[0]=fRecoParam->GetTimeResolution();
+  parPID[1]=fRecoParam->GetTimeNSigma();
+  fPid=new AliTOFpidESD(parPID);
 
   //Initialise some counters
 
@@ -331,7 +339,7 @@ void AliTOFtrackerMI::MatchTracksMI(Bool_t mLastStep){
   
   Int_t nSteps=(Int_t)(fTOFHeigth/0.1);
 
-  AliTOFcalib *calib = new AliTOFcalib();
+  //AliTOFcalib *calib = new AliTOFcalib(); // AdC
 
   //PH Arrays (moved outside of the loop)
   Float_t * trackPos[4];
@@ -580,7 +588,7 @@ void AliTOFtrackerMI::MatchTracksMI(Bool_t mLastStep){
 
     AliDebug(2, Form("%7i     %7i     %10i     %10i  %10i  %10i      %7i",
                     i,
-                    fnmatch,
+                    fnmatch-1,
                     TMath::Abs(trackTOFin->GetLabel()),
                     tlab[0], tlab[1], tlab[2],
                     igold)); // AdC
@@ -601,7 +609,7 @@ void AliTOFtrackerMI::MatchTracksMI(Bool_t mLastStep){
   //
   for (Int_t ii=0; ii<4; ii++) delete [] trackPos[ii];
   delete [] clind;
-  delete calib;
+  //delete calib; // AdC
 }
 //_________________________________________________________________________
 
index d28afe5..f78839e 100644 (file)
@@ -59,10 +59,11 @@ private:
  void  CollectESD(); // Select starting Set for Matching 
  //void  Init();
  Float_t GetLinearDistances(AliTOFtrack * track, AliTOFcluster *cluster, Float_t distances[5]);
- AliTOFRecoParam*  fRecoParam;           // Pointer to TOF Recontr. Params
- AliTOFGeometry*  fGeom;                 // Pointer to TOF geometry
- AliTOFpidESD*    fPid;               // Pointer to TOF PID
- AliTOFcluster *fClusters[kMaxCluster];  // pointers to the TOF clusters
+
+ const AliTOFRecoParam* fRecoParam;     // Pointer to TOF Recon. Pars
+ AliTOFGeometry*  fGeom;                // Pointer to TOF geometry
+ AliTOFpidESD*    fPid;                 // Pointer to TOF PID
+ AliTOFcluster *fClusters[kMaxCluster]; // pointers to the TOF clusters
 
  Int_t fN;              // Number of Clusters
  Int_t fNseeds;         // Number of track seeds  
index 62727c3..e3947c1 100644 (file)
@@ -15,7 +15,7 @@
 
 //--------------------------------------------------------------------//
 //                                                                    //
-// AliTOFtrackerV1 Class                                                //
+// AliTOFtrackerV1 Class                                              //
 // Task: Perform association of the ESD tracks to TOF Clusters        //
 // and Update ESD track with associated TOF Cluster parameters        //
 //                                                                    //
@@ -43,8 +43,8 @@
 #include "AliGeomManager.h"
 #include "AliCDBManager.h"
 
-#include "AliTOFcalib.h"
 #include "AliTOFRecoParam.h"
+#include "AliTOFReconstructor.h"
 #include "AliTOFcluster.h"
 #include "AliTOFGeometry.h"
 #include "AliTOFtrackerV1.h"
@@ -81,17 +81,8 @@ AliTOFtrackerV1::AliTOFtrackerV1():
   fHRecSigZVsPWin(0x0)
  { 
   //AliTOFtrackerV1 main Ctor
-   
-   // Read the reconstruction parameters from the OCDB
-   AliTOFcalib *calib = new AliTOFcalib();
-   fRecoParam = (AliTOFRecoParam*)calib->ReadRecParFromCDB("TOF/Calib",-1);
-   if(fRecoParam->GetApplyPbPbCuts())fRecoParam=fRecoParam->GetPbPbparam();
-   Double_t parPID[2];   
-   parPID[0]=fRecoParam->GetTimeResolution();
-   parPID[1]=fRecoParam->GetTimeNSigma();
-   fPid=new AliTOFpidESD(parPID);
+
    InitCheckHists();
-   delete calib;
 
 }
 //_____________________________________________________________________________
@@ -195,6 +186,20 @@ Int_t AliTOFtrackerV1::PropagateBack(AliESDEvent* event) {
   // Gets seeds from ESD event and Match with TOF Clusters
   //
 
+  // initialize RecoParam for current event
+
+  AliInfo("Initializing params for TOF... ");
+
+  fRecoParam = AliTOFReconstructor::GetRecoParam();  // instantiate reco param from STEER...
+  if (fRecoParam == 0x0) { 
+    AliFatal("No Reco Param found for TOF!!!");
+  }
+  //fRecoParam->Dump();
+  if(fRecoParam->GetApplyPbPbCuts())fRecoParam=fRecoParam->GetPbPbparam();
+  Double_t parPID[2];   
+  parPID[0]=fRecoParam->GetTimeResolution();
+  parPID[1]=fRecoParam->GetTimeNSigma();
+  fPid=new AliTOFpidESD(parPID);
 
   //Initialise some counters
 
@@ -367,7 +372,7 @@ void AliTOFtrackerV1::MatchTracks( ){
     Double_t cov[15]; trackTOFin->GetExternalCovariance(cov);
 
     Double_t z    = par[1];   
-    Double_t dz   =  scaleFact*3.*TMath::Sqrt(cov[2]+dZ*dZ/12);
+    Double_t dz   =  scaleFact*3.*TMath::Sqrt(cov[2]+dZ*dZ/12.);
     Double_t dphi =  scaleFact*3.*TMath::Sqrt(cov[0]+dY*dY/12.)/sensRadius; 
 
     Double_t phi=TMath::ATan2(par[0],x) + trackTOFin->GetAlpha();
@@ -443,13 +448,14 @@ void AliTOFtrackerV1::MatchTracks( ){
 
     fnmatch++;
 
-    AliDebug(2, Form("%7i     %7i     %10i     %10i  %10i  %10i",
+    AliDebug(2, Form("%7i     %7i     %10i     %10i  %10i  %10i      %7i",
                     iseed,
-                    fnmatch,
+                    fnmatch-1,
                     TMath::Abs(trackTOFin->GetLabel()),
                     bestCluster->GetLabel(0), 
                     bestCluster->GetLabel(1), 
-                    bestCluster->GetLabel(2))); // AdC
+                    bestCluster->GetLabel(2),
+                    idclus)); // AdC
 
     bestCluster->Use(); 
     if (
@@ -708,6 +714,23 @@ void AliTOFtrackerV1::InitCheckHists() {
 
   //Init histos for Digits/Reco QA and Calibration
 
+  TDirectory *dir = gDirectory;
+  TFile *logFileTOF = 0;
+
+  TSeqCollection *list = gROOT->GetListOfFiles();
+  int n = list->GetEntries();
+  Bool_t isThere=kFALSE;
+  for(int i=0; i<n; i++) {
+    logFileTOF = (TFile*)list->At(i);
+    if (strstr(logFileTOF->GetName(), "TOFQA.root")){
+      isThere=kTRUE;
+      break;
+    } 
+  }
+
+  if(!isThere)logFileTOF = new TFile( "TOFQA.root","RECREATE");
+  logFileTOF->cd(); 
+
   //Digits "QA" 
   fHDigClusMap = new TH2F("TOFDig_ClusMap", "",182,0.5,182.5,864, 0.5,864.5);  
   fHDigNClus = new TH1F("TOFDig_NClus", "",200,0.5,200.5);  
@@ -722,6 +745,9 @@ void AliTOFtrackerV1::InitCheckHists() {
   fHRecSigZVsP=new TH2F("TOFDig_SigZVsP", "",40,0.,4.,100, 0.,5.);
   fHRecSigYVsPWin=new TH2F("TOFDig_SigYVsPWin", "",40,0.,4.,100, 0.,50.);
   fHRecSigZVsPWin=new TH2F("TOFDig_SigZVsPWin", "",40,0.,4.,100, 0.,50.);
+
+  dir->cd();
+
 }
 
 //_________________________________________________________________________
@@ -749,6 +775,10 @@ void AliTOFtrackerV1::SaveCheckHists() {
     } 
   }
    
+  if(!isThere) {
+         AliError(Form("File TOFQA.root not found!! not wring histograms...."));
+         return;
+  }
   logFile->cd();
   fHDigClusMap->Write(fHDigClusMap->GetName(), TObject::kOverwrite);
   fHDigNClus->Write(fHDigNClus->GetName(), TObject::kOverwrite);
@@ -763,22 +793,8 @@ void AliTOFtrackerV1::SaveCheckHists() {
   fHRecSigZVsPWin->Write(fHRecSigZVsPWin->GetName(), TObject::kOverwrite);
   logFile->Flush();  
 
-  if(!isThere)logFileTOF = new TFile( "TOFQA.root","RECREATE");
-  logFileTOF->cd(); 
-  fHDigClusMap->Write(fHDigClusMap->GetName(), TObject::kOverwrite);
-  fHDigNClus->Write(fHDigNClus->GetName(), TObject::kOverwrite);
-  fHDigClusTime->Write(fHDigClusTime->GetName(), TObject::kOverwrite);
-  fHDigClusToT->Write(fHDigClusToT->GetName(), TObject::kOverwrite);
-  fHRecNClus->Write(fHRecNClus->GetName(), TObject::kOverwrite);
-  fHRecChi2->Write(fHRecChi2->GetName(), TObject::kOverwrite);
-  fHRecDistZ->Write(fHRecDistZ->GetName(), TObject::kOverwrite);
-  fHRecSigYVsP->Write(fHRecSigYVsP->GetName(), TObject::kOverwrite);
-  fHRecSigZVsP->Write(fHRecSigZVsP->GetName(), TObject::kOverwrite);
-  fHRecSigYVsPWin->Write(fHRecSigYVsPWin->GetName(), TObject::kOverwrite);
-  fHRecSigZVsPWin->Write(fHRecSigZVsPWin->GetName(), TObject::kOverwrite);
-  logFileTOF->Flush();  
-
   dir->cd();
+
   }
 //_________________________________________________________________________
 Float_t AliTOFtrackerV1::CorrectTimeWalk( Float_t dist, Float_t tof) {
index 8313350..5e7c48e 100644 (file)
@@ -64,9 +64,9 @@ private:
  Float_t  GetTimeZerofromT0(AliESDEvent* event) const; // T0 from T0
  Float_t  CorrectTimeWalk(Float_t dist,Float_t tof); // Time Walk correction
 
- AliTOFRecoParam* fRecoParam;           // Pointer to TOF Recon. Pars
- AliTOFpidESD*    fPid;               // Pointer to TOF PID
- AliTOFcluster *fClusters[kMaxCluster];  // pointers to the TOF clusters
+ const AliTOFRecoParam* fRecoParam;     // Pointer to TOF Recon. Pars
+ AliTOFpidESD*    fPid;                 // Pointer to TOF PID
+ AliTOFcluster *fClusters[kMaxCluster]; // pointers to the TOF clusters
 
  Int_t fN;              // Number of Clusters
  Int_t fNseeds;         // Number of track seeds