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