1 #include "../interface/TH1Keys.h"
2 #include <RooBinning.h>
3 #include <RooMsgService.h>
11 underflow_(0.0), overflow_(0.0),
19 TH1(name,title,nbinsx,xlow,xup),
20 min_(xlow), max_(xup),
21 x_(new RooRealVar(
"x",
"x", min_, max_)),
22 w_(new RooRealVar(
"w",
"w", 1.0)),
24 dataset_(new RooDataSet(name, title, RooArgSet(*x_, *w_),
"w")),
25 underflow_(0.0), overflow_(0.0),
29 cache_(new TH1F(
"",title,nbinsx,xlow,xup)),
38 TH1(name,title,nbinsx,xbins),
39 min_(xbins[0]), max_(xbins[nbinsx]),
40 x_(new RooRealVar(
"x",
"x", min_, max_)),
41 w_(new RooRealVar(
"w",
"w", 1.0)),
43 dataset_(new RooDataSet(name, title, RooArgSet(*x_, *w_),
"w")),
44 underflow_(0.0), overflow_(0.0),
48 cache_(new TH1F(
"",title,nbinsx,xbins)),
53 std::vector<Double_t> boundaries(nbinsx+1);
54 for (Int_t
i = 0;
i <= nbinsx; ++
i) boundaries[
i] = xbins[
i];
55 x_->setBinning(RooBinning(nbinsx, &boundaries[0]));
59 TH1(name,title,nbinsx,xbins),
60 min_(xbins[0]), max_(xbins[nbinsx]),
61 x_(new RooRealVar(
"x",
"x", min_, max_)),
62 w_(new RooRealVar(
"w",
"w", 1.0)),
64 dataset_(new RooDataSet(name, title, RooArgSet(*x_, *w_),
"w")),
65 underflow_(0.0), overflow_(0.0),
69 cache_(new TH1F(
"",title,nbinsx,xbins)),
74 x_->setBinning(RooBinning(nbinsx, xbins));
80 min_(other.min_), max_(other.max_),
81 x_(new RooRealVar(
"x",
"x", min_, max_)),
82 w_(new RooRealVar(
"w",
"w", 1.0)),
84 dataset_(new RooDataSet(other.GetName(), other.GetTitle(), RooArgSet(*x_, *w_),
"w")),
85 underflow_(other.underflow_), overflow_(other.overflow_),
86 globalScale_(other.globalScale_),
87 options_(other.options_),
89 cache_((TH1*)other.cache_->Clone()),
90 isCacheGood_(other.isCacheGood_)
93 x_->setBinning(other.
x_->getBinning());
120 for (Int_t
i = 0;
i < ntimes;
i += stride) {
127 if (c1 != 1.0)
dont(
"Add with constant != 1");
129 if (other == 0)
dont(
"Add with a non TH1Keys");
159 cache_ = pdf.createHistogram(GetName(), *
x_);
170 TObject::Error(
"TH1Keys",msg);
171 throw std::runtime_error(std::string(
"Error in TH1Keys: ")+msg);
virtual Int_t Fill(Double_t x)
static PFTauRenderPlugin instance
virtual void FillN(Int_t ntimes, const Double_t *x, const Double_t *w, Int_t stride=1)
virtual void Reset(Option_t *option="")
void dont(const char *) const
virtual void Add(const TH1 *h1, Double_t c1=1)
virtual void Scale(Double_t c1=1, Option_t *option="")
ClassDef(TH1Keys, 1) private RooRealVar * x_