]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFReconstructor.cxx
Corrected t0spread stored in AliTOFHeader object and changed log infos
[u/mrichter/AliRoot.git] / TOF / AliTOFReconstructor.cxx
index bdbf7e1898b55721855372b4f86ab4f67d362b76..aba69870b99a69a95df989e1908bf62ccf2b8912 100644 (file)
 #include "TString.h"
 
 #include "AliLog.h"
+#include "AliESDEvent.h"
+#include "AliESDpid.h"
 #include "AliRawReader.h"
+#include "AliTOFHeader.h"
 
 #include "AliTOFClusterFinder.h"
 #include "AliTOFClusterFinderV1.h"
 #include "AliTOFtrackerMI.h"
 #include "AliTOFtracker.h"
 #include "AliTOFtrackerV1.h"
+#include "AliTOFT0maker.h"
 #include "AliTOFReconstructor.h"
 
 class TTree;
 
-class AliESDEvent;
-
 ClassImp(AliTOFReconstructor)
 
  //____________________________________________________________________
 AliTOFReconstructor::AliTOFReconstructor() 
   : AliReconstructor(),
-    fTOFcalib(0)
+    fTOFcalib(0)/*,
+                 fTOFT0maker(0)*/
 {
 //
 // ctor
 //
   
   //Retrieving the TOF calibration info  
-  fTOFcalib    = new AliTOFcalib();
+  fTOFcalib = new AliTOFcalib();
+  fTOFcalib->Init();
+
+#if 0
   fTOFcalib->CreateCalObjects();
 
   if(!fTOFcalib->ReadParOnlineDelayFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
   if(!fTOFcalib->ReadParOnlineStatusFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
 
   if(!fTOFcalib->ReadParOfflineFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
+
+
+  if(!fTOFcalib->ReadDeltaBCOffsetFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
+  if(!fTOFcalib->ReadCTPLatencyFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
+  if(!fTOFcalib->ReadT0FillFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
+  if(!fTOFcalib->ReadRunParamsFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
+#endif
+
 }
 
 //_____________________________________________________________________________
@@ -67,7 +81,11 @@ AliTOFReconstructor::~AliTOFReconstructor()
 //
 // dtor
 //
+
   delete fTOFcalib;
+
+  //delete fTOFT0maker;
+
 }
 
 //_____________________________________________________________________________
@@ -79,15 +97,21 @@ void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
   //
 
   TString optionString = GetOption();
+
   // use V1 cluster finder if selected
   if (optionString.Contains("ClusterizerV1")) {
     static AliTOFClusterFinderV1 tofClus(fTOFcalib);
 
     // decoder version option
-    if (optionString.Contains("DecoderV0"))
+    if (optionString.Contains("DecoderV0")) {
       tofClus.SetDecoderVersion(0);
-    else
+    }
+    else if (optionString.Contains("DecoderV1")) {
       tofClus.SetDecoderVersion(1);
+    }
+    else {
+      tofClus.SetDecoderVersion(2);
+    }
     
     tofClus.Digits2RecPoints(rawReader, clustersTree);
   }
@@ -95,10 +119,15 @@ void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
     static AliTOFClusterFinder tofClus(fTOFcalib);
     
     // decoder version option
-    if (optionString.Contains("DecoderV0"))
+    if (optionString.Contains("DecoderV0")) {
       tofClus.SetDecoderVersion(0);
-    else
+    }
+    else if (optionString.Contains("DecoderV1")) {
       tofClus.SetDecoderVersion(1);
+    }
+    else {
+      tofClus.SetDecoderVersion(2);
+    }
 
     tofClus.Digits2RecPoints(rawReader, clustersTree);
   }
@@ -121,10 +150,15 @@ void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
     static AliTOFClusterFinderV1 tofClus(fTOFcalib);
 
     // decoder version option
-    if (optionString.Contains("DecoderV0"))
+    if (optionString.Contains("DecoderV0")) {
       tofClus.SetDecoderVersion(0);
-    else
+    }
+    else if (optionString.Contains("DecoderV1")) {
       tofClus.SetDecoderVersion(1);
+    }
+    else {
+      tofClus.SetDecoderVersion(2);
+    }
     
     tofClus.Digits2RecPoints(digitsTree, clustersTree);
   }
@@ -132,10 +166,15 @@ void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
     static AliTOFClusterFinder tofClus(fTOFcalib);
 
     // decoder version option
-    if (optionString.Contains("DecoderV0"))
+    if (optionString.Contains("DecoderV0")) {
       tofClus.SetDecoderVersion(0);
-    else
+    }
+    else if (optionString.Contains("DecoderV1")) {
       tofClus.SetDecoderVersion(1);
+    }
+    else {
+      tofClus.SetDecoderVersion(2);
+    }
     
     tofClus.Digits2RecPoints(digitsTree, clustersTree);
   }
@@ -154,10 +193,15 @@ void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
     static AliTOFClusterFinderV1 tofClus(fTOFcalib);
 
     // decoder version option
-    if (optionString.Contains("DecoderV0"))
+    if (optionString.Contains("DecoderV0")) {
       tofClus.SetDecoderVersion(0);
-    else
+    }
+    else if (optionString.Contains("DecoderV1")) {
       tofClus.SetDecoderVersion(1);
+    }
+    else {
+      tofClus.SetDecoderVersion(2);
+    }
     
     tofClus.Raw2Digits(reader, digitsTree);
   }
@@ -165,10 +209,15 @@ void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
     static AliTOFClusterFinder tofClus(fTOFcalib);
 
     // decoder version option
-    if (optionString.Contains("DecoderV0"))
+    if (optionString.Contains("DecoderV0")) {
       tofClus.SetDecoderVersion(0);
-    else
+    }
+    else if (optionString.Contains("DecoderV1")) {
       tofClus.SetDecoderVersion(1);
+    }
+    else {
+      tofClus.SetDecoderVersion(2);
+    }
     
     tofClus.Raw2Digits(reader, digitsTree);
   }
@@ -201,3 +250,23 @@ AliTracker* AliTOFReconstructor::CreateTracker() const
   return tracker;
 
 }
+
+//_____________________________________________________________________________
+void AliTOFReconstructor::FillEventTimeWithTOF(AliESDEvent *event, AliESDpid *esdPID)
+{
+  //
+  // Fill AliESDEvent::fTOFHeader variable
+  // It contains the event_time estiamted by the TOF combinatorial algorithm
+  //
+
+  Float_t tofResolution = GetRecoParam()->GetTimeResolution();// TOF time resolution in ps
+  AliTOFT0maker *tofT0maker = new AliTOFT0maker(esdPID,fTOFcalib);
+  //AliTOFT0maker tofT0maker = AliTOFT0maker(esdPID,fTOFcalib);
+  tofT0maker->SetTimeResolution(tofResolution);
+  tofT0maker->ComputeT0TOF(event);
+  tofT0maker->WriteInESD(event);
+  tofT0maker->~AliTOFT0maker();
+  delete tofT0maker;
+
+}
+