]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - ITS/AliITSReconstructor.cxx
Fixing Effective C++ warnings
[u/mrichter/AliRoot.git] / ITS / AliITSReconstructor.cxx
... / ...
CommitLineData
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
24#include "Riostream.h"
25#include "AliITSReconstructor.h"
26#include "AliRun.h"
27#include "AliRunLoader.h"
28#include "AliRawReader.h"
29#include "AliITSDetTypeRec.h"
30#include "AliITSLoader.h"
31#include "AliITStrackerMI.h"
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"
39#include "AliITSpidESD1.h"
40#include "AliITSpidESD2.h"
41#include "AliITSInitGeometry.h"
42
43ClassImp(AliITSReconstructor)
44
45//___________________________________________________________________________
46AliITSReconstructor::AliITSReconstructor() : AliReconstructor(),
47fItsPID(0)
48{
49 // Default constructor
50}
51 //___________________________________________________________________________
52AliITSReconstructor::~AliITSReconstructor(){
53// destructor
54 delete fItsPID;
55}
56//______________________________________________________________________
57AliITSReconstructor::AliITSReconstructor(const AliITSReconstructor &ob) :AliReconstructor(ob),
58fItsPID(ob.fItsPID)
59{
60 // Copy constructor
61}
62
63//______________________________________________________________________
64AliITSReconstructor& AliITSReconstructor::operator=(const AliITSReconstructor& ob ){
65 // Assignment operator
66 this->~AliITSReconstructor();
67 new(this) AliITSReconstructor(ob);
68 return *this;
69}
70//______________________________________________________________________
71void AliITSReconstructor::Init(AliRunLoader *runLoader) const{
72 // Initalize this constructor bet getting/creating the objects
73 // nesseary for a proper ITS reconstruction.
74 // Inputs:
75 // AliRunLoader *runLoader Pointer to the run loader to allow
76 // the getting of files/folders data
77 // needed to do reconstruction
78 // Output:
79 // none.
80 // Return:
81 // none.
82
83 AliITSInitGeometry initgeom;
84 AliITSgeom *geom = initgeom.CreateAliITSgeom();
85 AliInfo(Form("Geometry name: %s",(initgeom.GetGeometryName()).Data()));
86 AliITSLoader* loader = static_cast<AliITSLoader*>
87 (runLoader->GetLoader("ITSLoader"));
88 if (!loader) {
89 Error("Init", "ITS loader not found");
90 return;
91 }
92 loader->SetITSgeom(geom);
93 return;
94}
95//_____________________________________________________________________________
96void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader) const
97{
98// reconstruct clusters
99
100
101 AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
102 if (!loader) {
103 Error("Reconstruct", "ITS loader not found");
104 return;
105 }
106 AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
107 rec->SetDefaults();
108
109 loader->LoadRecPoints("recreate");
110 loader->LoadDigits("read");
111 runLoader->LoadKinematics();
112 TString option = GetOption();
113 Bool_t clusfinder=kTRUE; // Default: V2 cluster finder
114 if(option.Contains("OrigCF"))clusfinder=kFALSE;
115
116 Int_t nEvents = runLoader->GetNumberOfEvents();
117
118 for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
119 runLoader->GetEvent(iEvent);
120 if(loader->TreeR()==0x0) loader->MakeTree("R");
121 rec->MakeBranch("R");
122 rec->SetTreeAddress();
123 rec->DigitsToRecPoints(iEvent,0,"All",clusfinder);
124 }
125
126 loader->UnloadRecPoints();
127 loader->UnloadDigits();
128 runLoader->UnloadKinematics();
129}
130
131//_________________________________________________________________
132void AliITSReconstructor::Reconstruct(AliRunLoader* runLoader,
133 AliRawReader* rawReader) const
134{
135// reconstruct clusters
136
137
138 AliITSLoader* loader = static_cast<AliITSLoader*>(runLoader->GetLoader("ITSLoader"));
139 if (!loader) {
140 Error("Reconstruct", "ITS loader not found");
141 return;
142 }
143
144 AliITSDetTypeRec* rec = new AliITSDetTypeRec(loader);
145 rec->SetDefaults();
146 rec->SetDefaultClusterFindersV2(kTRUE);
147
148 loader->LoadRecPoints("recreate");
149
150 Int_t iEvent = 0;
151
152 while(rawReader->NextEvent()) {
153 runLoader->GetEvent(iEvent++);
154 if(loader->TreeR()==0x0) loader->MakeTree("R");
155 rec->DigitsToRecPoints(rawReader);
156 }
157
158 loader->UnloadRecPoints();
159}
160
161//_____________________________________________________________________________
162AliTracker* AliITSReconstructor::CreateTracker(AliRunLoader* runLoader)const
163{
164// create a ITS tracker
165
166
167 TString selectedTracker = GetOption();
168 AliTracker* tracker;
169 if (selectedTracker.Contains("MI")) {
170 tracker = new AliITStrackerMI(0);
171 }
172 else {
173 tracker = new AliITStrackerSA(0); // inherits from AliITStrackerMI
174 AliITStrackerSA *sat=(AliITStrackerSA*)tracker;
175 if(selectedTracker.Contains("onlyITS"))sat->SetSAFlag(kTRUE);
176 if(sat->GetSAFlag())AliDebug(1,"Tracking Performed in ITS only\n");
177 }
178
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;
192
193}
194
195//_____________________________________________________________________________
196AliVertexer* AliITSReconstructor::CreateVertexer(AliRunLoader* /*runLoader*/) const
197{
198// create a ITS vertexer
199
200 TString selectedVertexer = GetOption();
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//_____________________________________________________________________________
220void AliITSReconstructor::FillESD(AliRunLoader* runLoader,
221 AliESD* esd) const
222{
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")){
228 Info("FillESD","ITS LandauFitPID option has been selected\n");
229 pidESD=loader->GetITSpid();
230 }
231 else{
232 Info("FillESD","ITS default PID\n");
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 }
241}
242
243
244//_____________________________________________________________________________
245AliITSgeom* AliITSReconstructor::GetITSgeom(AliRunLoader* runLoader) const
246{
247// get the ITS geometry
248
249 if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
250 if (!runLoader->GetAliRun()) {
251 Error("GetITSgeom", "couldn't get AliRun object");
252 return NULL;
253 }
254 AliITSLoader *loader = (AliITSLoader*)runLoader->GetLoader("ITSLoader");
255 AliITSgeom* geom = (AliITSgeom*)loader->GetITSgeom();
256 if(!geom){
257 Error("GetITSgeom","no ITS geometry available");
258 return NULL;
259 }
260
261 return geom;
262}