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