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