]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSReconstructor.cxx
exclusive bins for high pT dihadron study
[u/mrichter/AliRoot.git] / ITS / AliITSReconstructor.cxx
index 4bd865e4e0e7971fa90870976bb8b63e26c0bdb5..9e61af29d029dbc166af4c0985eb2bd5c17e0a45 100644 (file)
 
 #include "Riostream.h"
 #include "AliITSReconstructor.h"
-#include "AliRunLoader.h"
+#include "AliRun.h"
 #include "AliRawReader.h"
-#include "AliITSclustererV2.h"
+#include "AliESDEvent.h"
+#include "AliESDpid.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 "AliITSVertexerFixed.h"
+#include "AliITSVertexer3D.h"
 #include "AliITSVertexerZ.h"
-#include "AliESD.h"
-#include "AliITSpidESD.h"
-#include "AliITSpidESD1.h"
-#include "AliITSpidESD2.h"
-#include "AliV0vertexer.h"
-#include "AliCascadeVertexer.h"
+#include "AliITSVertexerZD.h"
+#include "AliITSVertexerCosmics.h"
+#include "AliITSInitGeometry.h"
+#include "AliITSTrackleterSPDEff.h"
+#include "AliITSMultReconstructor.h"
 
 ClassImp(AliITSReconstructor)
 
 //___________________________________________________________________________
-AliITSReconstructor::AliITSReconstructor() : AliReconstructor(){
+AliITSReconstructor::AliITSReconstructor() : AliReconstructor(),
+fDetTypeRec(0)
+{
   // Default constructor
-  fItsPID=0;
 }
  //___________________________________________________________________________
 AliITSReconstructor::~AliITSReconstructor(){
 // destructor
-  delete fItsPID;
+  if(fDetTypeRec) delete fDetTypeRec;
 } 
-//______________________________________________________________________
-AliITSReconstructor::AliITSReconstructor(const AliITSReconstructor &ob) :AliReconstructor(ob) {
-  // Copy constructor
-  // Copies are not allowed. The method is protected to avoid misuse.
-  Error("AliITSpidESD2","Copy constructor not allowed\n");
+//____________________________________________________________________________
+void AliITSReconstructor::GetPidSettings(AliESDpid *ESDpid) {
+  //
+  // pass PID settings from AliITSRecoParam to AliESDpid
+  //
+  Int_t pidOpt = GetRecoParam()->GetPID();
+
+  if(pidOpt==1){
+    AliDebug(1,"ITS LandauFitPID option has been selected\n");
+    ESDpid->SetITSPIDmethod(AliESDpid::kITSLikelihood);
+  }
+  else{
+    AliDebug(1,"ITS default PID\n");
+    ESDpid->SetITSPIDmethod(AliESDpid::kITSTruncMean);
+  }
 }
-
 //______________________________________________________________________
-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");
-  return *this;
+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();
+
+    return;
 }
+
 //_____________________________________________________________________________
-void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader) const
+void AliITSReconstructor::Reconstruct(TTree *digitsTree, TTree *clustersTree) const
 {
 // reconstruct clusters
 
-
-  AliITSLoader *loader = (AliITSLoader *)runLoader->GetLoader("ITSLoader");
-  if (!loader) {
-    Error("Reconstruct", "ITS loader not found");
-    return;
-  }
-  loader->LoadRecPoints("recreate");
-  loader->LoadDigits("read");
-  runLoader->LoadKinematics();
-
-  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");
-  }
-
-  loader->UnloadRecPoints();
-  loader->UnloadDigits();
-  runLoader->UnloadKinematics();
+  TString recopt = GetRecoParam()->GetOptReco();
+  fDetTypeRec->SetTreeAddressD(digitsTree);
+  fDetTypeRec->MakeBranch(clustersTree,"R");
+  fDetTypeRec->SetTreeAddressR(clustersTree);
+  fDetTypeRec->DigitsToRecPoints(digitsTree,clustersTree,0,recopt.Data(),1);    
 }
 
+//_________________________________________________________________
+void AliITSReconstructor::Reconstruct(AliRawReader* rawReader, TTree *clustersTree) const
+{
+  // reconstruct clusters from raw data
+  TString recopt = GetRecoParam()->GetOptReco();
+  fDetTypeRec->SetDefaultClusterFindersV2(kTRUE,kTRUE);
+  fDetTypeRec->DigitsToRecPoints(rawReader,clustersTree,recopt.Data());
+}
 
 //_____________________________________________________________________________
-void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader,
-                                     AliRawReader* rawReader) const
+AliTrackleter* AliITSReconstructor::CreateMultFinder() 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();
-    }
-
-    clusterer.Digits2Clusters(rawReader);
-         
-    loader->WriteRecPoints("OVERWRITE");
-  }
-
-  loader->UnloadRecPoints();
+  // create the SPD trackeleter for mult. reconstruction
+  AliITSMultReconstructor* multReco = new AliITSMultReconstructor();
+  multReco->SetHistOn(kFALSE);
+  multReco->SetDetTypeRec(fDetTypeRec);
+  return multReco;
+}
 
+//_____________________________________________________________________________
+AliTracker* AliITSReconstructor::CreateTrackleter() const
+{
+// create the SPD trackeleter (for SPD PlaneEfficiency evaluation)
+  if(!GetRecoParam()->GetComputePlaneEff() || !GetRecoParam()->GetUseTrackletsPlaneEff()) return NULL;
+  //Int_t trackerOpt = GetRecoParam()->GetTracker();
+  AliTracker* trackleter;
+  trackleter = new AliITSTrackleterSPDEff();
+  AliITSTrackleterSPDEff *spdtrackleter=(AliITSTrackleterSPDEff*)trackleter;
+  // here set cuts (from RecoParam)
+  if(GetRecoParam()->GetBkgTrackletsPlaneEff()) spdtrackleter->SetReflectClusterAroundZAxisForLayer(1,kTRUE);
+  if(GetRecoParam()->GetMCTrackletsPlaneEff()) spdtrackleter->SetMC();
+  spdtrackleter->SetHistOn();
+  spdtrackleter->SetPhiWindowL2(GetRecoParam()->GetTrackleterPhiWindowL2());
+  spdtrackleter->SetZetaWindowL2(GetRecoParam()->GetTrackleterZetaWindowL2());
+  spdtrackleter->SetPhiWindowL1(GetRecoParam()->GetTrackleterPhiWindowL1());
+  spdtrackleter->SetZetaWindowL1(GetRecoParam()->GetTrackleterZetaWindowL1());
+  if(GetRecoParam()->GetUpdateOncePerEventPlaneEff()) spdtrackleter->SetUpdateOncePerEventPlaneEff();
+  spdtrackleter->SetMinContVtx(GetRecoParam()->GetMinContVtxPlaneEff());
+  return trackleter;
 }
 
 //_____________________________________________________________________________
-AliTracker* AliITSReconstructor::CreateTracker(AliRunLoader* runLoader)const
+AliTracker* AliITSReconstructor::CreateTracker(const
 {
 // create a ITS tracker
 
-  
-  AliITSgeom* geom = GetITSgeom(runLoader);
-  TString selectedTracker = GetOption();
+  Int_t trackerOpt = GetRecoParam()->GetTracker();
   AliTracker* tracker;    
-  if (selectedTracker.Contains("MI")) {
-    tracker = new AliITStrackerMI(geom);
+  if (trackerOpt==1) {
+    tracker = new AliITStrackerMI(0);
+    AliITStrackerMI *mit=(AliITStrackerMI*)tracker;
+    mit->SetDetTypeRec(fDetTypeRec);
+  }  
+  else if (trackerOpt==2) {
+    tracker = new AliITStrackerV2(0);
   }
   else {
-    tracker =  new AliITStrackerSA(geom);  // inherits from AliITStrackerMI
+    tracker =  new AliITStrackerSA(0);  // inherits from AliITStrackerMI
+    AliITStrackerSA *sat=(AliITStrackerSA*)tracker;
+    sat->SetDetTypeRec(fDetTypeRec);
+    if(GetRecoParam()->GetTrackerSAOnly()) sat->SetSAFlag(kTRUE);
+    if(sat->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
+       if(GetRecoParam()->GetInwardFindingSA()){
+       sat->SetInwardFinding();
+       sat->SetInnerStartLayer(GetRecoParam()->GetInnerStartLayerSA());
+       }else{
+      sat->SetOutwardFinding();
+      sat->SetOuterStartLayer(GetRecoParam()->GetOuterStartLayerSA());
+       }
+    sat->SetMinNPoints(GetRecoParam()->GetMinNPointsSA());
   }
 
-  TString selectedPIDmethod = GetOption();
-  AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
-  if (!loader) {
-    Error("CreateTracker", "ITS loader not found");
-  }
-  if(selectedPIDmethod.Contains("LandauFitPID")){
-    loader->AdoptITSpid(new AliITSpidESD2((AliITStrackerMI*)tracker,loader));
-  }
-  else{
-    Double_t parITS[] = {34., 0.15, 10.};
-    loader->AdoptITSpid(new AliITSpidESD1(parITS));
-  }
   return tracker;
   
 }
 
 //_____________________________________________________________________________
-AliVertexer* AliITSReconstructor::CreateVertexer(AliRunLoader* /*runLoader*/) const
+AliVertexer* AliITSReconstructor::CreateVertexer() const
 {
 // create a ITS vertexer
 
-  TString selectedVertexer = GetOption();
-  if(selectedVertexer.Contains("ions") || selectedVertexer.Contains("IONS")){
-    Info("CreateVertexer","a AliITSVertexerIons object has been selected\n");
-    return new AliITSVertexerIons("null");
+  AliITSVertexer *vptr = NULL;
+  Int_t vtxOpt = GetRecoParam()->GetVertexer();
+  if(vtxOpt==3){
+    AliFatal("Option AliITSVertexerIons is no longer supported");
+    return vptr;
   }
-  if(selectedVertexer.Contains("smear") || selectedVertexer.Contains("SMEAR")){
-    Double_t smear[3]={0.005,0.005,0.01};
-    Info("CreateVertexer","a AliITSVertexerFast object has been selected\n"); 
-    return new AliITSVertexerFast(smear);
+  else if(vtxOpt==4){
+    Double_t smear[3]={GetRecoParam()->GetVertexerFastSmearX(),
+                      GetRecoParam()->GetVertexerFastSmearY(),
+                      GetRecoParam()->GetVertexerFastSmearZ()};
+    AliDebug(1,"AliITSVertexerFast has been selected"); 
+    vptr = new AliITSVertexerFast(smear);
   }
-  if(selectedVertexer.Contains("ppz") || selectedVertexer.Contains("PPZ")){
-    Info("CreateVertexer","a AliITSVertexerPPZ object has been selected\n");
-    return new AliITSVertexerPPZ("null");
+  else if(vtxOpt==1){
+    AliDebug(1,"AliITSVertexerZ has been selected");
+    AliITSVertexerZ* vtxrz =  new AliITSVertexerZ();
+    Int_t pileupAlgo=GetRecoParam()->GetSPDVertexerPileupAlgo();
+    if(pileupAlgo==3) vtxrz->SetSearchForPileup(kFALSE);
+    vptr = vtxrz;
   }
-  // by default an AliITSVertexerZ object is instatiated
-  Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
-  return new AliITSVertexerZ("null");
-}
-
-//_____________________________________________________________________________
-void AliITSReconstructor::FillESD(AliRunLoader* runLoader, 
-                                 AliESD* esd) const
-{
-// make PID, find V0s and cascade
-  AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
-  AliITSpidESD *pidESD = 0;
-  TString selectedPIDmethod = GetOption();
-  if(selectedPIDmethod.Contains("LandauFitPID")){
-    Info("FillESD","ITS LandauFitPID option has been selected\n");
-    pidESD=loader->GetITSpid();
+  else if(vtxOpt==2){
+    AliDebug(1,"AliITSVertexerCosmics has been selected");
+    vptr = new AliITSVertexerCosmics();
   }
-  else{
-    Info("FillESD","ITS default PID\n");
-    pidESD=loader->GetITSpid();
+  else if(vtxOpt==5){ 
+    AliDebug(1,"Vertex is fixed in the position of the TDI\n");
+    vptr = new AliITSVertexerFixed("TDI");
+  }
+  else if(vtxOpt==6){ 
+    AliDebug(1,"Vertex is fixed in the position of the TED\n");
+    vptr = new AliITSVertexerFixed("TED");
   }
-  if(pidESD!=0){
-    pidESD->MakePID(esd);
+  else if(vtxOpt==7){
+    AliDebug(1,"VertexerZD:  reconstruction of the Z coordinate with SDD \n");
+    AliITSVertexerZD*vtxrz = new AliITSVertexerZD();
+    vtxrz->SetSearchForPileup(kFALSE);
+    vptr = vtxrz;
   }
   else {
-    Error("FillESD","!! cannot do the PID !!\n");
+  // by default an AliITSVertexer3D object is instatiated
+    AliITSVertexer3D*  vtxr = 
+       new AliITSVertexer3D(GetRecoParam()->GetVertexer3DWideFiducialRegionZ());
+    Float_t dzw=GetRecoParam()->GetVertexer3DWideFiducialRegionZ();
+    Float_t drw=GetRecoParam()->GetVertexer3DWideFiducialRegionR();
+    vtxr->SetWideFiducialRegion(dzw,drw);
+    Float_t dzn=GetRecoParam()->GetVertexer3DNarrowFiducialRegionZ();
+    Float_t drn=GetRecoParam()->GetVertexer3DNarrowFiducialRegionR();
+    vtxr->SetNarrowFiducialRegion(dzn,drn);
+    Float_t dphil=GetRecoParam()->GetVertexer3DLooseDeltaPhiCut();
+    Float_t dphit=GetRecoParam()->GetVertexer3DTightDeltaPhiCut();
+    vtxr->SetDeltaPhiCuts(dphil,dphit);
+    Float_t dcacut=GetRecoParam()->GetVertexer3DDCACut();
+    vtxr->SetDCACut(dcacut);
+    Int_t pileupAlgo=GetRecoParam()->GetSPDVertexerPileupAlgo();
+    vtxr->SetPileupAlgo(pileupAlgo);
+    UChar_t highmultAlgo=GetRecoParam()->GetSPDVertexerHighMultAlgo();
+    vtxr->SetHighMultAlgo(highmultAlgo);
+    AliDebug(1,Form("AliITSVertexer3D with pileup algo %d has been selected",pileupAlgo));
+    vptr = vtxr;
   }
-  // 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);
+  vptr->SetDetTypeRec(fDetTypeRec);
+  return vptr;
 }
 
-
 //_____________________________________________________________________________
-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;
-  }
-  
-  TDirectory * olddir = gDirectory;
-  runLoader->CdGAFile();
-  AliITSgeom* geom = (AliITSgeom*)gDirectory->Get("AliITSgeom");
-  olddir->cd();
-  if(!geom){
-    Error("GetITSgeom","no ITS geometry available");
-    return NULL;
-  }
-  
-  return geom;
+// make PID, find V0s and cascade
+/* Now done in AliESDpid
+  if(fItsPID!=0) fItsPID->MakePID(esd);
+  else AliError("!! cannot do the PID !!");
+*/
 }
-