74 _nominal(
"!nominal",
"nominal value", this, (
RooAbsReal&)nominal),
75 _lowSet(
"!lowSet",
"low-side variation",this),
76 _highSet(
"!highSet",
"high-side variation",this),
77 _paramSet(
"!paramSet",
"high-side variation",this),
78 _positiveDefinite(false)
83 coutE(InputArguments) <<
"PiecewiseInterpolation::ctor(" <<
GetName() <<
") ERROR: input lists should be of equal length" << endl ;
89 while((comp = inputIter1.
next())) {
91 coutE(InputArguments) <<
"PiecewiseInterpolation::ctor(" <<
GetName() <<
") ERROR: component " << comp->
GetName()
92 <<
" in first list is not of type RooAbsReal" << endl ;
103 while((comp = inputIter2.
next())) {
105 coutE(InputArguments) <<
"PiecewiseInterpolation::ctor(" <<
GetName() <<
") ERROR: component " << comp->
GetName()
106 <<
" in first list is not of type RooAbsReal" << endl ;
117 while((comp = inputIter3.
next())) {
119 coutE(InputArguments) <<
"PiecewiseInterpolation::ctor(" <<
GetName() <<
") ERROR: component " << comp->
GetName()
120 <<
" in first list is not of type RooAbsReal" << endl ;
143 _nominal(
"!nominal",this,other._nominal),
144 _lowSet(
"!lowSet",this,other._lowSet),
145 _highSet(
"!highSet",this,other._highSet),
146 _paramSet(
"!paramSet",this,other._paramSet),
147 _positiveDefinite(other._positiveDefinite),
148 _interpCode(other._interpCode)
185 if(param->getVal()>0)
186 sum += param->getVal()*(high->getVal() - nominal );
188 sum += param->getVal()*(nominal - low->getVal());
193 if(param->getVal()>=0)
194 sum *=
pow(high->getVal()/nominal, +param->getVal());
196 sum *=
pow(low->getVal()/nominal, -param->getVal());
201 double a = 0.5*(high->getVal()+low->getVal())-nominal;
202 double b = 0.5*(high->getVal()-low->getVal());
204 if(param->getVal()>1 ){
205 sum += (2*
a+
b)*(param->getVal()-1)+high->getVal()-nominal;
206 }
else if(param->getVal()<-1 ) {
207 sum += -1*(2*
a-
b)*(param->getVal()+1)+low->getVal()-nominal;
209 sum +=
a*
pow(param->getVal(),2) +
b*param->getVal()+
c;
215 double a = 0.5*(high->getVal()+low->getVal())-nominal;
216 double b = 0.5*(high->getVal()-low->getVal());
218 if(param->getVal()>1 ){
219 sum += (2*
a+
b)*(param->getVal()-1)+high->getVal()-nominal;
220 }
else if(param->getVal()<-1 ) {
221 sum += -1*(2*
a-
b)*(param->getVal()+1)+low->getVal()-nominal;
223 sum +=
a*
pow(param->getVal(),2) +
b*param->getVal()+
c;
234 double x = param->getVal();
236 sum +=
x*(high->getVal() - nominal );
238 sum +=
x*(nominal - low->getVal());
240 double eps_plus = high->getVal() - nominal;
241 double eps_minus = nominal - low->getVal();
242 double S = 0.5 * (eps_plus + eps_minus);
243 double A = 0.0625 * (eps_plus - eps_minus);
247 double val = nominal +
x * (S +
x * A * ( 15 +
x *
x * (-10 +
x *
x * 3 ) ) );
250 if (val < 0) val = 0;
260 double x = param->getVal();
262 if (
x > x0 ||
x < -x0)
265 sum +=
x*(high->getVal() - nominal );
267 sum +=
x*(nominal - low->getVal());
269 else if (nominal != 0)
271 double eps_plus = high->getVal() - nominal;
272 double eps_minus = nominal - low->getVal();
273 double S = (eps_plus + eps_minus)/2;
274 double A = (eps_plus - eps_minus)/2;
278 double b = 3*A/(2*x0);
280 double d = -A/(2*x0*x0*x0);
282 double val = nominal +
a*
x +
b*
pow(
x, 2) + 0 +
d*
pow(
x, 4);
283 if (val < 0) val = 0;
292 coutE(InputArguments) <<
"PiecewiseInterpolation::evaluate ERROR: " << param->GetName()
293 <<
" with unknown interpolation code" << icode << endl ;
307 cxcoutD(Tracing) <<
"PiecewiseInterpolation::evaluate - sum < 0, not forcing positive definite"<<endl;
324 cout <<
"Currently BinIntegrator only knows how to deal with 1-d "<<endl;
334 const RooArgSet* normSet,
const char* )
const
349 if (allVars.
getSize()==0)
return 0 ;
361 while( paramIterExtra.
next() ) {
364 cout <<
"can't factorize integral"<<endl;
371 analVars.
add(allVars) ;
378 Int_t sterileIdx(-1) ;
403 while(paramIter.
next() ) {
501 std::cout <<
"Error: Cache Element is NULL" << std::endl;
502 throw std::exception();
509 RooAbsReal *funcInt(0), *low(0), *high(0), *param(0) ;
516 value += funcInt->getVal() ;
520 if(i==0 || i>1) { cout <<
"problem, wrong number of nominal functions"<<endl; }
532 value += param->
getVal()*(high->getVal() - nominal );
534 value += param->
getVal()*(nominal - low->getVal());
613 coutE(InputArguments) <<
"PiecewiseInterpolation::setInterpCode ERROR: " << param.
GetName()
614 <<
" is not in list" << endl ;
616 coutW(InputArguments) <<
"PiecewiseInterpolation::setInterpCode : " << param.
GetName()
617 <<
" is now " << code << endl ;
687void PiecewiseInterpolation::printMetaArgs(ostream& os) const
694 Bool_t first(kTRUE) ;
696 RooAbsArg* arg1, *arg2 ;
697 if (_highSet.getSize()!=0) {
699 while((arg1=(RooAbsArg*)_lowIter->Next())) {
705 arg2=(RooAbsArg*)_highIter->Next() ;
706 os << arg1->GetName() << " * " << arg2->GetName() ;
711 while((arg1=(RooAbsArg*)_lowIter->Next())) {
717 os << arg1->GetName() ;
double pow(double, double)
The PiecewiseInterpolation is a class that can morph distributions into each other,...
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
WVE note: assumes nominal and alternates have identical structure, must add explicit check.
std::vector< int > _interpCode
Double_t analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=0) const
Implement analytical integrations by doing appropriate weighting from component integrals functions t...
Bool_t setBinIntegrator(RooArgSet &allVars)
void setAllInterpCodes(int code)
RooObjCacheManager _normIntMgr
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=0) const
Advertise that all integrals can be handled internally.
Double_t evaluate() const
Calculate and return current value of self.
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
void setInterpCode(RooAbsReal ¶m, int code)
virtual ~PiecewiseInterpolation()
Destructor.
virtual Bool_t isBinnedDistribution(const RooArgSet &obs) const
WVE note: assumes nominal and alternates have identical structure, must add explicit check.
void printAllInterpCodes()
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
friend void RooRefArray::Streamer(TBuffer &)
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
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.
RooFIter fwdIterator() const
One-time forward iterator.
Storage_t::size_type size() const
Bool_t setRealValue(const char *name, Double_t newVal=0, Bool_t verbose=kFALSE)
Set value of a RooAbsRealLValye stored in set with given name to newVal No error messages are printed...
RooAbsArg * first() const
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
Retrieve bin boundaries if this distribution is binned in obs.
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooAbsReal * createIntegral(const RooArgSet &iset, const RooCmdArg &arg1, const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Create an object that represents the integral of the function over one or more observables listed in ...
RooNumIntConfig * specialIntegratorConfig() const
Returns the specialized integrator configuration for this RooAbsReal.
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
virtual Bool_t isBinnedDistribution(const RooArgSet &) const
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
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_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Add element to non-owning set.
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=0, const TNamed *isetRangeName=0)
T * getObjByIndex(Int_t index) const
Retrieve payload object by slot index.
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=0)
virtual Bool_t setLabel(const char *label, bool printError=true) override
Set value by specifying the name of the desired state.
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
RooAbsArg * next()
Return next element or nullptr if at end.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Reimplementation of standard RooArgList::add()
const RooArgSet & getConfigSection(const char *name) const
Retrieve configuration information specific to integrator with given name.
RooRealVar represents a 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=0)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual const char * GetName() const
Returns name of object.
static uint64_t sum(uint64_t i)