1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 /* History of cvs commits:
21 * Revision 1.57 2007/04/05 10:18:58 policheh
22 * Introduced distance to nearest bad crystal.
24 * Revision 1.56 2007/03/06 06:47:28 kharlov
25 * DP:Possibility to use actual vertex position added
27 * Revision 1.55 2007/01/19 20:31:19 kharlov
28 * Improved formatting for Print()
30 * Revision 1.54 2006/08/28 10:01:56 kharlov
31 * Effective C++ warnings fixed (Timur Pocheptsov)
33 * Revision 1.53 2005/12/20 14:28:47 hristov
34 * Additional protection
36 * Revision 1.52 2005/05/28 14:19:04 schutz
37 * Compilation warnings fixed by T.P.
41 //_________________________________________________________________________
42 // RecPoint implementation for PHOS-EMC
43 // An EmcRecPoint is a cluster of digits
45 //*-- Author: Dmitri Peressounko (RRC KI & SUBATECH)
48 // --- ROOT system ---
54 // --- Standard library ---
56 // --- AliRoot header files ---
58 #include "AliPHOSLoader.h"
59 #include "AliGenerator.h"
60 #include "AliPHOSGeometry.h"
61 #include "AliPHOSDigit.h"
62 #include "AliPHOSEmcRecPoint.h"
64 ClassImp(AliPHOSEmcRecPoint)
66 //____________________________________________________________________________
67 AliPHOSEmcRecPoint::AliPHOSEmcRecPoint() :
69 fCoreEnergy(0.), fDispersion(0.),
70 fEnergyList(0), fTime(-1.), fNExMax(0),
71 fM2x(0.), fM2z(0.), fM3x(0.), fM4z(0.),
72 fPhixe(0.), fDistToBadCrystal(-1),fDebug(0)
77 fLocPos.SetX(1000000.) ; //Local position should be evaluated
80 //____________________________________________________________________________
81 AliPHOSEmcRecPoint::AliPHOSEmcRecPoint(const char * opt) :
83 fCoreEnergy(0.), fDispersion(0.),
84 fEnergyList(0), fTime(-1.), fNExMax(0),
85 fM2x(0.), fM2z(0.), fM3x(0.), fM4z(0.),
86 fPhixe(0.), fDistToBadCrystal(-1), fDebug(0)
91 fLocPos.SetX(1000000.) ; //Local position should be evaluated
94 //____________________________________________________________________________
95 AliPHOSEmcRecPoint::AliPHOSEmcRecPoint(const AliPHOSEmcRecPoint & rp) :
97 fCoreEnergy(rp.fCoreEnergy), fDispersion(rp.fDispersion),
98 fEnergyList(0), fTime(rp.fTime), fNExMax(rp.fNExMax),
99 fM2x(rp.fM2x), fM2z(rp.fM2z), fM3x(rp.fM3x), fM4z(rp.fM4z),
100 fPhixe(rp.fPhixe), fDistToBadCrystal(rp.fDistToBadCrystal), fDebug(rp.fDebug)
103 fMulDigit = rp.fMulDigit ;
105 fEnergyList = new Float_t[rp.fMulDigit] ;
107 for(index = 0 ; index < fMulDigit ; index++)
108 fEnergyList[index] = rp.fEnergyList[index] ;
111 //____________________________________________________________________________
112 AliPHOSEmcRecPoint::~AliPHOSEmcRecPoint()
116 delete[] fEnergyList ;
119 //____________________________________________________________________________
120 void AliPHOSEmcRecPoint::AddDigit(AliPHOSDigit & digit, Float_t Energy)
122 // Adds a digit to the RecPoint
123 // and accumulates the total amplitude and the multiplicity
126 fEnergyList = new Float_t[fMaxDigit];
128 if ( fMulDigit >= fMaxDigit ) { // increase the size of the lists
130 Int_t * tempo = new Int_t[fMaxDigit];
131 Float_t * tempoE = new Float_t[fMaxDigit];
134 for ( index = 0 ; index < fMulDigit ; index++ ){
135 tempo[index] = fDigitsList[index] ;
136 tempoE[index] = fEnergyList[index] ;
139 delete [] fDigitsList ;
140 fDigitsList = new Int_t[fMaxDigit];
142 delete [] fEnergyList ;
143 fEnergyList = new Float_t[fMaxDigit];
145 for ( index = 0 ; index < fMulDigit ; index++ ){
146 fDigitsList[index] = tempo[index] ;
147 fEnergyList[index] = tempoE[index] ;
154 fDigitsList[fMulDigit] = digit.GetIndexInList() ;
155 fEnergyList[fMulDigit] = Energy ;
159 EvalPHOSMod(&digit) ;
162 //____________________________________________________________________________
163 Bool_t AliPHOSEmcRecPoint::AreNeighbours(AliPHOSDigit * digit1, AliPHOSDigit * digit2 ) const
165 // Tells if (true) or not (false) two digits are neighbors
167 Bool_t aren = kFALSE ;
169 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
172 phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ;
175 phosgeom->AbsToRelNumbering(digit2->GetId(), relid2) ;
177 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
178 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
180 if (( coldiff <= 1 ) && ( rowdiff <= 1 ) && (coldiff + rowdiff > 0))
186 //____________________________________________________________________________
187 Int_t AliPHOSEmcRecPoint::Compare(const TObject * obj) const
189 // Compares two RecPoints according to their position in the PHOS modules
191 const Float_t delta = 1 ; //Width of "Sorting row". If you changibg this
192 //value (what is senseless) change as vell delta in
193 //AliPHOSTrackSegmentMakerv* and other RecPoints...
196 AliPHOSEmcRecPoint * clu = (AliPHOSEmcRecPoint *)obj ;
199 Int_t phosmod1 = GetPHOSMod() ;
200 Int_t phosmod2 = clu->GetPHOSMod() ;
203 GetLocalPosition(locpos1) ;
205 clu->GetLocalPosition(locpos2) ;
207 if(phosmod1 == phosmod2 ) {
208 Int_t rowdif = (Int_t)TMath::Ceil(locpos1.X()/delta)-(Int_t)TMath::Ceil(locpos2.X()/delta) ;
213 else if(locpos1.Z()>locpos2.Z())
220 if(phosmod1 < phosmod2 )
228 //______________________________________________________________________________
229 void AliPHOSEmcRecPoint::ExecuteEvent(Int_t event, Int_t, Int_t) /*const*/
232 // Execute action corresponding to one event
233 // This member function is called when a AliPHOSRecPoint is clicked with the locator
235 // If Left button is clicked on AliPHOSRecPoint, the digits are switched on
236 // and switched off when the mouse button is released.
239 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance();
241 static TGraph * digitgraph = 0 ;
243 if (!gPad->IsEditable()) return;
246 TCanvas * histocanvas ;
249 //try to get run loader from default event folder
250 AliRunLoader* rn = AliRunLoader::GetRunLoader(AliConfig::GetDefaultEventFolderName());
253 AliError(Form("Cannot find Run Loader in Default Event Folder"));
256 AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(rn->GetLoader("PHOSLoader"));
259 AliError(Form("Cannot find PHOS Loader from Run Loader"));
264 const TClonesArray * digits = gime->Digits() ;
269 AliPHOSDigit * digit ;
273 const Int_t kMulDigit = AliPHOSEmcRecPoint::GetDigitsMultiplicity() ;
274 Float_t * xi = new Float_t[kMulDigit] ;
275 Float_t * zi = new Float_t[kMulDigit] ;
277 // create the histogram for the single cluster
278 // 1. gets histogram boundaries
279 Float_t ximax = -999. ;
280 Float_t zimax = -999. ;
281 Float_t ximin = 999. ;
282 Float_t zimin = 999. ;
284 for(iDigit=0; iDigit<kMulDigit; iDigit++) {
285 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
286 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
287 phosgeom->RelPosInModule(relid, xi[iDigit], zi[iDigit]);
288 if ( xi[iDigit] > ximax )
290 if ( xi[iDigit] < ximin )
292 if ( zi[iDigit] > zimax )
294 if ( zi[iDigit] < zimin )
297 ximax += phosgeom->GetCrystalSize(0) / 2. ;
298 zimax += phosgeom->GetCrystalSize(2) / 2. ;
299 ximin -= phosgeom->GetCrystalSize(0) / 2. ;
300 zimin -= phosgeom->GetCrystalSize(2) / 2. ;
301 Int_t xdim = (int)( (ximax - ximin ) / phosgeom->GetCrystalSize(0) + 0.5 ) ;
302 Int_t zdim = (int)( (zimax - zimin ) / phosgeom->GetCrystalSize(2) + 0.5 ) ;
304 // 2. gets the histogram title
307 sprintf(title,"Energy=%1.2f GeV ; Digits ; %d ", GetEnergy(), GetDigitsMultiplicity()) ;
313 histo = new TH2F("cluster3D", title, xdim, ximin, ximax, zdim, zimin, zimax) ;
316 for(iDigit=0; iDigit<kMulDigit; iDigit++) {
317 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
318 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
319 phosgeom->RelPosInModule(relid, x, z);
320 histo->Fill(x, z, fEnergyList[iDigit] ) ;
324 digitgraph = new TGraph(kMulDigit,xi,zi);
325 digitgraph-> SetMarkerStyle(5) ;
326 digitgraph-> SetMarkerSize(1.) ;
327 digitgraph-> SetMarkerColor(1) ;
328 digitgraph-> Paint("P") ;
332 histocanvas = new TCanvas("cluster", "a single cluster", 600, 500) ;
333 histocanvas->Draw() ;
334 histo->Draw("lego1") ;
352 //____________________________________________________________________________
353 void AliPHOSEmcRecPoint::EvalDispersion(Float_t logWeight,TClonesArray * digits, TVector3 &vInc)
355 // Calculates the dispersion of the shower at the origine of the RecPoint
356 //DP: should we correct dispersion for non-perpendicular hit????????
364 AliPHOSDigit * digit ;
366 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance();
368 // Calculates the center of gravity in the local PHOS-module coordinates
372 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
373 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
377 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
378 phosgeom->RelPosInModule(relid, xi, zi);
379 if (fAmp>0 && fEnergyList[iDigit]>0) {
380 Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
386 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
393 AliError(Form("Wrong weight %f\n", wtot));
396 // Calculates the dispersion in coordinates
398 for(iDigit=0; iDigit < fMulDigit; iDigit++) {
399 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
403 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
404 phosgeom->RelPosInModule(relid, xi, zi);
405 if (fAmp>0 && fEnergyList[iDigit]>0) {
406 Float_t w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
407 d += w*((xi-x)*(xi-x) + (zi-z)*(zi-z) ) ;
411 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
419 AliError(Form("Wrong weight %f\n", wtot));
423 fDispersion = TMath::Sqrt(d) ;
427 //______________________________________________________________________________
428 void AliPHOSEmcRecPoint::EvalCoreEnergy(Float_t logWeight, TClonesArray * digits)
430 // This function calculates energy in the core,
431 // i.e. within a radius rad = 3cm around the center. Beyond this radius
432 // in accordance with shower profile the energy deposition
433 // should be less than 2%
434 //DP: non-perpendicular incidence??????????????
436 Float_t coreRadius = 3 ;
441 AliPHOSDigit * digit ;
443 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance();
447 // Calculates the center of gravity in the local PHOS-module coordinates
449 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
450 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
454 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
455 phosgeom->RelPosInModule(relid, xi, zi);
456 if (fAmp>0 && fEnergyList[iDigit]>0) {
457 Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
463 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
470 AliError(Form("Wrong weight %f\n", wtot));
473 for(iDigit=0; iDigit < fMulDigit; iDigit++) {
474 digit = (AliPHOSDigit *) ( digits->At(fDigitsList[iDigit]) ) ;
478 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
479 phosgeom->RelPosInModule(relid, xi, zi);
480 Float_t distance = TMath::Sqrt((xi-x)*(xi-x)+(zi-z)*(zi-z)) ;
481 if(distance < coreRadius)
482 fCoreEnergy += fEnergyList[iDigit] ;
488 //____________________________________________________________________________
489 void AliPHOSEmcRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digits, TVector3 &vInc)
491 // Calculates the axis of the shower ellipsoid
500 AliPHOSDigit * digit ;
502 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance();
507 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
508 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
512 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
513 phosgeom->RelPosInModule(relid, xi, zi);
514 if (fAmp>0 && fEnergyList[iDigit]>0) {
515 Double_t w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
524 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
536 // //Apply correction due to non-perpendicular incidence
539 // AliPHOSGetter * gime = AliPHOSGetter::Instance() ;
540 // AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
541 // Double_t DistanceToIP= (Double_t ) phosgeom->GetIPtoCrystalSurface() ;
543 // CosX = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+x*x) ;
544 // CosZ = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+z*z) ;
546 // dxx = dxx/(CosX*CosX) ;
547 // dzz = dzz/(CosZ*CosZ) ;
548 // dxz = dxz/(CosX*CosZ) ;
551 fLambda[0] = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
553 fLambda[0] = TMath::Sqrt(fLambda[0]) ;
555 fLambda[1] = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
556 if(fLambda[1] > 0) //To avoid exception if numerical errors lead to negative lambda.
557 fLambda[1] = TMath::Sqrt(fLambda[1]) ;
562 AliError(Form("Wrong weight %f\n", wtot));
563 fLambda[0]=fLambda[1]=0.;
567 //____________________________________________________________________________
568 void AliPHOSEmcRecPoint::EvalMoments(Float_t logWeight,TClonesArray * digits, TVector3 &vInc)
570 // Calculate the shower moments in the eigen reference system
571 // M2x, M2z, M3x, M4z
572 // Calculate the angle between the shower position vector and the eigen vector
580 Double_t lambda0=0, lambda1=0;
582 AliPHOSDigit * digit ;
584 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
588 // 1) Find covariance matrix elements:
596 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
597 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
598 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
599 phosgeom->RelPosInModule(relid, xi, zi);
600 if (fAmp>0 && fEnergyList[iDigit]>0) {
601 w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
610 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
623 // 2) Find covariance matrix eigen values lambda0 and lambda1
625 lambda0 = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
626 lambda1 = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
629 AliError(Form("Wrong weight %f\n", wtot));
633 // 3) Find covariance matrix eigen vectors e0 and e1
637 e0.Set(1.,(lambda0-dxx)/dxz);
642 e1.Set(-e0.Y(),e0.X());
644 // 4) Rotate cluster tensor from (x,z) to (e0,e1) system
645 // and calculate moments M3x and M4z
647 Float_t cosPhi = e0.X();
648 Float_t sinPhi = e0.Y();
652 Double_t dx3, dz3, dz4;
662 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
663 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
664 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
665 phosgeom->RelPosInModule(relid, xiPHOS, ziPHOS);
666 xi = xiPHOS*cosPhi + ziPHOS*sinPhi;
667 zi = ziPHOS*cosPhi - xiPHOS*sinPhi;
668 if (fAmp>0 && fEnergyList[iDigit]>0) {
669 w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
675 dx3 += w * xi * xi * xi;
676 dz3 += w * zi * zi * zi ;
677 dz4 += w * zi * zi * zi * zi ;
681 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
692 dx3 += -3*dxx*x + 2*x*x*x;
693 dz4 += -4*dz3*z + 6*dzz*z*z -3*z*z*z*z;
699 AliError(Form("Wrong weight %f\n", wtot));
701 // 5) Find an angle between cluster center vector and eigen vector e0
705 phi = TMath::ACos ((x*e0.X() + z*e0.Y()) / sqrt(x*x + z*z));
714 //____________________________________________________________________________
715 void AliPHOSEmcRecPoint::EvalAll(Float_t logWeight, TClonesArray * digits )
717 EvalCoreEnergy(logWeight, digits);
719 AliPHOSRecPoint::EvalAll(digits) ;
721 //____________________________________________________________________________
722 void AliPHOSEmcRecPoint::EvalAll(Float_t logWeight, TVector3 &vtx, TClonesArray * digits )
724 // Evaluates all shower parameters
726 EvalLocalPosition(logWeight, vtx, digits,vInc) ;
727 EvalElipsAxis(logWeight, digits, vInc) ; //they are evaluated with momenta
728 EvalMoments(logWeight, digits, vInc) ;
729 EvalDispersion(logWeight, digits, vInc) ;
731 //____________________________________________________________________________
732 void AliPHOSEmcRecPoint::EvalLocalPosition(Float_t logWeight, TVector3 &vtx, TClonesArray * digits, TVector3 &vInc)
734 // Calculates the center of gravity in the local PHOS-module coordinates
742 AliPHOSDigit * digit ;
744 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
748 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
749 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
753 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
754 phosgeom->RelPosInModule(relid, xi, zi);
755 if (fAmp>0 && fEnergyList[iDigit]>0) {
756 Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
762 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
769 AliError(Form("Wrong weight %f\n", wtot));
771 // Correction for the depth of the shower starting point (TDR p 127)
772 Float_t para = 0.925 ;
773 Float_t parb = 6.52 ;
775 phosgeom->GetIncidentVector(vtx,GetPHOSMod(),x,z,vInc) ;
779 if (fAmp>0&&vInc.Y()!=0.) {
780 depthx = ( para * TMath::Log(fAmp) + parb ) * vInc.X()/TMath::Abs(vInc.Y()) ;
781 depthz = ( para * TMath::Log(fAmp) + parb ) * vInc.Z()/TMath::Abs(vInc.Y()) ;
784 AliError(Form("Wrong amplitude %f\n", fAmp));
786 fLocPos.SetX(x - depthx) ;
788 fLocPos.SetZ(z - depthz) ;
793 //____________________________________________________________________________
794 Float_t AliPHOSEmcRecPoint::GetMaximalEnergy(void) const
796 // Finds the maximum energy in the cluster
798 Float_t menergy = 0. ;
802 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
804 if(fEnergyList[iDigit] > menergy)
805 menergy = fEnergyList[iDigit] ;
810 //____________________________________________________________________________
811 Int_t AliPHOSEmcRecPoint::GetMultiplicityAtLevel(Float_t H) const
813 // Calculates the multiplicity of digits with energy larger than H*energy
817 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
819 if(fEnergyList[iDigit] > H * fAmp)
825 //____________________________________________________________________________
826 Int_t AliPHOSEmcRecPoint::GetNumberOfLocalMax( AliPHOSDigit ** maxAt, Float_t * maxAtEnergy,
827 Float_t locMaxCut,TClonesArray * digits) const
829 // Calculates the number of local maxima in the cluster using fLocalMaxCut as the minimum
830 // energy difference between two local maxima
832 AliPHOSDigit * digit ;
833 AliPHOSDigit * digitN ;
839 for(iDigit = 0; iDigit < fMulDigit; iDigit++)
840 maxAt[iDigit] = (AliPHOSDigit*) digits->At(fDigitsList[iDigit]) ;
843 for(iDigit = 0 ; iDigit < fMulDigit; iDigit++) {
845 digit = maxAt[iDigit] ;
847 for(iDigitN = 0; iDigitN < fMulDigit; iDigitN++) {
848 if(iDigit == iDigitN)
851 digitN = (AliPHOSDigit *) digits->At(fDigitsList[iDigitN]) ;
853 if ( AreNeighbours(digit, digitN) ) {
854 if (fEnergyList[iDigit] > fEnergyList[iDigitN] ) {
856 // but may be digit too is not local max ?
857 if(fEnergyList[iDigit] < fEnergyList[iDigitN] + locMaxCut)
862 // but may be digitN too is not local max ?
863 if(fEnergyList[iDigit] > fEnergyList[iDigitN] - locMaxCut)
866 } // if Areneighbours
872 for(iDigit = 0; iDigit < fMulDigit; iDigit++) {
874 maxAt[iDigitN] = maxAt[iDigit] ;
875 maxAtEnergy[iDigitN] = fEnergyList[iDigit] ;
881 //____________________________________________________________________________
882 void AliPHOSEmcRecPoint::EvalTime(TClonesArray * digits)
884 // Define a rec.point time as a time in the cell with the maximum energy
888 for(Int_t idig=0; idig < fMulDigit; idig++){
889 if(fEnergyList[idig] > maxE){
890 maxE = fEnergyList[idig] ;
894 fTime = ((AliPHOSDigit*) digits->At(fDigitsList[maxAt]))->GetTime() ;
897 //____________________________________________________________________________
898 void AliPHOSEmcRecPoint::Purify(Float_t threshold){
899 //Removes digits below threshold
901 Int_t * tempo = new Int_t[fMaxDigit];
902 Float_t * tempoE = new Float_t[fMaxDigit];
905 for(Int_t iDigit=0;iDigit< fMulDigit ;iDigit++){
906 if(fEnergyList[iDigit] > threshold){
907 tempo[mult] = fDigitsList[iDigit] ;
908 tempoE[mult] = fEnergyList[iDigit] ;
914 delete [] fDigitsList ;
915 delete [] fEnergyList ;
916 fDigitsList = new Int_t[fMulDigit];
917 fEnergyList = new Float_t[fMulDigit];
919 fAmp = 0.; //Recalculate total energy
920 for(Int_t iDigit=0;iDigit< fMulDigit ;iDigit++){
921 fDigitsList[iDigit] = tempo[iDigit];
922 fEnergyList[iDigit] = tempoE[iDigit] ;
923 fAmp+=tempoE[iDigit];
930 //____________________________________________________________________________
931 void AliPHOSEmcRecPoint::Print(Option_t *) const
933 // Print the list of digits belonging to the cluster
936 message = "AliPHOSEmcRecPoint:\n" ;
937 message += "Digit multiplicity = %d" ;
938 message += ", cluster Energy = %f" ;
939 message += ", number of primaries = %d" ;
940 message += ", rec.point index = %d \n" ;
941 printf(message.Data(), fMulDigit, fAmp, fMulTrack,GetIndexInList() ) ;
944 printf(" digits ids = ") ;
945 for(iDigit=0; iDigit<fMulDigit; iDigit++)
946 printf(" %d ", fDigitsList[iDigit] ) ;
948 printf("\n digit energies = ") ;
949 for(iDigit=0; iDigit<fMulDigit; iDigit++)
950 printf(" %f ", fEnergyList[iDigit] ) ;
952 printf("\n digit primaries ") ;
953 if (fMulTrack<1) printf("... no primaries");
954 for(iDigit = 0;iDigit < fMulTrack; iDigit++)
955 printf(" %d ", fTracksList[iDigit]) ;