]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSReconstructor.cxx
Bug fix in AliITStrackerV2 (first cluster not used) + possibility of using the V2...
[u/mrichter/AliRoot.git] / ITS / AliITSReconstructor.cxx
index cee6b58ff0cc4d9770983649b6e5b5569ba7aea4..76b4daf4ed88a4ac74ccbd406b28a71be7df54d4 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 "AliITStrackerV2.h"
 #include "AliITStrackerSA.h"
 #include "AliITSVertexerIons.h"
 #include "AliITSVertexerFast.h"
 #include "AliITSpidESD.h"
 #include "AliITSpidESD1.h"
 #include "AliITSpidESD2.h"
-#include "AliV0vertexer.h"
-#include "AliCascadeVertexer.h"
+#include "AliITSInitGeometry.h"
 
 ClassImp(AliITSReconstructor)
 
 //___________________________________________________________________________
-AliITSReconstructor::AliITSReconstructor() : AliReconstructor(){
+AliITSReconstructor::AliITSReconstructor() : AliReconstructor(),
+fItsPID(0)
+{
   // Default constructor
-  fItsPID=0;
 }
  //___________________________________________________________________________
 AliITSReconstructor::~AliITSReconstructor(){
@@ -53,55 +55,73 @@ AliITSReconstructor::~AliITSReconstructor(){
   delete fItsPID;
 } 
 //______________________________________________________________________
-AliITSReconstructor::AliITSReconstructor(const AliITSReconstructor &ob) :AliReconstructor(ob) {
+AliITSReconstructor::AliITSReconstructor(const AliITSReconstructor &ob) :AliReconstructor(ob),
+fItsPID(ob.fItsPID) 
+{
   // Copy constructor
-  // Copies are not allowed. The method is protected to avoid misuse.
-  Error("AliITSpidESD2","Copy constructor not allowed\n");
 }
 
 //______________________________________________________________________
-AliITSReconstructor& AliITSReconstructor::operator=(const AliITSReconstructor& /* ob */){
+AliITSReconstructor& AliITSReconstructor::operator=(const AliITSReconstructor&  ob ){
   // Assignment operator
-  // Assignment is not allowed. The method is protected to avoid misuse.
-  Error("= operator","Assignment operator not allowed\n");
+  this->~AliITSReconstructor();
+  new(this) AliITSReconstructor(ob);
   return *this;
 }
+//______________________________________________________________________
+void AliITSReconstructor::Init(AliRunLoader *runLoader) const{
+    // Initalize this constructor bet getting/creating the objects
+    // nesseary for a proper ITS reconstruction.
+    // Inputs:
+    //    AliRunLoader *runLoader   Pointer to the run loader to allow
+    //                              the getting of files/folders data
+    //                              needed to do reconstruction
+    // Output:
+    //   none.
+    // Return:
+    //   none.
+
+    AliITSInitGeometry initgeom;
+    AliITSgeom *geom = initgeom.CreateAliITSgeom();
+    AliInfo(Form("Geometry name: %s",(initgeom.GetGeometryName()).Data()));
+    AliITSLoader* loader = static_cast<AliITSLoader*>
+       (runLoader->GetLoader("ITSLoader"));
+    if (!loader) {
+       Error("Init", "ITS loader not found");
+       return;
+    }
+    loader->SetITSgeom(geom);
+    return;
+}
 //_____________________________________________________________________________
 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 +129,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();
-
 }
 
 //_____________________________________________________________________________
@@ -151,14 +165,19 @@ AliTracker* AliITSReconstructor::CreateTracker(AliRunLoader* runLoader)const
 // create a ITS tracker
 
   
-  AliITSgeom* geom = GetITSgeom(runLoader);
   TString selectedTracker = GetOption();
   AliTracker* tracker;    
   if (selectedTracker.Contains("MI")) {
-    tracker = new AliITStrackerMI(geom);
+    tracker = new AliITStrackerMI(0);
+  }  
+  else if (selectedTracker.Contains("V2")) {
+    tracker = new AliITStrackerV2(0);
   }
   else {
-    tracker =  new AliITStrackerSA(geom);  // inherits from AliITStrackerMI
+    tracker =  new AliITStrackerSA(0);  // inherits from AliITStrackerMI
+    AliITStrackerSA *sat=(AliITStrackerSA*)tracker;
+    if(selectedTracker.Contains("onlyITS"))sat->SetSAFlag(kTRUE);
+    if(sat->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
   }
 
   TString selectedPIDmethod = GetOption();
@@ -210,9 +229,11 @@ void AliITSReconstructor::FillESD(AliRunLoader* runLoader,
   AliITSpidESD *pidESD = 0;
   TString selectedPIDmethod = GetOption();
   if(selectedPIDmethod.Contains("LandauFitPID")){
+    Info("FillESD","ITS LandauFitPID option has been selected\n");
     pidESD=loader->GetITSpid();
   }
   else{
+    Info("FillESD","ITS default PID\n");
     pidESD=loader->GetITSpid();
   }
   if(pidESD!=0){
@@ -221,35 +242,6 @@ void AliITSReconstructor::FillESD(AliRunLoader* runLoader,
   else {
     Error("FillESD","!! cannot do the PID !!\n");
   }
-  // V0 finding
-  Double_t cuts[]={33,  // max. allowed chi2
-                  0.16,// min. allowed negative daughter's impact parameter 
-                  0.05,// min. allowed positive daughter's impact parameter 
-                  0.08,// max. allowed DCA between the daughter tracks
-                  0.99,// max. allowed cosine of V0's pointing angle
-                  0.9,  // min. radius of the fiducial volume
-                  2.9   // max. radius of the fiducial volume
-  };
-  AliV0vertexer vtxer(cuts);
-  Double_t vtx[3], cvtx[6];
-  esd->GetVertex()->GetXYZ(vtx);
-  esd->GetVertex()->GetSigmaXYZ(cvtx);
-  vtxer.SetVertex(vtx);
-  vtxer.Tracks2V0vertices(esd);
-
-  // cascade finding
-  Double_t cts[]={33.,    // max. allowed chi2
-                 0.05,   // min. allowed V0 impact parameter 
-                 0.008,  // window around the Lambda mass 
-                 0.035,  // min. allowed bachelor's impact parameter 
-                 0.10,   // max. allowed DCA between a V0 and a track
-                 0.9985, //max. allowed cosine of the cascade pointing angle
-                 0.9,    // min. radius of the fiducial volume
-                 2.9     // max. radius of the fiducial volume
-  };
-  AliCascadeVertexer cvtxer=AliCascadeVertexer(cts);
-  cvtxer.SetVertex(vtx);
-  cvtxer.V0sTracks2CascadeVertices(esd);
 }
 
 
@@ -263,11 +255,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;
@@ -275,4 +264,3 @@ AliITSgeom* AliITSReconstructor::GetITSgeom(AliRunLoader* runLoader) const
   
   return geom;
 }
-