new design: singleton to be used instead od AliPHOS object during analysis; contains...
[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
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
41ClassImp(AliPHOSReconstructioner)
42
d15a28e7 43//____________________________________________________________________________
6ad0bfa0 44AliPHOSReconstructioner::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//____________________________________________________________________________
b73f246d 71 void AliPHOSReconstructioner::Make(DigitsList * dl,
72 AliPHOSRecPoint::RecPointsList * emccl,
73 AliPHOSRecPoint::RecPointsList * ppsdl,
b73f246d 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
fad3e5b9 84 fClusterizer->MakeClusters(dl, emccl, ppsdl);
b73f246d 85
2131115b 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() << " " <<
ad8cfaf4 160 setw(9) << 1000.*recpoint->GetEnergy() << " " <<
51926850 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 << " " <<
ad8cfaf4 201 setw(9) << 1000000.*ppsdrecpoint->GetEnergy() << " " <<
51926850 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;
fad3e5b9 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;
fad3e5b9 262
b73f246d 263 if (fPID) {
264 fPID->MakeParticles(trsl, rpl) ;
83974468 265
b73f246d 266 // mark the position of the RecParticles in the array
267 AliPHOSRecParticle * rp ;
2aad621e 268 for (index = 0 ; index < rpl->GetEntries() ; index++) {
b73f246d 269 rp = (AliPHOSRecParticle * )rpl->At(index) ;
270 rp->SetIndexInList(index) ;
271 }
272 //Debugger of RecParticles
273 if (fDebugReconstruction){
274 cout << "DebugReconstruction>>> Reconstructed particle list entries is " << rpl->GetEntries() << endl ;
275 cout << "DebugReconstruction>>> Module " <<
276 " PARTICLE " <<
277 "Ene(KeV) " <<
278 "Index " <<
279 " X " <<
280 " Y " <<
281 " Z " <<
282 "Nprim " <<
283 " Primaries list " << endl;
284 for (index = 0 ; index < rpl->GetEntries() ; index++) {
285 rp = (AliPHOSRecParticle * ) rpl->At(index) ;
286 TVector3 locpos; (rp->GetPHOSTrackSegment())->GetPosition(locpos);
287 Int_t * primaries;
288 Int_t nprimaries;
289 Text_t particle[11];
290 primaries = (rp->GetPHOSTrackSegment())->GetPrimariesEmc(nprimaries);
291 switch(rp->GetType()) {
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 }
b73f246d 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() << " " <<
326 setw(4) << nprimaries << " ";
327 for (Int_t iprimary=0; iprimary<nprimaries; iprimary++)
328 cout << setw(4) << primaries[iprimary] << " ";
329 cout << endl;
330 }
2aad621e 331 }
332
333 }
334
51926850 335}