51 ClassImp(RooFirstMoment);
58 RooFirstMoment::RooFirstMoment()
66 RooFirstMoment::RooFirstMoment(
const char* name,
const char* title, RooAbsReal& func, RooRealVar& x) :
67 RooAbsMoment(name, title,func,x,1,kFALSE),
68 _xf(
"!xf",
"xf",this,kFALSE,kFALSE),
69 _ixf(
"!ixf",
"ixf",this),
72 setExpensiveObjectCache(func.expensiveObjectCache()) ;
74 string pname=Form(
"%s_product",name) ;
76 RooProduct* XF =
new RooProduct(pname.c_str(),pname.c_str(),RooArgSet(x,func)) ;
77 XF->setExpensiveObjectCache(func.expensiveObjectCache()) ;
79 if (func.isBinnedDistribution(x)) {
80 XF->specialIntegratorConfig(kTRUE)->method1D().setLabel(
"RooBinIntegrator");
83 RooRealIntegral* intXF = (RooRealIntegral*) XF->createIntegral(x) ;
84 RooRealIntegral* intF = (RooRealIntegral*) func.createIntegral(x) ;
85 intXF->setCacheNumeric(kTRUE) ;
86 intF->setCacheNumeric(kTRUE) ;
91 addOwnedComponents(RooArgSet(*XF,*intXF,*intF)) ;
96 RooFirstMoment::RooFirstMoment(
const char* name,
const char* title, RooAbsReal& func, RooRealVar& x,
const RooArgSet& nset, Bool_t intNSet) :
97 RooAbsMoment(name, title,func,x,1,kFALSE),
98 _xf(
"!xf",
"xf",this,kFALSE,kFALSE),
99 _ixf(
"!ixf",
"ixf",this),
102 setExpensiveObjectCache(func.expensiveObjectCache()) ;
106 string pname=Form(
"%s_product",name) ;
108 RooProduct* XF =
new RooProduct(pname.c_str(),pname.c_str(),RooArgSet(x,func)) ;
109 XF->setExpensiveObjectCache(func.expensiveObjectCache()) ;
111 if (func.isBinnedDistribution(x)) {
112 XF->specialIntegratorConfig(kTRUE)->method1D().setLabel(
"RooBinIntegrator");
115 if (intNSet && _nset.getSize()>0 && func.isBinnedDistribution(_nset)) {
116 XF->specialIntegratorConfig(kTRUE)->method2D().setLabel(
"RooBinIntegrator");
117 XF->specialIntegratorConfig(kTRUE)->methodND().setLabel(
"RooBinIntegrator");
120 RooArgSet intSet(x) ;
121 if (intNSet) intSet.add(_nset,kTRUE) ;
122 RooRealIntegral* intXF = (RooRealIntegral*) XF->createIntegral(intSet,&_nset) ;
123 RooRealIntegral* intF = (RooRealIntegral*) func.createIntegral(intSet,&_nset) ;
124 intXF->setCacheNumeric(kTRUE) ;
125 intF->setCacheNumeric(kTRUE) ;
128 _ixf.setArg(*intXF) ;
130 addOwnedComponents(RooArgSet(*XF,*intXF,*intF)) ;
137 RooFirstMoment::RooFirstMoment(
const RooFirstMoment& other,
const char* name) :
138 RooAbsMoment(other, name),
139 _xf(
"xf",this,other._xf),
140 _ixf(
"ixf",this,other._ixf),
141 _if(
"if",this,other._if)
150 RooFirstMoment::~RooFirstMoment()
159 Double_t RooFirstMoment::evaluate()
const
161 Double_t ratio = _ixf / _if ;