Only one declaration of iDict in MakeDigits()
[u/mrichter/AliRoot.git] / PHOS / AliPHOSReconstructioner.cxx
CommitLineData
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
22//
23//*-- Author: Gines Martinez & Yves Schutz (SUBATECH)
24
d15a28e7 25
26// --- ROOT system ---
27
28#include "TClonesArray.h"
29
30// --- Standard library ---
31
364de5c6 32#include <iomanip>
33
d15a28e7 34// --- AliRoot header files ---
35
36#include "AliPHOSReconstructioner.h"
37#include "AliPHOSClusterizer.h"
38
39ClassImp(AliPHOSReconstructioner)
40
d15a28e7 41//____________________________________________________________________________
6ad0bfa0 42AliPHOSReconstructioner::AliPHOSReconstructioner(AliPHOSClusterizer * Clusterizer,
43 AliPHOSTrackSegmentMaker * Tracker,
908558fc 44 AliPHOSPID * Pid)
d15a28e7 45{
b2a60966 46 // ctor
47
6ad0bfa0 48 fClusterizer = Clusterizer ;
49 fTrackSegmentMaker = Tracker ;
908558fc 50 fPID = Pid ;
364de5c6 51 fDebugReconstruction = kFALSE ;
d15a28e7 52}
53
d15a28e7 54
55//____________________________________________________________________________
6ad0bfa0 56 void AliPHOSReconstructioner::Init(AliPHOSClusterizer * Clusterizer,
57 AliPHOSTrackSegmentMaker * Tracker,
908558fc 58 AliPHOSPID * Pid)
6ad0bfa0 59{
60 fClusterizer = Clusterizer ;
61 fTrackSegmentMaker = Tracker ;
908558fc 62 fPID = Pid ;
364de5c6 63 fDebugReconstruction = kFALSE ;
6ad0bfa0 64}
65
6ad0bfa0 66//____________________________________________________________________________
83974468 67 void AliPHOSReconstructioner::Make(DigitsList * dl, RecPointsList * emccl, RecPointsList * ppsdl,
6ad0bfa0 68 TrackSegmentsList * trsl, RecParticlesList * rpl)
d15a28e7 69{
b2a60966 70 // Launches the Reconstruction process in the sequence: Make the reconstructed poins (clusterize)
71 // Make the track segments
72 // Make the reconstructed particles
83974468 73 Int_t index ;
364de5c6 74 // Digit Debuging
2aad621e 75 if (fDebugReconstruction) {
76 cout << ">>>>>>>>>>>>>>>>>>>>>> DebugReconstruction <<<<<<<<<<<<<<<<<<<<<<<<<<" << endl ;
77 cout << "DebugReconstruction>>> Digit list entries is " << dl->GetEntries() << endl ;
78 AliPHOSDigit * digit;
79 Bool_t calorimeter ;
80 Float_t factor;
81 cout << "DebugReconstruction>>> Vol Id " <<
82 " Ene(MeV, KeV) " <<
83 " Index " <<
84 " Nprim " <<
85 " Prim1 " <<
86 " Prim2 " <<
87 " Prim3 " << endl;
88 for (index = 0 ; index < dl->GetEntries() ; index++) {
89 digit = (AliPHOSDigit * ) dl->At(index) ;
90 calorimeter = fClusterizer->IsInEmc(digit);
91 if (calorimeter) factor =1000. ; else factor=1000000.;
92 cout << "DebugReconstruction>>> " <<
93 setw(8) << digit->GetId() << " " <<
94 setw(3) << calorimeter <<
95 setw(10) << factor*fClusterizer->Calibrate(digit->GetAmp()) << " " <<
96 setw(6) << digit->GetIndexInList() << " " <<
97 setw(5) << digit->GetNprimary() <<" " <<
98 setw(5) << digit->GetPrimary(1) <<" " <<
99 setw(5) << digit->GetPrimary(2) <<" " <<
100 setw(5) << digit->GetPrimary(3) << endl;
364de5c6 101 }
2aad621e 102
103 }
364de5c6 104
105
2885696f 106
107 // Making Clusters
031f0861 108 if (fDebugReconstruction) cout << "DebugReconstruction>>> Start making reconstructed points (clusterizing)" << endl;
d15a28e7 109 fClusterizer->MakeClusters(dl, emccl, ppsdl);
6ad0bfa0 110
031f0861 111 // mark the position of the RecPoints in the array
112 AliPHOSEmcRecPoint * emcrp ;
113 for (index = 0 ; index < emccl->GetEntries() ; index++) {
114 emcrp = (AliPHOSEmcRecPoint * )emccl->At(index) ;
115 emcrp->SetIndexInList(index) ;
116 }
117 AliPHOSPpsdRecPoint * ppsdrp ;
118 for (index = 0 ; index < ppsdl->GetEntries() ; index++) {
119 ppsdrp = (AliPHOSPpsdRecPoint * )ppsdl->At(index) ;
120 ppsdrp->SetIndexInList(index) ;
121 }
2aad621e 122
2885696f 123 if (fDebugReconstruction)
124 {
031f0861 125 cout << "DebugReconstruction>>> Cluster emc list entries is " << emccl->GetEntries() << endl ;
2885696f 126 AliPHOSEmcRecPoint * recpoint;
031f0861 127 cout << "DebugReconstruction>>> Module " <<
2aad621e 128 "Ene(MeV) " <<
129 "Index " <<
130 "Multi " <<
131 " X " <<
132 " Y " <<
133 " Z " <<
134 " Lambda 1 " <<
135 " Lambda 2 " <<
136 "MaxEnergy(MeV) " <<
2885696f 137 "Nprim " <<
138 "Prim1 " <<
139 "Prim2 " <<
031f0861 140 "Prim3 " << endl;
2885696f 141 for (index = 0 ; index < emccl->GetEntries() ; index++) {
142 recpoint = (AliPHOSEmcRecPoint * )emccl->At(index) ;
143 TVector3 locpos; recpoint->GetLocalPosition(locpos);
144 Float_t lambda[2]; recpoint->GetElipsAxis(lambda);
145 Int_t * primaries;
146 Int_t nprimaries;
147 primaries = recpoint->GetPrimaries(nprimaries);
148 cout << "DebugReconstruction>>> " <<
149 setw(2) <<recpoint->GetPHOSMod() << " " <<
150 setw(9) << 1000.*recpoint->GetTotalEnergy() << " " <<
151 setw(6) << recpoint->GetIndexInList() << " " <<
152 setw(5) << recpoint->GetMultiplicity() <<" " <<
153 setw(8) << locpos.X() <<" " <<
154 setw(8) << locpos.Y() <<" " <<
155 setw(8) << locpos.Z() << " " <<
156 setw(10) << lambda[0] << " " <<
157 setw(10) << lambda[1] << " " <<
158 setw(9) << 1000*recpoint->GetMaximalEnergy() << " " <<
159 setw(9) << nprimaries << " " <<
160 setw(4) << primaries[0] << " " <<
161 setw(4) << primaries[1] << " " <<
031f0861 162 setw(4) << primaries[2] << " " << endl;
2885696f 163 }
2aad621e 164
031f0861 165 cout << "DebugReconstruction>>> Cluster ppsd list entries is " << ppsdl->GetEntries() << endl ;
166 AliPHOSPpsdRecPoint * ppsdrecpoint;
167 Text_t detector[4];
168 cout << "DebugReconstruction>>> Module " <<
2aad621e 169 "Det " <<
170 "Ene(KeV) " <<
171 "Index " <<
172 "Multi " <<
173 " X " <<
174 " Y " <<
175 " Z " <<
031f0861 176 "Nprim " <<
177 "Prim1 " <<
178 "Prim2 " <<
179 "Prim3 " << endl;
180 for (index = 0 ; index < ppsdl->GetEntries() ; index++) {
181 ppsdrecpoint = (AliPHOSPpsdRecPoint * ) ppsdl->At(index) ;
182 TVector3 locpos; ppsdrecpoint->GetLocalPosition(locpos);
183 Int_t * primaries;
184 Int_t nprimaries;
185 if (ppsdrecpoint->GetUp()) detector="CPV"; else detector="PC ";
186 primaries = ppsdrecpoint->GetPrimaries(nprimaries);
187 cout << "DebugReconstruction>>> " <<
188 setw(4) << ppsdrecpoint->GetPHOSMod() << " " <<
189 setw(4) << detector << " " <<
190 setw(9) << 1000000.*ppsdrecpoint->GetTotalEnergy() << " " <<
191 setw(6) << ppsdrecpoint->GetIndexInList() << " " <<
192 setw(5) << ppsdrecpoint->GetMultiplicity() <<" " <<
193 setw(8) << locpos.X() <<" " <<
194 setw(8) << locpos.Y() <<" " <<
195 setw(8) << locpos.Z() << " " <<
196 setw(9) << nprimaries << " " <<
197 setw(4) << primaries[0] << " " <<
198 setw(4) << primaries[1] << " " <<
199 setw(4) << primaries[2] << " " << endl;
200 }
201 }
2aad621e 202
203
031f0861 204 if (fDebugReconstruction) cout << "DebugReconstruction>>>> Start making track segments(unfolding+tracksegments)" << endl;
83974468 205 fTrackSegmentMaker->MakeTrackSegments(dl, emccl, ppsdl, trsl) ;
2aad621e 206
83974468 207 // mark the position of the TrackSegments in the array
208 AliPHOSTrackSegment * trs ;
209 for (index = 0 ; index < trsl->GetEntries() ; index++) {
210 trs = (AliPHOSTrackSegment * )trsl->At(index) ;
211 trs->SetIndexInList(index) ;
212 }
031f0861 213 if (fDebugReconstruction){
214 cout << "DebugReconstruction>>> Track segment list entries is " << trsl->GetEntries() << endl ;
215 cout << "DebugReconstruction>>> Module " <<
216 "Ene(KeV) " <<
217 "Index " <<
218 " X " <<
219 " Y " <<
220 " Z " <<
221 " rX " <<
222 " rY " <<
223 " rZ " <<
224 "Nprim " <<
225 "Prim1 " <<
226 "Prim2 " <<
227 "Prim3 " << endl;
2aad621e 228
031f0861 229 for (index = 0 ; index < trsl->GetEntries() ; index++) {
230 trs = (AliPHOSTrackSegment * )trsl->At(index) ;
231 TVector3 locpos; trs->GetPosition(locpos);
232 Int_t * primaries;
233 Int_t nprimaries;
234 primaries = trs->GetPrimariesEmc(nprimaries);
235 cout << "DebugReconstruction>>> " <<
236 setw(4) << trs->GetPHOSMod() << " " <<
237 setw(9) << 1000.*trs->GetEnergy() << " " <<
238 setw(3) << trs->GetIndexInList() << " " <<
239 setw(9) << locpos.X() <<" " <<
240 setw(9) << locpos.Y() <<" " <<
241 setw(9) << locpos.Z() << " " <<
242 setw(10) << (trs->GetMomentumDirection()).X() << " " <<
243 setw(10) << (trs->GetMomentumDirection()).Y() << " " <<
244 setw(10) << (trs->GetMomentumDirection()).Z() << " " <<
245 setw(4) << nprimaries << " " <<
246 setw(4) << primaries[0] << " " <<
247 setw(4) << primaries[1] << " " <<
248 setw(4) << primaries[2] << " " << endl;
2aad621e 249 }
250
031f0861 251 }
2aad621e 252 if (fDebugReconstruction) cout << "DebugReconstruction>>>> Start making reconstructed particles" << endl;
83974468 253
0dd37dda 254 fPID->MakeParticles(trsl, rpl) ;
83974468 255
256 // mark the position of the RecParticles in the array
257 AliPHOSRecParticle * rp ;
258 for (index = 0 ; index < rpl->GetEntries() ; index++) {
259 rp = (AliPHOSRecParticle * )rpl->At(index) ;
260 rp->SetIndexInList(index) ;
261 }
2aad621e 262 //Debugger of RecParticles
263 if (fDebugReconstruction){
264 cout << "DebugReconstruction>>> Reconstructed particle list entries is " << rpl->GetEntries() << endl ;
265 cout << "DebugReconstruction>>> Module " <<
266 " PARTICLE " <<
267 "Ene(KeV) " <<
268 "Index " <<
269 " X " <<
270 " Y " <<
271 " Z " <<
272 "Nprim " <<
273 "Prim1 " <<
274 "Prim2 " <<
275 "Prim3 " << endl;
276 for (index = 0 ; index < rpl->GetEntries() ; index++) {
277 rp = (AliPHOSRecParticle * ) rpl->At(index) ;
278 TVector3 locpos; (rp->GetPHOSTrackSegment())->GetPosition(locpos);
279 Int_t * primaries;
280 Int_t nprimaries;
281 Text_t particle[11];
282 primaries = (rp->GetPHOSTrackSegment())->GetPrimariesEmc(nprimaries);
283 switch(rp->GetType())
284 {
285 case kNEUTRAL_EM:
286 particle = "NEUTRAL_EM";
287 break;
288 case kNEUTRAL_HA:
289 particle = "NEUTRAL_HA";
290 break;
291 case kGAMMA:
292 particle = "GAMMA ";
293 break ;
294 case kGAMMA_HA:
295 particle = "GAMMA_HA ";
296 break ;
297 case kABSURD_EM:
298 particle = "ABSURD_EM " ;
299 break ;
300 case kABSURD_HA:
301 particle = "ABSURD_HA " ;
302 break ;
303 case kELECTRON:
304 particle = "ELECTRON " ;
305 break ;
306 case kCHARGED_HA:
307 particle = "CHARGED_HA" ;
308 break ;
309 }
310
311 cout << "DebugReconstruction>>> " <<
312 setw(4) << (rp->GetPHOSTrackSegment())->GetPHOSMod() << " " <<
313 setw(15) << particle << " " <<
314 setw(9) << 1000.*(rp->GetPHOSTrackSegment())->GetEnergy() << " " <<
315 setw(3) << rp->GetIndexInList() << " " <<
316 setw(9) << locpos.X() <<" " <<
317 setw(9) << locpos.Y() <<" " <<
318 setw(9) << locpos.Z() << " " <<
319 setw(4) << nprimaries << " " <<
320 setw(4) << primaries[0] << " " <<
321 setw(4) << primaries[1] << " " <<
322 setw(4) << primaries[2] << " " << endl;
323 }
324
325 }
326
327
d15a28e7 328}