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, Float_t time)
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] ;
152 for(Int_t index = 0 ; index < fMulDigit ; index++ ){
153 if(fEnergyList[index]>Energy){
161 //Alternative time calculation - still to be validated
162 // fTime = (fTime*fAmp + time*Energy)/(fAmp+Energy) ;
164 fDigitsList[fMulDigit] = digit.GetIndexInList() ;
165 fEnergyList[fMulDigit] = Energy ;
168 EvalPHOSMod(&digit) ;
171 //____________________________________________________________________________
172 Bool_t AliPHOSEmcRecPoint::AreNeighbours(AliPHOSDigit * digit1, AliPHOSDigit * digit2 ) const
174 // Tells if (true) or not (false) two digits are neighbors
176 Bool_t aren = kFALSE ;
178 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
181 phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ;
184 phosgeom->AbsToRelNumbering(digit2->GetId(), relid2) ;
186 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
187 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
189 if (( coldiff <= 1 ) && ( rowdiff <= 1 ) && (coldiff + rowdiff > 0))
195 //____________________________________________________________________________
196 Int_t AliPHOSEmcRecPoint::Compare(const TObject * obj) const
198 // Compares two RecPoints according to their position in the PHOS modules
200 const Float_t delta = 1 ; //Width of "Sorting row". If you changibg this
201 //value (what is senseless) change as vell delta in
202 //AliPHOSTrackSegmentMakerv* and other RecPoints...
205 AliPHOSEmcRecPoint * clu = (AliPHOSEmcRecPoint *)obj ;
208 Int_t phosmod1 = GetPHOSMod() ;
209 Int_t phosmod2 = clu->GetPHOSMod() ;
212 GetLocalPosition(locpos1) ;
214 clu->GetLocalPosition(locpos2) ;
216 if(phosmod1 == phosmod2 ) {
217 Int_t rowdif = (Int_t)TMath::Ceil(locpos1.X()/delta)-(Int_t)TMath::Ceil(locpos2.X()/delta) ;
222 else if(locpos1.Z()>locpos2.Z())
229 if(phosmod1 < phosmod2 )
237 //______________________________________________________________________________
238 void AliPHOSEmcRecPoint::ExecuteEvent(Int_t event, Int_t, Int_t) /*const*/
241 // Execute action corresponding to one event
242 // This member function is called when a AliPHOSRecPoint is clicked with the locator
244 // If Left button is clicked on AliPHOSRecPoint, the digits are switched on
245 // and switched off when the mouse button is released.
248 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance();
250 static TGraph * digitgraph = 0 ;
252 if (!gPad->IsEditable()) return;
255 TCanvas * histocanvas ;
258 //try to get run loader from default event folder
259 AliRunLoader* rn = AliRunLoader::GetRunLoader(AliConfig::GetDefaultEventFolderName());
262 AliError(Form("Cannot find Run Loader in Default Event Folder"));
265 AliPHOSLoader* phosLoader = dynamic_cast<AliPHOSLoader*>(rn->GetLoader("PHOSLoader"));
266 if (phosLoader == 0x0)
268 AliError(Form("Cannot find PHOS Loader from Run Loader"));
273 const TClonesArray * digits = phosLoader->Digits() ;
278 AliPHOSDigit * digit ;
282 const Int_t kMulDigit = AliPHOSEmcRecPoint::GetDigitsMultiplicity() ;
283 Float_t * xi = new Float_t[kMulDigit] ;
284 Float_t * zi = new Float_t[kMulDigit] ;
286 // create the histogram for the single cluster
287 // 1. gets histogram boundaries
288 Float_t ximax = -999. ;
289 Float_t zimax = -999. ;
290 Float_t ximin = 999. ;
291 Float_t zimin = 999. ;
293 for(iDigit=0; iDigit<kMulDigit; iDigit++) {
294 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
295 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
296 phosgeom->RelPosInModule(relid, xi[iDigit], zi[iDigit]);
297 if ( xi[iDigit] > ximax )
299 if ( xi[iDigit] < ximin )
301 if ( zi[iDigit] > zimax )
303 if ( zi[iDigit] < zimin )
306 ximax += phosgeom->GetCrystalSize(0) / 2. ;
307 zimax += phosgeom->GetCrystalSize(2) / 2. ;
308 ximin -= phosgeom->GetCrystalSize(0) / 2. ;
309 zimin -= phosgeom->GetCrystalSize(2) / 2. ;
310 Int_t xdim = (int)( (ximax - ximin ) / phosgeom->GetCrystalSize(0) + 0.5 ) ;
311 Int_t zdim = (int)( (zimax - zimin ) / phosgeom->GetCrystalSize(2) + 0.5 ) ;
313 // 2. gets the histogram title
316 sprintf(title,"Energy=%1.2f GeV ; Digits ; %d ", GetEnergy(), GetDigitsMultiplicity()) ;
322 histo = new TH2F("cluster3D", title, xdim, ximin, ximax, zdim, zimin, zimax) ;
325 for(iDigit=0; iDigit<kMulDigit; iDigit++) {
326 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
327 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
328 phosgeom->RelPosInModule(relid, x, z);
329 histo->Fill(x, z, fEnergyList[iDigit] ) ;
333 digitgraph = new TGraph(kMulDigit,xi,zi);
334 digitgraph-> SetMarkerStyle(5) ;
335 digitgraph-> SetMarkerSize(1.) ;
336 digitgraph-> SetMarkerColor(1) ;
337 digitgraph-> Paint("P") ;
341 histocanvas = new TCanvas("cluster", "a single cluster", 600, 500) ;
342 histocanvas->Draw() ;
343 histo->Draw("lego1") ;
361 //____________________________________________________________________________
362 void AliPHOSEmcRecPoint::EvalDispersion(Float_t logWeight,TClonesArray * digits, TVector3 & /* vInc */)
364 // Calculates the dispersion of the shower at the origine of the RecPoint
365 //DP: should we correct dispersion for non-perpendicular hit????????
373 AliPHOSDigit * digit ;
375 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance();
377 // Calculates the center of gravity in the local PHOS-module coordinates
381 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
382 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
386 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
387 phosgeom->RelPosInModule(relid, xi, zi);
388 if (fAmp>0 && fEnergyList[iDigit]>0) {
389 Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
395 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
402 AliError(Form("Wrong weight %f\n", wtot));
405 // Calculates the dispersion in coordinates
407 for(iDigit=0; iDigit < fMulDigit; iDigit++) {
408 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
412 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
413 phosgeom->RelPosInModule(relid, xi, zi);
414 if (fAmp>0 && fEnergyList[iDigit]>0) {
415 Float_t w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
416 d += w*((xi-x)*(xi-x) + (zi-z)*(zi-z) ) ;
420 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
428 AliError(Form("Wrong weight %f\n", wtot));
432 fDispersion = TMath::Sqrt(d) ;
436 //______________________________________________________________________________
437 void AliPHOSEmcRecPoint::EvalCoreEnergy(Float_t logWeight, Float_t coreRadius, TClonesArray * digits)
439 // This function calculates energy in the core,
440 // i.e. within a radius rad = 3cm around the center. Beyond this radius
441 // in accordance with shower profile the energy deposition
442 // should be less than 2%
443 //DP: non-perpendicular incidence??????????????
448 AliPHOSDigit * digit ;
450 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance();
454 // Calculates the center of gravity in the local PHOS-module coordinates
456 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
457 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
461 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
462 phosgeom->RelPosInModule(relid, xi, zi);
463 if (fAmp>0 && fEnergyList[iDigit]>0) {
464 Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
470 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
477 AliError(Form("Wrong weight %f\n", wtot));
480 for(iDigit=0; iDigit < fMulDigit; iDigit++) {
481 digit = (AliPHOSDigit *) ( digits->At(fDigitsList[iDigit]) ) ;
485 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
486 phosgeom->RelPosInModule(relid, xi, zi);
487 Float_t distance = TMath::Sqrt((xi-x)*(xi-x)+(zi-z)*(zi-z)) ;
488 if(distance < coreRadius)
489 fCoreEnergy += fEnergyList[iDigit] ;
495 //____________________________________________________________________________
496 void AliPHOSEmcRecPoint::EvalElipsAxis(Float_t logWeight,TClonesArray * digits, TVector3 & /* vInc */)
498 // Calculates the axis of the shower ellipsoid
507 AliPHOSDigit * digit ;
509 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance();
514 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
515 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
519 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
520 phosgeom->RelPosInModule(relid, xi, zi);
521 if (fAmp>0 && fEnergyList[iDigit]>0) {
522 Double_t w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
531 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
543 // //Apply correction due to non-perpendicular incidence
546 // AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
547 // Double_t DistanceToIP= (Double_t ) phosgeom->GetIPtoCrystalSurface() ;
549 // CosX = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+x*x) ;
550 // CosZ = DistanceToIP/TMath::Sqrt(DistanceToIP*DistanceToIP+z*z) ;
552 // dxx = dxx/(CosX*CosX) ;
553 // dzz = dzz/(CosZ*CosZ) ;
554 // dxz = dxz/(CosX*CosZ) ;
557 fLambda[0] = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
559 fLambda[0] = TMath::Sqrt(fLambda[0]) ;
561 fLambda[1] = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
562 if(fLambda[1] > 0) //To avoid exception if numerical errors lead to negative lambda.
563 fLambda[1] = TMath::Sqrt(fLambda[1]) ;
568 AliError(Form("Wrong weight %f\n", wtot));
569 fLambda[0]=fLambda[1]=0.;
573 //____________________________________________________________________________
574 void AliPHOSEmcRecPoint::EvalMoments(Float_t logWeight,TClonesArray * digits, TVector3 & /* vInc */)
576 // Calculate the shower moments in the eigen reference system
577 // M2x, M2z, M3x, M4z
578 // Calculate the angle between the shower position vector and the eigen vector
586 Double_t lambda0=0, lambda1=0;
588 AliPHOSDigit * digit ;
590 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
594 // 1) Find covariance matrix elements:
602 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
603 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
604 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
605 phosgeom->RelPosInModule(relid, xi, zi);
606 if (fAmp>0 && fEnergyList[iDigit]>0) {
607 w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
616 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
629 // 2) Find covariance matrix eigen values lambda0 and lambda1
631 lambda0 = 0.5 * (dxx + dzz) + TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
632 lambda1 = 0.5 * (dxx + dzz) - TMath::Sqrt( 0.25 * (dxx - dzz) * (dxx - dzz) + dxz * dxz ) ;
635 AliError(Form("Wrong weight %f\n", wtot));
639 // 3) Find covariance matrix eigen vectors e0 and e1
643 e0.Set(1.,(lambda0-dxx)/dxz);
648 e1.Set(-e0.Y(),e0.X());
650 // 4) Rotate cluster tensor from (x,z) to (e0,e1) system
651 // and calculate moments M3x and M4z
653 Float_t cosPhi = e0.X();
654 Float_t sinPhi = e0.Y();
658 Double_t dx3, dz3, dz4;
668 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
669 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
670 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
671 phosgeom->RelPosInModule(relid, xiPHOS, ziPHOS);
672 xi = xiPHOS*cosPhi + ziPHOS*sinPhi;
673 zi = ziPHOS*cosPhi - xiPHOS*sinPhi;
674 if (fAmp>0 && fEnergyList[iDigit]>0) {
675 w = TMath::Max(0.,logWeight+TMath::Log(fEnergyList[iDigit]/fAmp ) ) ;
681 dx3 += w * xi * xi * xi;
682 dz3 += w * zi * zi * zi ;
683 dz4 += w * zi * zi * zi * zi ;
687 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
698 dx3 += -3*dxx*x + 2*x*x*x;
699 dz4 += -4*dz3*z + 6*dzz*z*z -3*z*z*z*z;
705 AliError(Form("Wrong weight %f\n", wtot));
707 // 5) Find an angle between cluster center vector and eigen vector e0
711 phi = TMath::ACos ((x*e0.X() + z*e0.Y()) / sqrt(x*x + z*z));
720 //______________________________________________________________________________
721 void AliPHOSEmcRecPoint::EvalPrimaries(TClonesArray * digits)
723 // Constructs the list of primary particles (tracks) which have contributed to this RecPoint
725 AliPHOSDigit * digit ;
726 Int_t * tempo = new Int_t[fMaxTrack] ;
728 //First find digit with maximal energy deposition and copy its primaries
731 for(Int_t id=0; id<GetDigitsMultiplicity(); id++){
732 if(emax<fEnergyList[id])
735 digit = dynamic_cast<AliPHOSDigit *>(digits->At( fDigitsList[imaxDigit] )) ;
736 Int_t nprimaries = digit->GetNprimary() ;
737 if ( nprimaries > fMaxTrack ) {
739 Error("EvalPrimaries", "GetNprimaries ERROR > increase fMaxTrack" ) ;
740 nprimaries = fMaxTrack; //skip the rest
742 for(fMulTrack=0; fMulTrack<nprimaries ; fMulTrack++){
743 tempo[fMulTrack] = digit->GetPrimary(fMulTrack+1) ;
746 //Now add other digits contributions
747 for (Int_t index = 0 ; index < GetDigitsMultiplicity() ; index++ ) { // all digits
748 if(index==imaxDigit) //already in
750 digit = dynamic_cast<AliPHOSDigit *>(digits->At( fDigitsList[index] )) ;
751 nprimaries = digit->GetNprimary() ;
752 for(Int_t ipr=0; ipr<nprimaries; ipr++){
753 Int_t iprimary = digit->GetPrimary(ipr+1) ;
755 for(Int_t kndex = 0 ; (kndex < fMulTrack)&& notIn ; kndex++ ) { //check if not already stored
756 if(iprimary == tempo[kndex]){
761 if(fMulTrack<fMaxTrack){
762 tempo[fMulTrack]=iprimary ;
766 Error("EvalPrimaries", "GetNprimaries ERROR > increase fMaxTrack!!!" ) ;
773 if(fTracksList)delete [] fTracksList;
774 fTracksList = new Int_t[fMulTrack] ;
776 for(Int_t index = 0; index < fMulTrack; index++)
777 fTracksList[index] = tempo[index] ;
783 //____________________________________________________________________________
784 void AliPHOSEmcRecPoint::EvalAll(TClonesArray * digits )
786 // EvalCoreEnergy(logWeight, digits);
788 EvalPrimaries(digits) ;
789 AliPHOSRecPoint::EvalAll(digits) ;
791 //____________________________________________________________________________
792 void AliPHOSEmcRecPoint::EvalAll(Float_t logWeight, TVector3 &vtx, TClonesArray * digits )
794 // Evaluates all shower parameters
796 EvalLocalPosition(logWeight, vtx, digits,vInc) ;
797 EvalElipsAxis(logWeight, digits, vInc) ; //they are evaluated with momenta
798 EvalMoments(logWeight, digits, vInc) ;
799 EvalDispersion(logWeight, digits, vInc) ;
801 //____________________________________________________________________________
802 void AliPHOSEmcRecPoint::EvalLocalPosition(Float_t logWeight, TVector3 &vtx, TClonesArray * digits, TVector3 &vInc)
804 // Calculates the center of gravity in the local PHOS-module coordinates
812 AliPHOSDigit * digit ;
814 AliPHOSGeometry * phosgeom = AliPHOSGeometry::GetInstance() ;
818 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
819 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
823 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
824 phosgeom->RelPosInModule(relid, xi, zi);
825 if (fAmp>0 && fEnergyList[iDigit]>0) {
826 Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
832 AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp));
839 AliError(Form("Wrong weight %f\n", wtot));
841 // Correction for the depth of the shower starting point (TDR p 127)
842 Float_t para = 0.925 ;
843 Float_t parb = 6.52 ;
845 phosgeom->GetIncidentVector(vtx,GetPHOSMod(),x,z,vInc) ;
849 if (fAmp>0&&vInc.Y()!=0.) {
850 depthx = ( para * TMath::Log(fAmp) + parb ) * vInc.X()/TMath::Abs(vInc.Y()) ;
851 depthz = ( para * TMath::Log(fAmp) + parb ) * vInc.Z()/TMath::Abs(vInc.Y()) ;
854 AliError(Form("Wrong amplitude %f\n", fAmp));
856 fLocPos.SetX(x - depthx) ;
858 fLocPos.SetZ(z - depthz) ;
862 //____________________________________________________________________________
863 Float_t AliPHOSEmcRecPoint::GetMaximalEnergy(void) const
865 // Finds the maximum energy in the cluster
867 Float_t menergy = 0. ;
871 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
873 if(fEnergyList[iDigit] > menergy)
874 menergy = fEnergyList[iDigit] ;
879 //____________________________________________________________________________
880 Int_t AliPHOSEmcRecPoint::GetMultiplicityAtLevel(Float_t H) const
882 // Calculates the multiplicity of digits with energy larger than H*energy
886 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
888 if(fEnergyList[iDigit] > H * fAmp)
894 //____________________________________________________________________________
895 Int_t AliPHOSEmcRecPoint::GetNumberOfLocalMax( AliPHOSDigit ** maxAt, Float_t * maxAtEnergy,
896 Float_t locMaxCut,TClonesArray * digits) const
898 // Calculates the number of local maxima in the cluster using fLocalMaxCut as the minimum
899 // energy difference between two local maxima
901 AliPHOSDigit * digit ;
902 AliPHOSDigit * digitN ;
908 for(iDigit = 0; iDigit < fMulDigit; iDigit++)
909 maxAt[iDigit] = (AliPHOSDigit*) digits->At(fDigitsList[iDigit]) ;
912 for(iDigit = 0 ; iDigit < fMulDigit; iDigit++) {
914 digit = maxAt[iDigit] ;
916 for(iDigitN = 0; iDigitN < fMulDigit; iDigitN++) {
917 if(iDigit == iDigitN)
920 digitN = (AliPHOSDigit *) digits->At(fDigitsList[iDigitN]) ;
922 if ( AreNeighbours(digit, digitN) ) {
923 if (fEnergyList[iDigit] > fEnergyList[iDigitN] ) {
925 // but may be digit too is not local max ?
926 if(fEnergyList[iDigit] < fEnergyList[iDigitN] + locMaxCut)
931 // but may be digitN too is not local max ?
932 if(fEnergyList[iDigit] > fEnergyList[iDigitN] - locMaxCut)
935 } // if Areneighbours
941 for(iDigit = 0; iDigit < fMulDigit; iDigit++) {
943 maxAt[iDigitN] = maxAt[iDigit] ;
944 maxAtEnergy[iDigitN] = fEnergyList[iDigit] ;
950 //____________________________________________________________________________
951 void AliPHOSEmcRecPoint::EvalTime(TClonesArray * /*digits*/)
953 // Define a rec.point time as a time in the cell with the maximum energy
954 //Time already evaluated during AddDigit()
959 for(Int_t idig=0; idig < fMulDigit; idig++){
960 if(fEnergyList[idig] > maxE){
961 maxE = fEnergyList[idig] ;
965 fTime = ((AliPHOSDigit*) digits->At(fDigitsList[maxAt]))->GetTime() ;
968 //____________________________________________________________________________
969 void AliPHOSEmcRecPoint::Purify(Float_t threshold){
970 //Removes digits below threshold
972 Int_t * tempo = new Int_t[fMaxDigit];
973 Float_t * tempoE = new Float_t[fMaxDigit];
976 for(Int_t iDigit=0;iDigit< fMulDigit ;iDigit++){
977 if(fEnergyList[iDigit] > threshold){
978 tempo[mult] = fDigitsList[iDigit] ;
979 tempoE[mult] = fEnergyList[iDigit] ;
985 delete [] fDigitsList ;
986 delete [] fEnergyList ;
987 fDigitsList = new Int_t[fMulDigit];
988 fEnergyList = new Float_t[fMulDigit];
990 fAmp = 0.; //Recalculate total energy
991 for(Int_t iDigit=0;iDigit< fMulDigit ;iDigit++){
992 fDigitsList[iDigit] = tempo[iDigit];
993 fEnergyList[iDigit] = tempoE[iDigit] ;
994 fAmp+=tempoE[iDigit];
1001 //____________________________________________________________________________
1002 void AliPHOSEmcRecPoint::Print(Option_t *) const
1004 // Print the list of digits belonging to the cluster
1007 message = "AliPHOSEmcRecPoint:\n" ;
1008 message += "Digit multiplicity = %d" ;
1009 message += ", cluster Energy = %f" ;
1010 message += ", number of primaries = %d" ;
1011 message += ", rec.point index = %d \n" ;
1012 printf(message.Data(), fMulDigit, fAmp, fMulTrack,GetIndexInList() ) ;
1015 printf(" digits ids = ") ;
1016 for(iDigit=0; iDigit<fMulDigit; iDigit++)
1017 printf(" %d ", fDigitsList[iDigit] ) ;
1019 printf("\n digit energies = ") ;
1020 for(iDigit=0; iDigit<fMulDigit; iDigit++)
1021 printf(" %f ", fEnergyList[iDigit] ) ;
1023 printf("\n digit primaries ") ;
1024 if (fMulTrack<1) printf("... no primaries");
1025 for(iDigit = 0;iDigit < fMulTrack; iDigit++)
1026 printf(" %d ", fTracksList[iDigit]) ;