42 _gamma(
"gamma",
"gamma",this),
43 _nominal(
"nominal",
"nominal",this),
59 <<
") ERROR: input object must be a RooParamHistFunc" << endl ;
60 throw std::string(
"RooHistConstraint::ctor ERROR incongruent input arguments") ;
68 const char* vname =
Form(
"%s_nominal_bin_%i",
GetName(),i) ;
91 vector<RooParamHistFunc*> phvec ;
94 for (
const auto arg : phfSet) {
98 phvec.push_back(phfComp) ;
102 gammaSet.
add(phfComp->
_p) ;
106 <<
") ERROR: incongruent input arguments: all input RooParamHistFuncs should have same #bins" << endl ;
107 throw std::string(
"RooHistConstraint::ctor ERROR incongruent input arguments") ;
111 <<
") ERROR: incongruent input arguments: all input RooParamHistFuncs should have the same bin parameters.\n"
112 <<
"Previously found " << bin0_name <<
", now found " << phfComp->
_p.
at(0)->
GetName() <<
".\n"
113 <<
"Check that the right RooParamHistFuncs have been passed to this RooHistConstraint." << std::endl;
114 throw std::string(
"RooHistConstraint::ctor ERROR incongruent input arguments") ;
120 <<
") WARNING: ignoring input argument " << arg->GetName() <<
" which is not of type RooParamHistFunc" << endl;
128 for (
Int_t i=0 ; i<nbins ; i++) {
131 for (
const auto phfunc : phvec) {
132 sumVal += phfunc->getNominal(i);
135 if (sumVal<threshold && sumVal != 0.) {
137 const char* vname =
Form(
"%s_nominal_bin_%i",
GetName(),i) ;
141 for (vector<RooParamHistFunc*>::iterator iter = phvec.begin() ; iter != phvec.end() ; ++iter) {
142 sumVal2 += (*iter)->getNominal(i) ;
147 vname =
Form(
"%s_nominal_error_bin_%i",
GetName(),i) ;
151 for (vector<RooParamHistFunc*>::iterator iter = phvec.begin() ; iter != phvec.end() ; ++iter) {
152 sumErr2 +=
pow((*iter)->getNominalError(i),2) ;
172 _gamma(
"gamma",this,other._gamma),
173 _nominal(
"nominal",this,other._nominal),
174 _relParam(other._relParam)
188 double gamVal =
gamma.getVal();
190 gamVal *= nominal.getVal();
207 double gam =
gamma.getVal();
214 const double logPoisson = nom *
log(gam) - gam -
std::lgamma(nom+1);
217 cerr <<
"ERROR in RooHistConstraint: gam=0 and nom>0" << endl ;
double pow(double, double)
char * Form(const char *fmt,...)
Bool_t addOwnedComponents(const RooArgSet &comps)
Take ownership of the contents of 'comps'.
Storage_t::size_type size() const
RooAbsArg * first() const
void setConstant(Bool_t value=kTRUE)
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
virtual Double_t weight() const
virtual Int_t numEntries() const
Return the number of bins.
virtual const RooArgSet * get() const
The RooHistConstraint implements constraint terms for a binned PDF with statistical uncertainties.
Double_t getLogVal(const RooArgSet *set=0) const
Return the log of the current value with given normalization An error message is printed if the argum...
Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Reimplementation of standard RooArgList::add()
A histogram function that assigns scale parameters to every bin.
RooRealVar represents a variable that can be changed from the outside.
virtual void setVal(Double_t value)
Set value of variable to 'value'.
virtual const char * GetName() const
Returns name of object.
double lgamma(double x)
Calculates the logarithm of the gamma function.
Double_t Poisson(Double_t x, Double_t par)
Compute the Poisson distribution function for (x,par).
static long int sum(long int i)