42FlexibleInterpVar::FlexibleInterpVar()
56 Double_t nominal, vector<double> low, vector<double> high) :
58 _paramList(
"paramList",
"List of paramficients",this),
59 _nominal(nominal), _low(low), _high(high), _interpBoundary(1.)
70 <<
" is not of type RooAbsReal" << endl ;
93 _paramList(
"paramList",
"List of paramficients",this),
94 _nominal(nominal), _interpBoundary(1.)
117 <<
" is not of type RooAbsReal" << endl ;
141 double nominal, vector<double> low, vector<double> high,
144 _paramList(
"paramList",
"List of paramficients",this),
145 _nominal(nominal), _low(low), _high(high), _interpCode(code), _interpBoundary(1.)
156 <<
" is not of type RooAbsReal" << endl ;
178 _paramList(
"paramList",
"List of coefficients",this),
179 _nominal(0), _interpBoundary(1.)
190 _paramList(
"paramList",this,other._paramList),
191 _nominal(other._nominal), _low(other._low), _high(other._high), _interpCode(other._interpCode), _interpBoundary(other._interpBoundary)
218 <<
" is not in list" << endl ;
221 <<
" is now " << code << endl ;
244 coutW(
InputArguments) <<
"FlexibleInterpVar::setNominal : nominal is now " << newNominal << endl ;
258 <<
" is not in list" << endl ;
261 <<
" is now " << newLow << endl ;
262 _low.at(index) = newLow;
276 <<
" is not in list" << endl ;
279 <<
" is now " << newHigh << endl ;
280 _high.at(index) = newHigh;
306 double x0 = boundary;
315 unsigned int n =
_low.size();
316 assert(
n ==
_high.size() );
320 for (
unsigned int j = 0; j <
n ; j++) {
330 double pow_up_log =
_high[j] <= 0.0 ? 0.0 : pow_up * logHi;
331 double pow_down_log =
_low[j] <= 0.0 ? 0.0 : -pow_down * logLo;
332 double pow_up_log2 =
_high[j] <= 0.0 ? 0.0 : pow_up_log * logHi;
333 double pow_down_log2=
_low[j] <= 0.0 ? 0.0 : -pow_down_log* logLo;
335 double S0 = (pow_up+pow_down)/2;
336 double A0 = (pow_up-pow_down)/2;
337 double S1 = (pow_up_log+pow_down_log)/2;
338 double A1 = (pow_up_log-pow_down_log)/2;
339 double S2 = (pow_up_log2+pow_down_log2)/2;
340 double A2 = (pow_up_log2-pow_down_log2)/2;
345 coeff[0] = 1./(8*x0) *( 15*A0 - 7*x0*
S1 + x0*x0*A2);
346 coeff[1] = 1./(8*x0*x0) *(-24 + 24*
S0 - 9*x0*A1 + x0*x0*S2);
347 coeff[2] = 1./(4*
pow(x0, 3))*( - 5*A0 + 5*x0*
S1 - x0*x0*A2);
348 coeff[3] = 1./(4*
pow(x0, 4))*( 12 - 12*
S0 + 7*x0*A1 - x0*x0*S2);
349 coeff[4] = 1./(8*
pow(x0, 5))*( + 3*A0 - 3*x0*
S1 + x0*x0*A2);
350 coeff[5] = 1./(8*
pow(x0, 6))*( -8 + 8*
S0 - 5*x0*A1 + x0*x0*S2);
363 const double * coefficients = &
_polCoeff.front() + 6*i;
365 double a = coefficients[0];
366 double b = coefficients[1];
367 double c = coefficients[2];
368 double d = coefficients[3];
369 double e = coefficients[4];
370 double f = coefficients[5];
374 double value = 1. +
x * (
a +
x * (
b +
x * (
c +
x * (
d +
x * (
e +
x *
f ) ) ) ) );
425 }
else if(param->
getVal()<-1 ) {
439 }
else if(param->
getVal()<-1 ) {
456 else if (
x <= -boundary)
468 <<
" with unknown interpolation code" << endl ;
485 os <<
indent <<
"--- FlexibleInterpVar ---" << endl;
492 for (
int i=0;i<(
int)
_low.size();i++) {
494 os << setw(36) << param->
GetName()<<
": "<<setw(7) <<
_low[i]<<
" "<<setw(7) <<
_high[i]
static void indent(ostringstream &buf, int indent_level)
static unsigned int total
double pow(double, double)
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
void setValueDirty()
Mark the element dirty. This forces a re-evaluation when a value is requested.
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.
TIterator * createIterator(Bool_t dir=kIterForward) const
TIterator-style iteration over contained elements.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Structure printing.
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
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.
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)
Reimplementation of standard RooArgList::add()
std::vector< int > _interpCode
std::vector< double > _polCoeff
flag used for chaching polynomial coefficients
Double_t evaluate() const
cached polynomial coefficients
std::vector< double > _high
void setInterpCode(RooAbsReal ¶m, int code)
void printAllInterpCodes()
void setNominal(Double_t newNominal)
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Structure printing.
void setLow(RooAbsReal ¶m, Double_t newLow)
virtual ~FlexibleInterpVar()
Destructor.
void setAllInterpCodes(int code)
std::vector< double > _low
Bool_t _logInit
do not persist
double PolyInterpValue(int i, double x) const
virtual void printFlexibleInterpVars(std::ostream &os) const
FlexibleInterpVar()
Default constructor.
void setHigh(RooAbsReal ¶m, Double_t newHigh)
Iterator abstract base class.
virtual TObject * Next()=0
virtual const char * GetName() const
Returns name of object.
Namespace for the RooStats classes.
static T Min()
Returns maximum representation for type T.