]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliCaloFastAltroFitv0.cxx
Always delete TObjArrays created by TString::Tokenize (Ruben)
[u/mrichter/AliRoot.git] / RAW / AliCaloFastAltroFitv0.cxx
index 9fa38f0858d934465356168629a5421b245d991f..de96973f096fa671547e0af29d0f1f1250b9479d 100644 (file)
@@ -85,10 +85,8 @@ AliCaloFastAltroFitv0& AliCaloFastAltroFitv0::operator= (const AliCaloFastAltroF
 }
 
 void AliCaloFastAltroFitv0::FastFit(Int_t* t, Int_t* y, Int_t nPoints, Double_t sig, Double_t tau, 
-                                 Double_t n, Double_t ped, Double_t tMax)
+                                   Double_t /*n*/, Double_t ped, Double_t tMax)
 {
-  // n 2 here and unused
-  n = 2.;
   Reset();
 
   fSig = sig;
@@ -130,7 +128,8 @@ void AliCaloFastAltroFitv0::FastFit(TH1F* h, Double_t sig, Double_t tau, Double_
 Double_t ped, Double_t tMax)
 {
   // Service method for convinience only
-  // h - hist with altro response  
+  // h - hist with altro response, could have empty bin
+  // and center of bin could be different from bin number  
   Reset();
 
   if(h==0) return;
@@ -140,12 +139,16 @@ Double_t ped, Double_t tMax)
   Int_t* t = new Int_t[nPoints];
   Int_t* y = new Int_t[nPoints];
 
+  Int_t nPositive=0;
   for(Int_t i=0; i<nPoints; i++) {
-    t[i] = i+1;
-    y[i] = Int_t(h->GetBinContent(i+1));
+    if(h->GetBinContent(i+1) > 0.0){ // Get only positive
+      y[nPositive] = Int_t(h->GetBinContent(i+1));
+      t[nPositive] = Int_t(h->GetBinCenter(i+1)+0.0001);
+      nPositive++;
+    }
   }
 
-  if(nPoints>=2) {
+  if(nPositive >= 2) {
     FastFit(t,y,nPoints, sig,tau,n,ped, tMax);
   }
   if(fChi2<=0.0) fNoFit++;