From 5992186a2e6f8acee096ea41bb8e22c6aa308edb Mon Sep 17 00:00:00 2001 From: pavlinov Date: Tue, 7 Apr 2009 11:38:41 +0000 Subject: [PATCH] Improved a method FillH1 --- EMCAL/AliEMCALHistoUtilities.cxx | 12 ++++++++++-- EMCAL/AliEMCALHistoUtilities.h | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/EMCAL/AliEMCALHistoUtilities.cxx b/EMCAL/AliEMCALHistoUtilities.cxx index 37c30794c83..6a33ff238e2 100644 --- a/EMCAL/AliEMCALHistoUtilities.cxx +++ b/EMCAL/AliEMCALHistoUtilities.cxx @@ -87,14 +87,22 @@ TList* AliEMCALHistoUtilities::MoveHistsToList(const char* name, Bool_t putToBro return list; } -void AliEMCALHistoUtilities::FillH1(TList *l, Int_t ind, Double_t x, Double_t w) +void AliEMCALHistoUtilities::FillH1(TList *l, Int_t ind, Double_t x, Double_t w, Double_t error) { //fill 1d histogram static TH1* hid=0; + static int bin=0; if(l == 0) return; + if(ind>=0 && ind < l->GetSize()){ hid = (TH1*)l->At(ind); - hid->Fill(x,w); + if(error <= 0.0) { // standard way + hid->Fill(x,w); + } else{ + bin = hid->FindBin(x); + hid->SetBinContent(bin,w); + hid->SetBinError(bin,error); + } } } diff --git a/EMCAL/AliEMCALHistoUtilities.h b/EMCAL/AliEMCALHistoUtilities.h index 95106147fa1..a7f48dc9814 100644 --- a/EMCAL/AliEMCALHistoUtilities.h +++ b/EMCAL/AliEMCALHistoUtilities.h @@ -39,7 +39,7 @@ class AliEMCALHistoUtilities: public TNamed { // service routine static TList *MoveHistsToList(const char* name="ListOfHists", Bool_t putToBrowser=kTRUE); - static void FillH1(TList *l=0, Int_t ind=0, Double_t x=-99999., Double_t w=1.); + static void FillH1(TList *l=0, Int_t ind=0, Double_t x=-99999., Double_t w=1., Double_t error=0.); static void FillH2(TList *l=0, Int_t ind=0, Double_t x=-99999., Double_t y=-99999., Double_t w=1.); static int SaveListOfHists(TList *mylist=0, const char* name="test", Bool_t kSingleKey=kFALSE, const char* opt="RECREATE"); -- 2.43.0