]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFReconstructor.cxx
New class which will deal with the writing of DDL raw data and the endianess issue
[u/mrichter/AliRoot.git] / TOF / AliTOFReconstructor.cxx
index f89ecc4112d409da1e6e42e09b2c8bea9108958b..74fed57a157cea25cdf9c6ee435598bf5da6b375 100644 (file)
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
+#include "TFile.h"
 
-#include "AliTOFReconstructor.h"
+#include "AliLog.h"
+#include "AliRawReader.h"
 #include "AliRunLoader.h"
-#include "AliRun.h"
+
+#include "AliTOFClusterFinder.h"
+#include "AliTOFGeometry.h"
+#include "AliTOFtrackerMI.h"
 #include "AliTOFtracker.h"
-#include "AliLog.h"
-#include <TFile.h>
+#include "AliTOFReconstructor.h"
+
+class TTree;
+
+class AliESD;
 
+extern TDirectory *gDirectory;
+extern TFile *gFile;
 
 ClassImp(AliTOFReconstructor)
 
+//_____________________________________________________________________________
+  void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader) const
+{
+// 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();
+
+}
 
 //_____________________________________________________________________________
-void AliTOFReconstructor::Reconstruct(AliRunLoader* /*runLoader*/) const
+void AliTOFReconstructor::Reconstruct(AliRunLoader* runLoader,
+                                      AliRawReader *rawReader) const
 {
-// nothing to be done
+// 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();
+
+}
+
+//_____________________________________________________________________________
+void AliTOFReconstructor::Reconstruct(AliRawReader *rawReader,
+                                      TTree *clustersTree) const
+{
+// reconstruct clusters from Raw Data
+
+  AliTOFClusterFinder tofClus;
+  tofClus.Digits2RecPoints(rawReader, clustersTree);
 
 }
 
@@ -47,7 +93,12 @@ AliTracker* AliTOFReconstructor::CreateTracker(AliRunLoader* runLoader) const
 
   AliTOFGeometry* geom = GetTOFGeometry(runLoader);
   if (!geom) return NULL;
-  Double_t parPID[] = {130., 5.};
+  //  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);
 }
 
@@ -59,14 +110,27 @@ void AliTOFReconstructor::FillESD(AliRunLoader* /*runLoader*/,
 
 }
 
-
 //_____________________________________________________________________________
 AliTOFGeometry* AliTOFReconstructor::GetTOFGeometry(AliRunLoader* runLoader) const
 {
 // get the TOF parameters
 
+  AliTOFGeometry *tofGeom;
+
   runLoader->CdGAFile();
-  AliTOFGeometry* tofGeom = (AliTOFGeometry*) gFile->Get("TOFGeometry"); 
+  TDirectory *savedir=gDirectory; 
+  TFile *in=(TFile*)gFile;  
+  if (!in->IsOpen()) {
+    AliWarning("Geometry file is not open default  TOF geometry will be used");
+    tofGeom = new AliTOFGeometry();
+  }
+  else {
+    in->cd();  
+    tofGeom = (AliTOFGeometry*) in->Get("TOFgeometry");
+  }
+
+  savedir->cd();  
+
   if (!tofGeom) {
     AliError("no TOF geometry available");
     return NULL;