]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSReconstructor.cxx
Adding copy constructor and assignment operator
[u/mrichter/AliRoot.git] / ITS / AliITSReconstructor.cxx
index 4bd865e4e0e7971fa90870976bb8b63e26c0bdb5..429f71e056cd7e9a3ebbf88582d9e23b6c723639 100644 (file)
 
 #include "Riostream.h"
 #include "AliITSReconstructor.h"
+#include "AliRun.h"
 #include "AliRunLoader.h"
 #include "AliRawReader.h"
-#include "AliITSclustererV2.h"
+#include "AliITSDetTypeRec.h"
 #include "AliITSLoader.h"
 #include "AliITStrackerMI.h"
 #include "AliITStrackerSA.h"
@@ -66,42 +67,36 @@ AliITSReconstructor& AliITSReconstructor::operator=(const AliITSReconstructor& /
   Error("= operator","Assignment operator not allowed\n");
   return *this;
 }
+
 //_____________________________________________________________________________
 void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader) const
 {
 // reconstruct clusters
 
 
-  AliITSLoader *loader = (AliITSLoader *)runLoader->GetLoader("ITSLoader");
+  AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
   if (!loader) {
     Error("Reconstruct", "ITS loader not found");
     return;
   }
+  AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
+  rec->SetDefaults();
+
   loader->LoadRecPoints("recreate");
   loader->LoadDigits("read");
   runLoader->LoadKinematics();
+  TString option = GetOption();
+  Bool_t clusfinder=kTRUE;   // Default: V2 cluster finder
+  if(option.Contains("OrigCF"))clusfinder=kFALSE;
 
-  AliITSgeom* geom = GetITSgeom(runLoader);
-
-  AliITSclustererV2 clusterer(geom);
   Int_t nEvents = runLoader->GetNumberOfEvents();
 
   for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
     runLoader->GetEvent(iEvent);
-    TTree* treeClusters = loader->TreeR();
-    if (!treeClusters) {
-      loader->MakeTree("R");
-      treeClusters = loader->TreeR();
-    }
-    TTree* treeDigits = loader->TreeD();
-    if (!treeDigits) {
-      Error("Reconstruct", "Can't get digits tree !");
-      return;
-    }
-    
-    clusterer.Digits2Clusters(treeDigits, treeClusters);
-         
-    loader->WriteRecPoints("OVERWRITE");
+    if(loader->TreeR()==0x0) loader->MakeTree("R");
+    rec->MakeBranch("R");
+    rec->SetTreeAddress();
+    rec->DigitsToRecPoints(iEvent,0,"All",clusfinder);    
   }
 
   loader->UnloadRecPoints();
@@ -109,40 +104,34 @@ void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader) const
   runLoader->UnloadKinematics();
 }
 
-
-//_____________________________________________________________________________
-void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader,
-                                     AliRawReader* rawReader) const
+//_________________________________________________________________
+void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader, 
+                                      AliRawReader* rawReader) const
 {
-// reconstruct clusters from raw data
+// reconstruct clusters
 
-  AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
+  AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
   if (!loader) {
     Error("Reconstruct", "ITS loader not found");
     return;
   }
-  loader->LoadRecPoints("recreate");
 
-  AliITSgeom* geom = GetITSgeom(runLoader);
-  AliITSclustererV2 clusterer(geom);
+  AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
+  rec->SetDefaults();
+  rec->SetDefaultClusterFindersV2(kTRUE);
 
-  Int_t iEvent = 0;
-  while (rawReader->NextEvent()) {
-    runLoader->GetEvent(iEvent++);
+  loader->LoadRecPoints("recreate");
 
-    TTree* treeClusters = loader->TreeR();
-    if (!treeClusters) {
-      loader->MakeTree("R");
-      treeClusters = loader->TreeR();
-    }
+  Int_t iEvent = 0;
 
-    clusterer.Digits2Clusters(rawReader);
-         
-    loader->WriteRecPoints("OVERWRITE");
+  while(rawReader->NextEvent()) {
+    runLoader->GetEvent(iEvent++);
+    if(loader->TreeR()==0x0) loader->MakeTree("R");
+    rec->DigitsToRecPoints(rawReader);
   }
 
   loader->UnloadRecPoints();
-
 }
 
 //_____________________________________________________________________________
@@ -265,11 +254,8 @@ AliITSgeom* AliITSReconstructor::GetITSgeom(AliRunLoader* runLoader) const
     Error("GetITSgeom", "couldn't get AliRun object");
     return NULL;
   }
-  
-  TDirectory * olddir = gDirectory;
-  runLoader->CdGAFile();
-  AliITSgeom* geom = (AliITSgeom*)gDirectory->Get("AliITSgeom");
-  olddir->cd();
+  AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
+  AliITSgeom* geom = (AliITSgeom*)loader->GetITSgeom();
   if(!geom){
     Error("GetITSgeom","no ITS geometry available");
     return NULL;