]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFReconstructor.cxx
move string data members to int; add more calo specific information: time, ncells...
[u/mrichter/AliRoot.git] / TOF / AliTOFReconstructor.cxx
index 16fccb14a5d3ee0dbfef1434164788601b5df87a..adb9832697302533abeec640bd5448b47cb5a2f0 100644 (file)
@@ -13,7 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/* $Id$ */
+/* $Id: AliTOFReconstructor.cxx 59948 2012-12-12 11:05:59Z fnoferin $ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
 #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 "AliTOFtrackerV2.h"
+#include "AliTOFT0maker.h"
 #include "AliTOFReconstructor.h"
+#include "AliTOFTriggerMask.h"
+#include "AliTOFTrigger.h"
 
 class TTree;
 
-class AliESDEvent;
-
 ClassImp(AliTOFReconstructor)
 
  //____________________________________________________________________
-AliTOFReconstructor::AliTOFReconstructor() 
-  : AliReconstructor(),
-    fTOFcalib(0)
+AliTOFReconstructor::AliTOFReconstructor() :
+  AliReconstructor(),
+  fTOFcalib(0),
+  /*fTOFT0maker(0),*/
+  fNumberOfTofClusters(0),
+  fNumberOfTofTrgPads(0),
+  fClusterFinder(0),
+  fClusterFinderV1(0)
 {
 //
 // ctor
@@ -54,6 +64,24 @@ AliTOFReconstructor::AliTOFReconstructor()
   //Retrieving the TOF calibration info  
   fTOFcalib = new AliTOFcalib();
   fTOFcalib->Init();
+  fClusterFinder = new AliTOFClusterFinder(fTOFcalib);
+  fClusterFinderV1 = new AliTOFClusterFinderV1(fTOFcalib);
+
+  TString optionString = GetOption();
+  if (optionString.Contains("DecoderV0")) {
+    fClusterFinder->SetDecoderVersion(0);
+    fClusterFinderV1->SetDecoderVersion(0);
+  }
+  else if (optionString.Contains("DecoderV1")) {
+    fClusterFinder->SetDecoderVersion(1);
+    fClusterFinderV1->SetDecoderVersion(1);
+  }
+  else {
+    fClusterFinder->SetDecoderVersion(2);
+    fClusterFinderV1->SetDecoderVersion(2);
+  }
+
+
 
 #if 0
   fTOFcalib->CreateCalObjects();
@@ -78,7 +106,15 @@ AliTOFReconstructor::~AliTOFReconstructor()
 //
 // dtor
 //
+
   delete fTOFcalib;
+
+  //delete fTOFT0maker;
+  fNumberOfTofClusters = 0;
+  fNumberOfTofTrgPads = 0;
+
+  delete fClusterFinder;
+  delete fClusterFinderV1;
 }
 
 //_____________________________________________________________________________
@@ -93,7 +129,8 @@ void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
 
   // use V1 cluster finder if selected
   if (optionString.Contains("ClusterizerV1")) {
-    static AliTOFClusterFinderV1 tofClus(fTOFcalib);
+    /*
+    AliTOFClusterFinderV1 tofClus(fTOFcalib);
 
     // decoder version option
     if (optionString.Contains("DecoderV0")) {
@@ -105,12 +142,16 @@ void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
     else {
       tofClus.SetDecoderVersion(2);
     }
-    
+
     tofClus.Digits2RecPoints(rawReader, clustersTree);
+    */
+
+    fClusterFinderV1->Digits2RecPoints(rawReader, clustersTree);    
   }
   else {
-    static AliTOFClusterFinder tofClus(fTOFcalib);
-    
+    /*
+    AliTOFClusterFinder tofClus(fTOFcalib);
+      
     // decoder version option
     if (optionString.Contains("DecoderV0")) {
       tofClus.SetDecoderVersion(0);
@@ -123,8 +164,12 @@ void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
     }
 
     tofClus.Digits2RecPoints(rawReader, clustersTree);
-  }
 
+    */
+
+    fClusterFinder->Digits2RecPoints(rawReader, clustersTree);
+  }
+  AliTOFTrigger::PrepareTOFMapFromRaw(rawReader,13600); // 13600 +/- 400 is the value to select the richt bunch crossing (in future from OCDB)
 }
 
 //_____________________________________________________________________________
@@ -140,7 +185,8 @@ void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
   TString optionString = GetOption();
   // use V1 cluster finder if selected
   if (optionString.Contains("ClusterizerV1")) {
-    static AliTOFClusterFinderV1 tofClus(fTOFcalib);
+    /*
+    AliTOFClusterFinderV1 tofClus(fTOFcalib);
 
     // decoder version option
     if (optionString.Contains("DecoderV0")) {
@@ -154,9 +200,12 @@ void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
     }
     
     tofClus.Digits2RecPoints(digitsTree, clustersTree);
+    */
+    fClusterFinderV1->Digits2RecPoints(digitsTree, clustersTree);
   }
   else {
-    static AliTOFClusterFinder tofClus(fTOFcalib);
+    /*
+    AliTOFClusterFinder tofClus(fTOFcalib);
 
     // decoder version option
     if (optionString.Contains("DecoderV0")) {
@@ -170,6 +219,11 @@ void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
     }
     
     tofClus.Digits2RecPoints(digitsTree, clustersTree);
+    */
+
+    fClusterFinder->Digits2RecPoints(digitsTree, clustersTree);
+    AliTOFTrigger::PrepareTOFMapFromDigit(digitsTree);
+
   }
 
 }
@@ -183,7 +237,8 @@ void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
   TString optionString = GetOption();
   // use V1 cluster finder if selected
   if (optionString.Contains("ClusterizerV1")) {
-    static AliTOFClusterFinderV1 tofClus(fTOFcalib);
+    /*
+    AliTOFClusterFinderV1 tofClus(fTOFcalib);
 
     // decoder version option
     if (optionString.Contains("DecoderV0")) {
@@ -197,9 +252,13 @@ void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
     }
     
     tofClus.Raw2Digits(reader, digitsTree);
+    */
+
+    fClusterFinderV1->Digits2RecPoints(reader, digitsTree);
   }
   else {
-    static AliTOFClusterFinder tofClus(fTOFcalib);
+    /*
+    AliTOFClusterFinder tofClus(fTOFcalib);
 
     // decoder version option
     if (optionString.Contains("DecoderV0")) {
@@ -213,6 +272,10 @@ void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
     }
     
     tofClus.Raw2Digits(reader, digitsTree);
+    */
+
+    fClusterFinder->Digits2RecPoints(reader, digitsTree);
+
   }
 
 }
@@ -237,9 +300,78 @@ AliTracker* AliTOFReconstructor::CreateTracker() const
   else if (selectedTracker.Contains("TrackerV1")) {
     tracker =  new AliTOFtrackerV1();
   }
+  else if (selectedTracker.Contains("TrackerV2")) {
+    tracker =  new AliTOFtrackerV2();
+  }
   else {
     tracker = new AliTOFtracker();
   }
   return tracker;
 
 }
+
+//_____________________________________________________________________________
+void AliTOFReconstructor::FillEventTimeWithTOF(AliESDEvent *event, AliESDpid *esdPID)
+{
+  //
+  // Fill AliESDEvent::fTOFHeader variable
+  // It contains the event_time estiamted by the TOF combinatorial algorithm
+  //
+
+
+  // Set here F. Noferini
+  AliTOFTriggerMask *mapTrigger = AliTOFTrigger::GetTOFTriggerMap();
+
+
+  TString optionString = GetOption();
+  if (optionString.Contains("ClusterizerV1")) {
+    fNumberOfTofClusters=fClusterFinderV1->GetNumberOfTOFclusters();
+    fNumberOfTofTrgPads=fClusterFinderV1->GetNumberOfTOFtrgPads();
+    AliInfo(Form(" Number of TOF cluster readout = %d ",fNumberOfTofClusters));
+    AliInfo(Form(" Number of TOF cluster readout in trigger window = %d ",fNumberOfTofTrgPads));
+  } else {
+    fNumberOfTofClusters=fClusterFinder->GetNumberOfTOFclusters();
+    fNumberOfTofTrgPads=fClusterFinder->GetNumberOfTOFtrgPads();
+    AliInfo(Form(" Number of TOF cluster readout = %d ",fNumberOfTofClusters));
+    AliInfo(Form(" Number of TOF cluster readout in trigger window = %d ",fNumberOfTofTrgPads));
+  }
+
+  if (!GetRecoParam()) AliFatal("cannot get TOF RECO params");
+
+  Float_t tofResolution = GetRecoParam()->GetTimeResolution();// TOF time resolution in ps
+  AliTOFT0maker *tofT0maker = new AliTOFT0maker(esdPID);
+  tofT0maker->SetTimeResolution(tofResolution);
+  tofT0maker->ComputeT0TOF(event);
+  tofT0maker->WriteInESD(event);
+  tofT0maker->~AliTOFT0maker();
+  delete tofT0maker;
+
+  esdPID->SetTOFResponse(event,(AliESDpid::EStartTimeType_t)GetRecoParam()->GetStartTimeType());
+
+
+  event->GetTOFHeader()->SetNumberOfTOFclusters(fNumberOfTofClusters);
+  event->GetTOFHeader()->SetNumberOfTOFtrgPads(fNumberOfTofTrgPads);
+  event->GetTOFHeader()->SetTriggerMask(mapTrigger);
+  AliInfo(Form(" Number of readout cluster in trigger window = %d ; number of trgPads from Trigger map = %d",
+              event->GetTOFHeader()->GetNumberOfTOFtrgPads(),
+              event->GetTOFHeader()->GetNumberOfTOFmaxipad()));
+
+  fClusterFinderV1->ResetDigits();
+  fClusterFinderV1->ResetRecpoint();
+  fClusterFinder->ResetRecpoint();
+  fClusterFinderV1->Clear();
+  fClusterFinder->Clear();
+
+}
+
+//_____________________________________________________________________________
+void 
+AliTOFReconstructor::FillESD(TTree *, TTree *, AliESDEvent * /*esdEvent*/) const
+{
+  //
+  // correct Texp 
+  // 
+  //
+
+  //  fTOFcalib->CalibrateTExp(esdEvent);
+}