1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // class for ITS reconstruction //
22 ///////////////////////////////////////////////////////////////////////////////
24 #include "Riostream.h"
25 #include "AliITSReconstructor.h"
26 #include "AliRunLoader.h"
27 #include "AliRawReader.h"
28 #include "AliITSclustererV2.h"
29 #include "AliITSLoader.h"
30 #include "AliITStrackerMI.h"
31 #include "AliITStrackerSA.h"
32 #include "AliITSVertexerIons.h"
33 #include "AliITSVertexerFast.h"
34 #include "AliITSVertexerPPZ.h"
35 #include "AliITSVertexerZ.h"
37 #include "AliITSpidESD.h"
38 #include "AliITSpidESD1.h"
39 #include "AliITSpidESD2.h"
40 #include "AliV0vertexer.h"
41 #include "AliCascadeVertexer.h"
43 ClassImp(AliITSReconstructor)
45 //___________________________________________________________________________
46 AliITSReconstructor::AliITSReconstructor() : AliReconstructor(){
47 // Default constructor
50 //___________________________________________________________________________
51 AliITSReconstructor::~AliITSReconstructor(){
55 //______________________________________________________________________
56 AliITSReconstructor::AliITSReconstructor(const AliITSReconstructor &ob) :AliReconstructor(ob) {
58 // Copies are not allowed. The method is protected to avoid misuse.
59 Error("AliITSpidESD2","Copy constructor not allowed\n");
62 //______________________________________________________________________
63 AliITSReconstructor& AliITSReconstructor::operator=(const AliITSReconstructor& /* ob */){
64 // Assignment operator
65 // Assignment is not allowed. The method is protected to avoid misuse.
66 Error("= operator","Assignment operator not allowed\n");
69 //_____________________________________________________________________________
70 void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader) const
72 // reconstruct clusters
75 AliITSLoader *loader = (AliITSLoader *)runLoader->GetLoader("ITSLoader");
77 Error("Reconstruct", "ITS loader not found");
80 loader->LoadRecPoints("recreate");
81 loader->LoadDigits("read");
82 runLoader->LoadKinematics();
84 AliITSgeom* geom = GetITSgeom(runLoader);
86 AliITSclustererV2 clusterer(geom);
87 Int_t nEvents = runLoader->GetNumberOfEvents();
89 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
90 runLoader->GetEvent(iEvent);
91 TTree* treeClusters = loader->TreeR();
93 loader->MakeTree("R");
94 treeClusters = loader->TreeR();
96 TTree* treeDigits = loader->TreeD();
98 Error("Reconstruct", "Can't get digits tree !");
102 clusterer.Digits2Clusters(treeDigits, treeClusters);
104 loader->WriteRecPoints("OVERWRITE");
107 loader->UnloadRecPoints();
108 loader->UnloadDigits();
109 runLoader->UnloadKinematics();
113 //_____________________________________________________________________________
114 void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader,
115 AliRawReader* rawReader) const
117 // reconstruct clusters from raw data
119 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
121 Error("Reconstruct", "ITS loader not found");
124 loader->LoadRecPoints("recreate");
126 AliITSgeom* geom = GetITSgeom(runLoader);
127 AliITSclustererV2 clusterer(geom);
130 while (rawReader->NextEvent()) {
131 runLoader->GetEvent(iEvent++);
133 TTree* treeClusters = loader->TreeR();
135 loader->MakeTree("R");
136 treeClusters = loader->TreeR();
139 clusterer.Digits2Clusters(rawReader);
141 loader->WriteRecPoints("OVERWRITE");
144 loader->UnloadRecPoints();
148 //_____________________________________________________________________________
149 AliTracker* AliITSReconstructor::CreateTracker(AliRunLoader* runLoader)const
151 // create a ITS tracker
154 AliITSgeom* geom = GetITSgeom(runLoader);
155 TString selectedTracker = GetOption();
157 if (selectedTracker.Contains("MI")) {
158 tracker = new AliITStrackerMI(geom);
161 tracker = new AliITStrackerSA(geom); // inherits from AliITStrackerMI
164 TString selectedPIDmethod = GetOption();
165 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
167 Error("CreateTracker", "ITS loader not found");
169 if(selectedPIDmethod.Contains("LandauFitPID")){
170 loader->AdoptITSpid(new AliITSpidESD2((AliITStrackerMI*)tracker,loader));
173 Double_t parITS[] = {34., 0.15, 10.};
174 loader->AdoptITSpid(new AliITSpidESD1(parITS));
180 //_____________________________________________________________________________
181 AliVertexer* AliITSReconstructor::CreateVertexer(AliRunLoader* /*runLoader*/) const
183 // create a ITS vertexer
185 TString selectedVertexer = GetOption();
186 if(selectedVertexer.Contains("ions") || selectedVertexer.Contains("IONS")){
187 Info("CreateVertexer","a AliITSVertexerIons object has been selected\n");
188 return new AliITSVertexerIons("null");
190 if(selectedVertexer.Contains("smear") || selectedVertexer.Contains("SMEAR")){
191 Double_t smear[3]={0.005,0.005,0.01};
192 Info("CreateVertexer","a AliITSVertexerFast object has been selected\n");
193 return new AliITSVertexerFast(smear);
195 if(selectedVertexer.Contains("ppz") || selectedVertexer.Contains("PPZ")){
196 Info("CreateVertexer","a AliITSVertexerPPZ object has been selected\n");
197 return new AliITSVertexerPPZ("null");
199 // by default an AliITSVertexerZ object is instatiated
200 Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
201 return new AliITSVertexerZ("null");
204 //_____________________________________________________________________________
205 void AliITSReconstructor::FillESD(AliRunLoader* runLoader,
208 // make PID, find V0s and cascade
209 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
210 AliITSpidESD *pidESD = 0;
211 TString selectedPIDmethod = GetOption();
212 if(selectedPIDmethod.Contains("LandauFitPID")){
213 pidESD=loader->GetITSpid();
216 pidESD=loader->GetITSpid();
219 pidESD->MakePID(esd);
222 Error("FillESD","!! cannot do the PID !!\n");
225 Double_t cuts[]={33, // max. allowed chi2
226 0.16,// min. allowed negative daughter's impact parameter
227 0.05,// min. allowed positive daughter's impact parameter
228 0.08,// max. allowed DCA between the daughter tracks
229 0.99,// max. allowed cosine of V0's pointing angle
230 0.9, // min. radius of the fiducial volume
231 2.9 // max. radius of the fiducial volume
233 AliV0vertexer vtxer(cuts);
234 Double_t vtx[3], cvtx[6];
235 esd->GetVertex()->GetXYZ(vtx);
236 esd->GetVertex()->GetSigmaXYZ(cvtx);
237 vtxer.SetVertex(vtx);
238 vtxer.Tracks2V0vertices(esd);
241 Double_t cts[]={33., // max. allowed chi2
242 0.05, // min. allowed V0 impact parameter
243 0.008, // window around the Lambda mass
244 0.035, // min. allowed bachelor's impact parameter
245 0.10, // max. allowed DCA between a V0 and a track
246 0.9985, //max. allowed cosine of the cascade pointing angle
247 0.9, // min. radius of the fiducial volume
248 2.9 // max. radius of the fiducial volume
250 AliCascadeVertexer cvtxer=AliCascadeVertexer(cts);
251 cvtxer.SetVertex(vtx);
252 cvtxer.V0sTracks2CascadeVertices(esd);
256 //_____________________________________________________________________________
257 AliITSgeom* AliITSReconstructor::GetITSgeom(AliRunLoader* runLoader) const
259 // get the ITS geometry
261 if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
262 if (!runLoader->GetAliRun()) {
263 Error("GetITSgeom", "couldn't get AliRun object");
267 TDirectory * olddir = gDirectory;
268 runLoader->CdGAFile();
269 AliITSgeom* geom = (AliITSgeom*)gDirectory->Get("AliITSgeom");
272 Error("GetITSgeom","no ITS geometry available");