]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFReconstructor.cxx
Including strings.h to define bcmp
[u/mrichter/AliRoot.git] / TOF / AliTOFReconstructor.cxx
index 744180f32c760bb4d9ed1ea12baf8433624f4125..70bad529aeb6911a68f07cb8a02de2bf77953960 100644 (file)
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-
-#include <TFile.h>
+#include "TFile.h"
 
 #include "AliLog.h"
-#include "AliRun.h"
+#include "AliRawReader.h"
 #include "AliRunLoader.h"
 
+#include "AliTOFClusterFinder.h"
 #include "AliTOFGeometry.h"
-#include "AliTOFGeometryV4.h"
 #include "AliTOFGeometryV5.h"
-#include "AliTOFtracker.h"
+#include "AliTOFcalib.h"
 #include "AliTOFtrackerMI.h"
-#include "AliTOFClusterFinder.h"
+#include "AliTOFtracker.h"
 #include "AliTOFReconstructor.h"
 
+class TTree;
+
+class AliESDEvent;
+
+extern TDirectory *gDirectory;
+extern TFile *gFile;
+
 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);}  
+}
+
+//------------------------------------------------------------------------
+AliTOFReconstructor::AliTOFReconstructor(const AliTOFReconstructor &source)
+  : AliReconstructor(),
+    fTOFGeometry(0),
+    fTOFcalib(0)
+{
+//
+// copy ctor
+//
+  this->fTOFGeometry=source.fTOFGeometry;
+  this->fTOFcalib=source.fTOFcalib;
+}
+
+//------------------------------------------------------------------------
+AliTOFReconstructor & AliTOFReconstructor::operator=(const AliTOFReconstructor &source)
+{
+//
+// assignment op.
+//
+  this->fTOFGeometry=source.fTOFGeometry;
+  this->fTOFcalib=source.fTOFcalib;
+  return *this;
+}
+//_____________________________________________________________________________
+AliTOFReconstructor::~AliTOFReconstructor() 
+{
+//
+// dtor
+//
+  delete fTOFGeometry;
+  delete fTOFcalib;
+}
+
 //_____________________________________________________________________________
   void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader) const
 {
 // reconstruct clusters from digits
 
-  AliTOFClusterFinder *tofClus = new AliTOFClusterFinder(runLoader);
-  tofClus->Load();
+  AliTOFClusterFinder tofClus(runLoader, fTOFcalib);
+  tofClus.Load();
   for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++)
     {
-      tofClus->Digits2RecPoints(iEvent);
+      AliDebug(2,Form("Local Event loop mode: Creating Recpoints from Digits, Event n. %i",iEvent)); 
+      tofClus.Digits2RecPoints(iEvent);
     }
-  tofClus->UnLoad();
+  tofClus.UnLoad();
 
 }
 
@@ -59,12 +114,12 @@ void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader,
 {
 // reconstruct clusters from Raw Data
 
-  AliTOFClusterFinder tofClus(runLoader);
+  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);
-    //tofClus.Raw2Digits(iEvent,rawReader); // temporary solution
     iEvent++;
   }
   tofClus.UnLoadClusters();
@@ -77,30 +132,47 @@ void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
 {
 // reconstruct clusters from Raw Data
 
-  AliTOFClusterFinder tofClus;
+  AliTOFClusterFinder tofClus(fTOFcalib);
   tofClus.Digits2RecPoints(rawReader, clustersTree);
 
 }
 
 //_____________________________________________________________________________
-AliTracker* AliTOFReconstructor::CreateTracker(AliRunLoader* runLoader) const
+void AliTOFReconstructor::Reconstruct(TTree *digitsTree,
+                                      TTree *clustersTree) const
+{
+// reconstruct clusters from Raw Data
+
+  AliDebug(2,Form("Global Event loop mode: Creating Recpoints from Digits Tree")); 
+  AliTOFClusterFinder tofClus(fTOFcalib);
+  tofClus.Digits2RecPoints(digitsTree, clustersTree);
+
+}
+//_____________________________________________________________________________
+  void AliTOFReconstructor::ConvertDigits(AliRawReader* reader, TTree* digitsTree) const
+{
+// 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
 
-  AliTOFGeometry* geom = GetTOFGeometry(runLoader);
-  if (!geom) return NULL;
-  //  Double_t parPID[] = {130., 5.};
-  Double_t parPID[] = {80., 5.};
   TString selectedTracker = GetOption();
   // use MI tracker if selected
-  if (selectedTracker.Contains("MI")) return new AliTOFtrackerMI(geom,parPID);
-
-  return new AliTOFtracker(geom, parPID);
+  if (selectedTracker.Contains("MI")) return new AliTOFtrackerMI();
+  return new AliTOFtracker();
 }
 
 //_____________________________________________________________________________
 void AliTOFReconstructor::FillESD(AliRunLoader* /*runLoader*/, 
-                                 AliESD* /*esd*/) const
+                                 AliESDEvent* /*esd*/) const
 {
 // nothing to be done
 
@@ -118,7 +190,7 @@ AliTOFGeometry* AliTOFReconstructor::GetTOFGeometry(AliRunLoader* runLoader) con
   TFile *in=(TFile*)gFile;  
   if (!in->IsOpen()) {
     AliWarning("Geometry file is not open default  TOF geometry will be used");
-    tofGeom = new AliTOFGeometry();
+    tofGeom = new AliTOFGeometryV5();
   }
   else {
     in->cd();