86 _lowSet(
"!lowSet",
"low-side variation", this),
87 _highSet(
"!highSet",
"high-side variation", this),
88 _paramSet(
"!paramSet",
"high-side variation", this),
93 if (lowSet.
size() != highSet.
size()) {
94 coutE(InputArguments) <<
"PiecewiseInterpolation::ctor(" << GetName() <<
") ERROR: input lists should be of equal length" << std::endl ;
95 RooErrorHandler::softAbort() ;
98 for (
auto *comp : lowSet) {
100 coutE(InputArguments) <<
"PiecewiseInterpolation::ctor(" <<
GetName() <<
") ERROR: component " << comp->GetName()
101 <<
" in first list is not of type RooAbsReal" << std::endl ;
108 for (
auto *comp : highSet) {
110 coutE(InputArguments) <<
"PiecewiseInterpolation::ctor(" <<
GetName() <<
") ERROR: component " << comp->GetName()
111 <<
" in first list is not of type RooAbsReal" << std::endl ;
118 for (
auto *comp : paramSet) {
120 coutE(InputArguments) <<
"PiecewiseInterpolation::ctor(" <<
GetName() <<
") ERROR: component " << comp->GetName()
121 <<
" in first list is not of type RooAbsReal" << std::endl ;
173 double sum(nominal) ;
175 for (
unsigned int i=0; i <
_paramSet.size(); ++i) {
180 sum += flexibleInterpSingle(
_interpCode[i], low->getVal(), high->getVal(), 1.0, nominal, param->getVal(),
sum);
190 cxcoutD(Tracing) <<
"PiecewiseInterpolation::evaluate - sum < 0, not forcing positive definite"<< std::endl;
198inline double broadcast(std::span<const double>
const &s, std::size_t i)
200 return s.size() > 1 ? s[i] : s[0];
214 for (std::size_t j = 0; j <
sum.size(); ++j) {
215 sum[j] = broadcast(nominal, j);
218 for (
unsigned int i = 0; i <
_paramSet.size(); ++i) {
223 for (std::size_t j = 0; j <
sum.size(); ++j) {
225 sum[j] += flexibleInterpSingle(
_interpCode[i], broadcast(low, j), broadcast(high, j), 1.0, broadcast(nominal, j),
226 broadcast(param, j),
sum[j]);
231 for (std::size_t j = 0; j <
sum.size(); ++j) {
242 if(allVars.
size()==1){
244 temp->specialIntegratorConfig(
true)->method1D().setLabel(
"RooBinIntegrator") ;
246 temp->specialIntegratorConfig(
true)->getConfigSection(
"RooBinIntegrator").setRealValue(
"numBins",nbins);
249 std::cout <<
"Currently BinIntegrator only knows how to deal with 1-d "<< std::endl;
259 const RooArgSet* normSet,
const char* )
const
274 if (allVars.
empty())
return 0 ;
287 std::cout <<
"can't factorize integral" << std::endl;
293 analVars.
add(allVars) ;
296 Int_t sterileIdx(-1) ;
405 if( cache==
nullptr ) {
406 std::cout <<
"Error: Cache Element is nullptr" << std::endl;
407 throw std::exception();
420 value += funcInt->getVal() ;
424 if(i==0 || i>1) { std::cout <<
"problem, wrong number of nominal functions"<< std::endl; }
434 if(param->getVal() > 0) {
435 value += param->getVal()*(high->
getVal() - nominal);
437 value += param->getVal()*(nominal - low->
getVal());
514 coutE(InputArguments) <<
"PiecewiseInterpolation::setInterpCode ERROR: " << param.
GetName() <<
" is not in list"
523 for (std::size_t i = 0; i <
_interpCode.size(); ++i) {
531 if (code < 0 || code > 6) {
532 coutE(InputArguments) <<
"PiecewiseInterpolation::setInterpCode ERROR: " << param.
GetName()
533 <<
" with unknown interpolation code " << code <<
", keeping current code "
541 coutE(InputArguments) <<
"PiecewiseInterpolation::setInterpCode ERROR: " << param.
GetName()
542 <<
" with unknown interpolation code " << code <<
", defaulting to code 2" << std::endl;
563 return _nominal.arg().binBoundaries(obs,xlo,xhi) ;
572 return _nominal.arg().isBinnedDistribution(obs) ;
581 return _nominal.arg().plotSamplingHint(obs,xlo,xhi) ;
604void PiecewiseInterpolation::printMetaArgs(ostream& os) const
613 RooAbsArg* arg1, *arg2 ;
614 if (_highSet.size()!=0) {
616 while((arg1=(RooAbsArg*)_lowIter->Next())) {
622 arg2=(RooAbsArg*)_highIter->Next() ;
623 os << arg1->GetName() << " * " << arg2->GetName() ;
628 while((arg1=(RooAbsArg*)_lowIter->Next())) {
634 os << arg1->GetName() ;
ROOT::RRangeCast< T, false, Range_t > static_range_cast(Range_t &&coll)
int Int_t
Signed integer 4 bytes (int).
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 Streamer(TBuffer &) override
Stream an object of class PiecewiseInterpolation.
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()
void setValueDirty()
Mark the element dirty. This forces a re-evaluation when a value is requested.
RooAbsArg()
Default constructor.
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.
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.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooAbsReal()
coverity[UNINIT_CTOR] Default constructor
bool _forceNumInt
Force numerical integration if flag set.
RooNumIntConfig * specialIntegratorConfig() const
Returns the specialized integrator configuration for this RooAbsReal.
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.
bool setLabel(const char *label, bool printError=true) override
Set value by specifying the name of the desired state.
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()
Variable that can be changed from the outside.
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)