]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITS.cxx
Improved cuts for the reconstruction of V0s (M.Ivanov)
[u/mrichter/AliRoot.git] / ITS / AliITS.cxx
index 7f1009c52d3c5a602ccc4a998752c5a5a40b8819..3d3727de843f68ee7e205ea491e29e03abfc6f92 100644 (file)
@@ -92,7 +92,9 @@ the AliITS class.
 #include "AliITSRawClusterSDD.h"
 #include "AliITSRawClusterSSD.h"
 #include "AliITSRecPoint.h"
-#include "AliITSdigit.h"
+#include "AliITSdigitSPD.h"
+#include "AliITSdigitSDD.h"
+#include "AliITSdigitSSD.h"
 #include "AliITSgeom.h"
 #include "AliITShit.h"
 #include "AliITSmodule.h"
@@ -108,6 +110,18 @@ the AliITS class.
 #include "AliITSsimulationSSD.h"
 #include "AliMC.h"
 #include "AliITSDigitizer.h"
+#include "AliITSclustererV2.h"
+#include "AliITStrackerV2.h"
+#include "AliITStrackerSA.h"
+#include "AliITSpidESD.h"
+#include "AliV0vertexer.h"
+#include "AliITSVertexerPPZ.h"
+#include "AliITSVertexerFast.h"
+#include "AliITSVertexerZ.h"
+#include "AliITSVertexerIons.h"
+#include "AliCascadeVertexer.h"
+#include "AliESD.h"
+#include "AliRun.h"
 
 ClassImp(AliITS)
 
@@ -155,6 +169,7 @@ AliITS::AliITS() : AliDetector() {
     fNRecPoints = 0;
 
     SetMarkerColor(kRed);
+    SelectVertexer(" ");
 }
 //______________________________________________________________________
 AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
@@ -179,7 +194,7 @@ AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
 
     fIshunt     = 0;  // not zeroed in AliDetector
     fHits       = new TClonesArray("AliITShit", 1560);//not done in AliDetector
-    gAlice->GetMCApp()->AddHitList(fHits);  // Not done in AliDetector.
+    if(gAlice->GetMCApp()) gAlice->GetMCApp()->AddHitList(fHits);// Not done in AliDetector.
 
     fEuclidOut  = 0;
     fITSgeom    = 0;
@@ -213,7 +228,7 @@ AliITS::AliITS(const char *name, const char *title):AliDetector(name,title){
     } // end for i
 
     SetMarkerColor(kRed);
-
+    SelectVertexer(" ");
 }
 //______________________________________________________________________
 AliITS::~AliITS(){
@@ -345,7 +360,7 @@ void AliITS::Init(){
 
     SetDefaults();
     // Array of TStrings
-    for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
+    if(gMC) for(i=0;i<fIdN;i++) fIdSens[i] = gMC->VolId(fIdName[i]);
 }
 //______________________________________________________________________
 void AliITS::SetDefaults(){
@@ -722,7 +737,7 @@ void AliITS::InitModules(Int_t size,Int_t &nmodules){
 }
 //______________________________________________________________________
 void AliITS::FillModules(Int_t evnt,Int_t bgrev,Int_t nmodules,
-                         Option_t *option,Text_t *filename){
+                         Option_t *option, const char *filename){
     // fill the modules with the sorted by module hits; add hits from
     // background if option=Add.
     // Inputs:
@@ -983,7 +998,7 @@ void AliITS::Hits2PreDigits(){
     HitsToPreDigits(header->GetEvent(),0,-1," ",fOpt," ");
 }
 //______________________________________________________________________
-AliDigitizer* AliITS::CreateDigitizer(AliRunDigitizer* manager)
+AliDigitizer* AliITS::CreateDigitizer(AliRunDigitizer* manager) const
 {
   return new AliITSDigitizer(manager);
 }
@@ -1079,7 +1094,7 @@ void AliITS::Hits2Digits(){
 }
 //______________________________________________________________________
 void AliITS::HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size,
-                          Option_t *option, Option_t *opt,Text_t *filename){
+                          Option_t *option, Option_t *opt, const char *filename){
     // keep galice.root for signal and name differently the file for 
     // background when add! otherwise the track info for signal will be lost !
     // the condition below will disappear when the geom class will be
@@ -1104,7 +1119,7 @@ void AliITS::HitsToSDigits(Int_t evNumber,Int_t bgrev,Int_t size,
 }
 //______________________________________________________________________
 void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
-                          Option_t *option, Option_t *opt,Text_t *filename){
+                          Option_t *option, Option_t *opt, const char *filename){
     //   Keep galice.root for signal and name differently the file for 
     // background when add! otherwise the track info for signal will be lost !
     // the condition below will disappear when the geom class will be
@@ -1168,7 +1183,7 @@ void AliITS::HitsToPreDigits(Int_t evNumber,Int_t bgrev,Int_t size,
 }
 //______________________________________________________________________
 void AliITS::HitsToDigits(Int_t evNumber,Int_t bgrev,Int_t size,
-                          Option_t *option, Option_t *opt,Text_t *filename){
+                          Option_t *option, Option_t *opt, const char *filename){
     //   Keep galice.root for signal and name differently the file for 
     // background when add! otherwise the track info for signal will be lost !
     // the condition below will disappear when the geom class will be
@@ -1324,38 +1339,40 @@ void AliITS::AddSimDigit(Int_t id, AliITSdigit *d){
 //______________________________________________________________________
 void AliITS::AddSimDigit(Int_t id,Float_t phys,Int_t *digits,Int_t *tracks,
                          Int_t *hits,Float_t *charges){
-    //   Add a simulated digit to the list.
-    // Inputs:
-    //      Int_t id        Detector type number.
-    //      Float_t phys    Physics indicator. See AliITSdigits.h
-    //      Int_t *digits   Integer array containing the digits info. See 
-    //                      AliITSdigit.h
-    //      Int_t *tracks   Integer array [AliITSdigitS?D::GetNTracks()] 
-    //                      containing the track numbers that contributed to
-    //                      this digit.
-    //      Int_t *hits     Integer array [AliITSdigitS?D::GetNTracks()]
-    //                      containing the hit numbers, from AliITSmodule, that
-    //                      contributed to this digit.
-    //      Float_t *charge Floating point array of the signals contributed
-    //                      to this digit by each track.
-    // Outputs:
-    //      none.
-    // Return:
-    //      none.
+  //   Add a simulated digit to the list.
+  // Inputs:
+  //      Int_t id        Detector type number.
+  //      Float_t phys    Physics indicator. See AliITSdigits.h
+  //      Int_t *digits   Integer array containing the digits info. See 
+  //                      AliITSdigit.h
+  //      Int_t *tracks   Integer array [AliITSdigitS?D::GetNTracks()] 
+  //                      containing the track numbers that contributed to
+  //                      this digit.
+  //      Int_t *hits     Integer array [AliITSdigitS?D::GetNTracks()]
+  //                      containing the hit numbers, from AliITSmodule, that
+  //                      contributed to this digit.
+  //      Float_t *charge Floating point array of the signals contributed
+  //                      to this digit by each track.
+  // Outputs:
+  //      none.
+  // Return:
+  //      none.
 
-    TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
-    switch(id){
-    case 0:
-        new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
-        break;
-    case 1:
-        new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,
-                                                   hits,charges);
-        break;
-    case 2:
-        new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
-        break;
-    } // end switch id
+  TClonesArray &ldigits = *((TClonesArray*)fDtype->At(id));
+  AliITSresponseSDD *resp = 0;
+  switch(id){
+  case 0:
+    new(ldigits[fNdtype[id]++]) AliITSdigitSPD(digits,tracks,hits);
+    break;
+  case 1:
+    resp = (AliITSresponseSDD*)DetType(1)->GetResponseModel();
+    new(ldigits[fNdtype[id]++]) AliITSdigitSDD(phys,digits,tracks,
+                                              hits,charges,resp);
+    break;
+  case 2:
+    new(ldigits[fNdtype[id]++]) AliITSdigitSSD(digits,tracks,hits);
+    break;
+  } // end switch id
 }
 //______________________________________________________________________
 void AliITS::MakeTreeC(Option_t *option){
@@ -1595,7 +1612,7 @@ void AliITS::AddRecPoint(const AliITSRecPoint &r){
 }
 //______________________________________________________________________
 void AliITS::HitsToFastRecPoints(Int_t evNumber,Int_t bgrev,Int_t size,
-                                  Option_t *opt0,Option_t *opt1,Text_t *flnm){
+                                  Option_t *opt0,Option_t *opt1, const char *flnm){
     // keep galice.root for signal and name differently the file for 
     // background when add! otherwise the track info for signal will be lost !
     // the condition below will disappear when the geom class will be
@@ -1761,3 +1778,109 @@ AliLoader* AliITS::MakeLoader(const char* topfoldername)
 }
 
 
+//_____________________________________________________________________________
+void AliITS::Reconstruct() const
+{
+// reconstruct clusters
+
+  AliLoader* loader = GetLoader();
+  loader->LoadRecPoints("recreate");
+  loader->LoadDigits("read");
+
+  AliITSclustererV2 clusterer(GetITSgeom());
+  AliRunLoader* runLoader = loader->GetRunLoader();
+  Int_t nEvents = runLoader->GetNumberOfEvents();
+  runLoader->LoadKinematics();
+
+  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();
+}
+
+//_____________________________________________________________________________
+AliTracker* AliITS::CreateTracker() const
+{
+// create an ITS tracker
+
+  return new AliITStrackerSA(GetITSgeom());
+}
+//_____________________________________________________________________________
+AliVertexer* AliITS::CreateVertexer() const
+{
+  // create a ITS vertexer
+
+  if(fSelectedVertexer.Contains("ions") || fSelectedVertexer.Contains("IONS")){
+    Info("CreateVertexer","a AliITSVertexerIons object has been selected\n");
+    return new AliITSVertexerIons("null");
+  }
+  if(fSelectedVertexer.Contains("smear") || fSelectedVertexer.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);
+  }
+  if(fSelectedVertexer.Contains("ppz") || fSelectedVertexer.Contains("PPZ")){
+    Info("CreateVertexer","a AliITSVertexerPPZ object has been selected\n");
+    return new AliITSVertexerPPZ("null");
+  }
+  // by default an AliITSVertexerZ object is instatiated
+  Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
+  return new AliITSVertexerZ("null");
+}
+
+//_____________________________________________________________________________
+void AliITS::FillESD(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.080,// max. allowed DCA between the daughter tracks
+                  0.998,// 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.V0sTracks2CascadeVertices(esd);
+}
+