New data member (cerenkov angle) in Cerenkov data structure.
[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//____________________________________________________________________________
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;
e126816e 185 if (ppsdrecpoint->GetUp())
186 strcpy(detector, "CPV");
187 else
188 strcpy(detector, "PC ");
031f0861 189 primaries = ppsdrecpoint->GetPrimaries(nprimaries);
190 cout << "DebugReconstruction>>> " <<
191 setw(4) << ppsdrecpoint->GetPHOSMod() << " " <<
192 setw(4) << detector << " " <<
193 setw(9) << 1000000.*ppsdrecpoint->GetTotalEnergy() << " " <<
194 setw(6) << ppsdrecpoint->GetIndexInList() << " " <<
195 setw(5) << ppsdrecpoint->GetMultiplicity() <<" " <<
196 setw(8) << locpos.X() <<" " <<
197 setw(8) << locpos.Y() <<" " <<
198 setw(8) << locpos.Z() << " " <<
199 setw(9) << nprimaries << " " <<
200 setw(4) << primaries[0] << " " <<
201 setw(4) << primaries[1] << " " <<
202 setw(4) << primaries[2] << " " << endl;
203 }
204 }
2aad621e 205
206
031f0861 207 if (fDebugReconstruction) cout << "DebugReconstruction>>>> Start making track segments(unfolding+tracksegments)" << endl;
83974468 208 fTrackSegmentMaker->MakeTrackSegments(dl, emccl, ppsdl, trsl) ;
2aad621e 209
83974468 210 // mark the position of the TrackSegments in the array
211 AliPHOSTrackSegment * trs ;
212 for (index = 0 ; index < trsl->GetEntries() ; index++) {
213 trs = (AliPHOSTrackSegment * )trsl->At(index) ;
214 trs->SetIndexInList(index) ;
215 }
031f0861 216 if (fDebugReconstruction){
217 cout << "DebugReconstruction>>> Track segment list entries is " << trsl->GetEntries() << endl ;
218 cout << "DebugReconstruction>>> Module " <<
219 "Ene(KeV) " <<
220 "Index " <<
221 " X " <<
222 " Y " <<
223 " Z " <<
224 " rX " <<
225 " rY " <<
226 " rZ " <<
227 "Nprim " <<
228 "Prim1 " <<
229 "Prim2 " <<
230 "Prim3 " << endl;
2aad621e 231
031f0861 232 for (index = 0 ; index < trsl->GetEntries() ; index++) {
233 trs = (AliPHOSTrackSegment * )trsl->At(index) ;
234 TVector3 locpos; trs->GetPosition(locpos);
235 Int_t * primaries;
236 Int_t nprimaries;
237 primaries = trs->GetPrimariesEmc(nprimaries);
238 cout << "DebugReconstruction>>> " <<
239 setw(4) << trs->GetPHOSMod() << " " <<
240 setw(9) << 1000.*trs->GetEnergy() << " " <<
241 setw(3) << trs->GetIndexInList() << " " <<
242 setw(9) << locpos.X() <<" " <<
243 setw(9) << locpos.Y() <<" " <<
244 setw(9) << locpos.Z() << " " <<
245 setw(10) << (trs->GetMomentumDirection()).X() << " " <<
246 setw(10) << (trs->GetMomentumDirection()).Y() << " " <<
247 setw(10) << (trs->GetMomentumDirection()).Z() << " " <<
248 setw(4) << nprimaries << " " <<
249 setw(4) << primaries[0] << " " <<
250 setw(4) << primaries[1] << " " <<
251 setw(4) << primaries[2] << " " << endl;
2aad621e 252 }
253
031f0861 254 }
2aad621e 255 if (fDebugReconstruction) cout << "DebugReconstruction>>>> Start making reconstructed particles" << endl;
83974468 256
0dd37dda 257 fPID->MakeParticles(trsl, rpl) ;
83974468 258
259 // mark the position of the RecParticles in the array
260 AliPHOSRecParticle * rp ;
261 for (index = 0 ; index < rpl->GetEntries() ; index++) {
262 rp = (AliPHOSRecParticle * )rpl->At(index) ;
263 rp->SetIndexInList(index) ;
264 }
2aad621e 265 //Debugger of RecParticles
266 if (fDebugReconstruction){
267 cout << "DebugReconstruction>>> Reconstructed particle list entries is " << rpl->GetEntries() << endl ;
268 cout << "DebugReconstruction>>> Module " <<
269 " PARTICLE " <<
270 "Ene(KeV) " <<
271 "Index " <<
272 " X " <<
273 " Y " <<
274 " Z " <<
275 "Nprim " <<
276 "Prim1 " <<
277 "Prim2 " <<
278 "Prim3 " << endl;
279 for (index = 0 ; index < rpl->GetEntries() ; index++) {
280 rp = (AliPHOSRecParticle * ) rpl->At(index) ;
281 TVector3 locpos; (rp->GetPHOSTrackSegment())->GetPosition(locpos);
282 Int_t * primaries;
283 Int_t nprimaries;
284 Text_t particle[11];
285 primaries = (rp->GetPHOSTrackSegment())->GetPrimariesEmc(nprimaries);
286 switch(rp->GetType())
287 {
288 case kNEUTRAL_EM:
e126816e 289 strcpy( particle, "NEUTRAL_EM");
2aad621e 290 break;
291 case kNEUTRAL_HA:
e126816e 292 strcpy(particle, "NEUTRAL_HA");
2aad621e 293 break;
294 case kGAMMA:
e126816e 295 strcpy(particle, "GAMMA");
2aad621e 296 break ;
297 case kGAMMA_HA:
e126816e 298 strcpy(particle, "GAMMA_H");
2aad621e 299 break ;
300 case kABSURD_EM:
e126816e 301 strcpy(particle, "ABSURD_EM") ;
2aad621e 302 break ;
303 case kABSURD_HA:
e126816e 304 strcpy(particle, "ABSURD_HA") ;
2aad621e 305 break ;
306 case kELECTRON:
e126816e 307 strcpy(particle, "ELECTRON") ;
2aad621e 308 break ;
309 case kCHARGED_HA:
e126816e 310 strcpy(particle, "CHARGED_HA") ;
2aad621e 311 break ;
312 }
313
314 cout << "DebugReconstruction>>> " <<
315 setw(4) << (rp->GetPHOSTrackSegment())->GetPHOSMod() << " " <<
316 setw(15) << particle << " " <<
317 setw(9) << 1000.*(rp->GetPHOSTrackSegment())->GetEnergy() << " " <<
318 setw(3) << rp->GetIndexInList() << " " <<
319 setw(9) << locpos.X() <<" " <<
320 setw(9) << locpos.Y() <<" " <<
321 setw(9) << locpos.Z() << " " <<
322 setw(4) << nprimaries << " " <<
323 setw(4) << primaries[0] << " " <<
324 setw(4) << primaries[1] << " " <<
325 setw(4) << primaries[2] << " " << endl;
326 }
327
328 }
329
330
d15a28e7 331}