]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
protections agains 0 energy - Salvatore
authorgconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 Sep 2012 15:03:56 +0000 (15:03 +0000)
committergconesab <gconesab@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 20 Sep 2012 15:03:56 +0000 (15:03 +0000)
EMCAL/AliEMCALRecoUtils.cxx
EMCAL/AliEMCALRecoUtils.h

index c2ac8c1bc078f601157dee7678890caf2737fc76..5ef377283fc29b04dd8b7e78cd582cf547c00215 100644 (file)
@@ -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) ;
 
index c3c7e492facebb879d5123cc79e5f9e3ead5d35b..d2236466ec6749f954b1de7f5a434870d758353b 100644 (file)
@@ -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 ;