]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSReconstructioner.cxx
CPV clusterization updated
[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//____________________________________________________________________________
88714635 71 void AliPHOSReconstructioner::Make(DigitsList * dl,
72 AliPHOSRecPoint::RecPointsList * emccl,
73 AliPHOSRecPoint::RecPointsList * ppsdl,
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
59cd4405 84 fClusterizer->MakeClusters(dl, emccl, ppsdl);
2131115b 85
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
121
2885696f 122
123 // Making Clusters
031f0861 124 if (fDebugReconstruction) cout << "DebugReconstruction>>> Start making reconstructed points (clusterizing)" << endl;
6ad0bfa0 125
031f0861 126 // mark the position of the RecPoints in the array
127 AliPHOSEmcRecPoint * emcrp ;
128 for (index = 0 ; index < emccl->GetEntries() ; index++) {
129 emcrp = (AliPHOSEmcRecPoint * )emccl->At(index) ;
130 emcrp->SetIndexInList(index) ;
131 }
132 AliPHOSPpsdRecPoint * ppsdrp ;
133 for (index = 0 ; index < ppsdl->GetEntries() ; index++) {
134 ppsdrp = (AliPHOSPpsdRecPoint * )ppsdl->At(index) ;
135 ppsdrp->SetIndexInList(index) ;
136 }
2aad621e 137
51926850 138 if (fDebugReconstruction) {
139 cout << "DebugReconstruction>>> Cluster emc list entries is " << emccl->GetEntries() << endl ;
140 AliPHOSEmcRecPoint * recpoint;
141 cout << "DebugReconstruction>>> Module " <<
142 "Ene(MeV) " <<
143 "Index " <<
144 "Multi " <<
145 " X " <<
146 " Y " <<
147 " Z " <<
148 " Lambda 1 " <<
149 " Lambda 2 " <<
150 "MaxEnergy(MeV) " <<
151 "Nprim " <<
152 " Primaries list " << endl;
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 for (Int_t iprimary=0; iprimary<nprimaries; iprimary++)
173 cout << setw(4) << primaries[iprimary] << " ";
174 cout << endl;
175 }
2aad621e 176
51926850 177 cout << "DebugReconstruction>>> Cluster ppsd list entries is " << ppsdl->GetEntries() << endl ;
178 AliPHOSPpsdRecPoint * ppsdrecpoint;
179 Text_t detector[4];
180 cout << "DebugReconstruction>>> Module " <<
181 "Det " <<
182 "Ene(KeV) " <<
183 "Index " <<
184 "Multi " <<
185 " X " <<
186 " Y " <<
187 " Z " <<
188 "Nprim " <<
189 " Primaries list " << endl;
190 for (index = 0 ; index < ppsdl->GetEntries() ; index++) {
191 ppsdrecpoint = (AliPHOSPpsdRecPoint * ) ppsdl->At(index) ;
192 TVector3 locpos; ppsdrecpoint->GetLocalPosition(locpos);
193 Int_t * primaries;
194 Int_t nprimaries;
195 if (ppsdrecpoint->GetUp())
196 strcpy(detector, "CPV");
197 else
198 strcpy(detector, "PC ");
199 primaries = ppsdrecpoint->GetPrimaries(nprimaries);
200 cout << "DebugReconstruction>>> " <<
201 setw(4) << ppsdrecpoint->GetPHOSMod() << " " <<
202 setw(4) << detector << " " <<
203 setw(9) << 1000000.*ppsdrecpoint->GetTotalEnergy() << " " <<
204 setw(6) << ppsdrecpoint->GetIndexInList() << " " <<
205 setw(5) << ppsdrecpoint->GetMultiplicity() <<" " <<
206 setw(8) << locpos.X() <<" " <<
207 setw(8) << locpos.Y() <<" " <<
208 setw(8) << locpos.Z() << " " <<
209 setw(9) << nprimaries << " ";
210 for (Int_t iprimary=0; iprimary<nprimaries; iprimary++)
211 cout << setw(4) << primaries[iprimary] << " ";
212 cout << endl;
213 }
214 }
2aad621e 215
216
031f0861 217 if (fDebugReconstruction) cout << "DebugReconstruction>>>> Start making track segments(unfolding+tracksegments)" << endl;
83974468 218 fTrackSegmentMaker->MakeTrackSegments(dl, emccl, ppsdl, trsl) ;
2aad621e 219
83974468 220 // mark the position of the TrackSegments in the array
221 AliPHOSTrackSegment * trs ;
222 for (index = 0 ; index < trsl->GetEntries() ; index++) {
223 trs = (AliPHOSTrackSegment * )trsl->At(index) ;
224 trs->SetIndexInList(index) ;
225 }
031f0861 226 if (fDebugReconstruction){
227 cout << "DebugReconstruction>>> Track segment list entries is " << trsl->GetEntries() << endl ;
228 cout << "DebugReconstruction>>> Module " <<
229 "Ene(KeV) " <<
51926850 230 "Index " <<
231 " X " <<
232 " Y " <<
233 " Z " <<
234 " rX " <<
235 " rY " <<
236 " rZ " <<
237 "Nprim " <<
238 " Primaries list " << endl;
2aad621e 239
031f0861 240 for (index = 0 ; index < trsl->GetEntries() ; index++) {
241 trs = (AliPHOSTrackSegment * )trsl->At(index) ;
242 TVector3 locpos; trs->GetPosition(locpos);
243 Int_t * primaries;
244 Int_t nprimaries;
245 primaries = trs->GetPrimariesEmc(nprimaries);
246 cout << "DebugReconstruction>>> " <<
247 setw(4) << trs->GetPHOSMod() << " " <<
248 setw(9) << 1000.*trs->GetEnergy() << " " <<
249 setw(3) << trs->GetIndexInList() << " " <<
250 setw(9) << locpos.X() <<" " <<
251 setw(9) << locpos.Y() <<" " <<
252 setw(9) << locpos.Z() << " " <<
253 setw(10) << (trs->GetMomentumDirection()).X() << " " <<
254 setw(10) << (trs->GetMomentumDirection()).Y() << " " <<
255 setw(10) << (trs->GetMomentumDirection()).Z() << " " <<
51926850 256 setw(4) << nprimaries << " ";
257 for (Int_t iprimary=0; iprimary<nprimaries; iprimary++)
258 cout << setw(4) << primaries[iprimary] << " ";
259 cout << endl;
2aad621e 260 }
261
031f0861 262 }
2aad621e 263 if (fDebugReconstruction) cout << "DebugReconstruction>>>> Start making reconstructed particles" << endl;
83974468 264
0dd37dda 265 fPID->MakeParticles(trsl, rpl) ;
83974468 266
267 // mark the position of the RecParticles in the array
268 AliPHOSRecParticle * rp ;
269 for (index = 0 ; index < rpl->GetEntries() ; index++) {
270 rp = (AliPHOSRecParticle * )rpl->At(index) ;
271 rp->SetIndexInList(index) ;
272 }
2aad621e 273 //Debugger of RecParticles
51926850 274 if (fDebugReconstruction){
2aad621e 275 cout << "DebugReconstruction>>> Reconstructed particle list entries is " << rpl->GetEntries() << endl ;
276 cout << "DebugReconstruction>>> Module " <<
277 " PARTICLE " <<
51926850 278 "Ene(KeV) " <<
279 "Index " <<
280 " X " <<
281 " Y " <<
282 " Z " <<
283 "Nprim " <<
284 " Primaries list " << endl;
2aad621e 285 for (index = 0 ; index < rpl->GetEntries() ; index++) {
286 rp = (AliPHOSRecParticle * ) rpl->At(index) ;
287 TVector3 locpos; (rp->GetPHOSTrackSegment())->GetPosition(locpos);
288 Int_t * primaries;
289 Int_t nprimaries;
290 Text_t particle[11];
291 primaries = (rp->GetPHOSTrackSegment())->GetPrimariesEmc(nprimaries);
292 switch(rp->GetType())
293 {
9ec91567 294 case AliPHOSFastRecParticle::kNEUTRALEM:
e126816e 295 strcpy( particle, "NEUTRAL_EM");
2aad621e 296 break;
9ec91567 297 case AliPHOSFastRecParticle::kNEUTRALHA:
e126816e 298 strcpy(particle, "NEUTRAL_HA");
2aad621e 299 break;
9ec91567 300 case AliPHOSFastRecParticle::kGAMMA:
e126816e 301 strcpy(particle, "GAMMA");
2aad621e 302 break ;
9ec91567 303 case AliPHOSFastRecParticle::kGAMMAHA:
e126816e 304 strcpy(particle, "GAMMA_H");
2aad621e 305 break ;
9ec91567 306 case AliPHOSFastRecParticle::kABSURDEM:
e126816e 307 strcpy(particle, "ABSURD_EM") ;
2aad621e 308 break ;
9ec91567 309 case AliPHOSFastRecParticle::kABSURDHA:
e126816e 310 strcpy(particle, "ABSURD_HA") ;
2aad621e 311 break ;
9ec91567 312 case AliPHOSFastRecParticle::kELECTRON:
e126816e 313 strcpy(particle, "ELECTRON") ;
2aad621e 314 break ;
9ec91567 315 case AliPHOSFastRecParticle::kCHARGEDHA:
e126816e 316 strcpy(particle, "CHARGED_HA") ;
2aad621e 317 break ;
318 }
319
320 cout << "DebugReconstruction>>> " <<
321 setw(4) << (rp->GetPHOSTrackSegment())->GetPHOSMod() << " " <<
322 setw(15) << particle << " " <<
323 setw(9) << 1000.*(rp->GetPHOSTrackSegment())->GetEnergy() << " " <<
324 setw(3) << rp->GetIndexInList() << " " <<
325 setw(9) << locpos.X() <<" " <<
326 setw(9) << locpos.Y() <<" " <<
327 setw(9) << locpos.Z() << " " <<
51926850 328 setw(4) << nprimaries << " ";
329 for (Int_t iprimary=0; iprimary<nprimaries; iprimary++)
330 cout << setw(4) << primaries[iprimary] << " ";
331 cout << endl;
2aad621e 332 }
333
334 }
335
336
d15a28e7 337}
51926850 338
339//____________________________________________________________________________
340 void AliPHOSReconstructioner::Make(DigitsList * dl,
341 AliPHOSRecPoint::RecPointsList * emccl,
342 AliPHOSRecPoint::RecPointsList * cpvcl)
343{
344
345 // Launches the Reconstruction process of EMC and CPV in the sequence:
346 // Make the reconstructed poins (clusterize)
347 // Make the track segments
348 // Particle identification is not made here
349 // EMC and CPV rec.points are the same yet
350 //
351 // Yuri Kharlov. 20 October 2000
352
353 Int_t index ;
354
355 // Making Clusters
356 if (fDebugReconstruction)
357 cout << "DebugReconstruction>>> Start clusterizing reconstructed points" << endl;
358 fClusterizer->MakeClusters(dl, emccl, cpvcl);
359
360 if (fDebugReconstruction){
361 // Digit Debuging
362 cout << "AliPHOSReconstructioner: Digit list entries are " << dl->GetEntries() << endl ;
363 cout << "AliPHOSReconstructioner: EMC list entries are " << emccl->GetEntries() << endl ;
364 cout << "AliPHOSReconstructioner: CPV list entries are " << cpvcl->GetEntries() << endl ;
365 cout << ">>>>>>>>>>>>>>>>>>>>>> DebugReconstruction <<<<<<<<<<<<<<<<<<<<<<<<<<" << endl ;
366 cout << "DebugReconstruction>>> Digit list entries is " << dl->GetEntries() << endl ;
367 AliPHOSDigit * digit;
368 Bool_t calorimeter ;
369 Float_t factor;
370 cout << "DebugReconstruction>>> Vol Id " <<
371 " Ene(MeV, KeV) " <<
372 " Index " <<
373 " Nprim " <<
374 " Primaries list " << endl;
375 for (index = 0 ; index < dl->GetEntries() ; index++) {
376 digit = (AliPHOSDigit * ) dl->At(index) ;
377 calorimeter = fClusterizer->IsInEmc(digit);
378 if (calorimeter) factor =1000. ; else factor=1000000.;
379 cout << "DebugReconstruction>>> " <<
380 setw(8) << digit->GetId() << " " <<
381 setw(3) << (Int_t) calorimeter <<
382 setw(10) << factor*fClusterizer->Calibrate(digit->GetAmp()) << " " <<
383 setw(6) << digit->GetIndexInList() << " " <<
384 setw(5) << digit->GetNprimary() <<" ";
385 for (Int_t iprimary=0; iprimary<digit->GetNprimary(); iprimary++)
386 cout << setw(5) << digit->GetPrimary(iprimary+1) << " ";
387 cout << endl;
388 }
389
390 }
391
392 // mark the position of the RecPoints in the array
393 AliPHOSEmcRecPoint * emcrp ;
a3dfe79c 394 Int_t currentPHOSModule;
51926850 395 for (index = 0 ; index < emccl->GetEntries() ; index++) {
396 emcrp = (AliPHOSEmcRecPoint * )emccl->At(index) ;
397 emcrp ->SetIndexInList(index) ;
398 TVector3 locpos; emcrp->GetLocalPosition(locpos);
a3dfe79c 399 currentPHOSModule = emcrp->GetPHOSMod();
51926850 400 }
0b06c60d 401 AliPHOSCpvRecPoint * cpvrp ;
51926850 402 for (index = 0 ; index < cpvcl->GetEntries() ; index++) {
0b06c60d 403 cpvrp = (AliPHOSCpvRecPoint * )cpvcl->At(index) ;
51926850 404 cpvrp ->SetIndexInList(index) ;
0b06c60d 405 TVector3 locpos; cpvrp->GetLocalPosition(locpos);
406 Int_t lengX,lengZ; cpvrp->GetClusterLengths(lengX,lengZ);
a3dfe79c 407 currentPHOSModule = cpvrp->GetPHOSMod();
51926850 408 }
409
410 if (fDebugReconstruction)
411 cout << "DebugReconstruction>>>> Start unfolding reconstructed points" << endl;
412 fTrackSegmentMaker->MakeTrackSegmentsCPV(dl, emccl, cpvcl) ;
413}