Added MuonRec.SetLoadAlignData("MUON") to get rid off warnings from
[u/mrichter/AliRoot.git] / ITS / AliITSReconstructor.cxx
CommitLineData
121a60bd 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id$ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// class for ITS reconstruction //
21// //
22///////////////////////////////////////////////////////////////////////////////
23
e62c1aea 24#include "Riostream.h"
121a60bd 25#include "AliITSReconstructor.h"
00a7cc50 26#include "AliRun.h"
121a60bd 27#include "AliRunLoader.h"
113c12f1 28#include "AliRawReader.h"
00a7cc50 29#include "AliITSDetTypeRec.h"
7d62fb64 30#include "AliITSLoader.h"
e43c066c 31#include "AliITStrackerMI.h"
121a60bd 32#include "AliITStrackerSA.h"
33#include "AliITSVertexerIons.h"
34#include "AliITSVertexerFast.h"
35#include "AliITSVertexerPPZ.h"
36#include "AliITSVertexerZ.h"
37#include "AliESD.h"
38#include "AliITSpidESD.h"
e62c1aea 39#include "AliITSpidESD1.h"
40#include "AliITSpidESD2.h"
121a60bd 41#include "AliV0vertexer.h"
42#include "AliCascadeVertexer.h"
023ae34b 43#include "AliITSInitGeometry.h"
121a60bd 44
45ClassImp(AliITSReconstructor)
46
e62c1aea 47//___________________________________________________________________________
48AliITSReconstructor::AliITSReconstructor() : AliReconstructor(){
49 // Default constructor
50 fItsPID=0;
51}
52 //___________________________________________________________________________
53AliITSReconstructor::~AliITSReconstructor(){
54// destructor
55 delete fItsPID;
56}
57//______________________________________________________________________
58AliITSReconstructor::AliITSReconstructor(const AliITSReconstructor &ob) :AliReconstructor(ob) {
59 // Copy constructor
60 // Copies are not allowed. The method is protected to avoid misuse.
61 Error("AliITSpidESD2","Copy constructor not allowed\n");
62}
63
64//______________________________________________________________________
65AliITSReconstructor& AliITSReconstructor::operator=(const AliITSReconstructor& /* ob */){
66 // Assignment operator
67 // Assignment is not allowed. The method is protected to avoid misuse.
68 Error("= operator","Assignment operator not allowed\n");
69 return *this;
70}
023ae34b 71//______________________________________________________________________
72void AliITSReconstructor::Init(AliRunLoader *runLoader){
73 // Initalize this constructor bet getting/creating the objects
74 // nesseary for a proper ITS reconstruction.
75 // Inputs:
76 // AliRunLoader *runLoader Pointer to the run loader to allow
77 // the getting of files/folders data
78 // needed to do reconstruction
79 // Output:
80 // none.
81 // Return:
82 // none.
00a7cc50 83
023ae34b 84 AliITSInitGeometry *initgeom = new AliITSInitGeometry("AliITSvPPRasymmFMD",
85 2);
86 AliITSgeom *geom = initgeom->CreateAliITSgeom();
87 delete initgeom; // once created, do not need initgeom any more.
88 AliITSLoader* loader = static_cast<AliITSLoader*>
89 (runLoader->GetLoader("ITSLoader"));
90 if (!loader) {
91 Error("Init", "ITS loader not found");
92 return;
93 }
94 loader->SetITSgeom(geom);
95 return;
96}
121a60bd 97//_____________________________________________________________________________
98void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader) const
99{
100// reconstruct clusters
101
7d62fb64 102
8e50d897 103 AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
121a60bd 104 if (!loader) {
105 Error("Reconstruct", "ITS loader not found");
106 return;
107 }
8e50d897 108 AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
00a7cc50 109 rec->SetDefaults();
110
121a60bd 111 loader->LoadRecPoints("recreate");
112 loader->LoadDigits("read");
113 runLoader->LoadKinematics();
00a7cc50 114 TString option = GetOption();
115 Bool_t clusfinder=kTRUE; // Default: V2 cluster finder
116 if(option.Contains("OrigCF"))clusfinder=kFALSE;
121a60bd 117
121a60bd 118 Int_t nEvents = runLoader->GetNumberOfEvents();
119
120 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
121 runLoader->GetEvent(iEvent);
00a7cc50 122 if(loader->TreeR()==0x0) loader->MakeTree("R");
123 rec->MakeBranch("R");
124 rec->SetTreeAddress();
125 rec->DigitsToRecPoints(iEvent,0,"All",clusfinder);
121a60bd 126 }
127
128 loader->UnloadRecPoints();
129 loader->UnloadDigits();
130 runLoader->UnloadKinematics();
131}
132
00a7cc50 133//_________________________________________________________________
134void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader,
135 AliRawReader* rawReader) const
113c12f1 136{
00a7cc50 137// reconstruct clusters
113c12f1 138
00a7cc50 139
8e50d897 140 AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
113c12f1 141 if (!loader) {
142 Error("Reconstruct", "ITS loader not found");
143 return;
144 }
00a7cc50 145
8e50d897 146 AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
00a7cc50 147 rec->SetDefaults();
148 rec->SetDefaultClusterFindersV2(kTRUE);
113c12f1 149
00a7cc50 150 loader->LoadRecPoints("recreate");
113c12f1 151
152 Int_t iEvent = 0;
113c12f1 153
00a7cc50 154 while(rawReader->NextEvent()) {
155 runLoader->GetEvent(iEvent++);
156 if(loader->TreeR()==0x0) loader->MakeTree("R");
157 rec->DigitsToRecPoints(rawReader);
113c12f1 158 }
159
160 loader->UnloadRecPoints();
161}
162
121a60bd 163//_____________________________________________________________________________
e62c1aea 164AliTracker* AliITSReconstructor::CreateTracker(AliRunLoader* runLoader)const
121a60bd 165{
166// create a ITS tracker
167
7d62fb64 168
121a60bd 169 AliITSgeom* geom = GetITSgeom(runLoader);
e43c066c 170 TString selectedTracker = GetOption();
e62c1aea 171 AliTracker* tracker;
172 if (selectedTracker.Contains("MI")) {
173 tracker = new AliITStrackerMI(geom);
174 }
175 else {
176 tracker = new AliITStrackerSA(geom); // inherits from AliITStrackerMI
177 }
7d62fb64 178
e62c1aea 179 TString selectedPIDmethod = GetOption();
180 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
181 if (!loader) {
182 Error("CreateTracker", "ITS loader not found");
183 }
184 if(selectedPIDmethod.Contains("LandauFitPID")){
185 loader->AdoptITSpid(new AliITSpidESD2((AliITStrackerMI*)tracker,loader));
186 }
187 else{
188 Double_t parITS[] = {34., 0.15, 10.};
189 loader->AdoptITSpid(new AliITSpidESD1(parITS));
190 }
191 return tracker;
7d62fb64 192
121a60bd 193}
194
195//_____________________________________________________________________________
196AliVertexer* AliITSReconstructor::CreateVertexer(AliRunLoader* /*runLoader*/) const
197{
198// create a ITS vertexer
199
f4d5a8d1 200 TString selectedVertexer = GetOption();
121a60bd 201 if(selectedVertexer.Contains("ions") || selectedVertexer.Contains("IONS")){
202 Info("CreateVertexer","a AliITSVertexerIons object has been selected\n");
203 return new AliITSVertexerIons("null");
204 }
205 if(selectedVertexer.Contains("smear") || selectedVertexer.Contains("SMEAR")){
206 Double_t smear[3]={0.005,0.005,0.01};
207 Info("CreateVertexer","a AliITSVertexerFast object has been selected\n");
208 return new AliITSVertexerFast(smear);
209 }
210 if(selectedVertexer.Contains("ppz") || selectedVertexer.Contains("PPZ")){
211 Info("CreateVertexer","a AliITSVertexerPPZ object has been selected\n");
212 return new AliITSVertexerPPZ("null");
213 }
214 // by default an AliITSVertexerZ object is instatiated
215 Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
216 return new AliITSVertexerZ("null");
217}
218
219//_____________________________________________________________________________
e62c1aea 220void AliITSReconstructor::FillESD(AliRunLoader* runLoader,
121a60bd 221 AliESD* esd) const
222{
e62c1aea 223// make PID, find V0s and cascade
224 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
225 AliITSpidESD *pidESD = 0;
226 TString selectedPIDmethod = GetOption();
227 if(selectedPIDmethod.Contains("LandauFitPID")){
149c4c59 228 Info("FillESD","ITS LandauFitPID option has been selected\n");
e62c1aea 229 pidESD=loader->GetITSpid();
230 }
231 else{
149c4c59 232 Info("FillESD","ITS default PID\n");
e62c1aea 233 pidESD=loader->GetITSpid();
234 }
235 if(pidESD!=0){
236 pidESD->MakePID(esd);
237 }
238 else {
239 Error("FillESD","!! cannot do the PID !!\n");
240 }
121a60bd 241 // V0 finding
242 Double_t cuts[]={33, // max. allowed chi2
243 0.16,// min. allowed negative daughter's impact parameter
244 0.05,// min. allowed positive daughter's impact parameter
245 0.08,// max. allowed DCA between the daughter tracks
246 0.99,// max. allowed cosine of V0's pointing angle
247 0.9, // min. radius of the fiducial volume
248 2.9 // max. radius of the fiducial volume
249 };
250 AliV0vertexer vtxer(cuts);
251 Double_t vtx[3], cvtx[6];
252 esd->GetVertex()->GetXYZ(vtx);
253 esd->GetVertex()->GetSigmaXYZ(cvtx);
254 vtxer.SetVertex(vtx);
255 vtxer.Tracks2V0vertices(esd);
256
257 // cascade finding
258 Double_t cts[]={33., // max. allowed chi2
259 0.05, // min. allowed V0 impact parameter
260 0.008, // window around the Lambda mass
261 0.035, // min. allowed bachelor's impact parameter
262 0.10, // max. allowed DCA between a V0 and a track
263 0.9985, //max. allowed cosine of the cascade pointing angle
264 0.9, // min. radius of the fiducial volume
265 2.9 // max. radius of the fiducial volume
266 };
267 AliCascadeVertexer cvtxer=AliCascadeVertexer(cts);
268 cvtxer.SetVertex(vtx);
269 cvtxer.V0sTracks2CascadeVertices(esd);
270}
271
272
273//_____________________________________________________________________________
274AliITSgeom* AliITSReconstructor::GetITSgeom(AliRunLoader* runLoader) const
275{
276// get the ITS geometry
277
278 if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
279 if (!runLoader->GetAliRun()) {
280 Error("GetITSgeom", "couldn't get AliRun object");
281 return NULL;
282 }
8e50d897 283 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
284 AliITSgeom* geom = (AliITSgeom*)loader->GetITSgeom();
7d62fb64 285 if(!geom){
286 Error("GetITSgeom","no ITS geometry available");
121a60bd 287 return NULL;
288 }
7d62fb64 289
290 return geom;
121a60bd 291}