39using namespace HistFactory;
44FlexibleInterpVar::FlexibleInterpVar()
58 Double_t nominal, vector<double> low, vector<double> high) :
60 _paramList(
"paramList",
"List of paramficients",this),
61 _nominal(nominal), _low(low), _high(high), _interpBoundary(1.)
72 <<
" is not of type RooAbsReal" << endl ;
95 _paramList(
"paramList",
"List of paramficients",this),
96 _nominal(nominal), _interpBoundary(1.)
119 <<
" is not of type RooAbsReal" << endl ;
143 double nominal, vector<double> low, vector<double> high,
146 _paramList(
"paramList",
"List of paramficients",this),
147 _nominal(nominal), _low(low), _high(high), _interpCode(code), _interpBoundary(1.)
158 <<
" is not of type RooAbsReal" << endl ;
180 _paramList(
"paramList",
"List of coefficients",this),
181 _nominal(0), _interpBoundary(1.)
192 _paramList(
"paramList",this,other._paramList),
193 _nominal(other._nominal), _low(other._low), _high(other._high), _interpCode(other._interpCode), _interpBoundary(other._interpBoundary)
220 <<
" is not in list" << endl ;
223 <<
" is now " << code << endl ;
246 coutW(
InputArguments) <<
"FlexibleInterpVar::setNominal : nominal is now " << newNominal << endl ;
260 <<
" is not in list" << endl ;
263 <<
" is now " << newLow << endl ;
264 _low.at(index) = newLow;
278 <<
" is not in list" << endl ;
281 <<
" is now " << newHigh << endl ;
282 _high.at(index) = newHigh;
308 double x0 = boundary;
317 unsigned int n =
_low.size();
318 assert(
n ==
_high.size() );
322 for (
unsigned int j = 0; j <
n ; j++) {
332 double pow_up_log =
_high[j] <= 0.0 ? 0.0 : pow_up * logHi;
333 double pow_down_log =
_low[j] <= 0.0 ? 0.0 : -pow_down * logLo;
334 double pow_up_log2 =
_high[j] <= 0.0 ? 0.0 : pow_up_log * logHi;
335 double pow_down_log2=
_low[j] <= 0.0 ? 0.0 : -pow_down_log* logLo;
337 double S0 = (pow_up+pow_down)/2;
338 double A0 = (pow_up-pow_down)/2;
339 double S1 = (pow_up_log+pow_down_log)/2;
340 double A1 = (pow_up_log-pow_down_log)/2;
341 double S2 = (pow_up_log2+pow_down_log2)/2;
342 double A2 = (pow_up_log2-pow_down_log2)/2;
347 coeff[0] = 1./(8*x0) *( 15*A0 - 7*x0*
S1 + x0*x0*A2);
348 coeff[1] = 1./(8*x0*x0) *(-24 + 24*
S0 - 9*x0*A1 + x0*x0*S2);
349 coeff[2] = 1./(4*
pow(x0, 3))*( - 5*A0 + 5*x0*
S1 - x0*x0*A2);
350 coeff[3] = 1./(4*
pow(x0, 4))*( 12 - 12*
S0 + 7*x0*A1 - x0*x0*S2);
351 coeff[4] = 1./(8*
pow(x0, 5))*( + 3*A0 - 3*x0*
S1 + x0*x0*A2);
352 coeff[5] = 1./(8*
pow(x0, 6))*( -8 + 8*
S0 - 5*x0*A1 + x0*x0*S2);
365 const double * coefficients = &
_polCoeff.front() + 6*i;
367 double a = coefficients[0];
368 double b = coefficients[1];
369 double c = coefficients[2];
370 double d = coefficients[3];
371 double e = coefficients[4];
372 double f = coefficients[5];
376 double value = 1. +
x * (
a +
x * (
b +
x * (
c +
x * (
d +
x * (
e +
x *
f ) ) ) ) );
427 }
else if(param->
getVal()<-1 ) {
441 }
else if(param->
getVal()<-1 ) {
458 else if (
x <= -boundary)
470 <<
" with unknown interpolation code" << endl ;
487 os <<
indent <<
"--- FlexibleInterpVar ---" << endl;
494 for (
int i=0;i<(int)
_low.size();i++) {
496 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() const
RooFIter fwdIterator() const R__SUGGEST_ALTERNATIVE("begin()
One-time forward iterator.
TIterator * createIterator(Bool_t dir=kIterForward) const R__SUGGEST_ALTERNATIVE("begin()
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.
Int_t index(const RooAbsArg *arg) const
Returns index of given arg, or -1 if arg is not in list.
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.