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