]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSReconstructor.cxx
plitting of drift speed (updated at every physics run) from other calibration paramet...
[u/mrichter/AliRoot.git] / ITS / AliITSReconstructor.cxx
index 79ff19767239e8a4da9889ba2174ca3f395ab0a1..a634b5d8d3ccf365471ba0ed3496195b9bd421f6 100644 (file)
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-
+#include "Riostream.h"
 #include "AliITSReconstructor.h"
-#include "AliRunLoader.h"
+#include "AliRun.h"
 #include "AliRawReader.h"
-#include "AliITSclustererV2.h"
+#include "AliITSDetTypeRec.h"
+#include "AliITSgeom.h"
 #include "AliITSLoader.h"
 #include "AliITStrackerMI.h"
+#include "AliITStrackerV2.h"
 #include "AliITStrackerSA.h"
 #include "AliITSVertexerIons.h"
 #include "AliITSVertexerFast.h"
-#include "AliITSVertexerPPZ.h"
+#include "AliITSVertexer3D.h"
 #include "AliITSVertexerZ.h"
-#include "AliESD.h"
+#include "AliITSVertexerCosmics.h"
+#include "AliESDEvent.h"
 #include "AliITSpidESD.h"
-#include "AliV0vertexer.h"
-#include "AliCascadeVertexer.h"
+#include "AliITSpidESD1.h"
+#include "AliITSpidESD2.h"
+#include "AliITSInitGeometry.h"
 
-ClassImp(AliITSReconstructor)
 
-  
-  
-//_____________________________________________________________________________
-void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader) const
-{
-// reconstruct clusters
+ClassImp(AliITSReconstructor)
 
+AliITSRecoParam *AliITSReconstructor::fgkRecoParam =0;  // reconstruction parameters
 
-  AliLoader* loader = runLoader->GetLoader("ITSLoader");
-  if (!loader) {
-    Error("Reconstruct", "ITS loader not found");
-    return;
+//___________________________________________________________________________
+AliITSReconstructor::AliITSReconstructor() : AliReconstructor(),
+fItsPID(0),
+fDetTypeRec(0)
+{
+  // Default constructor
+  if (!fgkRecoParam) {
+    AliError("The Reconstruction parameters nonitialized - Used default one");
+    fgkRecoParam = AliITSRecoParam::GetHighFluxParam();
   }
-  loader->LoadRecPoints("recreate");
-  loader->LoadDigits("read");
-  runLoader->LoadKinematics();
+}
+ //___________________________________________________________________________
+AliITSReconstructor::~AliITSReconstructor(){
+// destructor
+  delete fItsPID;
+  if(fgkRecoParam) delete fgkRecoParam;
+  if(fDetTypeRec) delete fDetTypeRec;
+} 
+//______________________________________________________________________
+AliITSReconstructor::AliITSReconstructor(const AliITSReconstructor &ob) :AliReconstructor(ob),
+                                                                        fItsPID(ob.fItsPID),
+                                                                        fDetTypeRec(ob.fDetTypeRec)
 
-  AliITSgeom* geom = GetITSgeom(runLoader);
+{
+  // Copy constructor
+}
 
-  AliITSclustererV2 clusterer(geom);
-  Int_t nEvents = runLoader->GetNumberOfEvents();
+//______________________________________________________________________
+AliITSReconstructor& AliITSReconstructor::operator=(const AliITSReconstructor&  ob ){
+  // Assignment operator
+  this->~AliITSReconstructor();
+  new(this) AliITSReconstructor(ob);
+  return *this;
+}
 
-  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;
-    }
+//______________________________________________________________________
+void AliITSReconstructor::Init() {
+    // Initalize this constructor bet getting/creating the objects
+    // nesseary for a proper ITS reconstruction.
+    // Inputs:
+    //   none.
+    // Output:
+    //   none.
+    // Return:
+    //   none.
+
+    AliITSInitGeometry initgeom;
+    AliITSgeom *geom = initgeom.CreateAliITSgeom();
+    AliInfo(Form("Geometry name: %s",(initgeom.GetGeometryName()).Data()));
+
+    fDetTypeRec = new AliITSDetTypeRec();
+    fDetTypeRec->SetITSgeom(geom);
+    fDetTypeRec->SetDefaults();
     
-    clusterer.Digits2Clusters(treeDigits, treeClusters);
-         
-    loader->WriteRecPoints("OVERWRITE");
-  }
-
-  loader->UnloadRecPoints();
-  loader->UnloadDigits();
-  runLoader->UnloadKinematics();
+    return;
 }
 
-
 //_____________________________________________________________________________
-void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader,
-                                     AliRawReader* rawReader) const
+void AliITSReconstructor::Reconstruct(TTree *digitsTree, TTree *clustersTree) const
 {
-// reconstruct clusters from raw data
-
-  AliITSLoader* loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
-  if (!loader) {
-    Error("Reconstruct", "ITS loader not found");
-    return;
-  }
-  loader->LoadRecPoints("recreate");
-
-  AliITSgeom* geom = GetITSgeom(runLoader);
-  AliITSclustererV2 clusterer(geom);
-
-  Int_t iEvent = 0;
-  while (rawReader->NextEvent()) {
-    runLoader->GetEvent(iEvent++);
-
-    TTree* treeClusters = loader->TreeR();
-    if (!treeClusters) {
-      loader->MakeTree("R");
-      treeClusters = loader->TreeR();
-    }
+// reconstruct clusters
 
-    clusterer.Digits2Clusters(rawReader);
-         
-    loader->WriteRecPoints("OVERWRITE");
-  }
+  TString option = GetOption();
+  Bool_t clusfinder=kTRUE;   // Default: V2 cluster finder
+  if(option.Contains("OrigCF"))clusfinder=kFALSE;
 
-  loader->UnloadRecPoints();
+  fDetTypeRec->SetTreeAddressD(digitsTree);
+  fDetTypeRec->MakeBranch(clustersTree,"R");
+  fDetTypeRec->SetTreeAddressR(clustersTree);
+  fDetTypeRec->DigitsToRecPoints(digitsTree,clustersTree,0,"All",clusfinder);    
+}
 
+//_________________________________________________________________
+void AliITSReconstructor::Reconstruct(AliRawReader* rawReader, TTree *clustersTree) const
+{
+  // reconstruct clusters from raw data
+  fDetTypeRec->SetDefaultClusterFindersV2(kTRUE);
+  fDetTypeRec->DigitsToRecPoints(rawReader,clustersTree);
 }
 
 //_____________________________________________________________________________
-AliTracker* AliITSReconstructor::CreateTracker(AliRunLoader* runLoader) const
+AliTracker* AliITSReconstructor::CreateTracker() const
 {
 // create a ITS tracker
 
   
-  AliITSgeom* geom = GetITSgeom(runLoader);
   TString selectedTracker = GetOption();
-  if (selectedTracker.Contains("MI")) return new AliITStrackerMI(geom);
-  return new AliITStrackerSA(geom);
-  
+  AliTracker* tracker;    
+  if (selectedTracker.Contains("MI")) {
+    tracker = new AliITStrackerMI(0);
+  }  
+  else if (selectedTracker.Contains("V2")) {
+    tracker = new AliITStrackerV2(0);
+  }
+  else {
+    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");
+    if(selectedTracker.Contains("cosmics")||selectedTracker.Contains("COSMICS"))
+      sat->SetOuterStartLayer(AliITSgeomTGeo::GetNLayers()-2);
+  }
 
+  TString selectedPIDmethod = GetOption();
+  AliITSReconstructor* nc = const_cast<AliITSReconstructor*>(this);
+  if(selectedPIDmethod.Contains("LandauFitPID")){
+    Info("FillESD","ITS LandauFitPID option has been selected\n");
+    nc->fItsPID = new AliITSpidESD2((AliITStrackerMI*)tracker);
+  }
+  else{
+    Info("FillESD","ITS default PID\n");
+    Double_t parITS[] = {79.,0.13, 5.}; //IB: this is  "pp tuning"
+    nc->fItsPID = new AliITSpidESD1(parITS);
+  }
+  return tracker;
   
 }
 
 //_____________________________________________________________________________
-AliVertexer* AliITSReconstructor::CreateVertexer(AliRunLoader* /*runLoader*/) const
+AliVertexer* AliITSReconstructor::CreateVertexer() const
 {
 // create a ITS vertexer
 
@@ -151,9 +182,13 @@ AliVertexer* AliITSReconstructor::CreateVertexer(AliRunLoader* /*runLoader*/) co
     Info("CreateVertexer","a AliITSVertexerFast object has been selected\n"); 
     return new AliITSVertexerFast(smear);
   }
-  if(selectedVertexer.Contains("ppz") || selectedVertexer.Contains("PPZ")){
-    Info("CreateVertexer","a AliITSVertexerPPZ object has been selected\n");
-    return new AliITSVertexerPPZ("null");
+  if(selectedVertexer.Contains("3d") || selectedVertexer.Contains("3D")){
+    Info("CreateVertexer","a AliITSVertexer3D object has been selected\n");
+    return new AliITSVertexer3D("null");
+  }
+  if(selectedVertexer.Contains("cosmics") || selectedVertexer.Contains("COSMICS")){
+    Info("CreateVertexer","a AliITSVertexerCosmics object has been selected\n");
+    return new AliITSVertexerCosmics();
   }
   // by default an AliITSVertexerZ object is instatiated
   Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
@@ -161,67 +196,20 @@ AliVertexer* AliITSReconstructor::CreateVertexer(AliRunLoader* /*runLoader*/) co
 }
 
 //_____________________________________________________________________________
-void AliITSReconstructor::FillESD(AliRunLoader* /*runLoader*/, 
-                                 AliESD* esd) const
-{
-// make PID, find V0s and cascades
-
-  Double_t parITS[] = {34., 0.15, 10.};
-  AliITSpidESD itsPID(parITS);
-  itsPID.MakePID(esd);
-
-  // 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);
-}
-
-
-//_____________________________________________________________________________
-AliITSgeom* AliITSReconstructor::GetITSgeom(AliRunLoader* runLoader) const
+void AliITSReconstructor::FillESD(TTree * /*digitsTree*/, TTree *clustersTree, 
+                                 AliESDEvent* esd) const
 {
-// get the ITS geometry
-
-  if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
-  if (!runLoader->GetAliRun()) {
-    Error("GetITSgeom", "couldn't get AliRun object");
-    return NULL;
+// make PID, find V0s and cascade
+  if(fItsPID!=0) {
+    TString selectedPIDmethod = GetOption();
+    if(selectedPIDmethod.Contains("LandauFitPID")){
+      fItsPID->MakePID(clustersTree,esd);
+    }
+    else{
+      fItsPID->MakePID(esd);
+    }
   }
-  
-  TDirectory * olddir = gDirectory;
-  runLoader->CdGAFile();
-  AliITSgeom* geom = (AliITSgeom*)gDirectory->Get("AliITSgeom");
-  olddir->cd();
-  if(!geom){
-    Error("GetITSgeom","no ITS geometry available");
-    return NULL;
+  else {
+    Error("FillESD","!! cannot do the PID !!\n");
   }
-  
-  return geom;
 }
-