From: gconesab Date: Thu, 20 Sep 2012 15:03:56 +0000 (+0000) Subject: protections agains 0 energy - Salvatore X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=a840d58957c483beae4f7ab9e53f4610422cb435;p=u%2Fmrichter%2FAliRoot.git protections agains 0 energy - Salvatore --- diff --git a/EMCAL/AliEMCALRecoUtils.cxx b/EMCAL/AliEMCALRecoUtils.cxx index c2ac8c1bc07..5ef377283fc 100644 --- a/EMCAL/AliEMCALRecoUtils.cxx +++ b/EMCAL/AliEMCALRecoUtils.cxx @@ -841,15 +841,22 @@ Float_t AliEMCALRecoUtils::GetDepth(const Float_t energy, Float_t x0 = 1.31; Float_t ecr = 8; Float_t depth = 0; + Float_t arg = energy*1000/ ecr; //Multiply energy by 1000 to transform to MeV switch ( iParticle ) { case kPhoton: - depth = x0 * (TMath::Log(energy*1000/ ecr) + 0.5); //Multiply energy by 1000 to transform to MeV + if (arg < 1) + depth = 0; + else + depth = x0 * (TMath::Log(arg) + 0.5); break; case kElectron: - depth = x0 * (TMath::Log(energy*1000/ ecr) - 0.5); //Multiply energy by 1000 to transform to MeV + if (arg < 1) + depth = 0; + else + depth = x0 * (TMath::Log(arg) - 0.5); break; case kHadron: @@ -872,13 +879,19 @@ Float_t AliEMCALRecoUtils::GetDepth(const Float_t energy, } else {//electron - depth = x0 * (TMath::Log(energy*1000 / ecr) - 0.5); //Multiply energy by 1000 to transform to MeV + if (arg < 1) + depth = 0; + else + depth = x0 * (TMath::Log(arg) - 0.5); } break; default://photon - depth = x0 * (TMath::Log(energy*1000 / ecr) + 0.5); //Multiply energy by 1000 to transform to MeV + if (arg < 1) + depth = 0; + else + depth = x0 * (TMath::Log(arg) + 0.5); } return depth; @@ -1287,6 +1300,8 @@ void AliEMCALRecoUtils::RecalculateClusterPositionFromTowerGlobal(const AliEMCAL Bool_t shared = kFALSE; Float_t clEnergy = clu->E(); //Energy already recalibrated previously + if (clEnergy <= 0) + return; GetMaxEnergyCell(geom, cells, clu, absId, iSupModMax, ieta, iphi,shared); Double_t depth = GetDepth(clEnergy,fParticleType,iSupModMax) ; @@ -1370,6 +1385,8 @@ void AliEMCALRecoUtils::RecalculateClusterPositionFromTowerIndex(const AliEMCALG Bool_t shared = kFALSE; Float_t clEnergy = clu->E(); //Energy already recalibrated previously. + if (clEnergy <= 0) + return; GetMaxEnergyCell(geom, cells, clu, absId, iSupModMax, ieta, iphi,shared); Float_t depth = GetDepth(clEnergy,fParticleType,iSupMod) ; diff --git a/EMCAL/AliEMCALRecoUtils.h b/EMCAL/AliEMCALRecoUtils.h index c3c7e492fac..d2236466ec6 100644 --- a/EMCAL/AliEMCALRecoUtils.h +++ b/EMCAL/AliEMCALRecoUtils.h @@ -63,7 +63,8 @@ public: void RecalculateClusterPositionFromTowerIndex (const AliEMCALGeometry *geom, AliVCaloCells* cells, AliVCluster* clu); void RecalculateClusterPositionFromTowerGlobal(const AliEMCALGeometry *geom, AliVCaloCells* cells, AliVCluster* clu); - Float_t GetCellWeight(const Float_t eCell, const Float_t eCluster) const { return TMath::Max( 0., fW0 + TMath::Log( eCell / eCluster )) ; } + Float_t GetCellWeight(const Float_t eCell, const Float_t eCluster) const { if (eCell > 0 && eCluster > 0) return TMath::Max( 0., fW0 + TMath::Log( eCell / eCluster )) ; + else return 0. ; } Float_t GetDepth(const Float_t eCluster, const Int_t iParticle, const Int_t iSM) const ;