56 Double_t argNominal, vector<double> lowVec, vector<double> highVec) :
58 _paramList(
"paramList",
"List of paramficients",this),
59 _nominal(argNominal), _low(lowVec), _high(highVec), _interpBoundary(1.)
69 coutE(InputArguments) <<
"FlexibleInterpVar::ctor(" <<
GetName() <<
") ERROR: paramficient " << param->
GetName()
70 <<
" is not of type RooAbsReal" << endl ;
77 coutE(InputArguments) <<
"FlexibleInterpVar::ctor(" <<
GetName() <<
") invalid input low/high vectors " << endl;
93 _paramList(
"paramList",
"List of paramficients",this),
94 _nominal(argNominal), _interpBoundary(1.)
116 coutE(InputArguments) <<
"FlexibleInterpVar::ctor(" <<
GetName() <<
") ERROR: paramficient " << param->
GetName()
117 <<
" is not of type RooAbsReal" << endl ;
124 coutE(InputArguments) <<
"FlexibleInterpVar::ctor(" <<
GetName() <<
") invalid input low/high lists " << endl;
141 double argNominal, vector<double> lowVec, vector<double> highVec,
144 _paramList(
"paramList",
"List of paramficients",this),
145 _nominal(argNominal), _low(lowVec), _high(highVec), _interpCode(code), _interpBoundary(1.)
155 coutE(InputArguments) <<
"FlexibleInterpVar::ctor(" <<
GetName() <<
") ERROR: paramficient " << param->
GetName()
156 <<
" is not of type RooAbsReal" << endl ;
163 coutE(InputArguments) <<
"FlexibleInterpVar::ctor(" <<
GetName() <<
") invalid input vectors " << 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)
217 coutE(InputArguments) <<
"FlexibleInterpVar::setInterpCode ERROR: " << param.
GetName()
218 <<
" is not in list" << endl ;
220 coutW(InputArguments) <<
"FlexibleInterpVar::setInterpCode : " << param.
GetName()
221 <<
" is now " << code << endl ;
244 coutW(InputArguments) <<
"FlexibleInterpVar::setNominal : nominal is now " << newNominal << endl ;
257 coutE(InputArguments) <<
"FlexibleInterpVar::setLow ERROR: " << param.
GetName()
258 <<
" is not in list" << endl ;
260 coutW(InputArguments) <<
"FlexibleInterpVar::setLow : " << param.
GetName()
261 <<
" is now " << newLow << endl ;
262 _low.at(index) = newLow;
275 coutE(InputArguments) <<
"FlexibleInterpVar::setHigh ERROR: " << param.
GetName()
276 <<
" is not in list" << endl ;
278 coutW(InputArguments) <<
"FlexibleInterpVar::setHigh : " << param.
GetName()
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++) {
328 double logHi = std::log(
_high[j]) ;
329 double logLo = std::log(
_low[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 ) ) ) ) );
433 }
else if(param->
getVal()<-1 ) {
447 }
else if(param->
getVal()<-1 ) {
464 else if (
x <= -boundary)
475 coutE(InputArguments) <<
"FlexibleInterpVar::evaluate ERROR: " << param->
GetName()
476 <<
" with unknown interpolation code" << endl ;
493 os <<
indent <<
"--- FlexibleInterpVar ---" << endl;
500 for (
int i=0;i<(
int)
_low.size();i++) {
502 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 and a "shape" in RooFi...
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.
RooListProxy is the concrete proxy for RooArgList objects.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
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.
const std::vector< double > & high() const
void setLow(RooAbsReal ¶m, Double_t newLow)
virtual ~FlexibleInterpVar()
Destructor.
const std::vector< double > & low() const
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.
const RooListProxy & variables() const
Const getters.
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.