Go to the documentation of this file.00001 #ifndef TH1Keys_h
00002 #define TH1Keys_h
00003
00004 #include <TH1.h>
00005 #include <RooRealVar.h>
00006 #include <RooArgSet.h>
00007 #include <RooDataSet.h>
00008 #include <RooNDKeysPdf.h>
00009
00010 class TH1Keys : public TH1 {
00011 public:
00012 TH1Keys();
00013 TH1Keys(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup, TString options = "a", Double_t rho = 1.5);
00014 TH1Keys(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins, TString options = "a", Double_t rho = 1.5) ;
00015 TH1Keys(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins, TString options = "a", Double_t rho = 1.5) ;
00016 TH1Keys(const TH1Keys &other);
00017 virtual ~TH1Keys();
00018
00019 TH1 * GetHisto() { if (!isCacheGood_) FillH1(); return cache_; }
00020 const TH1 * GetHisto() const { if (!isCacheGood_) FillH1(); return cache_; }
00021
00022 virtual Int_t Fill(Double_t x) { return Fill(x,1.0); }
00023 virtual Int_t Fill(Double_t x, Double_t w);
00024 virtual void FillN(Int_t ntimes, const Double_t *x, const Double_t *w, Int_t stride=1);
00025
00026 virtual void Add(const TH1 *h1, Double_t c1=1);
00027 virtual void Add(const TH1 *h, const TH1 *h2, Double_t c1=1, Double_t c2=1) { dont("Add with two arguments"); }
00028
00029 virtual void AddBinContent(Int_t bin) { AddBinContent(bin, 1.0); }
00030 virtual void AddBinContent(Int_t bin, Double_t w) { dont("AddBinContent"); }
00031 virtual void Copy(TObject &hnew) const { dont("Copy"); }
00032
00033 virtual TH1 *DrawCopy(Option_t *option="") const { dont("DrawCopy"); return 0; }
00034
00035 virtual Double_t GetBinContent(Int_t bin) const { return GetHisto()->GetBinContent(bin); }
00036 virtual Double_t GetBinContent(Int_t bin, Int_t) const { return GetHisto()->GetBinContent(bin); }
00037 virtual Double_t GetBinContent(Int_t bin, Int_t, Int_t) const {return GetHisto()->GetBinContent(bin); }
00038
00039 virtual Double_t GetEntries() const { return dataset_->numEntries(); }
00040
00041 virtual void Reset(Option_t *option="") ;
00042 virtual void SetBinContent(Int_t bin, Double_t content) { dont("SetBinContent"); }
00043 virtual void SetBinContent(Int_t bin, Int_t, Double_t content) { SetBinContent(bin,content); }
00044 virtual void SetBinContent(Int_t bin, Int_t, Int_t, Double_t content) { SetBinContent(bin,content); }
00045 virtual void SetBinsLength(Int_t n=-1) { dont("SetBinLength"); }
00046 virtual void Scale(Double_t c1=1, Option_t *option="");
00047
00048 ClassDef(TH1Keys,1)
00049
00050 private:
00051 Double_t min_, max_;
00052 RooRealVar *x_, *w_;
00053 RooArgSet point_;
00054 RooDataSet *dataset_;
00055 Double_t underflow_, overflow_;
00056 Double_t globalScale_;
00057
00058 TString options_;
00059 Double_t rho_;
00060
00061 mutable TH1 *cache_;
00062 mutable bool isCacheGood_;
00063
00064 void FillH1() const;
00065
00066 void dont(const char *) const ;
00067 };
00068
00069 #endif