d15a28e7 |
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 | |
b2a60966 |
16 | /* $Id$ */ |
17 | |
d15a28e7 |
18 | //_________________________________________________________________________ |
b2a60966 |
19 | // Algorithm class for the reconstruction: clusterizer |
20 | // track segment maker |
21 | // particle identifier |
a3dfe79c |
22 | //*-- |
b2a60966 |
23 | //*-- Author: Gines Martinez & Yves Schutz (SUBATECH) |
24 | |
d15a28e7 |
25 | |
26 | // --- ROOT system --- |
27 | |
28 | #include "TClonesArray.h" |
29 | |
30 | // --- Standard library --- |
31 | |
e126816e |
32 | #include <iomanip.h> |
364de5c6 |
33 | |
d15a28e7 |
34 | // --- AliRoot header files --- |
35 | |
36 | #include "AliPHOSReconstructioner.h" |
37 | #include "AliPHOSClusterizer.h" |
9ec91567 |
38 | #include "AliPHOSFastRecParticle.h" |
0b06c60d |
39 | #include "AliPHOSCpvRecPoint.h" |
d15a28e7 |
40 | |
41 | ClassImp(AliPHOSReconstructioner) |
42 | |
d15a28e7 |
43 | //____________________________________________________________________________ |
6ad0bfa0 |
44 | AliPHOSReconstructioner::AliPHOSReconstructioner(AliPHOSClusterizer * Clusterizer, |
45 | AliPHOSTrackSegmentMaker * Tracker, |
908558fc |
46 | AliPHOSPID * Pid) |
d15a28e7 |
47 | { |
b2a60966 |
48 | // ctor |
49 | |
6ad0bfa0 |
50 | fClusterizer = Clusterizer ; |
51 | fTrackSegmentMaker = Tracker ; |
908558fc |
52 | fPID = Pid ; |
364de5c6 |
53 | fDebugReconstruction = kFALSE ; |
d15a28e7 |
54 | } |
55 | |
d15a28e7 |
56 | |
57 | //____________________________________________________________________________ |
6ad0bfa0 |
58 | void AliPHOSReconstructioner::Init(AliPHOSClusterizer * Clusterizer, |
59 | AliPHOSTrackSegmentMaker * Tracker, |
908558fc |
60 | AliPHOSPID * Pid) |
6ad0bfa0 |
61 | { |
839ffcb3 |
62 | // Initialisation |
63 | |
6ad0bfa0 |
64 | fClusterizer = Clusterizer ; |
65 | fTrackSegmentMaker = Tracker ; |
908558fc |
66 | fPID = Pid ; |
364de5c6 |
67 | fDebugReconstruction = kFALSE ; |
6ad0bfa0 |
68 | } |
69 | |
6ad0bfa0 |
70 | //____________________________________________________________________________ |
ed4205d8 |
71 | void AliPHOSReconstructioner::MakePPSD(DigitsList * dl, |
72 | AliPHOSRecPoint::RecPointsList * emccl, |
73 | AliPHOSRecPoint::RecPointsList * ppsdl, |
74 | AliPHOSTrackSegment::TrackSegmentsList * trsl, |
75 | AliPHOSRecParticle::RecParticlesList * rpl) |
d15a28e7 |
76 | { |
b2a60966 |
77 | // Launches the Reconstruction process in the sequence: Make the reconstructed poins (clusterize) |
78 | // Make the track segments |
79 | // Make the reconstructed particles |
59cd4405 |
80 | Int_t index ; |
2131115b |
81 | if (fDebugReconstruction) |
51926850 |
82 | cout << "\n\nDebugReconstruction>>> " << "Start making reconstructed points (clusterizing!!)" << endl; |
2131115b |
83 | |
59cd4405 |
84 | fClusterizer->MakeClusters(dl, emccl, ppsdl); |
2131115b |
85 | |
86 | if (fDebugReconstruction){ |
87 | cout << "DebugReconstruction>>> " << "AliPHOSReconstructioner: Digit list entries is " << dl->GetEntries() << endl ; |
88 | cout << "AliPHOSReconstructioner: Emc list entries is " << emccl->GetEntries() << endl ; |
89 | cout << "AliPHOSReconstructioner: Ppsd list entries is " << ppsdl->GetEntries() << endl ; |
90 | } |
59cd4405 |
91 | |
364de5c6 |
92 | // Digit Debuging |
2aad621e |
93 | if (fDebugReconstruction) { |
94 | cout << ">>>>>>>>>>>>>>>>>>>>>> DebugReconstruction <<<<<<<<<<<<<<<<<<<<<<<<<<" << endl ; |
95 | cout << "DebugReconstruction>>> Digit list entries is " << dl->GetEntries() << endl ; |
96 | AliPHOSDigit * digit; |
97 | Bool_t calorimeter ; |
98 | Float_t factor; |
99 | cout << "DebugReconstruction>>> Vol Id " << |
51926850 |
100 | " Ene(MeV, KeV) " << |
101 | " Index " << |
102 | " Nprim " << |
103 | " Primaries list " << endl; |
2aad621e |
104 | for (index = 0 ; index < dl->GetEntries() ; index++) { |
105 | digit = (AliPHOSDigit * ) dl->At(index) ; |
106 | calorimeter = fClusterizer->IsInEmc(digit); |
107 | if (calorimeter) factor =1000. ; else factor=1000000.; |
108 | cout << "DebugReconstruction>>> " << |
51926850 |
109 | setw(8) << digit->GetId() << " " << |
110 | setw(3) << (Int_t) calorimeter << |
111 | setw(10) << factor*fClusterizer->Calibrate(digit->GetAmp()) << " " << |
2aad621e |
112 | setw(6) << digit->GetIndexInList() << " " << |
51926850 |
113 | setw(5) << digit->GetNprimary() <<" "; |
114 | for (Int_t iprimary=0; iprimary<digit->GetNprimary(); iprimary++) |
115 | cout << setw(5) << digit->GetPrimary(iprimary+1) << " "; |
116 | cout << endl; |
364de5c6 |
117 | } |
2aad621e |
118 | |
119 | } |
364de5c6 |
120 | |
2885696f |
121 | // Making Clusters |
031f0861 |
122 | if (fDebugReconstruction) cout << "DebugReconstruction>>> Start making reconstructed points (clusterizing)" << endl; |
6ad0bfa0 |
123 | |
031f0861 |
124 | // mark the position of the RecPoints in the array |
125 | AliPHOSEmcRecPoint * emcrp ; |
126 | for (index = 0 ; index < emccl->GetEntries() ; index++) { |
127 | emcrp = (AliPHOSEmcRecPoint * )emccl->At(index) ; |
128 | emcrp->SetIndexInList(index) ; |
129 | } |
130 | AliPHOSPpsdRecPoint * ppsdrp ; |
131 | for (index = 0 ; index < ppsdl->GetEntries() ; index++) { |
132 | ppsdrp = (AliPHOSPpsdRecPoint * )ppsdl->At(index) ; |
133 | ppsdrp->SetIndexInList(index) ; |
134 | } |
2aad621e |
135 | |
51926850 |
136 | if (fDebugReconstruction) { |
137 | cout << "DebugReconstruction>>> Cluster emc list entries is " << emccl->GetEntries() << endl ; |
138 | AliPHOSEmcRecPoint * recpoint; |
139 | cout << "DebugReconstruction>>> Module " << |
140 | "Ene(MeV) " << |
141 | "Index " << |
142 | "Multi " << |
143 | " X " << |
144 | " Y " << |
145 | " Z " << |
146 | " Lambda 1 " << |
147 | " Lambda 2 " << |
148 | "MaxEnergy(MeV) " << |
149 | "Nprim " << |
150 | " Primaries list " << endl; |
151 | for (index = 0 ; index < emccl->GetEntries() ; index++) { |
152 | recpoint = (AliPHOSEmcRecPoint * )emccl->At(index) ; |
153 | TVector3 locpos; recpoint->GetLocalPosition(locpos); |
154 | Float_t lambda[2]; recpoint->GetElipsAxis(lambda); |
155 | Int_t * primaries; |
156 | Int_t nprimaries; |
157 | primaries = recpoint->GetPrimaries(nprimaries); |
158 | cout << "DebugReconstruction>>> " << |
159 | setw(2) <<recpoint->GetPHOSMod() << " " << |
160 | setw(9) << 1000.*recpoint->GetTotalEnergy() << " " << |
161 | setw(6) << recpoint->GetIndexInList() << " " << |
162 | setw(5) << recpoint->GetMultiplicity() <<" " << |
163 | setw(8) << locpos.X() <<" " << |
164 | setw(8) << locpos.Y() <<" " << |
165 | setw(8) << locpos.Z() << " " << |
166 | setw(10) << lambda[0] << " " << |
167 | setw(10) << lambda[1] << " " << |
168 | setw(9) << 1000*recpoint->GetMaximalEnergy() << " " << |
169 | setw(9) << nprimaries << " "; |
170 | for (Int_t iprimary=0; iprimary<nprimaries; iprimary++) |
171 | cout << setw(4) << primaries[iprimary] << " "; |
172 | cout << endl; |
173 | } |
2aad621e |
174 | |
51926850 |
175 | cout << "DebugReconstruction>>> Cluster ppsd list entries is " << ppsdl->GetEntries() << endl ; |
176 | AliPHOSPpsdRecPoint * ppsdrecpoint; |
177 | Text_t detector[4]; |
178 | cout << "DebugReconstruction>>> Module " << |
179 | "Det " << |
180 | "Ene(KeV) " << |
181 | "Index " << |
182 | "Multi " << |
183 | " X " << |
184 | " Y " << |
185 | " Z " << |
186 | "Nprim " << |
187 | " Primaries list " << endl; |
188 | for (index = 0 ; index < ppsdl->GetEntries() ; index++) { |
189 | ppsdrecpoint = (AliPHOSPpsdRecPoint * ) ppsdl->At(index) ; |
190 | TVector3 locpos; ppsdrecpoint->GetLocalPosition(locpos); |
191 | Int_t * primaries; |
192 | Int_t nprimaries; |
193 | if (ppsdrecpoint->GetUp()) |
194 | strcpy(detector, "CPV"); |
195 | else |
196 | strcpy(detector, "PC "); |
197 | primaries = ppsdrecpoint->GetPrimaries(nprimaries); |
198 | cout << "DebugReconstruction>>> " << |
199 | setw(4) << ppsdrecpoint->GetPHOSMod() << " " << |
200 | setw(4) << detector << " " << |
201 | setw(9) << 1000000.*ppsdrecpoint->GetTotalEnergy() << " " << |
202 | setw(6) << ppsdrecpoint->GetIndexInList() << " " << |
203 | setw(5) << ppsdrecpoint->GetMultiplicity() <<" " << |
204 | setw(8) << locpos.X() <<" " << |
205 | setw(8) << locpos.Y() <<" " << |
206 | setw(8) << locpos.Z() << " " << |
207 | setw(9) << nprimaries << " "; |
208 | for (Int_t iprimary=0; iprimary<nprimaries; iprimary++) |
209 | cout << setw(4) << primaries[iprimary] << " "; |
210 | cout << endl; |
211 | } |
212 | } |
2aad621e |
213 | |
214 | |
031f0861 |
215 | if (fDebugReconstruction) cout << "DebugReconstruction>>>> Start making track segments(unfolding+tracksegments)" << endl; |
83974468 |
216 | fTrackSegmentMaker->MakeTrackSegments(dl, emccl, ppsdl, trsl) ; |
2aad621e |
217 | |
83974468 |
218 | // mark the position of the TrackSegments in the array |
219 | AliPHOSTrackSegment * trs ; |
220 | for (index = 0 ; index < trsl->GetEntries() ; index++) { |
221 | trs = (AliPHOSTrackSegment * )trsl->At(index) ; |
222 | trs->SetIndexInList(index) ; |
223 | } |
031f0861 |
224 | if (fDebugReconstruction){ |
225 | cout << "DebugReconstruction>>> Track segment list entries is " << trsl->GetEntries() << endl ; |
226 | cout << "DebugReconstruction>>> Module " << |
227 | "Ene(KeV) " << |
51926850 |
228 | "Index " << |
229 | " X " << |
230 | " Y " << |
231 | " Z " << |
232 | " rX " << |
233 | " rY " << |
234 | " rZ " << |
235 | "Nprim " << |
236 | " Primaries list " << endl; |
2aad621e |
237 | |
031f0861 |
238 | for (index = 0 ; index < trsl->GetEntries() ; index++) { |
239 | trs = (AliPHOSTrackSegment * )trsl->At(index) ; |
240 | TVector3 locpos; trs->GetPosition(locpos); |
241 | Int_t * primaries; |
242 | Int_t nprimaries; |
243 | primaries = trs->GetPrimariesEmc(nprimaries); |
244 | cout << "DebugReconstruction>>> " << |
245 | setw(4) << trs->GetPHOSMod() << " " << |
246 | setw(9) << 1000.*trs->GetEnergy() << " " << |
247 | setw(3) << trs->GetIndexInList() << " " << |
248 | setw(9) << locpos.X() <<" " << |
249 | setw(9) << locpos.Y() <<" " << |
250 | setw(9) << locpos.Z() << " " << |
251 | setw(10) << (trs->GetMomentumDirection()).X() << " " << |
252 | setw(10) << (trs->GetMomentumDirection()).Y() << " " << |
253 | setw(10) << (trs->GetMomentumDirection()).Z() << " " << |
51926850 |
254 | setw(4) << nprimaries << " "; |
255 | for (Int_t iprimary=0; iprimary<nprimaries; iprimary++) |
256 | cout << setw(4) << primaries[iprimary] << " "; |
257 | cout << endl; |
2aad621e |
258 | } |
259 | |
031f0861 |
260 | } |
2aad621e |
261 | if (fDebugReconstruction) cout << "DebugReconstruction>>>> Start making reconstructed particles" << endl; |
83974468 |
262 | |
0dd37dda |
263 | fPID->MakeParticles(trsl, rpl) ; |
83974468 |
264 | |
265 | // mark the position of the RecParticles in the array |
266 | AliPHOSRecParticle * rp ; |
267 | for (index = 0 ; index < rpl->GetEntries() ; index++) { |
268 | rp = (AliPHOSRecParticle * )rpl->At(index) ; |
269 | rp->SetIndexInList(index) ; |
270 | } |
2aad621e |
271 | //Debugger of RecParticles |
51926850 |
272 | if (fDebugReconstruction){ |
2aad621e |
273 | cout << "DebugReconstruction>>> Reconstructed particle list entries is " << rpl->GetEntries() << endl ; |
274 | cout << "DebugReconstruction>>> Module " << |
275 | " PARTICLE " << |
51926850 |
276 | "Ene(KeV) " << |
277 | "Index " << |
278 | " X " << |
279 | " Y " << |
280 | " Z " << |
281 | "Nprim " << |
282 | " Primaries list " << endl; |
2aad621e |
283 | for (index = 0 ; index < rpl->GetEntries() ; index++) { |
284 | rp = (AliPHOSRecParticle * ) rpl->At(index) ; |
285 | TVector3 locpos; (rp->GetPHOSTrackSegment())->GetPosition(locpos); |
286 | Int_t * primaries; |
287 | Int_t nprimaries; |
288 | Text_t particle[11]; |
289 | primaries = (rp->GetPHOSTrackSegment())->GetPrimariesEmc(nprimaries); |
290 | switch(rp->GetType()) |
291 | { |
9ec91567 |
292 | case AliPHOSFastRecParticle::kNEUTRALEM: |
e126816e |
293 | strcpy( particle, "NEUTRAL_EM"); |
2aad621e |
294 | break; |
9ec91567 |
295 | case AliPHOSFastRecParticle::kNEUTRALHA: |
e126816e |
296 | strcpy(particle, "NEUTRAL_HA"); |
2aad621e |
297 | break; |
9ec91567 |
298 | case AliPHOSFastRecParticle::kGAMMA: |
e126816e |
299 | strcpy(particle, "GAMMA"); |
2aad621e |
300 | break ; |
9ec91567 |
301 | case AliPHOSFastRecParticle::kGAMMAHA: |
e126816e |
302 | strcpy(particle, "GAMMA_H"); |
2aad621e |
303 | break ; |
9ec91567 |
304 | case AliPHOSFastRecParticle::kABSURDEM: |
e126816e |
305 | strcpy(particle, "ABSURD_EM") ; |
2aad621e |
306 | break ; |
9ec91567 |
307 | case AliPHOSFastRecParticle::kABSURDHA: |
e126816e |
308 | strcpy(particle, "ABSURD_HA") ; |
2aad621e |
309 | break ; |
9ec91567 |
310 | case AliPHOSFastRecParticle::kELECTRON: |
e126816e |
311 | strcpy(particle, "ELECTRON") ; |
2aad621e |
312 | break ; |
9ec91567 |
313 | case AliPHOSFastRecParticle::kCHARGEDHA: |
e126816e |
314 | strcpy(particle, "CHARGED_HA") ; |
2aad621e |
315 | break ; |
316 | } |
317 | |
318 | cout << "DebugReconstruction>>> " << |
319 | setw(4) << (rp->GetPHOSTrackSegment())->GetPHOSMod() << " " << |
320 | setw(15) << particle << " " << |
321 | setw(9) << 1000.*(rp->GetPHOSTrackSegment())->GetEnergy() << " " << |
322 | setw(3) << rp->GetIndexInList() << " " << |
323 | setw(9) << locpos.X() <<" " << |
324 | setw(9) << locpos.Y() <<" " << |
325 | setw(9) << locpos.Z() << " " << |
51926850 |
326 | setw(4) << nprimaries << " "; |
327 | for (Int_t iprimary=0; iprimary<nprimaries; iprimary++) |
328 | cout << setw(4) << primaries[iprimary] << " "; |
329 | cout << endl; |
2aad621e |
330 | } |
331 | |
332 | } |
333 | |
334 | |
d15a28e7 |
335 | } |
51926850 |
336 | |
337 | //____________________________________________________________________________ |
ed4205d8 |
338 | void AliPHOSReconstructioner::MakeCPV(DigitsList * dl, |
339 | AliPHOSRecPoint::RecPointsList * emccl, |
340 | AliPHOSRecPoint::RecPointsList * cpvcl) |
51926850 |
341 | { |
342 | |
343 | // Launches the Reconstruction process of EMC and CPV in the sequence: |
344 | // Make the reconstructed poins (clusterize) |
345 | // Make the track segments |
346 | // Particle identification is not made here |
347 | // EMC and CPV rec.points are the same yet |
348 | // |
349 | // Yuri Kharlov. 20 October 2000 |
350 | |
351 | Int_t index ; |
352 | |
353 | // Making Clusters |
354 | if (fDebugReconstruction) |
355 | cout << "DebugReconstruction>>> Start clusterizing reconstructed points" << endl; |
356 | fClusterizer->MakeClusters(dl, emccl, cpvcl); |
357 | |
358 | if (fDebugReconstruction){ |
ed4205d8 |
359 | // Digit Debuging |
51926850 |
360 | cout << "AliPHOSReconstructioner: Digit list entries are " << dl->GetEntries() << endl ; |
361 | cout << "AliPHOSReconstructioner: EMC list entries are " << emccl->GetEntries() << endl ; |
362 | cout << "AliPHOSReconstructioner: CPV list entries are " << cpvcl->GetEntries() << endl ; |
363 | cout << ">>>>>>>>>>>>>>>>>>>>>> DebugReconstruction <<<<<<<<<<<<<<<<<<<<<<<<<<" << endl ; |
364 | cout << "DebugReconstruction>>> Digit list entries is " << dl->GetEntries() << endl ; |
365 | AliPHOSDigit * digit; |
366 | Bool_t calorimeter ; |
367 | Float_t factor; |
368 | cout << "DebugReconstruction>>> Vol Id " << |
369 | " Ene(MeV, KeV) " << |
370 | " Index " << |
371 | " Nprim " << |
372 | " Primaries list " << endl; |
373 | for (index = 0 ; index < dl->GetEntries() ; index++) { |
374 | digit = (AliPHOSDigit * ) dl->At(index) ; |
375 | calorimeter = fClusterizer->IsInEmc(digit); |
376 | if (calorimeter) factor =1000. ; else factor=1000000.; |
377 | cout << "DebugReconstruction>>> " << |
378 | setw(8) << digit->GetId() << " " << |
379 | setw(3) << (Int_t) calorimeter << |
380 | setw(10) << factor*fClusterizer->Calibrate(digit->GetAmp()) << " " << |
381 | setw(6) << digit->GetIndexInList() << " " << |
382 | setw(5) << digit->GetNprimary() <<" "; |
383 | for (Int_t iprimary=0; iprimary<digit->GetNprimary(); iprimary++) |
384 | cout << setw(5) << digit->GetPrimary(iprimary+1) << " "; |
385 | cout << endl; |
386 | } |
387 | |
388 | } |
389 | |
390 | // mark the position of the RecPoints in the array |
391 | AliPHOSEmcRecPoint * emcrp ; |
a3dfe79c |
392 | Int_t currentPHOSModule; |
51926850 |
393 | for (index = 0 ; index < emccl->GetEntries() ; index++) { |
394 | emcrp = (AliPHOSEmcRecPoint * )emccl->At(index) ; |
395 | emcrp ->SetIndexInList(index) ; |
396 | TVector3 locpos; emcrp->GetLocalPosition(locpos); |
a3dfe79c |
397 | currentPHOSModule = emcrp->GetPHOSMod(); |
51926850 |
398 | } |
0b06c60d |
399 | AliPHOSCpvRecPoint * cpvrp ; |
51926850 |
400 | for (index = 0 ; index < cpvcl->GetEntries() ; index++) { |
0b06c60d |
401 | cpvrp = (AliPHOSCpvRecPoint * )cpvcl->At(index) ; |
ed4205d8 |
402 | if (cpvrp->IsCPV()) break; |
51926850 |
403 | cpvrp ->SetIndexInList(index) ; |
0b06c60d |
404 | TVector3 locpos; cpvrp->GetLocalPosition(locpos); |
405 | Int_t lengX,lengZ; cpvrp->GetClusterLengths(lengX,lengZ); |
a3dfe79c |
406 | currentPHOSModule = cpvrp->GetPHOSMod(); |
51926850 |
407 | } |
408 | |
409 | if (fDebugReconstruction) |
410 | cout << "DebugReconstruction>>>> Start unfolding reconstructed points" << endl; |
411 | fTrackSegmentMaker->MakeTrackSegmentsCPV(dl, emccl, cpvcl) ; |
412 | } |