]> 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 8812438e5506ebf5d5754470acf1b953a129922b..3395725e2e626cc91e5c9e2ba4966f0a7377252b 100644 (file)
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-#include "TFile.h"
+#include <cstdlib>
 #include "TObjArray.h"
 #include "TString.h"
 
 #include "AliLog.h"
 #include "AliRawReader.h"
-#include "AliCDBManager.h"
-#include "AliCDBEntry.h"
 
 #include "AliTOFClusterFinder.h"
+#include "AliTOFClusterFinderV1.h"
 #include "AliTOFcalib.h"
 #include "AliTOFtrackerMI.h"
 #include "AliTOFtracker.h"
 #include "AliTOFtrackerV1.h"
 #include "AliTOFReconstructor.h"
-#include "AliTOFFormatDCS.h"
 
 class TTree;
 
 class AliESDEvent;
 
-extern TDirectory *gDirectory;
-extern TFile *gFile;
-
 ClassImp(AliTOFReconstructor)
 
  //____________________________________________________________________
@@ -55,56 +50,25 @@ AliTOFReconstructor::AliTOFReconstructor()
 //
 // ctor
 //
-
-//reading DCS DP processing result
-
-  AliCDBManager *man = AliCDBManager::Instance();
-  Char_t *sel = "TOF/Calib/DCSData" ;
-  Char_t  out[100];
-  sprintf(out,"%s",sel); 
-  if (!man->Get(out,-1)) { 
-    AliInfo("No DCS data found in CDB");
-  }
-  else{
-    AliCDBEntry *entry = man->Get(out,-1);
-    if(!entry->GetObject()){
-      AliInfo("No DCS array found in CDB entry");
-    }
-     
-   else {
-      TObjArray *array = (TObjArray*)entry->GetObject();
-      TString alias[4]={"tof_lv_i48","tof_lv_v48","tof_lv_i33","tof_lv_v33"};
-      for (Int_t jj=0;jj<4;jj++){
-       AliInfo(Form("Alias = %s",alias[jj].Data()));
-       
-       AliTOFFormatDCS *dcs = (AliTOFFormatDCS*)array->At(jj);
-       for (Int_t i=0;i<3;i++){
-         AliInfo(Form("set value %i to %f at %f",i,dcs->GetFloat(i),dcs->GetTimeStampFloat(i)));
-       }
-       for (Int_t i=0;i<2;i++){
-         AliInfo(Form("set variation %i to %f at %f",i,dcs->GetDelta(i),dcs->GetTimeStampDelta(i)));
-       }
-       
-      }
-    }
-  }
   
   //Retrieving the TOF calibration info  
   fTOFcalib    = new AliTOFcalib();
-  fTOFcalib->CreateCalArrays();
-  if(!fTOFcalib->ReadParOnlineFromCDB("TOF/Calib",-1)) {AliFatal("Exiting, no CDB object found!!!");exit(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);}  
 }
 
 //------------------------------------------------------------------------
 AliTOFReconstructor::AliTOFReconstructor(const AliTOFReconstructor &source)
-  : AliReconstructor(),
-    fTOFcalib(0)
+  : AliReconstructor(source),
+    fTOFcalib(source.fTOFcalib)
 {
 //
 // copy ctor
 //
-  this->fTOFcalib=source.fTOFcalib;
 }
 
 //------------------------------------------------------------------------
@@ -113,7 +77,10 @@ AliTOFReconstructor & AliTOFReconstructor::operator=(const AliTOFReconstructor &
 //
 // assignment op.
 //
-  this->fTOFcalib=source.fTOFcalib;
+  if (this == &source)
+    return *this;
+
+  fTOFcalib=source.fTOFcalib;
   return *this;
 }
 //_____________________________________________________________________________
@@ -129,10 +96,34 @@ AliTOFReconstructor::~AliTOFReconstructor()
 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);
+  }
 
 }
 
@@ -140,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);
+  }
 
 }
 //_____________________________________________________________________________
@@ -153,20 +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);
+
+  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);
+  }
 
 }
 
 //_____________________________________________________________________________
 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("TrackerMI")) {
+    tracker = new AliTOFtrackerMI();
+  }
+  // use V1 tracker if selected
+  else if (selectedTracker.Contains("TrackerV1")) {
+    tracker =  new AliTOFtrackerV1();
+  }
+  else {
+    tracker = new AliTOFtracker();
+  }
+  return tracker;
 
+}