36 :
RooAbsReal(
name, title), _x(
"x",
"x", this), _p(
"p",
"p", this), _dh(dh), _relParam(paramRelative)
43 _p.add(paramSource->_p);
49 for (
Int_t i = 0; i < _dh.numEntries(); i++) {
50 const double wi = _dh.weight(i);
51 const char *vname =
Form(
"%s_gamma_bin_%i", GetName(), i);
53 var->
setVal(_relParam ? 1 : wi);
54 var->
setError(_relParam ? 1 / sqrt(wi) : sqrt(wi));
59 addOwnedComponents(allVars);
66 _x(
"x",this,other._x),
67 _p(
"p",this,other._p),
69 _relParam(other._relParam)
75double RooParamHistFunc::evaluate()
const
79 return _relParam ? ret * getNominal(idx) : ret;
84double RooParamHistFunc::getActual(
Int_t ibin)
86 return (
static_cast<RooAbsReal&
>(_p[ibin])).getVal() ;
91void RooParamHistFunc::setActual(
Int_t ibin,
double newVal)
93 (
static_cast<RooRealVar&
>(_p[ibin])).setVal(newVal) ;
98double RooParamHistFunc::getNominal(
Int_t ibin)
const
100 return _dh.weight(ibin) ;
105double RooParamHistFunc::getNominalError(
Int_t ibin)
const
108 return _dh.weightError() ;
116std::list<double>* RooParamHistFunc::plotSamplingHint(
RooAbsRealLValue& obs,
double xlo,
double xhi)
const
126 double* boundaries = binning->
array() ;
128 std::list<double>* hint =
new std::list<double> ;
131 xlo = xlo - 0.01*(xhi-xlo) ;
132 xhi = xhi + 0.01*(xhi-xlo) ;
134 double delta = (xhi-xlo)*1
e-8 ;
139 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
140 hint->push_back(boundaries[i]-delta) ;
141 hint->push_back(boundaries[i]+delta) ;
153std::list<double>* RooParamHistFunc::binBoundaries(
RooAbsRealLValue& obs,
double xlo,
double xhi)
const
163 double* boundaries = binning->
array() ;
165 std::list<double>* hint =
new std::list<double> ;
170 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
171 hint->push_back(boundaries[i]) ;
185 std::unique_ptr<RooAbsCollection> allVarsCommon{allVars.
selectCommon(_x)};
186 bool intAllObs = (allVarsCommon->size()==_x.size()) ;
187 if (intAllObs && matchArgs(allVars,analVars,_x)) {
198double RooParamHistFunc::analyticalIntegralWN(
Int_t code,
const RooArgSet* ,
const char* rangeName)
const
209 std::map<const RooAbsArg*, std::pair<double, double> > ranges;
210 for (
const auto obs : _x) {
214 auto getBinScale = [&](
int iBin){
return static_cast<const RooAbsReal&
>(_p[iBin]).getVal(); };
217 return const_cast<RooDataHist&
>(_dh).
sum(_x, sliceSet,
true,
false, ranges, getBinScale);
int Int_t
Signed integer 4 bytes (int)
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Abstract base class for RooRealVar binning definitions.
virtual Int_t numBoundaries() const =0
virtual double * array() const =0
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Abstract base class for objects that are lvalues, i.e.
virtual const RooAbsBinning * getBinningPtr(const char *rangeName) const =0
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
void setConstant(bool value=true)
Abstract base class for objects that represent a real value and implements functionality common to al...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * selectCommon(const RooAbsCollection &refColl) const
Use RooAbsCollection::selecCommon(), but return as RooArgSet.
Container class to hold N-dimensional binned data.
Variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
void setError(double value)
const char * GetName() const override
Returns name of object.
std::pair< double, double > getRangeOrBinningInterval(RooAbsArg const *arg, const char *rangeName)
static uint64_t sum(uint64_t i)