]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSReconstructor.cxx
Changes reflecting the updated track references
[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"
c0342e67 32#include "AliITStrackerV2.h"
121a60bd 33#include "AliITStrackerSA.h"
34#include "AliITSVertexerIons.h"
35#include "AliITSVertexerFast.h"
3acc14d5 36#include "AliITSVertexer3D.h"
121a60bd 37#include "AliITSVertexerZ.h"
3acc14d5 38#include "AliITSVertexerCosmics.h"
af885e0f 39#include "AliESDEvent.h"
121a60bd 40#include "AliITSpidESD.h"
e62c1aea 41#include "AliITSpidESD1.h"
42#include "AliITSpidESD2.h"
023ae34b 43#include "AliITSInitGeometry.h"
121a60bd 44
44347160 45
121a60bd 46ClassImp(AliITSReconstructor)
47
44347160 48AliITSRecoParam *AliITSReconstructor::fgkRecoParam =0; // reconstruction parameters
49
e62c1aea 50//___________________________________________________________________________
94631b2f 51AliITSReconstructor::AliITSReconstructor() : AliReconstructor(),
52fItsPID(0)
53{
e62c1aea 54 // Default constructor
44347160 55 if (!fgkRecoParam) {
56 AliError("The Reconstruction parameters nonitialized - Used default one");
57 fgkRecoParam = AliITSRecoParam::GetHighFluxParam();
58 }
e62c1aea 59}
60 //___________________________________________________________________________
61AliITSReconstructor::~AliITSReconstructor(){
62// destructor
63 delete fItsPID;
44347160 64 if(fgkRecoParam) delete fgkRecoParam;
e62c1aea 65}
66//______________________________________________________________________
94631b2f 67AliITSReconstructor::AliITSReconstructor(const AliITSReconstructor &ob) :AliReconstructor(ob),
44347160 68 fItsPID(ob.fItsPID)
94631b2f 69{
e62c1aea 70 // Copy constructor
e62c1aea 71}
72
73//______________________________________________________________________
94631b2f 74AliITSReconstructor& AliITSReconstructor::operator=(const AliITSReconstructor& ob ){
e62c1aea 75 // Assignment operator
94631b2f 76 this->~AliITSReconstructor();
77 new(this) AliITSReconstructor(ob);
e62c1aea 78 return *this;
79}
023ae34b 80//______________________________________________________________________
94631b2f 81void AliITSReconstructor::Init(AliRunLoader *runLoader) const{
023ae34b 82 // Initalize this constructor bet getting/creating the objects
83 // nesseary for a proper ITS reconstruction.
84 // Inputs:
85 // AliRunLoader *runLoader Pointer to the run loader to allow
86 // the getting of files/folders data
87 // needed to do reconstruction
88 // Output:
89 // none.
90 // Return:
91 // none.
00a7cc50 92
108bd0fe 93 AliITSInitGeometry initgeom;
94 AliITSgeom *geom = initgeom.CreateAliITSgeom();
95 AliInfo(Form("Geometry name: %s",(initgeom.GetGeometryName()).Data()));
023ae34b 96 AliITSLoader* loader = static_cast<AliITSLoader*>
97 (runLoader->GetLoader("ITSLoader"));
98 if (!loader) {
99 Error("Init", "ITS loader not found");
100 return;
101 }
102 loader->SetITSgeom(geom);
103 return;
104}
121a60bd 105//_____________________________________________________________________________
106void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader) const
107{
108// reconstruct clusters
109
7d62fb64 110
8e50d897 111 AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
121a60bd 112 if (!loader) {
113 Error("Reconstruct", "ITS loader not found");
114 return;
115 }
8e50d897 116 AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
00a7cc50 117 rec->SetDefaults();
118
121a60bd 119 loader->LoadRecPoints("recreate");
120 loader->LoadDigits("read");
121 runLoader->LoadKinematics();
00a7cc50 122 TString option = GetOption();
123 Bool_t clusfinder=kTRUE; // Default: V2 cluster finder
124 if(option.Contains("OrigCF"))clusfinder=kFALSE;
121a60bd 125
121a60bd 126 Int_t nEvents = runLoader->GetNumberOfEvents();
127
128 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
129 runLoader->GetEvent(iEvent);
00a7cc50 130 if(loader->TreeR()==0x0) loader->MakeTree("R");
131 rec->MakeBranch("R");
132 rec->SetTreeAddress();
133 rec->DigitsToRecPoints(iEvent,0,"All",clusfinder);
121a60bd 134 }
135
136 loader->UnloadRecPoints();
137 loader->UnloadDigits();
39bd04c5 138 loader->UnloadRawClusters();
121a60bd 139 runLoader->UnloadKinematics();
39bd04c5 140 delete rec;
121a60bd 141}
142
00a7cc50 143//_________________________________________________________________
144void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader,
145 AliRawReader* rawReader) const
113c12f1 146{
00a7cc50 147// reconstruct clusters
113c12f1 148
00a7cc50 149
8e50d897 150 AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
113c12f1 151 if (!loader) {
152 Error("Reconstruct", "ITS loader not found");
153 return;
154 }
00a7cc50 155
8e50d897 156 AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
00a7cc50 157 rec->SetDefaults();
158 rec->SetDefaultClusterFindersV2(kTRUE);
113c12f1 159
00a7cc50 160 loader->LoadRecPoints("recreate");
113c12f1 161
162 Int_t iEvent = 0;
113c12f1 163
00a7cc50 164 while(rawReader->NextEvent()) {
165 runLoader->GetEvent(iEvent++);
166 if(loader->TreeR()==0x0) loader->MakeTree("R");
167 rec->DigitsToRecPoints(rawReader);
113c12f1 168 }
169
170 loader->UnloadRecPoints();
39bd04c5 171 loader->UnloadRawClusters();
172 delete rec;
113c12f1 173}
174
121a60bd 175//_____________________________________________________________________________
e62c1aea 176AliTracker* AliITSReconstructor::CreateTracker(AliRunLoader* runLoader)const
121a60bd 177{
178// create a ITS tracker
179
7d62fb64 180
e43c066c 181 TString selectedTracker = GetOption();
e62c1aea 182 AliTracker* tracker;
183 if (selectedTracker.Contains("MI")) {
e341247d 184 tracker = new AliITStrackerMI(0);
c0342e67 185 }
186 else if (selectedTracker.Contains("V2")) {
187 tracker = new AliITStrackerV2(0);
e62c1aea 188 }
189 else {
cc088660 190 tracker = new AliITStrackerSA(0); // inherits from AliITStrackerMI
1966f03c 191 AliITStrackerSA *sat=(AliITStrackerSA*)tracker;
192 if(selectedTracker.Contains("onlyITS"))sat->SetSAFlag(kTRUE);
193 if(sat->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
b8ed1a92 194 if(selectedTracker.Contains("cosmics")||selectedTracker.Contains("COSMICS"))
195 sat->SetOuterStartLayer(AliITSgeomTGeo::GetNLayers()-2);
e62c1aea 196 }
7d62fb64 197
e62c1aea 198 TString selectedPIDmethod = GetOption();
199 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
200 if (!loader) {
201 Error("CreateTracker", "ITS loader not found");
202 }
203 if(selectedPIDmethod.Contains("LandauFitPID")){
204 loader->AdoptITSpid(new AliITSpidESD2((AliITStrackerMI*)tracker,loader));
205 }
206 else{
25fee9b6 207 Double_t parITS[] = {0.15, 10.}; //PH positions of the MIP peak
e62c1aea 208 loader->AdoptITSpid(new AliITSpidESD1(parITS));
209 }
210 return tracker;
7d62fb64 211
121a60bd 212}
213
214//_____________________________________________________________________________
215AliVertexer* AliITSReconstructor::CreateVertexer(AliRunLoader* /*runLoader*/) const
216{
217// create a ITS vertexer
218
f4d5a8d1 219 TString selectedVertexer = GetOption();
121a60bd 220 if(selectedVertexer.Contains("ions") || selectedVertexer.Contains("IONS")){
221 Info("CreateVertexer","a AliITSVertexerIons object has been selected\n");
222 return new AliITSVertexerIons("null");
223 }
224 if(selectedVertexer.Contains("smear") || selectedVertexer.Contains("SMEAR")){
225 Double_t smear[3]={0.005,0.005,0.01};
226 Info("CreateVertexer","a AliITSVertexerFast object has been selected\n");
227 return new AliITSVertexerFast(smear);
228 }
3acc14d5 229 if(selectedVertexer.Contains("3d") || selectedVertexer.Contains("3D")){
230 Info("CreateVertexer","a AliITSVertexer3D object has been selected\n");
231 return new AliITSVertexer3D("null");
232 }
233 if(selectedVertexer.Contains("cosmics") || selectedVertexer.Contains("COSMICS")){
234 Info("CreateVertexer","a AliITSVertexerCosmics object has been selected\n");
235 return new AliITSVertexerCosmics();
121a60bd 236 }
237 // by default an AliITSVertexerZ object is instatiated
238 Info("CreateVertexer","a AliITSVertexerZ object has been selected\n");
239 return new AliITSVertexerZ("null");
240}
241
242//_____________________________________________________________________________
e62c1aea 243void AliITSReconstructor::FillESD(AliRunLoader* runLoader,
af885e0f 244 AliESDEvent* esd) const
121a60bd 245{
e62c1aea 246// make PID, find V0s and cascade
247 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
248 AliITSpidESD *pidESD = 0;
249 TString selectedPIDmethod = GetOption();
250 if(selectedPIDmethod.Contains("LandauFitPID")){
149c4c59 251 Info("FillESD","ITS LandauFitPID option has been selected\n");
e62c1aea 252 pidESD=loader->GetITSpid();
253 }
254 else{
149c4c59 255 Info("FillESD","ITS default PID\n");
e62c1aea 256 pidESD=loader->GetITSpid();
257 }
258 if(pidESD!=0){
259 pidESD->MakePID(esd);
260 }
261 else {
262 Error("FillESD","!! cannot do the PID !!\n");
263 }
121a60bd 264}
265
266
267//_____________________________________________________________________________
268AliITSgeom* AliITSReconstructor::GetITSgeom(AliRunLoader* runLoader) const
269{
270// get the ITS geometry
271
272 if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
273 if (!runLoader->GetAliRun()) {
274 Error("GetITSgeom", "couldn't get AliRun object");
275 return NULL;
276 }
8e50d897 277 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
278 AliITSgeom* geom = (AliITSgeom*)loader->GetITSgeom();
7d62fb64 279 if(!geom){
280 Error("GetITSgeom","no ITS geometry available");
121a60bd 281 return NULL;
282 }
7d62fb64 283
284 return geom;
121a60bd 285}