New methods Reconstruct and FillESD added
[u/mrichter/AliRoot.git] / PMD / AliPMDReconstructor.cxx
index 185181413995b9bfab47ec36d4cd25afc8236adf..69138b002a0630c1d42ed66f6b2e7f0309024726 100644 (file)
 #include "AliRun.h"
 #include "AliPMDClusterFinder.h"
 #include "AliPMDtracker.h"
+#include "AliRawReader.h"
 #include "AliESDPmdTrack.h"
 #include "AliESD.h"
-
+#include "AliLog.h"
 
 ClassImp(AliPMDReconstructor)
 
-
+//_____________________________________________________________________________
+void AliPMDReconstructor::Init(AliRunLoader* runLoader) 
+{
+  // Initialize the reconstructor 
+  AliDebug(1, Form("Init called with runloader 0x%x", runLoader));
+  if (!runLoader)
+    { 
+      AliWarning("Init : No run loader");
+      return;
+    }
+}
+    
 //_____________________________________________________________________________
 void AliPMDReconstructor::Reconstruct(AliRunLoader* runLoader) const
 {
-// reconstruct clusters
+// reconstruct clusters from digits file
 
   AliPMDClusterFinder *pmdClus = new AliPMDClusterFinder(runLoader);
   pmdClus->Load();
@@ -47,21 +59,62 @@ void AliPMDReconstructor::Reconstruct(AliRunLoader* runLoader) const
   delete pmdClus;
 
 }
-
 // ------------------------------------------------------------------------ //
 
-void AliPMDReconstructor::FillESD(AliRunLoader* runLoader,AliESD* esd) const
+void AliPMDReconstructor::Reconstruct(AliRunLoader* runLoader,
+                                     AliRawReader *rawReader) const
 {
-  AliLoader* loader = runLoader->GetLoader("PMDLoader");
-  if (!loader) {
-    Error("Reconstruct", "PMD loader not found");
-    return;
+// reconstruct clusters from Raw Data
+
+  AliPMDClusterFinder pmdClus(runLoader);
+  pmdClus.LoadClusters();
+
+  Int_t iEvent = 0;
+  while (rawReader->NextEvent()) {
+    pmdClus.Digits2RecPoints(iEvent,rawReader);
+    iEvent++;
   }
-  loader->LoadRecPoints("READ");
+  pmdClus.UnLoadClusters();
+  
+}
+
+
+// ------------------------------------------------------------------------ //
 
-  TTree *treeR = loader->TreeR();
+void AliPMDReconstructor::Reconstruct(AliRawReader *rawReader,
+                                     TTree *clustersTree) const
+{
+// reconstruct clusters from Raw Data
+
+  AliPMDClusterFinder pmdClus;
+  pmdClus.Digits2RecPoints(rawReader, clustersTree);
+
+}
+
+// ------------------------------------------------------------------------ //
+
+//void AliPMDReconstructor::FillESD(AliRunLoader* runLoader,AliESD* esd) const
+//{
+//  AliLoader* loader = runLoader->GetLoader("PMDLoader");
+//  if (!loader) {
+//    AliError("PMD loader not found");
+//    return;
+//  }
+//  loader->LoadRecPoints("READ");
+//  TTree *treeR = loader->TreeR();
+//  AliPMDtracker pmdtracker;
+//  pmdtracker.LoadClusters(treeR);
+//  pmdtracker.Clusters2Tracks(esd);
+//  loader->UnloadRecPoints();
+//}
+
+// ------------------------------------------------------------------------ //
+void AliPMDReconstructor::FillESD(AliRawReader* /*rawReader*/,
+                                 TTree* clustersTree, AliESD* esd) const
+{
   AliPMDtracker pmdtracker;
-  pmdtracker.LoadClusters(treeR);
+  pmdtracker.LoadClusters(clustersTree);
   pmdtracker.Clusters2Tracks(esd);
-  loader->UnloadRecPoints();
 }
+
+