Added protection in AliHMPIDParam::FindTemp() in case tLow is equal to tHigh
authorgvolpe <gvolpe@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 21 Jan 2010 19:13:01 +0000 (19:13 +0000)
committergvolpe <gvolpe@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 21 Jan 2010 19:13:01 +0000 (19:13 +0000)
HMPID/AliHMPIDParam.h

index 846ab4b..c784f1c 100644 (file)
@@ -252,9 +252,14 @@ Double_t AliHMPIDParam::FindTemp(Double_t tLow,Double_t tHigh,Double_t y)
 //  Double_t gradT = (t2-t1)/SizePcY();  // linear gradient
 //  return gradT*y+t1;
   Double_t halfPadSize = 0.5*SizePadY();
-  Double_t gradT = (TMath::Log(SizePcY()) - TMath::Log(halfPadSize))/(TMath::Log(tHigh)-TMath::Log(tLow));
-  if(y<0) y = 0;
-  return tLow + TMath::Power(y/halfPadSize,1./gradT);  
+  Double_t result = tLow;
+  Double_t delta = (TMath::Log(tHigh)-TMath::Log(tLow));
+  if (TMath::Abs(delta)>0) {
+    Double_t gradT = (TMath::Log(SizePcY()) - TMath::Log(halfPadSize))/delta;
+    if(y<0) y = 0;
+    result += TMath::Power(y/halfPadSize,1./gradT);
+  }
+  return result;    
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 #endif