]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFReconstructor.cxx
Use the DATE monitor lib in addition to the normal offline trigger selection.
[u/mrichter/AliRoot.git] / TOF / AliTOFReconstructor.cxx
index 4e0948081aaa678ae30300a5ff3c942893b5912f..3395725e2e626cc91e5c9e2ba4966f0a7377252b 100644 (file)
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-#include "TFile.h"
+#include <cstdlib>
+#include "TObjArray.h"
+#include "TString.h"
 
 #include "AliLog.h"
 #include "AliRawReader.h"
-#include "AliRunLoader.h"
 
 #include "AliTOFClusterFinder.h"
-#include "AliTOFGeometry.h"
-#include "AliTOFGeometryV5.h"
+#include "AliTOFClusterFinderV1.h"
 #include "AliTOFcalib.h"
 #include "AliTOFtrackerMI.h"
 #include "AliTOFtracker.h"
+#include "AliTOFtrackerV1.h"
 #include "AliTOFReconstructor.h"
 
 class TTree;
 
-class AliESD;
-
-extern TDirectory *gDirectory;
-extern TFile *gFile;
+class AliESDEvent;
 
 ClassImp(AliTOFReconstructor)
 
  //____________________________________________________________________
 AliTOFReconstructor::AliTOFReconstructor() 
   : AliReconstructor(),
-    fTOFGeometry(0),
     fTOFcalib(0)
 {
 //
 // ctor
 //
+  
   //Retrieving the TOF calibration info  
-  fTOFGeometry = new AliTOFGeometryV5();
-  fTOFcalib    = new AliTOFcalib(fTOFGeometry);
-  if(!fTOFcalib->ReadParFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(0);}  
+  fTOFcalib    = new AliTOFcalib();
+  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);}  
 }
 
 //------------------------------------------------------------------------
 AliTOFReconstructor::AliTOFReconstructor(const AliTOFReconstructor &source)
-  : AliReconstructor(),
-    fTOFGeometry(0),
-    fTOFcalib(0)
+  : AliReconstructor(source),
+    fTOFcalib(source.fTOFcalib)
 {
 //
 // copy ctor
 //
-  this->fTOFGeometry=source.fTOFGeometry;
-  this->fTOFcalib=source.fTOFcalib;
 }
 
 //------------------------------------------------------------------------
@@ -78,8 +77,10 @@ AliTOFReconstructor & AliTOFReconstructor::operator=(const AliTOFReconstructor &
 //
 // assignment op.
 //
-  this->fTOFGeometry=source.fTOFGeometry;
-  this->fTOFcalib=source.fTOFcalib;
+  if (this == &source)
+    return *this;
+
+  fTOFcalib=source.fTOFcalib;
   return *this;
 }
 //_____________________________________________________________________________
@@ -88,52 +89,41 @@ AliTOFReconstructor::~AliTOFReconstructor()
 //
 // dtor
 //
-  delete fTOFGeometry;
   delete fTOFcalib;
 }
 
-//_____________________________________________________________________________
-  void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader) const
-{
-// reconstruct clusters from digits
-
-  AliTOFClusterFinder tofClus(runLoader, fTOFcalib);
-  tofClus.Load();
-  for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++)
-    {
-      AliDebug(2,Form("Local Event loop mode: Creating Recpoints from Digits, Event n. %i",iEvent)); 
-      tofClus.Digits2RecPoints(iEvent);
-    }
-  tofClus.UnLoad();
-
-}
-
-//_____________________________________________________________________________
-void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader,
-                                      AliRawReader *rawReader) const
-{
-// reconstruct clusters from Raw Data
-
-  AliTOFClusterFinder tofClus(runLoader, fTOFcalib);
-  tofClus.LoadClusters();
-  Int_t iEvent = 0;
-  while (rawReader->NextEvent()) {
-    AliDebug(2,Form("Local Event loop mode: Creating Recpoints from Raw data, Event n. %i",iEvent)); 
-    tofClus.Digits2RecPoints(iEvent,rawReader);
-    iEvent++;
-  }
-  tofClus.UnLoadClusters();
-
-}
-
 //_____________________________________________________________________________
 void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
                                       TTree *clustersTree) const
 {
-// reconstruct clusters from Raw Data
-
-  AliTOFClusterFinder tofClus(fTOFcalib);
-  tofClus.Digits2RecPoints(rawReader, clustersTree);
+  //
+  // reconstruct clusters from Raw Data
+  //
+
+  TString optionString = GetOption();
+  // use V1 cluster finder if selected
+  if (optionString.Contains("ClusterizerV1")) {
+    static AliTOFClusterFinderV1 tofClus(fTOFcalib);
+
+    // decoder version option
+    if (optionString.Contains("DecoderV1"))
+      tofClus.SetDecoderVersion(1);
+    else
+      tofClus.SetDecoderVersion(0);
+    
+    tofClus.Digits2RecPoints(rawReader, clustersTree);
+  }
+  else {
+    static AliTOFClusterFinder tofClus(fTOFcalib);
+    
+    // decoder version option
+    if (optionString.Contains("DecoderV1"))
+      tofClus.SetDecoderVersion(1);
+    else
+      tofClus.SetDecoderVersion(0);
+
+    tofClus.Digits2RecPoints(rawReader, clustersTree);
+  }
 
 }
 
@@ -141,11 +131,36 @@ void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
 void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
                                       TTree *clustersTree) const
 {
-// reconstruct clusters from Raw Data
+  //
+  // reconstruct clusters from digits
+  //
 
   AliDebug(2,Form("Global Event loop mode: Creating Recpoints from Digits Tree")); 
-  AliTOFClusterFinder tofClus(fTOFcalib);
-  tofClus.Digits2RecPoints(digitsTree, clustersTree);
+
+  TString optionString = GetOption();
+  // use V1 cluster finder if selected
+  if (optionString.Contains("ClusterizerV1")) {
+    static AliTOFClusterFinderV1 tofClus(fTOFcalib);
+
+    // decoder version option
+    if (optionString.Contains("DecoderV1"))
+      tofClus.SetDecoderVersion(1);
+    else
+      tofClus.SetDecoderVersion(0);
+    
+    tofClus.Digits2RecPoints(digitsTree, clustersTree);
+  }
+  else {
+    static AliTOFClusterFinder tofClus(fTOFcalib);
+
+    // decoder version option
+    if (optionString.Contains("DecoderV1"))
+      tofClus.SetDecoderVersion(1);
+    else
+      tofClus.SetDecoderVersion(0);
+    
+    tofClus.Digits2RecPoints(digitsTree, clustersTree);
+  }
 
 }
 //_____________________________________________________________________________
@@ -154,54 +169,57 @@ void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
 // reconstruct clusters from digits
 
   AliDebug(2,Form("Global Event loop mode: Converting Raw Data to a Digits Tree")); 
-  AliTOFClusterFinder tofClus(fTOFcalib);
-  tofClus.Raw2Digits(reader, digitsTree);
-
-}
 
-//_____________________________________________________________________________
-AliTracker* AliTOFReconstructor::CreateTracker(AliRunLoader* /*runLoader*/) const
-{
-// create a TOF tracker
-
-  TString selectedTracker = GetOption();
-  // use MI tracker if selected
-  if (selectedTracker.Contains("MI")) return new AliTOFtrackerMI();
-  return new AliTOFtracker();
-}
-
-//_____________________________________________________________________________
-void AliTOFReconstructor::FillESD(AliRunLoader* /*runLoader*/, 
-                                 AliESD* /*esd*/) const
-{
-// nothing to be done
+  TString optionString = GetOption();
+  // use V1 cluster finder if selected
+  if (optionString.Contains("ClusterizerV1")) {
+    static AliTOFClusterFinderV1 tofClus(fTOFcalib);
+
+    // decoder version option
+    if (optionString.Contains("DecoderV1"))
+      tofClus.SetDecoderVersion(1);
+    else
+      tofClus.SetDecoderVersion(0);
+    
+    tofClus.Raw2Digits(reader, digitsTree);
+  }
+  else {
+    static AliTOFClusterFinder tofClus(fTOFcalib);
+
+    // decoder version option
+    if (optionString.Contains("DecoderV1"))
+      tofClus.SetDecoderVersion(1);
+    else
+      tofClus.SetDecoderVersion(0);
+    
+    tofClus.Raw2Digits(reader, digitsTree);
+  }
 
 }
 
 //_____________________________________________________________________________
-AliTOFGeometry* AliTOFReconstructor::GetTOFGeometry(AliRunLoader* runLoader) const
+AliTracker* AliTOFReconstructor::CreateTracker() const
 {
-// get the TOF parameters
 
-  AliTOFGeometry *tofGeom;
+  // 
+  // create a TOF tracker using 
+  // TOF Reco Param collected by STEER
+  //
 
-  runLoader->CdGAFile();
-  TDirectory *savedir=gDirectory; 
-  TFile *in=(TFile*)gFile;  
-  if (!in->IsOpen()) {
-    AliWarning("Geometry file is not open default  TOF geometry will be used");
-    tofGeom = new AliTOFGeometryV5();
+  TString selectedTracker = GetOption();
+  AliTracker *tracker;
+  // use MI tracker if selected
+  if (selectedTracker.Contains("TrackerMI")) {
+    tracker = new AliTOFtrackerMI();
+  }
+  // use V1 tracker if selected
+  else if (selectedTracker.Contains("TrackerV1")) {
+    tracker =  new AliTOFtrackerV1();
   }
   else {
-    in->cd();  
-    tofGeom = (AliTOFGeometry*) in->Get("TOFgeometry");
+    tracker = new AliTOFtracker();
   }
+  return tracker;
 
-  savedir->cd();  
-
-  if (!tofGeom) {
-    AliError("no TOF geometry available");
-    return NULL;
-  }
-  return tofGeom;
 }