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.59 2007/10/18 15:12:22 kharlov
22 * Moved MakePrimary to EMCRecPoint to rpduce correct order of primaries
24 * Revision 1.58 2007/04/16 09:03:37 kharlov
25 * Incedent angle correction fixed
27 * Revision 1.57 2007/04/05 10:18:58 policheh
28 * Introduced distance to nearest bad crystal.
30 * Revision 1.56 2007/03/06 06:47:28 kharlov
31 * DP:Possibility to use actual vertex position added
33 * Revision 1.55 2007/01/19 20:31:19 kharlov
34 * Improved formatting for Print()
37 //_________________________________________________________________________
38 // RecPoint implementation for PHOS-EMC
39 // An EmcRecPoint is a cluster of digits
41 //-- Author: Dmitri Peressounko (RRC KI & SUBATECH)
44 // --- ROOT system ---
50 // --- Standard library ---
52 // --- AliRoot header files ---
54 #include "AliPHOSLoader.h"
55 #include "AliGenerator.h"
56 #include "AliPHOSGeometry.h"
57 #include "AliPHOSDigit.h"
58 #include "AliPHOSEmcRecPoint.h"
59 #include "AliPHOSReconstructor.h"
61 ClassImp(AliPHOSEmcRecPoint)
63 //____________________________________________________________________________
64 AliPHOSEmcRecPoint::AliPHOSEmcRecPoint() :
66 fCoreEnergy(0.), fDispersion(0.),
67 fEnergyList(0), fTime(-1.), fNExMax(0),
68 fM2x(0.), fM2z(0.), fM3x(0.), fM4z(0.),
69 fPhixe(0.), fDistToBadCrystal(-1),fDebug(0)
74 fLocPos.SetX(1000000.) ; //Local position should be evaluated
77 //____________________________________________________________________________
78 AliPHOSEmcRecPoint::AliPHOSEmcRecPoint(const char * opt) :
80 fCoreEnergy(0.), fDispersion(0.),
81 fEnergyList(0), fTime(-1.), fNExMax(0),
82 fM2x(0.), fM2z(0.), fM3x(0.), fM4z(0.),
83 fPhixe(0.), fDistToBadCrystal(-1), fDebug(0)
88 fLocPos.SetX(1000000.) ; //Local position should be evaluated
91 //____________________________________________________________________________
92 AliPHOSEmcRecPoint::AliPHOSEmcRecPoint(const AliPHOSEmcRecPoint & rp) :
94 fCoreEnergy(rp.fCoreEnergy), fDispersion(rp.fDispersion),
95 fEnergyList(0), fTime(rp.fTime), fNExMax(rp.fNExMax),
96 fM2x(rp.fM2x), fM2z(rp.fM2z), fM3x(rp.fM3x), fM4z(rp.fM4z),
97 fPhixe(rp.fPhixe), fDistToBadCrystal(rp.fDistToBadCrystal), fDebug(rp.fDebug)
100 fMulDigit = rp.fMulDigit ;
102 if (rp.fMulDigit>0) fEnergyList = new Float_t[rp.fMulDigit] ;
103 for(Int_t index = 0 ; index < fMulDigit ; index++)
104 fEnergyList[index] = rp.fEnergyList[index] ;
107 //____________________________________________________________________________
108 AliPHOSEmcRecPoint::~AliPHOSEmcRecPoint()
112 delete[] fEnergyList ;
115 //____________________________________________________________________________
116 void AliPHOSEmcRecPoint::AddDigit(AliPHOSDigit & digit, Float_t Energy)
118 // Adds a digit to the RecPoint
119 // and accumulates the total amplitude and the multiplicity
122 fEnergyList = new Float_t[fMaxDigit];
124 if ( fMulDigit >= fMaxDigit ) { // increase the size of the lists
126 Int_t * tempo = new Int_t[fMaxDigit];
127 Float_t * tempoE = new Float_t[fMaxDigit];
130 for ( index = 0 ; index < fMulDigit ; index++ ){
131 tempo[index] = fDigitsList[index] ;
132 tempoE[index] = fEnergyList[index] ;
135 delete [] fDigitsList ;
136 fDigitsList = new Int_t[fMaxDigit];
138 delete [] fEnergyList ;
139 fEnergyList = new Float_t[fMaxDigit];
141 for ( index = 0 ; index < fMulDigit ; index++ ){
142 fDigitsList[index] = tempo[index] ;
143 fEnergyList[index] = tempoE[index] ;
150 fDigitsList[fMulDigit] = digit.GetIndexInList() ;
151 fEnergyList[fMulDigit] = Energy ;
155 EvalPHOSMod(&digit) ;
158 //____________________________________________________________________________
159 Bool_t AliPHOSEmcRecPoint::AreNeighbours(AliPHOSDigit * digit1, AliPHOSDigit * digit2 ) const
161 // Tells if (true) or not (false) two digits are neighbors
163 Bool_t aren = kFALSE ;
165 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
168 phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ;
171 phosgeom->AbsToRelNumbering(digit2->GetId(), relid2) ;
173 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
174 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
176 if (( coldiff <= 1 ) && ( rowdiff <= 1 ) && (coldiff + rowdiff > 0))
182 //____________________________________________________________________________
183 Int_t AliPHOSEmcRecPoint::Compare(const TObject * obj) const
185 // Compares two RecPoints according to their position in the PHOS modules
187 const Float_t delta = 1 ; //Width of "Sorting row". If you changibg this
188 //value (what is senseless) change as vell delta in
189 //AliPHOSTrackSegmentMakerv* and other RecPoints...
192 AliPHOSEmcRecPoint * clu = (AliPHOSEmcRecPoint *)obj ;
195 Int_t phosmod1 = GetPHOSMod() ;
196 Int_t phosmod2 = clu->GetPHOSMod() ;
199 GetLocalPosition(locpos1) ;
201 clu->GetLocalPosition(locpos2) ;
203 if(phosmod1 == phosmod2 ) {
204 Int_t rowdif = (Int_t)TMath::Ceil(locpos1.X()/delta)-(Int_t)TMath::Ceil(locpos2.X()/delta) ;
209 else if(locpos1.Z()>locpos2.Z())
216 if(phosmod1 < phosmod2 )
224 //______________________________________________________________________________
225 void AliPHOSEmcRecPoint::ExecuteEvent(Int_t event, Int_t, Int_t) /*const*/
228 // Execute action corresponding to one event
229 // This member function is called when a AliPHOSRecPoint is clicked with the locator
231 // If Left button is clicked on AliPHOSRecPoint, the digits are switched on
232 // and switched off when the mouse button is released.
235 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance();
237 static TGraph * digitgraph = 0 ;
239 if (!gPad->IsEditable()) return;
242 TCanvas * histocanvas ;
245 //try to get run loader from default event folder
246 AliRunLoader* rn = AliRunLoader::GetRunLoader(AliConfig::GetDefaultEventFolderName());
249 AliError(Form("Cannot find Run Loader in Default Event Folder"));
252 AliPHOSLoader* phosLoader = dynamic_cast<AliPHOSLoader*>(rn->GetLoader("PHOSLoader"));
253 if (phosLoader == 0x0)
255 AliError(Form("Cannot find PHOS Loader from Run Loader"));
260 const TClonesArray * digits = phosLoader->Digits() ;
265 AliPHOSDigit * digit ;
269 const Int_t kMulDigit = AliPHOSEmcRecPoint::GetDigitsMultiplicity() ;
270 Float_t * xi = new Float_t[kMulDigit] ;
271 Float_t * zi = new Float_t[kMulDigit] ;
273 // create the histogram for the single cluster
274 // 1. gets histogram boundaries
275 Float_t ximax = -999. ;
276 Float_t zimax = -999. ;
277 Float_t ximin = 999. ;
278 Float_t zimin = 999. ;
280 for(iDigit=0; iDigit<kMulDigit; iDigit++) {
281 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
282 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
283 phosgeom->RelPosInModule(relid, xi[iDigit], zi[iDigit]);
284 if ( xi[iDigit] > ximax )
286 if ( xi[iDigit] < ximin )
288 if ( zi[iDigit] > zimax )
290 if ( zi[iDigit] < zimin )
293 ximax += phosgeom->GetCrystalSize(0) / 2. ;
294 zimax += phosgeom->GetCrystalSize(2) / 2. ;
295 ximin -= phosgeom->GetCrystalSize(0) / 2. ;
296 zimin -= phosgeom->GetCrystalSize(2) / 2. ;
297 Int_t xdim = (int)( (ximax - ximin ) / phosgeom->GetCrystalSize(0) + 0.5 ) ;
298 Int_t zdim = (int)( (zimax - zimin ) / phosgeom->GetCrystalSize(2) + 0.5 ) ;
300 // 2. gets the histogram title
303 sprintf(title,"Energy=%1.2f GeV ; Digits ; %d ", GetEnergy(), GetDigitsMultiplicity()) ;
309 histo = new TH2F("cluster3D", title, xdim, ximin, ximax, zdim, zimin, zimax) ;
312 for(iDigit=0; iDigit<kMulDigit; iDigit++) {
313 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
314 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
315 phosgeom->RelPosInModule(relid, x, z);
316 histo->Fill(x, z, fEnergyList[iDigit] ) ;
320 digitgraph = new TGraph(kMulDigit,xi,zi);
321 digitgraph-> SetMarkerStyle(5) ;
322 digitgraph-> SetMarkerSize(1.) ;
323 digitgraph-> SetMarkerColor(1) ;
324 digitgraph-> Paint("P") ;
328 histocanvas = new TCanvas("cluster", "a single cluster", 600, 500) ;
329 histocanvas->Draw() ;
330 histo->Draw("lego1") ;
348 //____________________________________________________________________________
349 void AliPHOSEmcRecPoint::EvalDispersion(Float_t logWeight,TClonesArray * digits, TVector3 & /* vInc */)
351 // Calculates the dispersion of the shower at the origine of the RecPoint
352 //DP: should we correct dispersion for non-perpendicular hit????????
360 AliPHOSDigit * digit ;
362 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance();
364 // Calculates the center of gravity in the local PHOS-module coordinates
368 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
369 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
373 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
374 phosgeom->RelPosInModule(relid, xi, zi);
375 if (fAmp>0 && fEnergyList[iDigit]>0) {
376 Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
382 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
389 AliError(Form("Wrong weight %f\n", wtot));
392 // Calculates the dispersion in coordinates
394 for(iDigit=0; iDigit < fMulDigit; iDigit++) {
395 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
399 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
400 phosgeom->RelPosInModule(relid, xi, zi);
401 if (fAmp>0 && fEnergyList[iDigit]>0) {
402 Float_t w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
403 d += w*((xi-x)*(xi-x) + (zi-z)*(zi-z) ) ;
407 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
415 AliError(Form("Wrong weight %f\n", wtot));
419 fDispersion = TMath::Sqrt(d) ;
423 //______________________________________________________________________________
424 void AliPHOSEmcRecPoint::EvalCoreEnergy(Float_t logWeight, Float_t coreRadius, TClonesArray * digits)
426 // This function calculates energy in the core,
427 // i.e. within a radius rad = 3cm around the center. Beyond this radius
428 // in accordance with shower profile the energy deposition
429 // should be less than 2%
430 //DP: non-perpendicular incidence??????????????
435 AliPHOSDigit * digit ;
437 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance();
441 // Calculates the center of gravity in the local PHOS-module coordinates
443 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
444 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
448 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
449 phosgeom->RelPosInModule(relid, xi, zi);
450 if (fAmp>0 && fEnergyList[iDigit]>0) {
451 Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
457 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
464 AliError(Form("Wrong weight %f\n", wtot));
467 for(iDigit=0; iDigit < fMulDigit; iDigit++) {
468 digit = (AliPHOSDigit *) ( digits->At(fDigitsList[iDigit]) ) ;
472 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
473 phosgeom->RelPosInModule(relid, xi, zi);
474 Float_t distance = TMath::Sqrt((xi-x)*(xi-x)+(zi-z)*(zi-z)) ;
475 if(distance < coreRadius)
476 fCoreEnergy += fEnergyList[iDigit] ;
482 //____________________________________________________________________________
483 void AliPHOSEmcRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digits, TVector3 & /* vInc */)
485 // Calculates the axis of the shower ellipsoid
494 AliPHOSDigit * digit ;
496 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance();
501 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
502 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
506 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
507 phosgeom->RelPosInModule(relid, xi, zi);
508 if (fAmp>0 && fEnergyList[iDigit]>0) {
509 Double_t w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
518 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
530 // //Apply correction due to non-perpendicular incidence
533 // AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
534 // Double_t DistanceToIP= (Double_t ) phosgeom->GetIPtoCrystalSurface() ;
536 // CosX = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+x*x) ;
537 // CosZ = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+z*z) ;
539 // dxx = dxx/(CosX*CosX) ;
540 // dzz = dzz/(CosZ*CosZ) ;
541 // dxz = dxz/(CosX*CosZ) ;
544 fLambda[0] = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
546 fLambda[0] = TMath::Sqrt(fLambda[0]) ;
548 fLambda[1] = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
549 if(fLambda[1] > 0) //To avoid exception if numerical errors lead to negative lambda.
550 fLambda[1] = TMath::Sqrt(fLambda[1]) ;
555 AliError(Form("Wrong weight %f\n", wtot));
556 fLambda[0]=fLambda[1]=0.;
560 //____________________________________________________________________________
561 void AliPHOSEmcRecPoint::EvalMoments(Float_t logWeight,TClonesArray * digits, TVector3 & /* vInc */)
563 // Calculate the shower moments in the eigen reference system
564 // M2x, M2z, M3x, M4z
565 // Calculate the angle between the shower position vector and the eigen vector
573 Double_t lambda0=0, lambda1=0;
575 AliPHOSDigit * digit ;
577 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
581 // 1) Find covariance matrix elements:
589 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
590 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
591 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
592 phosgeom->RelPosInModule(relid, xi, zi);
593 if (fAmp>0 && fEnergyList[iDigit]>0) {
594 w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
603 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
616 // 2) Find covariance matrix eigen values lambda0 and lambda1
618 lambda0 = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
619 lambda1 = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
622 AliError(Form("Wrong weight %f\n", wtot));
626 // 3) Find covariance matrix eigen vectors e0 and e1
630 e0.Set(1.,(lambda0-dxx)/dxz);
635 e1.Set(-e0.Y(),e0.X());
637 // 4) Rotate cluster tensor from (x,z) to (e0,e1) system
638 // and calculate moments M3x and M4z
640 Float_t cosPhi = e0.X();
641 Float_t sinPhi = e0.Y();
645 Double_t dx3, dz3, dz4;
655 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
656 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
657 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
658 phosgeom->RelPosInModule(relid, xiPHOS, ziPHOS);
659 xi = xiPHOS*cosPhi + ziPHOS*sinPhi;
660 zi = ziPHOS*cosPhi - xiPHOS*sinPhi;
661 if (fAmp>0 && fEnergyList[iDigit]>0) {
662 w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
668 dx3 += w * xi * xi * xi;
669 dz3 += w * zi * zi * zi ;
670 dz4 += w * zi * zi * zi * zi ;
674 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
685 dx3 += -3*dxx*x + 2*x*x*x;
686 dz4 += -4*dz3*z + 6*dzz*z*z -3*z*z*z*z;
692 AliError(Form("Wrong weight %f\n", wtot));
694 // 5) Find an angle between cluster center vector and eigen vector e0
698 phi = TMath::ACos ((x*e0.X() + z*e0.Y()) / sqrt(x*x + z*z));
707 //______________________________________________________________________________
708 void AliPHOSEmcRecPoint::EvalPrimaries(TClonesArray * digits)
710 // Constructs the list of primary particles (tracks) which have contributed to this RecPoint
712 AliPHOSDigit * digit ;
713 Int_t * tempo = new Int_t[fMaxTrack] ;
715 //First find digit with maximal energy deposition and copy its primaries
718 for(Int_t id=0; id<GetDigitsMultiplicity(); id++){
719 if(emax<fEnergyList[id])
722 digit = dynamic_cast<AliPHOSDigit *>(digits->At( fDigitsList[imaxDigit] )) ;
723 Int_t nprimaries = digit->GetNprimary() ;
724 if ( nprimaries > fMaxTrack ) {
726 Error("EvalPrimaries", "GetNprimaries ERROR > increase fMaxTrack" ) ;
727 nprimaries = fMaxTrack; //skip the rest
729 for(fMulTrack=0; fMulTrack<nprimaries ; fMulTrack++){
730 tempo[fMulTrack] = digit->GetPrimary(fMulTrack+1) ;
733 //Now add other digits contributions
734 for (Int_t index = 0 ; index < GetDigitsMultiplicity() ; index++ ) { // all digits
735 if(index==imaxDigit) //already in
737 digit = dynamic_cast<AliPHOSDigit *>(digits->At( fDigitsList[index] )) ;
738 nprimaries = digit->GetNprimary() ;
739 for(Int_t ipr=0; ipr<nprimaries; ipr++){
740 Int_t iprimary = digit->GetPrimary(ipr+1) ;
742 for(Int_t kndex = 0 ; (kndex < fMulTrack)&& notIn ; kndex++ ) { //check if not already stored
743 if(iprimary == tempo[kndex]){
748 if(fMulTrack<fMaxTrack){
749 tempo[fMulTrack]=iprimary ;
753 Error("EvalPrimaries", "GetNprimaries ERROR > increase fMaxTrack!!!" ) ;
760 if(fTracksList)delete [] fTracksList;
761 fTracksList = new Int_t[fMulTrack] ;
763 for(Int_t index = 0; index < fMulTrack; index++)
764 fTracksList[index] = tempo[index] ;
770 //____________________________________________________________________________
771 void AliPHOSEmcRecPoint::EvalAll(TClonesArray * digits )
773 // EvalCoreEnergy(logWeight, digits);
775 EvalPrimaries(digits) ;
776 AliPHOSRecPoint::EvalAll(digits) ;
778 //____________________________________________________________________________
779 void AliPHOSEmcRecPoint::EvalAll(Float_t logWeight, TVector3 &vtx, TClonesArray * digits )
781 // Evaluates all shower parameters
783 EvalLocalPosition(logWeight, vtx, digits,vInc) ;
784 EvalElipsAxis(logWeight, digits, vInc) ; //they are evaluated with momenta
785 EvalMoments(logWeight, digits, vInc) ;
786 EvalDispersion(logWeight, digits, vInc) ;
788 //____________________________________________________________________________
789 void AliPHOSEmcRecPoint::EvalLocalPosition(Float_t logWeight, TVector3 &vtx, TClonesArray * digits, TVector3 &vInc)
791 // Calculates the center of gravity in the local PHOS-module coordinates
799 AliPHOSDigit * digit ;
801 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
805 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
806 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
810 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
811 phosgeom->RelPosInModule(relid, xi, zi);
812 if (fAmp>0 && fEnergyList[iDigit]>0) {
813 Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
819 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
826 AliError(Form("Wrong weight %f\n", wtot));
828 // Correction for the depth of the shower starting point (TDR p 127)
829 Float_t para = 0.925 ;
830 Float_t parb = 6.52 ;
832 phosgeom->GetIncidentVector(vtx,GetPHOSMod(),x,z,vInc) ;
836 if (fAmp>0&&vInc.Y()!=0.) {
837 depthx = ( para * TMath::Log(fAmp) + parb ) * vInc.X()/TMath::Abs(vInc.Y()) ;
838 depthz = ( para * TMath::Log(fAmp) + parb ) * vInc.Z()/TMath::Abs(vInc.Y()) ;
841 AliError(Form("Wrong amplitude %f\n", fAmp));
843 fLocPos.SetX(x - depthx) ;
845 fLocPos.SetZ(z - depthz) ;
849 //____________________________________________________________________________
850 Float_t AliPHOSEmcRecPoint::GetMaximalEnergy(void) const
852 // Finds the maximum energy in the cluster
854 Float_t menergy = 0. ;
858 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
860 if(fEnergyList[iDigit] > menergy)
861 menergy = fEnergyList[iDigit] ;
866 //____________________________________________________________________________
867 Int_t AliPHOSEmcRecPoint::GetMultiplicityAtLevel(Float_t H) const
869 // Calculates the multiplicity of digits with energy larger than H*energy
873 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
875 if(fEnergyList[iDigit] > H * fAmp)
881 //____________________________________________________________________________
882 Int_t AliPHOSEmcRecPoint::GetNumberOfLocalMax( AliPHOSDigit ** maxAt, Float_t * maxAtEnergy,
883 Float_t locMaxCut,TClonesArray * digits) const
885 // Calculates the number of local maxima in the cluster using fLocalMaxCut as the minimum
886 // energy difference between two local maxima
888 AliPHOSDigit * digit ;
889 AliPHOSDigit * digitN ;
895 for(iDigit = 0; iDigit < fMulDigit; iDigit++)
896 maxAt[iDigit] = (AliPHOSDigit*) digits->At(fDigitsList[iDigit]) ;
899 for(iDigit = 0 ; iDigit < fMulDigit; iDigit++) {
901 digit = maxAt[iDigit] ;
903 for(iDigitN = 0; iDigitN < fMulDigit; iDigitN++) {
904 if(iDigit == iDigitN)
907 digitN = (AliPHOSDigit *) digits->At(fDigitsList[iDigitN]) ;
909 if ( AreNeighbours(digit, digitN) ) {
910 if (fEnergyList[iDigit] > fEnergyList[iDigitN] ) {
912 // but may be digit too is not local max ?
913 if(fEnergyList[iDigit] < fEnergyList[iDigitN] + locMaxCut)
918 // but may be digitN too is not local max ?
919 if(fEnergyList[iDigit] > fEnergyList[iDigitN] - locMaxCut)
922 } // if Areneighbours
928 for(iDigit = 0; iDigit < fMulDigit; iDigit++) {
930 maxAt[iDigitN] = maxAt[iDigit] ;
931 maxAtEnergy[iDigitN] = fEnergyList[iDigit] ;
937 //____________________________________________________________________________
938 void AliPHOSEmcRecPoint::EvalTime(TClonesArray * digits)
940 // Define a rec.point time as a time in the cell with the maximum energy
944 for(Int_t idig=0; idig < fMulDigit; idig++){
945 if(fEnergyList[idig] > maxE){
946 maxE = fEnergyList[idig] ;
950 fTime = ((AliPHOSDigit*) digits->At(fDigitsList[maxAt]))->GetTime() ;
953 //____________________________________________________________________________
954 void AliPHOSEmcRecPoint::Purify(Float_t threshold){
955 //Removes digits below threshold
957 Int_t * tempo = new Int_t[fMaxDigit];
958 Float_t * tempoE = new Float_t[fMaxDigit];
961 for(Int_t iDigit=0;iDigit< fMulDigit ;iDigit++){
962 if(fEnergyList[iDigit] > threshold){
963 tempo[mult] = fDigitsList[iDigit] ;
964 tempoE[mult] = fEnergyList[iDigit] ;
970 delete [] fDigitsList ;
971 delete [] fEnergyList ;
972 fDigitsList = new Int_t[fMulDigit];
973 fEnergyList = new Float_t[fMulDigit];
975 fAmp = 0.; //Recalculate total energy
976 for(Int_t iDigit=0;iDigit< fMulDigit ;iDigit++){
977 fDigitsList[iDigit] = tempo[iDigit];
978 fEnergyList[iDigit] = tempoE[iDigit] ;
979 fAmp+=tempoE[iDigit];
986 //____________________________________________________________________________
987 void AliPHOSEmcRecPoint::Print(Option_t *) const
989 // Print the list of digits belonging to the cluster
992 message = "AliPHOSEmcRecPoint:\n" ;
993 message += "Digit multiplicity = %d" ;
994 message += ", cluster Energy = %f" ;
995 message += ", number of primaries = %d" ;
996 message += ", rec.point index = %d \n" ;
997 printf(message.Data(), fMulDigit, fAmp, fMulTrack,GetIndexInList() ) ;
1000 printf(" digits ids = ") ;
1001 for(iDigit=0; iDigit<fMulDigit; iDigit++)
1002 printf(" %d ", fDigitsList[iDigit] ) ;
1004 printf("\n digit energies = ") ;
1005 for(iDigit=0; iDigit<fMulDigit; iDigit++)
1006 printf(" %f ", fEnergyList[iDigit] ) ;
1008 printf("\n digit primaries ") ;
1009 if (fMulTrack<1) printf("... no primaries");
1010 for(iDigit = 0;iDigit < fMulTrack; iDigit++)
1011 printf(" %d ", fTracksList[iDigit]) ;