]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFReconstructor.cxx
branches
[u/mrichter/AliRoot.git] / TOF / AliTOFReconstructor.cxx
index e04aff9118b590f058941da915c058f83e94d6c6..93919145f3f19f369a0eba488d6f26102e01081e 100644 (file)
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-
-#include <TFile.h>
+#include <cstdlib>
+#include "TObjArray.h"
+#include "TString.h"
 
 #include "AliLog.h"
-#include "AliRun.h"
-#include "AliRunLoader.h"
+#include "AliRawReader.h"
 
-#include "AliTOFtracker.h"
 #include "AliTOFClusterFinder.h"
+#include "AliTOFClusterFinderV1.h"
+#include "AliTOFcalib.h"
+#include "AliTOFtrackerMI.h"
+#include "AliTOFtracker.h"
+#include "AliTOFtrackerV1.h"
 #include "AliTOFReconstructor.h"
 
+class TTree;
+
+class AliESDEvent;
 
 ClassImp(AliTOFReconstructor)
 
+ //____________________________________________________________________
+AliTOFReconstructor::AliTOFReconstructor() 
+  : AliReconstructor(),
+    fTOFcalib(0)
+{
+//
+// ctor
+//
+  
+  //Retrieving the TOF calibration info  
+  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);}  
+}
 
-//_____________________________________________________________________________
-  void AliTOFReconstructor::Reconstruct(AliRunLoader* /*runLoader*/) const
+//------------------------------------------------------------------------
+AliTOFReconstructor::AliTOFReconstructor(const AliTOFReconstructor &source)
+  : AliReconstructor(),
+    fTOFcalib(0)
 {
-// reconstruct clusters from digits
-/*
-  AliTOFClusterFinder *tofClus = new AliTOFClusterFinder(runLoader);
-  tofClus->Load();
-  for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++)
-    {
-      tofClus->Digits2RecPoints(iEvent);
-    }
-  tofClus->UnLoad();
-*/
+//
+// copy ctor
+//
+  this->fTOFcalib=source.fTOFcalib;
 }
 
+//------------------------------------------------------------------------
+AliTOFReconstructor & AliTOFReconstructor::operator=(const AliTOFReconstructor &source)
+{
+//
+// assignment op.
+//
+  this->fTOFcalib=source.fTOFcalib;
+  return *this;
+}
 //_____________________________________________________________________________
-void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader,
-                                      AliRawReader *rawReader) const
+AliTOFReconstructor::~AliTOFReconstructor() 
 {
-// reconstruct clusters from Raw Data
-
-  AliTOFClusterFinder tofClus(runLoader);
-  tofClus.LoadClusters();
-  Int_t iEvent = 0;
-  while (rawReader->NextEvent()) {
-    //tofClus.Digits2RecPoints(iEvent,rawReader);
-    tofClus.Raw2Digits(iEvent,rawReader); // temporary solution
-    iEvent++;
-  }
-  tofClus.UnLoadClusters();
-
+//
+// dtor
+//
+  delete fTOFcalib;
 }
 
 //_____________________________________________________________________________
 void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
                                       TTree *clustersTree) const
 {
-// reconstruct clusters from Raw Data
-
-  AliTOFClusterFinder tofClus;
-  tofClus.Digits2RecPoints(rawReader, clustersTree);
+  //
+  // reconstruct clusters from Raw Data
+  //
+
+  TString selectedClusterFinder = GetOption();
+  // use V1 cluster finder if selected
+  if (selectedClusterFinder.Contains("NCF")) {
+    static AliTOFClusterFinderV1 tofClus(fTOFcalib);
+    tofClus.Digits2RecPoints(rawReader, clustersTree);
+  }
+  else {
+    static AliTOFClusterFinder tofClus(fTOFcalib);
+    tofClus.Digits2RecPoints(rawReader, clustersTree);
+  }
 
 }
 
 //_____________________________________________________________________________
-AliTracker* AliTOFReconstructor::CreateTracker(AliRunLoader* runLoader) const
+void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
+                                      TTree *clustersTree) const
 {
-// create a TOF tracker
+  //
+  // reconstruct clusters from digits
+  //
 
-  AliTOFGeometry* geom = GetTOFGeometry(runLoader);
-  if (!geom) return NULL;
-  Double_t parPID[] = {130., 5.};
-  return new AliTOFtracker(geom, parPID);
-}
+  AliDebug(2,Form("Global Event loop mode: Creating Recpoints from Digits Tree")); 
 
+  TString selectedClusterFinder = GetOption();
+  // use V1 cluster finder if selected
+  if (selectedClusterFinder.Contains("NCF")) {
+    static AliTOFClusterFinderV1 tofClus(fTOFcalib);
+    tofClus.Digits2RecPoints(digitsTree, clustersTree);
+  }
+  else {
+    static AliTOFClusterFinder tofClus(fTOFcalib);
+    tofClus.Digits2RecPoints(digitsTree, clustersTree);
+  }
+
+}
 //_____________________________________________________________________________
-void AliTOFReconstructor::FillESD(AliRunLoader* /*runLoader*/, 
-                                 AliESD* /*esd*/) const
+  void AliTOFReconstructor::ConvertDigits(AliRawReader* reader, TTree* digitsTree) const
 {
-// nothing to be done
+// reconstruct clusters from digits
+
+  AliDebug(2,Form("Global Event loop mode: Converting Raw Data to a Digits Tree")); 
+
+  TString selectedClusterFinder = GetOption();
+  // use V1 cluster finder if selected
+  if (selectedClusterFinder.Contains("NCF")) {
+    static AliTOFClusterFinderV1 tofClus(fTOFcalib);
+    tofClus.Raw2Digits(reader, digitsTree);
+  }
+  else {
+    static AliTOFClusterFinder tofClus(fTOFcalib);
+    tofClus.Raw2Digits(reader, digitsTree);
+  }
 
 }
 
 //_____________________________________________________________________________
-AliTOFGeometry* AliTOFReconstructor::GetTOFGeometry(AliRunLoader* runLoader) const
+AliTracker* AliTOFReconstructor::CreateTracker() const
 {
-// get the TOF parameters
 
-  runLoader->CdGAFile();
-  AliTOFGeometry* tofGeom = (AliTOFGeometry*) gFile->Get("TOFGeometry"); 
-  if (!tofGeom) {
-    AliError("no TOF geometry available");
-    return NULL;
+  // 
+  // 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")) {
+    tracker = new AliTOFtrackerMI();
   }
-  return tofGeom;
+  // use V1 tracker if selected
+  if (selectedTracker.Contains("V1")) {
+    tracker =  new AliTOFtrackerV1();
+  }
+  else {
+    tracker = new AliTOFtracker();
+  }
+  return tracker;
+
 }