CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TH1Keys.h
Go to the documentation of this file.
1 #ifndef TH1Keys_h
2 #define TH1Keys_h
3 
4 #include <TH1.h>
5 #include <RooRealVar.h>
6 #include <RooArgSet.h>
7 #include <RooDataSet.h>
8 #include <RooNDKeysPdf.h>
9 
10 class TH1Keys : public TH1 {
11  public:
12  TH1Keys();
13  TH1Keys(const char *name,const char *title,Int_t nbinsx,Double_t xlow,Double_t xup, TString options = "a", Double_t rho = 1.5);
14  TH1Keys(const char *name,const char *title,Int_t nbinsx,const Float_t *xbins, TString options = "a", Double_t rho = 1.5) ;
15  TH1Keys(const char *name,const char *title,Int_t nbinsx,const Double_t *xbins, TString options = "a", Double_t rho = 1.5) ;
16  TH1Keys(const TH1Keys &other);
17  virtual ~TH1Keys();
18 
19  TH1 * GetHisto() { if (!isCacheGood_) FillH1(); return cache_; }
20  const TH1 * GetHisto() const { if (!isCacheGood_) FillH1(); return cache_; }
21 
22  virtual Int_t Fill(Double_t x) { return Fill(x,1.0); }
23  virtual Int_t Fill(Double_t x, Double_t w);
24  virtual void FillN(Int_t ntimes, const Double_t *x, const Double_t *w, Int_t stride=1);
25 
26  virtual void Add(const TH1 *h1, Double_t c1=1);
27  virtual void Add(const TH1 *h, const TH1 *h2, Double_t c1=1, Double_t c2=1) { dont("Add with two arguments"); }
28 
29  virtual void AddBinContent(Int_t bin) { AddBinContent(bin, 1.0); }
30  virtual void AddBinContent(Int_t bin, Double_t w) { dont("AddBinContent"); }
31  virtual void Copy(TObject &hnew) const { dont("Copy"); }
32 
33  virtual TH1 *DrawCopy(Option_t *option="") const { dont("DrawCopy"); return 0; }
34 
35  virtual Double_t GetBinContent(Int_t bin) const { return GetHisto()->GetBinContent(bin); }
36  virtual Double_t GetBinContent(Int_t bin, Int_t) const { return GetHisto()->GetBinContent(bin); }
37  virtual Double_t GetBinContent(Int_t bin, Int_t, Int_t) const {return GetHisto()->GetBinContent(bin); }
38 
39  virtual Double_t GetEntries() const { return dataset_->numEntries(); }
40 
41  virtual void Reset(Option_t *option="") ;
42  virtual void SetBinContent(Int_t bin, Double_t content) { dont("SetBinContent"); }
43  virtual void SetBinContent(Int_t bin, Int_t, Double_t content) { SetBinContent(bin,content); }
44  virtual void SetBinContent(Int_t bin, Int_t, Int_t, Double_t content) { SetBinContent(bin,content); }
45  virtual void SetBinsLength(Int_t n=-1) { dont("SetBinLength"); }
46  virtual void Scale(Double_t c1=1, Option_t *option="");
47 
48  ClassDef(TH1Keys,1) //
49 
50  private:
51  Double_t min_, max_;
52  RooRealVar *x_, *w_;
53  RooArgSet point_;
54  RooDataSet *dataset_;
55  Double_t underflow_, overflow_;
56  Double_t globalScale_;
57 
58  TString options_;
59  Double_t rho_;
60 
61  mutable TH1 *cache_;
62  mutable bool isCacheGood_;
63 
64  void FillH1() const;
65 
66  void dont(const char *) const ;
67 }; // class
68 
69 #endif
virtual void SetBinsLength(Int_t n=-1)
Definition: TH1Keys.h:45
TH1 * cache_
Definition: TH1Keys.h:61
virtual Double_t GetEntries() const
Definition: TH1Keys.h:39
ClassDef(TH1Keys, 1) private RooRealVar * w_
Definition: TH1Keys.h:48
virtual Int_t Fill(Double_t x)
Definition: TH1Keys.h:22
const double xbins[]
RooDataSet * dataset_
Definition: TH1Keys.h:54
virtual void SetBinContent(Int_t bin, Int_t, Int_t, Double_t content)
Definition: TH1Keys.h:44
virtual void Copy(TObject &hnew) const
Definition: TH1Keys.h:31
Definition: DDAxes.h:10
RooArgSet point_
Definition: TH1Keys.h:53
virtual void AddBinContent(Int_t bin)
Definition: TH1Keys.h:29
virtual void FillN(Int_t ntimes, const Double_t *x, const Double_t *w, Int_t stride=1)
Definition: TH1Keys.cc:117
virtual void Reset(Option_t *option="")
Definition: TH1Keys.cc:140
virtual Double_t GetBinContent(Int_t bin, Int_t) const
Definition: TH1Keys.h:36
bool isCacheGood_
Definition: TH1Keys.h:62
virtual Double_t GetBinContent(Int_t bin) const
Definition: TH1Keys.h:35
virtual void Add(const TH1 *h, const TH1 *h2, Double_t c1=1, Double_t c2=1)
Definition: TH1Keys.h:27
virtual void SetBinContent(Int_t bin, Double_t content)
Definition: TH1Keys.h:42
void dont(const char *) const
Definition: TH1Keys.cc:169
TH1 * GetHisto()
Definition: TH1Keys.h:19
virtual void AddBinContent(Int_t bin, Double_t w)
Definition: TH1Keys.h:30
Double_t underflow_
Definition: TH1Keys.h:55
virtual void Add(const TH1 *h1, Double_t c1=1)
Definition: TH1Keys.cc:125
Double_t rho_
Definition: TH1Keys.h:59
virtual Double_t GetBinContent(Int_t bin, Int_t, Int_t) const
Definition: TH1Keys.h:37
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
virtual TH1 * DrawCopy(Option_t *option="") const
Definition: TH1Keys.h:33
string const
Definition: compareJSON.py:14
virtual ~TH1Keys()
Definition: TH1Keys.cc:97
virtual void SetBinContent(Int_t bin, Int_t, Double_t content)
Definition: TH1Keys.h:43
#define private
Definition: FWFileEntry.h:18
Double_t overflow_
Definition: TH1Keys.h:55
virtual void Scale(Double_t c1=1, Option_t *option="")
Definition: TH1Keys.cc:134
x
Definition: VDTMath.h:216
TH1Keys()
Definition: TH1Keys.cc:8
void FillH1() const
Definition: TH1Keys.cc:150
const TH1 * GetHisto() const
Definition: TH1Keys.h:20
ClassDef(TH1Keys, 1) private RooRealVar * x_
Definition: TH1Keys.h:48
T w() const
TString options_
Definition: TH1Keys.h:58
Double_t globalScale_
Definition: TH1Keys.h:56