41 _positiveDefinite=
false;
55 _nominal(
"!nominal",
"nominal value", this, (
RooAbsReal&)nominal),
56 _lowSet(
"!lowSet",
"low-side variation",this),
57 _highSet(
"!highSet",
"high-side variation",this),
58 _paramSet(
"!paramSet",
"high-side variation",this),
59 _positiveDefinite(
false)
70 coutE(
InputArguments) <<
"PiecewiseInterpolation::ctor(" <<
GetName() <<
") ERROR: input lists should be of equal length" << endl ;
76 while((comp = inputIter1.
next())) {
77 if (!dynamic_cast<RooAbsReal*>(comp)) {
79 <<
" in first list is not of type RooAbsReal" << endl ;
90 while((comp = inputIter2.
next())) {
91 if (!dynamic_cast<RooAbsReal*>(comp)) {
93 <<
" in first list is not of type RooAbsReal" << endl ;
104 while((comp = inputIter3.
next())) {
105 if (!dynamic_cast<RooAbsReal*>(comp)) {
107 <<
" in first list is not of type RooAbsReal" << endl ;
130 _nominal(
"!nominal",this,other._nominal),
131 _lowSet(
"!lowSet",this,other._lowSet),
132 _highSet(
"!highSet",this,other._highSet),
133 _paramSet(
"!paramSet",this,other._paramSet),
134 _positiveDefinite(other._positiveDefinite),
135 _interpCode(other._interpCode)
172 while((param=(
RooAbsReal*)paramIter.next())) {
201 sum += (2*a+b)*(param->
getVal()-1)+high->
getVal()-nominal;
202 }
else if(param->
getVal()<-1 ) {
203 sum += -1*(2*a-b)*(param->
getVal()+1)+low->
getVal()-nominal;
215 sum += (2*a+b)*(param->
getVal()-1)+high->
getVal()-nominal;
216 }
else if(param->
getVal()<-1 ) {
217 sum += -1*(2*a-b)*(param->
getVal()+1)+low->
getVal()-nominal;
232 sum += x*(high->
getVal() - nominal );
234 sum += x*(nominal - low->
getVal());
236 double eps_plus = high->
getVal() - nominal;
237 double eps_minus = nominal - low->
getVal();
238 double S = 0.5 * (eps_plus + eps_minus);
239 double A = 0.0625 * (eps_plus - eps_minus);
243 double val = nominal + x * (S + x * A * ( 15 + x * x * (-10 + x * x * 3 ) ) );
246 if (val < 0) val = 0;
258 if (x > x0 || x < -x0)
261 sum += x*(high->
getVal() - nominal );
263 sum += x*(nominal - low->
getVal());
265 else if (nominal != 0)
267 double eps_plus = high->
getVal() - nominal;
268 double eps_minus = nominal - low->
getVal();
269 double S = (eps_plus + eps_minus)/2;
270 double A = (eps_plus - eps_minus)/2;
274 double b = 3*A/(2*x0);
276 double d = -A/(2*x0*x0*x0);
278 double val = nominal + a*x + b*
pow(x, 2) + 0 + d*
pow(x, 4);
279 if (val < 0) val = 0;
289 <<
" with unknown interpolation code" << icode << endl ;
304 cxcoutD(
Tracing) <<
"PiecewiseInterpolation::evaluate - sum < 0, not forcing positive definite"<<endl;
321 cout <<
"Currently BinIntegrator only knows how to deal with 1-d "<<endl;
331 const RooArgSet* normSet,
const char* )
const
346 if (allVars.
getSize()==0)
return 0 ;
358 while( paramIterExtra.next() ) {
361 cout <<
"can't factorize integral"<<endl;
368 analVars.
add(allVars) ;
375 Int_t sterileIdx(-1) ;
400 while(paramIter.next() ) {
498 std::cout <<
"Error: Cache Element is NULL" << std::endl;
499 throw std::exception();
506 RooAbsReal *funcInt(0), *low(0), *high(0), *param(0) ;
513 value += funcInt->getVal() ;
517 if(i==0 || i>1) { cout <<
"problem, wrong number of nominal functions"<<endl; }
524 while( (param=(
RooAbsReal*)paramIter.next()) ) {
529 value += param->
getVal()*(high->getVal() - nominal );
531 value += param->
getVal()*(nominal - low->getVal());
611 <<
" is not in list" << endl ;
614 <<
" is now " << code << endl ;
667 void PiecewiseInterpolation::Streamer(
TBuffer &R__b)
684 void PiecewiseInterpolation::printMetaArgs(ostream& os) const
691 Bool_t first(kTRUE) ;
693 RooAbsArg* arg1, *arg2 ;
694 if (_highSet.getSize()!=0) {
696 while((arg1=(RooAbsArg*)_lowIter->Next())) {
702 arg2=(RooAbsArg*)_highIter->Next() ;
703 os << arg1->GetName() << " * " << arg2->GetName() ;
708 while((arg1=(RooAbsArg*)_lowIter->Next())) {
714 os << arg1->GetName() ;
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...
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
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...
virtual Bool_t isBinnedDistribution(const RooArgSet &) const
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
RooFIter fwdIterator() const
Int_t index(const RooAbsArg *arg) const
virtual Bool_t isBinnedDistribution(const RooArgSet &obs) const
WVE note: assumes nominal and alternates have identical structure, must add explicit check...
Buffer base class used for serializing objects.
Double_t evaluate() const
Calculate and return current value of self.
ClassImp(TIterator) Bool_t TIterator return false
Compare two iterator objects.
const RooAbsReal & arg() const
virtual Bool_t setLabel(const char *label, Bool_t printError=kTRUE)
Set value by specifying the name of the desired state If printError is set, a message will be printed...
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=0) const
Advertise that all integrals can be handled internally.
RooAbsArg * first() const
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=0, const TNamed *isetRangeName=0)
double pow(double, double)
std::vector< int > _interpCode
virtual ~PiecewiseInterpolation()
Destructor.
void setAllInterpCodes(int code)
Double_t getVal(const RooArgSet *set=0) const
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Reimplementation of standard RooArgList::add()
void setInterpCode(RooAbsReal ¶m, int code)
RooObjCacheManager _normIntMgr
virtual const char * GetName() const
Returns name of object.
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &, Double_t, Double_t) const
void printAllInterpCodes()
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
RooAbsArg * at(Int_t idx) const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
double func(double *x, double *p)
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
T * getObjByIndex(Int_t index) const
Bool_t setBinIntegrator(RooArgSet &allVars)
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=0)
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
ClassImp(PiecewiseInterpolation)
const RooArgSet & getConfigSection(const char *name) const
Retrieve configuration information specific to integrator with given name.
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...
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add element to non-owning set.
RooNumIntConfig * specialIntegratorConfig() const
Returns the specialized integrator configuration for this RooAbsReal.
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 ...