Additional protection in Digitize, which was moved to the implementation file
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Apr 2006 14:22:31 +0000 (14:22 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 Apr 2006 14:22:31 +0000 (14:22 +0000)
EMCAL/AliEMCALSDigitizer.cxx
EMCAL/AliEMCALSDigitizer.h

index 1caebbffcdbc035daa0a4f22d4837c02b2cb9912..331ff5ccfc1c124b960203055feb01bd079e3533 100644 (file)
 //////////////////////////////////////////////////////////////////////////////
 
 // --- ROOT system ---
-#include "TBenchmark.h"
-#include "TH1.h"
-#include "TBrowser.h"
-#include "Riostream.h"
-//#include "TObjectTable.h"
+#include <TBenchmark.h>
+#include <TH1.h>
+#include <TBrowser.h>
+#include <Riostream.h>
+#include <TMath.h>
 
 // --- Standard library ---
 #include "stdlib.h"
@@ -318,6 +318,22 @@ void AliEMCALSDigitizer::Exec(Option_t *option)
   }
 }
 
+//__________________________________________________________________
+
+Int_t AliEMCALSDigitizer::Digitize(Float_t energy)const {
+  // Digitize the energy
+    Double_t aSignal = fA + energy*fB;
+    if (TMath::Abs(aSignal)>2147483647.0) { 
+      //PH 2147483647 is the max. integer
+      //PH This apparently is a problem which needs investigation
+      AliWarning(Form("Too big or too small energy %f",aSignal));
+      aSignal = TMath::Sign((Double_t)2147483647,aSignal);
+    }
+    return (Int_t ) aSignal;
+  }
+
+//__________________________________________________________________
 
 void AliEMCALSDigitizer::Print1(Option_t * option)
 {
index a983a4d7e8c29a8d3a142ef5efc6cdc63345d688..3c6fd6d512180c0f6869693733a1888d7f26b6fe 100644 (file)
@@ -35,7 +35,7 @@ public:
   virtual ~AliEMCALSDigitizer(); // dtor
 
   Float_t       Calibrate(Int_t amp)const {return (amp - fA)/fB ; }
-  Int_t         Digitize(Float_t energy)const { return (Int_t ) (fA + energy*fB); }
+  Int_t         Digitize(Float_t energy)const;
   virtual void  Exec(Option_t *option); 
   Int_t         GetSDigitsInRun() const {return fSDigitsInRun ;}  
   virtual void  Print(Option_t *option="") const;