61using std::endl, std::cout;
88 _nominal(
"!nominal",
"nominal value", this, (
RooAbsReal &)nominal),
89 _lowSet(
"!lowSet",
"low-side variation", this),
90 _highSet(
"!highSet",
"high-side variation", this),
91 _paramSet(
"!paramSet",
"high-side variation", this),
92 _positiveDefinite(false)
96 if (lowSet.
size() != highSet.
size()) {
97 coutE(InputArguments) <<
"PiecewiseInterpolation::ctor(" <<
GetName() <<
") ERROR: input lists should be of equal length" << endl ;
101 for (
auto *comp : lowSet) {
103 coutE(InputArguments) <<
"PiecewiseInterpolation::ctor(" <<
GetName() <<
") ERROR: component " << comp->GetName()
104 <<
" in first list is not of type RooAbsReal" << endl ;
111 for (
auto *comp : highSet) {
113 coutE(InputArguments) <<
"PiecewiseInterpolation::ctor(" <<
GetName() <<
") ERROR: component " << comp->GetName()
114 <<
" in first list is not of type RooAbsReal" << endl ;
121 for (
auto *comp : paramSet) {
123 coutE(InputArguments) <<
"PiecewiseInterpolation::ctor(" <<
GetName() <<
") ERROR: component " << comp->GetName()
124 <<
" in first list is not of type RooAbsReal" << endl ;
144 _normIntMgr(other._normIntMgr, this),
145 _nominal(
"!nominal",this,other._nominal),
146 _lowSet(
"!lowSet",this,other._lowSet),
147 _highSet(
"!highSet",this,other._highSet),
148 _paramSet(
"!paramSet",this,other._paramSet),
149 _positiveDefinite(other._positiveDefinite),
150 _interpCode(other._interpCode)
176 double sum(nominal) ;
183 sum += flexibleInterpSingle(
_interpCode[i], low->getVal(), high->getVal(), 1.0, nominal, param->getVal(),
sum);
193 cxcoutD(Tracing) <<
"PiecewiseInterpolation::evaluate - sum < 0, not forcing positive definite"<<endl;
201inline double broadcast(std::span<const double>
const &s, std::size_t i)
203 return s.size() > 1 ? s[i] : s[0];
218 for (std::size_t j = 0; j <
sum.size(); ++j) {
219 sum[j] = broadcast(nominal, j);
227 for (std::size_t j = 0; j <
sum.size(); ++j) {
229 sum[j] += flexibleInterpSingle(
_interpCode[i], broadcast(low, j), broadcast(high, j), 1.0, broadcast(nominal, j),
230 broadcast(param, j),
sum[j]);
235 for (std::size_t j = 0; j <
sum.size(); ++j) {
246 if(allVars.
size()==1){
253 cout <<
"Currently BinIntegrator only knows how to deal with 1-d "<<endl;
263 const RooArgSet* normSet,
const char* )
const
278 if (allVars.
empty())
return 0 ;
291 cout <<
"can't factorize integral" << endl;
297 analVars.
add(allVars) ;
300 Int_t sterileIdx(-1) ;
409 if( cache==
nullptr ) {
410 std::cout <<
"Error: Cache Element is nullptr" << std::endl;
411 throw std::exception();
423 for (
auto funcInt : static_range_cast<RooAbsReal*>(cache->
_funcIntList)) {
424 value += funcInt->getVal() ;
428 if(i==0 || i>1) { cout <<
"problem, wrong number of nominal functions"<<endl; }
434 for (
auto const *param : static_range_cast<RooAbsReal *>(
_paramSet)) {
438 if(param->getVal() > 0) {
439 value += param->getVal()*(high->
getVal() - nominal);
441 value += param->getVal()*(nominal - low->
getVal());
518 coutE(InputArguments) <<
"PiecewiseInterpolation::setInterpCode ERROR: " << param.
GetName() <<
" is not in list"
527 for (std::size_t i = 0; i <
_interpCode.size(); ++i) {
535 if (code < 0 || code > 6) {
536 coutE(InputArguments) <<
"PiecewiseInterpolation::setInterpCode ERROR: " << param.
GetName()
537 <<
" with unknown interpolation code " << code <<
", keeping current code "
545 coutE(InputArguments) <<
"PiecewiseInterpolation::setInterpCode ERROR: " << param.
GetName()
546 <<
" with unknown interpolation code " << code <<
", defaulting to code 2" << std::endl;
608void PiecewiseInterpolation::printMetaArgs(ostream& os) const
617 RooAbsArg* arg1, *arg2 ;
618 if (_highSet.size()!=0) {
620 while((arg1=(RooAbsArg*)_lowIter->Next())) {
626 arg2=(RooAbsArg*)_highIter->Next() ;
627 os << arg1->GetName() << " * " << arg2->GetName() ;
632 while((arg1=(RooAbsArg*)_lowIter->Next())) {
638 os << arg1->GetName() ;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
The PiecewiseInterpolation is a class that can morph distributions into each other,...
bool _positiveDefinite
protect against negative and 0 bins.
RooListProxy _lowSet
Low-side variation.
std::vector< int > _interpCode
RooListProxy _highSet
High-side variation.
bool isBinnedDistribution(const RooArgSet &obs) const override
WVE note: assumes nominal and alternates have identical structure, must add explicit check.
~PiecewiseInterpolation() override
Destructor.
void setInterpCodeForParam(int iParam, int code)
void setInterpCode(RooAbsReal ¶m, int code, bool silent=true)
void setAllInterpCodes(int code)
RooObjCacheManager _normIntMgr
! The integration cache manager
bool setBinIntegrator(RooArgSet &allVars)
std::list< double > * plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const override
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Advertise that all integrals can be handled internally.
RooListProxy _paramSet
interpolation parameters
std::list< double > * binBoundaries(RooAbsRealLValue &, double, double) const override
WVE note: assumes nominal and alternates have identical structure, must add explicit check.
RooRealProxy _nominal
The nominal value.
double evaluate() const override
Calculate and return current value of self.
void doEval(RooFit::EvalContext &) const override
Interpolate between input distributions for all values of the observable in evalData.
double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Implement analytical integrations by doing appropriate weighting from component integrals functions t...
void printAllInterpCodes()
Common abstract base class for objects that represent a value and a "shape" in RooFit.
friend void RooRefArray::Streamer(TBuffer &)
void setValueDirty()
Mark the element dirty. This forces a re-evaluation when a value is requested.
Abstract base class for objects to be stored in RooAbsCache cache manager objects.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
Int_t index(const RooAbsArg *arg) const
Returns index of given arg, or -1 if arg is not in the collection.
const_iterator end() const
Storage_t::size_type size() const
RooAbsArg * first() const
virtual bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
bool setRealValue(const char *name, double newVal=0.0, bool verbose=false)
Set value of a RooAbsRealLValue stored in set with given name to newVal No error messages are printed...
const_iterator begin() const
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
Abstract base class for objects that represent a real value and implements functionality common to al...
virtual std::list< double > * binBoundaries(RooAbsRealLValue &obs, double xlo, double xhi) const
Retrieve bin boundaries if this distribution is binned in obs.
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
bool _forceNumInt
Force numerical integration if flag set.
RooNumIntConfig * specialIntegratorConfig() const
Returns the specialized integrator configuration for this RooAbsReal.
virtual bool isBinnedDistribution(const RooArgSet &) const
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
virtual std::list< double > * plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
RooFit::OwningPtr< RooAbsReal > createIntegral(const RooArgSet &iset, const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Create an object that represents the integral of the function over one or more observables listed in ...
RooArgList is a container object that can hold multiple RooAbsArg objects.
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.
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=nullptr)
Setter function without integration set.
T * getObjByIndex(Int_t index) const
Retrieve payload object by slot index.
Int_t lastIndex() const
Return index of slot used in last get or set operation.
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=nullptr, const TNamed *isetRangeName=nullptr)
Getter function without integration set.
bool setLabel(const char *label, bool printError=true) override
Set value by specifying the name of the desired state.
bool add(const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
Overloaded RooCollection_t::add() method insert object into set and registers object as server to own...
static void softAbort()
Soft abort function that interrupts macro execution but doesn't kill ROOT.
std::span< const double > at(RooAbsArg const *arg, RooAbsArg const *caller=nullptr)
std::span< double > output()
const RooArgSet & getConfigSection(const char *name) const
Retrieve configuration information specific to integrator with given name.
Variable that can be changed from the outside.
const T & arg() const
Return reference to object held in proxy.
Buffer base class used for serializing objects.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
const char * GetName() const override
Returns name of object.
double flexibleInterpSingle(unsigned int code, double low, double high, double boundary, double nominal, double paramVal, double res)
static uint64_t sum(uint64_t i)