]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSreconstruction.cxx
Dependencies on MC truth in reconstruction limited to rec. of MC data for comparison...
[u/mrichter/AliRoot.git] / ITS / AliITSreconstruction.cxx
CommitLineData
e69020a0 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
88cb7938 16/* $Id$ */
8ace09b6 17/////////////////////////////////////////////////////////////////////////
18// //
7d62fb64 19// Class for ITS RecPoint reconstruction //
8ace09b6 20// //
21////////////////////////////////////////////////////////////////////////
b9d0a01d 22
e69020a0 23#include <TString.h>
e69020a0 24#include "AliRun.h"
88cb7938 25#include "AliRunLoader.h"
7d62fb64 26#include "AliITSDetTypeRec.h"
88cb7938 27#include "AliITSLoader.h"
e69020a0 28#include "AliITSreconstruction.h"
e69020a0 29#include "AliITSgeom.h"
30
7d62fb64 31
e69020a0 32ClassImp(AliITSreconstruction)
33
34//______________________________________________________________________
88cb7938 35AliITSreconstruction::AliITSreconstruction():
36 fInit(kFALSE),
37 fEnt(0),
38 fEnt0(0),
8221b41b 39 fDetTypeRec(0x0),
88cb7938 40 fDfArp(kFALSE),
8221b41b 41 fITSgeom(0x0),
88cb7938 42 fLoader(0x0),
43 fRunLoader(0x0)
44{
e69020a0 45 // Default constructor.
46 // Inputs:
47 // none.
48 // Outputs:
49 // none.
50 // Return:
51 // A zero-ed constructed AliITSreconstruction class.
e69020a0 52 fDet[0] = fDet[1] = fDet[2] = kTRUE;
4d24e763 53}
54//______________________________________________________________________
4d24e763 55
88cb7938 56AliITSreconstruction::AliITSreconstruction(AliRunLoader *rl):
57 fInit(kFALSE),
58 fEnt(0),
59 fEnt0(0),
8221b41b 60 fDetTypeRec(0x0),
88cb7938 61 fDfArp(kFALSE),
8221b41b 62 fITSgeom(0x0),
88cb7938 63 fLoader(0x0),
64 fRunLoader(rl)
65{
66 fDet[0] = fDet[1] = fDet[2] = kTRUE;
e69020a0 67}
68//______________________________________________________________________
88cb7938 69AliITSreconstruction::AliITSreconstruction(const char* filename):
70 fInit(kFALSE),
71 fEnt(0),
72 fEnt0(0),
8221b41b 73 fDetTypeRec(0x0),
88cb7938 74 fDfArp(kFALSE),
8221b41b 75 fITSgeom(0x0),
88cb7938 76 fLoader(0x0),
77 fRunLoader(0x0)
78{
e69020a0 79 // Standard constructor.
80 // Inputs:
81 // const char* filename filename containing the digits to be
3e9ba728 82 // reconstructed. If filename = 0 (nil)
83 // then no file is opened but a file is
84 // assumed to already be opened. This
85 // already opened file will be used.
e69020a0 86 // Outputs:
87 // none.
88 // Return:
89 // A standardly constructed AliITSreconstruction class.
90
88cb7938 91 fDet[0] = fDet[1] = fDet[2] = kTRUE;
92
93 fRunLoader = AliRunLoader::Open(filename);
94 if (fRunLoader == 0x0)
95 {
96 Error("AliITSreconstruction","Can not load the session",filename);
97 return;
98 }
88cb7938 99
e69020a0 100}
8221b41b 101
7d62fb64 102//______________________________________________________________________
8221b41b 103AliITSreconstruction::AliITSreconstruction(const AliITSreconstruction &rec):TTask(rec),
104fInit(rec.fInit),
105fEnt(rec.fEnt),
106fEnt0(rec.fEnt0),
107fDetTypeRec(rec.fDetTypeRec),
108fDfArp(rec.fDfArp),
109fITSgeom(rec.fITSgeom),
110fLoader(rec.fLoader),
111fRunLoader(rec.fRunLoader)
112{
7d62fb64 113 // Copy constructor.
114
7d62fb64 115
116}
8221b41b 117
7d62fb64 118//______________________________________________________________________
8221b41b 119AliITSreconstruction& AliITSreconstruction::operator=(const AliITSreconstruction& source){
120 // Assignment operator.
121 this->~AliITSreconstruction();
122 new(this) AliITSreconstruction(source);
123 return *this;
124
7d62fb64 125}
126
e69020a0 127//______________________________________________________________________
128AliITSreconstruction::~AliITSreconstruction(){
e69020a0 129 // A destroyed AliITSreconstruction class.
7d62fb64 130
131 //fITS = 0;
88cb7938 132 delete fRunLoader;
7d62fb64 133
e69020a0 134}
135//______________________________________________________________________
136Bool_t AliITSreconstruction::Init(){
137 // Class Initilizer.
138 // Inputs:
139 // none.
140 // Outputs:
141 // none.
142 // Return:
143 // kTRUE if no errors initilizing this class occurse else kFALSE
88cb7938 144 Info("Init","");
145 if (fRunLoader == 0x0)
146 {
147 Error("Init","Run Loader is NULL");
148 return kFALSE;
149 }
60b9526b 150 // fRunLoader->LoadgAlice();
151 // fRunLoader->LoadHeader();
88cb7938 152
153 fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
154 if(!fLoader) {
155 Error("Init","ITS loader not found");
156 fInit = kFALSE;
157 }
158
e69020a0 159 // Now ready to init.
7d62fb64 160
60b9526b 161 //fRunLoader->CdGAFile();
c7dca079 162 fITSgeom = fLoader->GetITSgeom();
e69020a0 163
8e50d897 164 fDetTypeRec = new AliITSDetTypeRec(fLoader);
7d62fb64 165 fDetTypeRec->SetDefaults();
e69020a0 166 fDet[0] = fDet[1] = fDet[2] = kTRUE;
167 fEnt0 = 0;
88cb7938 168
8ace09b6 169 //fEnt = gAlice->GetEventsPerRun();
60b9526b 170 fEnt = Int_t(fRunLoader->GetNumberOfEvents());
88cb7938 171
172 fLoader->LoadDigits("read");
173 fLoader->LoadRecPoints("recreate");
174 fLoader->LoadRawClusters("recreate");
175 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
7d62fb64 176 if (fLoader->TreeC() == 0x0) fLoader->MakeTree("C");
177
7d62fb64 178 fDetTypeRec->MakeBranchR(0);
179 fDetTypeRec->MakeBranchC();
180 fDetTypeRec->SetTreeAddress();
181 fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
182
e69020a0 183 fInit = InitRec();
88cb7938 184
185 Info("Init"," Done\n\n\n");
186
e69020a0 187 return fInit;
188}
189//______________________________________________________________________
190Bool_t AliITSreconstruction::InitRec(){
191 // Sets up Reconstruction part of AliITSDetType..
192 // Inputs:
193 // none.
194 // Outputs:
195 // none.
196 // Return:
197 // none.
7d62fb64 198 /*
199 //AliITSDetType *idt;
200 fDetTypeRec->SetLoader(fLoader);
e69020a0 201 // SPD
7d62fb64 202 if(fDet[kSPD]){
203 Info("InitRec","SPD");
204 //idt = fITS->DetType(kSPD);
205 AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)fDetTypeRec->GetSegmentationModel(0);
206 TClonesArray *digSPD = fDetTypeRec->DigitsAddress(kSPD);
207 TClonesArray *recpSPD = fDetTypeRec->ClustersAddress(kSPD);
208 Info("InitRec","idt = %#x; digSPD = %#x; recpSPD = %#x",fDetTypeRec,digSPD,recpSPD);
88cb7938 209 AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD,digSPD,recpSPD);
7d62fb64 210 fDetTypeRec->SetReconstructionModel(kSPD,recSPD);
e69020a0 211 } // end if fDet[kSPD].
7d62fb64 212 // SDD
213 if(fDet[kSDD]){
214 Info("InitRec","SDD");
215 // idt = fITS->DetType(kSDD);
216 AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*)
217 fDetTypeRec->GetSegmentationModel(1);
218 AliITSresponseSDD *resSDD = (AliITSresponseSDD*)
219 fDetTypeRec->GetCalibrationModel(fDetTypeRec->GetITSgeom()->GetStartSDD());
220 TClonesArray *digSDD = fDetTypeRec->DigitsAddress(kSDD);
221 TClonesArray *recpSDD = fDetTypeRec->ClustersAddress(kSDD);
222 AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD,
223 resSDD,
224 digSDD,recpSDD);
225 fDetTypeRec->SetReconstructionModel(kSDD,recSDD);
226 } // end if fDet[kSDD]
e69020a0 227 // SSD
7d62fb64 228 if(fDet[kSSD]){
229 Info("InitRec","SSD");
230 //idt = fITS->DetType(kSSD);
231 AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*)
232 fDetTypeRec->GetSegmentationModel(2);
233 TClonesArray *digSSD = fDetTypeRec->DigitsAddress(kSSD);
88cb7938 234 AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD,
7d62fb64 235 digSSD);
236 recSSD->SetITSgeom(fDetTypeRec->GetITSgeom());
237 fDetTypeRec->SetReconstructionModel(kSSD,recSSD);
e69020a0 238 } // end if fDet[kSSD]
7d62fb64 239 */
240 fDetTypeRec->SetDefaultClusterFinders();
88cb7938 241 Info("InitRec"," Done\n");
e69020a0 242 return kTRUE;
243}
244//______________________________________________________________________
245void AliITSreconstruction::Exec(const Option_t *opt){
246 // Main reconstruction function.
247 // Inputs:
248 // Option_t * opt list of subdetector to digitize. =0 all.
249 // Outputs:
250 // none.
251 // Return:
252 // none.
253 Option_t *lopt;
88cb7938 254 Int_t evnt;
e69020a0 255
256 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
88cb7938 257 fDet[0] = fDet[1] = fDet[2] = kTRUE;
258 lopt = "All";
e69020a0 259 }else{
88cb7938 260 fDet[0] = fDet[1] = fDet[2] = kFALSE;
261 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
262 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
263 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
264 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
265 else lopt = opt;
e69020a0 266 } // end if strstr(opt,...)
267
268 if(!fInit){
88cb7938 269 cout << "Initilization Failed, Can't run Exec." << endl;
270 return;
e69020a0 271 } // end if !fInit
88cb7938 272 for(evnt=0;evnt<fEnt;evnt++)
273 {
274 Info("Exec","");
275 Info("Exec","Processing Event %d",evnt);
276 Info("Exec","");
277
278 fRunLoader->GetEvent(evnt);
279 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
7d62fb64 280 fDetTypeRec->MakeBranchR(0);
281 if (fLoader->TreeC() == 0x0){
282 fDetTypeRec->MakeTreeC();
283 fDetTypeRec->MakeBranchC();
284 }
285 fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
286 fDetTypeRec->SetTreeAddressD(fLoader->TreeD());
287 fDetTypeRec->DigitsToRecPoints(evnt,0,lopt);
e69020a0 288 } // end for evnt
f243fbe6 289}
290//______________________________________________________________________
291void AliITSreconstruction::SetOutputFile(TString filename){
999cc3eb 292 // Set a new file name for recpoints.
293 // It must be called before Init()
294 if(!fLoader)fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
295 if(fLoader){
296 Info("SetOutputFile","name for rec points is %s",filename.Data());
297 fLoader->SetRecPointsFileName(filename);
298 }
299 else {
300 Error("SetOutputFile",
301 "ITS loader not available. Not possible to set name: %s",filename.Data());
302 }
e69020a0 303}