159 if (
observables_.getSize() > 3)
throw std::invalid_argument(std::string(
"ERROR in SinglePdfGenInfo::generateWithHisto for ") +
pdf_->GetName() +
", more than 3 observable");
161 RooRealVar *
x = (RooRealVar*)obs.at(0);
162 RooRealVar *
y = obs.getSize() > 1 ? (RooRealVar*)obs.at(1) : 0;
163 RooRealVar *
z = obs.getSize() > 2 ? (RooRealVar*)obs.at(2) : 0;
164 if (weightVar == 0) weightVar =
new RooRealVar(
"_weight_",
"",1.0);
166 RooCmdArg ay = (y ? RooFit::YVar(*y) : RooCmdArg::
none());
167 RooCmdArg az = (z ? RooFit::ZVar(*z) : RooCmdArg::
none());
176 RooArgSet obsPlusW(obs); obsPlusW.add(*weightVar);
177 RooDataSet *
data =
new RooDataSet(TString::Format(
"%sData",
pdf_->GetName()),
"", obsPlusW, weightVar->GetName());
178 RooAbsArg::setDirtyInhibit(
true);
179 switch (obs.getSize()) {
182 x->setVal(
histoSpec_->GetXaxis()->GetBinCenter(
i));
188 TH2& h2 =
dynamic_cast<TH2&
>(*histoSpec_);
189 for (
int ix = 1, nx = h2.GetNbinsX(); ix <= nx; ++ix) {
190 for (
int iy = 1, ny = h2.GetNbinsY(); iy <= ny; ++iy) {
191 x->setVal(h2.GetXaxis()->GetBinCenter(ix));
192 y->setVal(h2.GetYaxis()->GetBinCenter(iy));
193 data->add(
observables_, asimov ? h2.GetBinContent(ix,iy) : RooRandom::randomGenerator()->Poisson(h2.GetBinContent(ix,iy)) );
199 TH3& h3 =
dynamic_cast<TH3&
>(*histoSpec_);
200 for (
int ix = 1, nx = h3.GetNbinsX(); ix <= nx; ++ix) {
201 for (
int iy = 1, ny = h3.GetNbinsY(); iy <= ny; ++iy) {
202 for (
int iz = 1, nz = h3.GetNbinsZ(); iz <= nz; ++iz) {
203 x->setVal(h3.GetXaxis()->GetBinCenter(ix));
204 y->setVal(h3.GetYaxis()->GetBinCenter(iy));
205 z->setVal(h3.GetYaxis()->GetBinCenter(iz));
206 data->add(
observables_, asimov ? h3.GetBinContent(ix,iy,iz) : RooRandom::randomGenerator()->Poisson(h3.GetBinContent(ix,iy,iz)) );
210 RooAbsArg::setDirtyInhibit(
false);
RooDataSet * generateCountingAsimov()
char data[epos_bytes_allocation]