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