Added protection for NaN
authorlaphecet <laphecet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 29 Jun 2008 09:18:18 +0000 (09:18 +0000)
committerlaphecet <laphecet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 29 Jun 2008 09:18:18 +0000 (09:18 +0000)
MUON/AliMUONTrackerData.cxx
MUON/AliMUONTrackerDataHistogrammer.cxx

index 0aec610..cbadf79 100644 (file)
@@ -1059,7 +1059,9 @@ AliMUONTrackerData::Value(const AliMUONVCalibParam& param, Int_t i, Int_t dim) c
   
   if ( TMath::Even(dim) || IsSingleEvent() ) 
   {
-    return value/occ;
+               Double_t x = value/occ;
+               
+               return ( TMath::Finite(x) ? x : 0.0 ) ;
   }
   else
   {
index d3fb150..734a99d 100644 (file)
@@ -32,6 +32,7 @@
 #include <TH1.h>
 #include <TObjArray.h>
 #include <TROOT.h>
+#include <TMath.h>
 
 ///\class AliMUONTrackerDataHistogrammer
 ///
@@ -197,14 +198,18 @@ AliMUONTrackerDataHistogrammer::CreateHisto(const char* name,
     h = new TH1F(name,name,nbins,xmin,xmax);
     h->SetDirectory(gROOT);
   }
+       else
+       {
+               AliError(Form("Cannot create histo for name=%s nbins=%d xmin=%e xmax=%e",name,nbins,xmin,xmax));
+       }
   return h;
 }
 
 //_____________________________________________________________________________
 TH1* 
 AliMUONTrackerDataHistogrammer::CreateHisto(const AliMUONVPainter& painter, 
-                                                    Int_t externalDim,
-                                                    Int_t internalDim)
+                                                                                                                                                                               Int_t externalDim,
+                                                                                                                                                                               Int_t internalDim)
 {
   /// Create an histogram, from given dim of given data, 
   /// for all the channels handled by painter
@@ -344,8 +349,16 @@ AliMUONTrackerDataHistogrammer::GetDataRange(const TObjArray& manuArray,
       if ( fData.HasChannel(detElemId,manuId,i) ) 
       {
         Double_t value = fData.Channel(detElemId,manuId,i,fInternalDim);
-        xmin = TMath::Min(xmin,value);
-        xmax = TMath::Max(xmax,value);
+                               
+                               if ( ! TMath::Finite(value) )
+                               {
+                                       AliError(Form("Got a NaN for DE %d manu %d ch %d",detElemId,manuId,i));
+                               }
+                               else
+                               {
+                                       xmin = TMath::Min(xmin,value);
+                                       xmax = TMath::Max(xmax,value);
+                               }
       }
     }
   }