+//____________________________________________________________________________
+Double_t AliPHOSTenderSupply::CoreEnergy(AliVCluster * clu){
+ //calculate energy of the cluster in the circle with radius distanceCut around the maximum
+
+ //Can not use already calculated coordinates?
+ //They have incidence correction...
+ const Double_t distanceCut =3.5 ;
+ const Double_t logWeight=4.5 ;
+
+ Double32_t * elist = clu->GetCellsAmplitudeFraction() ;
+// Calculates the center of gravity in the local PHOS-module coordinates
+ Float_t wtot = 0;
+ Double_t xc[100]={0} ;
+ Double_t zc[100]={0} ;
+ Double_t x = 0 ;
+ Double_t z = 0 ;
+ Int_t mulDigit=TMath::Min(100,clu->GetNCells()) ;
+ for(Int_t iDigit=0; iDigit<mulDigit; iDigit++) {
+ Int_t relid[4] ;
+ Float_t xi ;
+ Float_t zi ;
+ fPHOSGeo->AbsToRelNumbering(clu->GetCellAbsId(iDigit), relid) ;
+ fPHOSGeo->RelPosInModule(relid, xi, zi);
+ xc[iDigit]=xi ;
+ zc[iDigit]=zi ;
+ if (clu->E()>0 && elist[iDigit]>0) {
+ Float_t w = TMath::Max( 0., logWeight + TMath::Log( elist[iDigit] / clu->E() ) ) ;
+ x += xc[iDigit] * w ;
+ z += zc[iDigit] * w ;
+ wtot += w ;
+ }
+ }
+ if (wtot>0) {
+ x /= wtot ;
+ z /= wtot ;
+ }
+ Double_t coreE=0. ;
+ for(Int_t iDigit=0; iDigit < mulDigit; iDigit++) {
+ Double_t distance = TMath::Sqrt((xc[iDigit]-x)*(xc[iDigit]-x)+(zc[iDigit]-z)*(zc[iDigit]-z)) ;
+ if(distance < distanceCut)
+ coreE += elist[iDigit] ;
+ }
+ //Apply non-linearity correction
+ return coreE ;
+}