42 using namespace RooStats;
43 using namespace HistFactory;
50 _paramIter = _paramList.createIterator() ;
60 FlexibleInterpVar::FlexibleInterpVar(
const char* name,
const char* title,
62 Double_t nominal, vector<double> low, vector<double> high) :
64 _paramList(
"paramList",
"List of paramficients",this),
65 _nominal(nominal), _low(low), _high(high), _interpBoundary(1.)
74 if (!dynamic_cast<RooAbsReal*>(param)) {
76 <<
" is not of type RooAbsReal" << endl ;
99 _paramList(
"paramList",
"List of paramficients",this),
100 _nominal(nominal), _interpBoundary(1.)
121 if (!dynamic_cast<RooAbsReal*>(param)) {
123 <<
" is not of type RooAbsReal" << endl ;
147 double nominal, vector<double> low, vector<double> high,
150 _paramList(
"paramList",
"List of paramficients",this),
151 _nominal(nominal), _low(low), _high(high), _interpCode(code), _interpBoundary(1.)
160 if (!dynamic_cast<RooAbsReal*>(param)) {
162 <<
" is not of type RooAbsReal" << endl ;
184 _paramList(
"paramList",
"List of coefficients",this),
185 _nominal(0), _interpBoundary(1.)
196 _paramList(
"paramList",this,other._paramList),
197 _nominal(other._nominal), _low(other._low), _high(other._high), _interpCode(other._interpCode), _interpBoundary(other._interpBoundary)
224 <<
" is not in list" << endl ;
227 <<
" is now " << code << endl ;
250 coutW(
InputArguments) <<
"FlexibleInterpVar::setNominal : nominal is now " << newNominal << endl ;
264 <<
" is not in list" << endl ;
267 <<
" is now " << newLow << endl ;
268 _low.at(index) = newLow;
282 <<
" is not in list" << endl ;
285 <<
" is now " << newHigh << endl ;
286 _high.at(index) = newHigh;
312 double x0 = boundary;
321 unsigned int n =
_low.size();
326 for (
unsigned int j = 0; j <
n ; j++) {
336 double pow_up_log =
_high[j] <= 0.0 ? 0.0 : pow_up * logHi;
337 double pow_down_log =
_low[j] <= 0.0 ? 0.0 : -pow_down * logLo;
338 double pow_up_log2 =
_high[j] <= 0.0 ? 0.0 : pow_up_log * logHi;
339 double pow_down_log2=
_low[j] <= 0.0 ? 0.0 : -pow_down_log* logLo;
341 double S0 = (pow_up+pow_down)/2;
342 double A0 = (pow_up-pow_down)/2;
343 double S1 = (pow_up_log+pow_down_log)/2;
344 double A1 = (pow_up_log-pow_down_log)/2;
345 double S2 = (pow_up_log2+pow_down_log2)/2;
346 double A2 = (pow_up_log2-pow_down_log2)/2;
351 coeff[0] = 1./(8*x0) *( 15*A0 - 7*x0*S1 + x0*x0*A2);
352 coeff[1] = 1./(8*x0*x0) *(-24 + 24*S0 - 9*x0*A1 + x0*x0*S2);
353 coeff[2] = 1./(4*
pow(x0, 3))*( - 5*A0 + 5*x0*S1 - x0*x0*A2);
354 coeff[3] = 1./(4*
pow(x0, 4))*( 12 - 12*S0 + 7*x0*A1 - x0*x0*S2);
355 coeff[4] = 1./(8*
pow(x0, 5))*( + 3*A0 - 3*x0*S1 + x0*x0*A2);
356 coeff[5] = 1./(8*
pow(x0, 6))*( -8 + 8*S0 - 5*x0*A1 + x0*x0*S2);
369 const double * coefficients = &
_polCoeff.front() + 6*i;
371 double a = coefficients[0];
372 double b = coefficients[1];
373 double c = coefficients[2];
374 double d = coefficients[3];
375 double e = coefficients[4];
376 double f = coefficients[5];
380 double value = 1. + x * (a + x * ( b + x * ( c + x * ( d + x * ( e + x *
f ) ) ) ) );
431 }
else if(param->
getVal()<-1 ) {
445 }
else if(param->
getVal()<-1 ) {
462 else if (x <= -boundary)
474 <<
" with unknown interpolation code" << endl ;
491 os << indent <<
"--- FlexibleInterpVar ---" << endl;
498 for (
int i=0;i<(int)
_low.size();i++) {
500 os << setw(36) << param->
GetName()<<
": "<<setw(7) <<
_low[i]<<
" "<<setw(7) <<
_high[i]
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Structure printing.
void setNominal(Double_t newNominal)
double PolyInterpValue(int i, double x) const
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Structure printing.
std::vector< double > _low
RooFIter fwdIterator() const
void setInterpCode(RooAbsReal ¶m, int code)
Int_t index(const RooAbsArg *arg) const
virtual void printFlexibleInterpVars(std::ostream &os) const
Iterator abstract base class.
Double_t evaluate() const
cached polynomial coefficients
double pow(double, double)
TIterator * createIterator(Bool_t dir=kIterForward) const
Double_t getVal(const RooArgSet *set=0) const
FlexibleInterpVar()
Default constructor.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Reimplementation of standard RooArgList::add()
void setLow(RooAbsReal ¶m, Double_t newLow)
Bool_t _logInit
do not persist
virtual const char * GetName() const
Returns name of object.
static void indent(ostringstream &buf, int indent_level)
void printAllInterpCodes()
virtual ~FlexibleInterpVar()
Destructor.
RooAbsArg * at(Int_t idx) const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
void setValueDirty() const
virtual TObject * Next()=0
std::vector< double > _polCoeff
flag used for chaching polynomial coefficients
void setAllInterpCodes(int code)
std::vector< double > _high
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
void setHigh(RooAbsReal ¶m, Double_t newHigh)
ClassImp(RooStats::HistFactory::FlexibleInterpVar) using namespace RooStats
std::vector< int > _interpCode