]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALTowerRecPoint.cxx
Initialized to a large size enough for dN/deta =80000 the array of primaries
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALTowerRecPoint.cxx
CommitLineData
ab48128d 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
16/* $Id$ */
17
18//_________________________________________________________________________
19// RecPoint implementation for EMCAL-EMC
20// An TowerRecPoint is a cluster of digits
21//*--
22//*-- Author: Dmitri Peressounko (RRC KI & SUBATECH)
23
24
25// --- ROOT system ---
26#include "TPad.h"
27#include "TH2.h"
28#include "TMath.h"
29#include "TCanvas.h"
30
31// --- Standard library ---
32
33#include <iostream.h>
34
35// --- AliRoot header files ---
36
37 #include "AliGenerator.h"
38#include "AliEMCALGeometry.h"
39#include "AliEMCALTowerRecPoint.h"
40#include "AliRun.h"
41#include "AliEMCALGetter.h"
42
43ClassImp(AliEMCALTowerRecPoint)
44
45//____________________________________________________________________________
46AliEMCALTowerRecPoint::AliEMCALTowerRecPoint() : AliEMCALRecPoint()
47{
48 // ctor
49
50 fMulDigit = 0 ;
51 fAmp = 0. ;
52 fCoreEnergy = 0 ;
53 fEnergyList = 0 ;
54 fTime = -1. ;
55 fLocPos.SetX(1000000.) ; //Local position should be evaluated
56
57}
58
59//____________________________________________________________________________
60AliEMCALTowerRecPoint::AliEMCALTowerRecPoint(const char * opt) : AliEMCALRecPoint(opt)
61{
62 // ctor
63
64 fMulDigit = 0 ;
65 fAmp = 0. ;
66 fCoreEnergy = 0 ;
67 fEnergyList = 0 ;
68 fTime = -1. ;
69 fLocPos.SetX(1000000.) ; //Local position should be evaluated
70
71}
72
73//____________________________________________________________________________
74AliEMCALTowerRecPoint::~AliEMCALTowerRecPoint()
75{
76 // dtor
77
78 if ( fEnergyList )
79 delete[] fEnergyList ;
80}
81
82//____________________________________________________________________________
83void AliEMCALTowerRecPoint::AddDigit(AliEMCALDigit & digit, Float_t Energy)
84{
85 // Adds a digit to the RecPoint
86 // and accumulates the total amplitude and the multiplicity
87
88 if(fEnergyList == 0)
89 fEnergyList = new Float_t[fMaxDigit];
90
91 if ( fMulDigit >= fMaxDigit ) { // increase the size of the lists
92 fMaxDigit*=2 ;
93 Int_t * tempo = new ( Int_t[fMaxDigit] ) ;
94 Float_t * tempoE = new ( Float_t[fMaxDigit] ) ;
95
96 Int_t index ;
97 for ( index = 0 ; index < fMulDigit ; index++ ){
98 tempo[index] = fDigitsList[index] ;
99 tempoE[index] = fEnergyList[index] ;
100 }
101
102 delete [] fDigitsList ;
103 fDigitsList = new ( Int_t[fMaxDigit] ) ;
104
105 delete [] fEnergyList ;
106 fEnergyList = new ( Float_t[fMaxDigit] ) ;
107
108 for ( index = 0 ; index < fMulDigit ; index++ ){
109 fDigitsList[index] = tempo[index] ;
110 fEnergyList[index] = tempoE[index] ;
111 }
112
113 delete [] tempo ;
114 delete [] tempoE ;
115 } // if
116
117 fDigitsList[fMulDigit] = digit.GetIndexInList() ;
118 fEnergyList[fMulDigit] = Energy ;
119 fMulDigit++ ;
120 fAmp += Energy ;
121
122 // EvalEMCALMod(&digit) ;
123}
124
125//____________________________________________________________________________
126Bool_t AliEMCALTowerRecPoint::AreNeighbours(AliEMCALDigit * digit1, AliEMCALDigit * digit2 ) const
127{
128 // Tells if (true) or not (false) two digits are neighbors
129
130 Bool_t aren = kFALSE ;
131
132 AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
133 AliEMCALGeometry * phosgeom = (AliEMCALGeometry*)gime->EMCALGeometry();
134
135 Int_t relid1[4] ;
136 phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ;
137
138 Int_t relid2[4] ;
139 phosgeom->AbsToRelNumbering(digit2->GetId(), relid2) ;
140
141 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
142 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
143
144 if (( coldiff <= 1 ) && ( rowdiff <= 1 ) && (coldiff + rowdiff > 0))
145 aren = kTRUE ;
146
147 return aren ;
148}
149
150//____________________________________________________________________________
151Int_t AliEMCALTowerRecPoint::Compare(const TObject * obj) const
152{
153 // Compares two RecPoints according to their position in the EMCAL modules
154
155 Float_t delta = 1 ; //Width of "Sorting row". If you changibg this
156 //value (what is senseless) change as vell delta in
157 //AliEMCALTrackSegmentMakerv* and other RecPoints...
158 Int_t rv ;
159
160 AliEMCALTowerRecPoint * clu = (AliEMCALTowerRecPoint *)obj ;
161
162
163 Int_t phosmod1 = GetEMCALArm() ;
164 Int_t phosmod2 = clu->GetEMCALArm() ;
165
166 TVector3 locpos1;
167 GetLocalPosition(locpos1) ;
168 TVector3 locpos2;
169 clu->GetLocalPosition(locpos2) ;
170
171 if(phosmod1 == phosmod2 ) {
172 Int_t rowdif = (Int_t)TMath::Ceil(locpos1.X()/delta)-(Int_t)TMath::Ceil(locpos2.X()/delta) ;
173 if (rowdif> 0)
174 rv = 1 ;
175 else if(rowdif < 0)
176 rv = -1 ;
177 else if(locpos1.Z()>locpos2.Z())
178 rv = -1 ;
179 else
180 rv = 1 ;
181 }
182
183 else {
184 if(phosmod1 < phosmod2 )
185 rv = -1 ;
186 else
187 rv = 1 ;
188 }
189
190 return rv ;
191}
192//______________________________________________________________________________
193void AliEMCALTowerRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py) const
194{
195
196 // Execute action corresponding to one event
197 // This member function is called when a AliEMCALRecPoint is clicked with the locator
198 //
199 // If Left button is clicked on AliEMCALRecPoint, the digits are switched on
200 // and switched off when the mouse button is released.
201
202
203 // AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
204// if(!gime) return ;
205// AliEMCALGeometry * emcalgeom = (AliEMCALGeometry*)gime->EMCALGeometry();
206
207// static TGraph * digitgraph = 0 ;
208
209// if (!gPad->IsEditable()) return;
210
211// TH2F * histo = 0 ;
212// TCanvas * histocanvas ;
213
214// const TClonesArray * digits = gime->Digits() ;
215
216// switch (event) {
217
218// case kButton1Down: {
219// AliEMCALDigit * digit ;
220// Int_t iDigit;
221// Int_t relid[4] ;
222
223// const Int_t kMulDigit = AliEMCALTowerRecPoint::GetDigitsMultiplicity() ;
224// Float_t * xi = new Float_t[kMulDigit] ;
225// Float_t * zi = new Float_t[kMulDigit] ;
226
227// // create the histogram for the single cluster
228// // 1. gets histogram boundaries
229// Float_t ximax = -999. ;
230// Float_t zimax = -999. ;
231// Float_t ximin = 999. ;
232// Float_t zimin = 999. ;
233
234// for(iDigit=0; iDigit<kMulDigit; iDigit++) {
235// digit = (AliEMCALDigit *) digits->At(fDigitsList[iDigit]) ;
236// emcalgeom->AbsToRelNumbering(digit->GetId(), relid) ;
237// emcalgeom->RelPosInModule(relid, xi[iDigit], zi[iDigit]);
238// if ( xi[iDigit] > ximax )
239// ximax = xi[iDigit] ;
240// if ( xi[iDigit] < ximin )
241// ximin = xi[iDigit] ;
242// if ( zi[iDigit] > zimax )
243// zimax = zi[iDigit] ;
244// if ( zi[iDigit] < zimin )
245// zimin = zi[iDigit] ;
246// }
247// ximax += emcalgeom->GetCrystalSize(0) / 2. ;
248// zimax += emcalgeom->GetCrystalSize(2) / 2. ;
249// ximin -= emcalgeom->GetCrystalSize(0) / 2. ;
250// zimin -= emcalgeom->GetCrystalSize(2) / 2. ;
251// Int_t xdim = (int)( (ximax - ximin ) / emcalgeom->GetCrystalSize(0) + 0.5 ) ;
252// Int_t zdim = (int)( (zimax - zimin ) / emcalgeom->GetCrystalSize(2) + 0.5 ) ;
253
254// // 2. gets the histogram title
255
256// Text_t title[100] ;
257// sprintf(title,"Energy=%1.2f GeV ; Digits ; %d ", GetEnergy(), GetDigitsMultiplicity()) ;
258
259// if (!histo) {
260// delete histo ;
261// histo = 0 ;
262// }
263// histo = new TH2F("cluster3D", title, xdim, ximin, ximax, zdim, zimin, zimax) ;
264
265// Float_t x, z ;
266// for(iDigit=0; iDigit<kMulDigit; iDigit++) {
267// digit = (AliEMCALDigit *) digits->At(fDigitsList[iDigit]) ;
268// emcalgeom->AbsToRelNumbering(digit->GetId(), relid) ;
269// emcalgeom->RelPosInModule(relid, x, z);
270// histo->Fill(x, z, fEnergyList[iDigit] ) ;
271// }
272
273// if (!digitgraph) {
274// digitgraph = new TGraph(kMulDigit,xi,zi);
275// digitgraph-> SetMarkerStyle(5) ;
276// digitgraph-> SetMarkerSize(1.) ;
277// digitgraph-> SetMarkerColor(1) ;
278// digitgraph-> Paint("P") ;
279// }
280
281// // Print() ;
282// histocanvas = new TCanvas("cluster", "a single cluster", 600, 500) ;
283// histocanvas->Draw() ;
284// histo->Draw("lego1") ;
285
286// delete[] xi ;
287// delete[] zi ;
288
289// break;
290// }
291
292// case kButton1Up:
293// if (digitgraph) {
294// delete digitgraph ;
295// digitgraph = 0 ;
296// }
297// break;
298
299// }
300}
301
302//____________________________________________________________________________
303void AliEMCALTowerRecPoint::EvalDispersion(Float_t logWeight,TClonesArray * digits)
304{
305 // Calculates the dispersion of the shower at the origine of the RecPoint
306
307 Float_t d = 0. ;
308 Float_t wtot = 0. ;
309
310 AliEMCALDigit * digit ;
311
312 AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
313 AliEMCALGeometry * emcalgeom = (AliEMCALGeometry*)gime->EMCALGeometry();
314
315
316 // Calculates the center of gravity in the local EMCAL-module coordinates
317
318 Int_t iDigit;
319 Int_t relid[4] ;
320
321 if (!fTheta || !fPhi ) {
322 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
323 digit = dynamic_cast<AliEMCALDigit *>(digits->At(fDigitsList[iDigit])) ;
324
325 Float_t thetai ;
326 Float_t phii ;
327 emcalgeom->AbsToRelNumbering(digit->GetId(), relid) ;
328 emcalgeom->PosInAlice(relid, thetai, phii);
329 Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
330 fTheta = fTheta + thetai * w ;
331 fPhi += (phii * w );
332 wtot += w ;
333 }
334
335 fTheta /= wtot ;
336 fPhi /= wtot ;
337 }
338
339 const Float_t kDeg2Rad = TMath::Pi() / static_cast<Double_t>(180) ;
340
341 Float_t cyl_radius = emcalgeom->GetIPDistance()+emcalgeom->GetAirGap() ;
342 Float_t x = cyl_radius * TMath::Cos(fPhi * kDeg2Rad ) ;
343 Float_t y = cyl_radius * TMath::Cos(fPhi * kDeg2Rad ) ;
344 Float_t z = cyl_radius * TMath::Tan(fTheta * kDeg2Rad ) ;
345
346// Calculates the dispersion in coordinates
347 wtot = 0.;
348 for(iDigit=0; iDigit < fMulDigit; iDigit++) {
349 digit = (AliEMCALDigit *) digits->At(fDigitsList[iDigit]) ;
350 Float_t thetai = 0. ;
351 Float_t phii = 0.;
352 emcalgeom->AbsToRelNumbering(digit->GetId(), relid) ;
353 emcalgeom->PosInAlice(relid, thetai, phii);
354 Float_t xi = cyl_radius * TMath::Cos(phii * kDeg2Rad ) ;
355 Float_t yi = cyl_radius * TMath::Sin(phii * kDeg2Rad ) ;
356 Float_t zi = cyl_radius * TMath::Tan(thetai * kDeg2Rad ) ;
357
358 Float_t w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
359 d += w*((xi-x)*(xi-x) + (yi-y)*(yi-y)+ (zi-z)*(zi-z) ) ;
360 wtot+=w ;
361 }
362
363 d /= wtot ;
364
365 fDispersion = TMath::Sqrt(d) ;
366
367}
368//______________________________________________________________________________
369void AliEMCALTowerRecPoint::EvalCoreEnergy(Float_t logWeight, TClonesArray * digits)
370{
371 // This function calculates energy in the core,
372 // i.e. within a radius rad = 3cm around the center. Beyond this radius
373 // in accordance with shower profile the energy deposition
374 // should be less than 2%
375
376 Float_t coreRadius = 10. ;
377
378 AliEMCALDigit * digit ;
379 Int_t relid[4] ;
380 Float_t wtot = 0. ;
381
382 AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
383 AliEMCALGeometry * emcalgeom = (AliEMCALGeometry*)gime->EMCALGeometry();
384
385 Int_t iDigit;
386
387 if (!fTheta || !fPhi ) {
388 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
389 digit = dynamic_cast<AliEMCALDigit *>(digits->At(fDigitsList[iDigit])) ;
390
391 Float_t thetai ;
392 Float_t phii ;
393 emcalgeom->AbsToRelNumbering(digit->GetId(), relid) ;
394 emcalgeom->PosInAlice(relid, thetai, phii);
395 Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
396 fTheta = fTheta + thetai * w ;
397 fPhi += (phii * w );
398 wtot += w ;
399 }
400
401 fTheta /= wtot ;
402 fPhi /= wtot ;
403 }
404
405 const Float_t kDeg2Rad = TMath::Pi() / static_cast<Double_t>(180) ;
406
407 Float_t cyl_radius = emcalgeom->GetIPDistance()+emcalgeom->GetAirGap() ;
408 Float_t x = cyl_radius * TMath::Cos(fPhi * kDeg2Rad ) ;
409 Float_t y = cyl_radius * TMath::Cos(fPhi * kDeg2Rad ) ;
410 Float_t z = cyl_radius * TMath::Tan(fTheta * kDeg2Rad ) ;
411
412 for(iDigit=0; iDigit < fMulDigit; iDigit++) {
413 digit = (AliEMCALDigit *) ( digits->At(fDigitsList[iDigit]) ) ;
414 Int_t relid[4] ;
415 Float_t thetai = 0. ;
416 Float_t phii = 0. ;
417 emcalgeom->AbsToRelNumbering(digit->GetId(), relid) ;
418 emcalgeom->PosInAlice(relid, thetai, phii);
419
420 Float_t xi = cyl_radius * TMath::Cos(phii * kDeg2Rad ) ;
421 Float_t yi = cyl_radius * TMath::Sin(phii * kDeg2Rad ) ;
422 Float_t zi = cyl_radius * TMath::Tan(thetai * kDeg2Rad ) ;
423
424 Float_t distance = TMath::Sqrt((xi-x)*(xi-x)+(yi-y)*(yi-y)+(zi-z)*(zi-z)) ;
425 if(distance < coreRadius)
426 fCoreEnergy += fEnergyList[iDigit] ;
427 }
428
429}
430
431//____________________________________________________________________________
432void AliEMCALTowerRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digits)
433{
434 // Calculates the axis of the shower ellipsoid
435
436 Double_t wtot = 0. ;
437 Double_t x = 0.;
438 Double_t z = 0.;
439 Double_t dxx = 0.;
440 Double_t dzz = 0.;
441 Double_t dxz = 0.;
442
443 AliEMCALDigit * digit ;
444
445 AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
446 AliEMCALGeometry * emcalgeom = (AliEMCALGeometry*)gime->EMCALGeometry();
447
448 Int_t iDigit;
449 const Float_t kDeg2Rad = TMath::Pi() / static_cast<Double_t>(180) ;
450
451 Float_t cyl_radius = emcalgeom->GetIPDistance()+emcalgeom->GetAirGap() ;
452
453 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
454 digit = (AliEMCALDigit *) digits->At(fDigitsList[iDigit]) ;
455 Int_t relid[4] ;
456 Float_t thetai = 0. ;
457 Float_t phii = 0. ;
458 emcalgeom->AbsToRelNumbering(digit->GetId(), relid) ;
459 emcalgeom->PosInAlice(relid, thetai, phii);
460 Double_t w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
461 Float_t xi = cyl_radius * TMath::Cos(fPhi * kDeg2Rad ) ;
462 Float_t zi = cyl_radius * TMath::Tan(fTheta * kDeg2Rad ) ;
463 dxx += w * xi * xi ;
464 x += w * xi ;
465 dzz += w * zi * zi ;
466 z += w * zi ;
467 dxz += w * xi * zi ;
468 wtot += w ;
469 }
470 dxx /= wtot ;
471 x /= wtot ;
472 dxx -= x * x ;
473 dzz /= wtot ;
474 z /= wtot ;
475 dzz -= z * z ;
476 dxz /= wtot ;
477 dxz -= x * z ;
478
479// //Apply correction due to non-perpendicular incidence
480// Double_t CosX ;
481// Double_t CosZ ;
482// AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
483// AliEMCALGeometry * emcalgeom = (AliEMCALGeometry*)gime->EMCALGeometry();
484 // Double_t DistanceToIP= (Double_t ) emcalgeom->GetIPDistance() ;
485
486// CosX = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+x*x) ;
487// CosZ = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+z*z) ;
488
489// dxx = dxx/(CosX*CosX) ;
490// dzz = dzz/(CosZ*CosZ) ;
491// dxz = dxz/(CosX*CosZ) ;
492
493
494 fLambda[0] = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
495 if(fLambda[0] > 0)
496 fLambda[0] = TMath::Sqrt(fLambda[0]) ;
497
498 fLambda[1] = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
499 if(fLambda[1] > 0) //To avoid exception if numerical errors lead to negative lambda.
500 fLambda[1] = TMath::Sqrt(fLambda[1]) ;
501 else
502 fLambda[1]= 0. ;
503}
504
505//____________________________________________________________________________
506void AliEMCALTowerRecPoint::EvalAll(Float_t logWeight, TClonesArray * digits )
507{
508 // Evaluates all shower parameters
509
510 AliEMCALRecPoint::EvalAll(logWeight,digits) ;
511 EvalGlobalPosition(logWeight, digits) ;
512 EvalElipsAxis(logWeight, digits) ;
513 EvalDispersion(logWeight, digits) ;
514 EvalCoreEnergy(logWeight, digits);
515 EvalTime(digits) ;
516}
517
518//____________________________________________________________________________
519void AliEMCALTowerRecPoint::EvalGlobalPosition(Float_t logWeight, TClonesArray * digits)
520{
521 // Calculates the center of gravity in the local EMCAL-module coordinates
522 Float_t wtot = 0. ;
523
524 Int_t relid[4] ;
525
526 AliEMCALDigit * digit ;
527
528 AliEMCALGetter * gime = AliEMCALGetter::GetInstance() ;
529 AliEMCALGeometry * emcalgeom = static_cast<AliEMCALGeometry*>(gime->EMCALGeometry());
530 Int_t iDigit;
531
532 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
533 digit = dynamic_cast<AliEMCALDigit *>(digits->At(fDigitsList[iDigit])) ;
534
535 Float_t thetai ;
536 Float_t phii ;
537 emcalgeom->AbsToRelNumbering(digit->GetId(), relid) ;
538 emcalgeom->PosInAlice(relid, thetai, phii);
539 Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
540 fTheta = fTheta + thetai * w ;
541 fPhi += (phii * w );
542 wtot += w ;
543 }
544
545 fTheta /= wtot ;
546 fPhi /= wtot ;
547
548 fLocPos.SetX(0.) ;
549 fLocPos.SetY(0.) ;
550 fLocPos.SetZ(0.) ;
551
552 fLocPosM = 0 ;
553}
554
555//____________________________________________________________________________
556Float_t AliEMCALTowerRecPoint::GetMaximalEnergy(void) const
557{
558 // Finds the maximum energy in the cluster
559
560 Float_t menergy = 0. ;
561
562 Int_t iDigit;
563
564 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
565
566 if(fEnergyList[iDigit] > menergy)
567 menergy = fEnergyList[iDigit] ;
568 }
569 return menergy ;
570}
571
572//____________________________________________________________________________
573Int_t AliEMCALTowerRecPoint::GetMultiplicityAtLevel(const Float_t H) const
574{
575 // Calculates the multiplicity of digits with energy larger than H*energy
576
577 Int_t multipl = 0 ;
578 Int_t iDigit ;
579 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
580
581 if(fEnergyList[iDigit] > H * fAmp)
582 multipl++ ;
583 }
584 return multipl ;
585}
586
587//____________________________________________________________________________
588Int_t AliEMCALTowerRecPoint::GetNumberOfLocalMax(Int_t * maxAt, Float_t * maxAtEnergy,
589 Float_t locMaxCut,TClonesArray * digits) const
590{
591 // Calculates the number of local maxima in the cluster using fLocalMaxCut as the minimum
592 // energy difference between two local maxima
593
594 AliEMCALDigit * digit ;
595 AliEMCALDigit * digitN ;
596
597
598 Int_t iDigitN ;
599 Int_t iDigit ;
600
601 for(iDigit = 0; iDigit < fMulDigit; iDigit++)
602 maxAt[iDigit] = (Int_t) digits->At(fDigitsList[iDigit]) ;
603
604
605 for(iDigit = 0 ; iDigit < fMulDigit; iDigit++) {
606 if(maxAt[iDigit] != -1) {
607 digit = (AliEMCALDigit *) maxAt[iDigit] ;
608
609 for(iDigitN = 0; iDigitN < fMulDigit; iDigitN++) {
610 digitN = (AliEMCALDigit *) digits->At(fDigitsList[iDigitN]) ;
611
612 if ( AreNeighbours(digit, digitN) ) {
613 if (fEnergyList[iDigit] > fEnergyList[iDigitN] ) {
614 maxAt[iDigitN] = -1 ;
615 // but may be digit too is not local max ?
616 if(fEnergyList[iDigit] < fEnergyList[iDigitN] + locMaxCut)
617 maxAt[iDigit] = -1 ;
618 }
619 else {
620 maxAt[iDigit] = -1 ;
621 // but may be digitN too is not local max ?
622 if(fEnergyList[iDigit] > fEnergyList[iDigitN] - locMaxCut)
623 maxAt[iDigitN] = -1 ;
624 }
625 } // if Areneighbours
626 } // while digitN
627 } // slot not empty
628 } // while digit
629
630 iDigitN = 0 ;
631 for(iDigit = 0; iDigit < fMulDigit; iDigit++) {
632 if(maxAt[iDigit] != -1){
633 maxAt[iDigitN] = maxAt[iDigit] ;
634 maxAtEnergy[iDigitN] = fEnergyList[iDigit] ;
635 iDigitN++ ;
636 }
637 }
638 return iDigitN ;
639}
640//____________________________________________________________________________
641void AliEMCALTowerRecPoint::EvalTime(TClonesArray * digits){
642
643 Float_t maxE = 0;
644 Int_t maxAt = 0;
645 for(Int_t idig=0; idig < fMulDigit; idig++){
646 if(fEnergyList[idig] > maxE){
647 maxE = fEnergyList[idig] ;
648 maxAt = idig;
649 }
650 }
651 fTime = ((AliEMCALDigit*) digits->At(fDigitsList[maxAt]))->GetTime() ;
652
653}
654//____________________________________________________________________________
655void AliEMCALTowerRecPoint::Print(Option_t * option)
656{
657 // Print the list of digits belonging to the cluster
658
659 cout << "AliEMCALTowerRecPoint: " << endl ;
660
661 Int_t iDigit;
662 cout << " digits # = " ;
663 for(iDigit=0; iDigit<fMulDigit; iDigit++)
664 cout << fDigitsList[iDigit] << " " ;
665 cout << endl ;
666
667 cout << " Energies = " ;
668 for(iDigit=0; iDigit<fMulDigit; iDigit++)
669 cout << fEnergyList[iDigit] << " ";
670 cout << endl ;
671
672 cout << " Primaries " ;
673 for(iDigit = 0;iDigit < fMulTrack; iDigit++)
674 cout << fTracksList[iDigit] << " " << endl ;
675
676 cout << " Multiplicity = " << fMulDigit << endl ;
677 cout << " Cluster Energy = " << fAmp << endl ;
678 cout << " Number of primaries " << fMulTrack << endl ;
679 cout << " Stored at position " << GetIndexInList() << endl ;
680
681}
682