44RooGenProdProj::RooGenProdProj(
const char *
name,
const char *title,
const RooArgSet& _prodSet,
const RooArgSet& _intSet,
45 const RooArgSet& _normSet,
const char* isetRangeName,
const char* normRangeName,
bool doFactorize) :
47 _compSetN(
"compSetN",
"Set of integral components owned by numerator",this,false),
48 _compSetD(
"compSetD",
"Set of integral components owned by denominator",this,false),
49 _intList(
"intList",
"List of integrals",this,true)
55 _compSetOwnedN = std::make_unique<RooArgSet>();
56 _compSetOwnedD = std::make_unique<RooArgSet>();
58 RooAbsReal* numerator = makeIntegral(
"numerator",_prodSet,_intSet,*_compSetOwnedN,isetRangeName,doFactorize) ;
59 RooAbsReal* denominator = makeIntegral(
"denominator",_prodSet,_normSet,*_compSetOwnedD,normRangeName,doFactorize) ;
67 _compSetN.add(*_compSetOwnedN) ;
68 _compSetD.add(*_compSetOwnedD) ;
70 _intList.add(*numerator) ;
72 _intList.add(*denominator) ;
82RooGenProdProj::RooGenProdProj(
const RooGenProdProj &other,
const char *
name)
84 _compSetN(
"compSetN",
"Set of integral components owned by numerator", this),
85 _compSetD(
"compSetD",
"Set of integral components owned by denominator", this),
86 _intList(
"intList",
"List of integrals", this),
90 _compSetOwnedN = std::make_unique<RooArgSet>();
91 other._compSetN.snapshot(*_compSetOwnedN);
92 _compSetN.add(*_compSetOwnedN) ;
94 _compSetOwnedD = std::make_unique<RooArgSet>();
95 other._compSetD.snapshot(*_compSetOwnedD);
96 _compSetD.add(*_compSetOwnedD) ;
99 arg->setOperMode(_operMode) ;
101 for (
RooAbsArg * arg : *_compSetOwnedD) {
102 arg->setOperMode(_operMode) ;
107 _intList.add(*_compSetN.find(other._intList.at(0)->GetName())) ;
109 _intList.add(*_compSetD.find(other._intList.at(1)->GetName())) ;
128 RooArgSet& saveSet,
const char* isetRangeName,
bool doFactorize)
134 for (
const auto arg : intSet) {
135 auto count = std::count_if(compSet.
begin(), compSet.
end(), [arg](
const RooAbsArg* pdfAsArg){
136 auto pdf = static_cast<const RooAbsPdf*>(pdfAsArg);
137 return (pdf->dependsOn(*arg));
141 anaIntSet.
add(*arg) ;
147 numIntSet.
add(intSet) ;
167 for (
const auto pdfAsArg : compSet) {
168 auto pdf =
static_cast<const RooAbsPdf*
>(pdfAsArg);
170 if (doFactorize && pdf->dependsOn(anaIntSet)) {
172 Int_t code = pdf->getAnalyticalIntegralWN(anaIntSet,anaSet,
nullptr,isetRangeName) ;
175 std::unique_ptr<RooAbsReal> pai{pdf->createIntegral(anaSet,emptyNormSet,isetRangeName)};
176 pai->setOperMode(_operMode) ;
182 numIntSet.
remove(anaSet) ;
211 prodSet.
snapshot(prodSetClone,
false);
213 auto prod = std::make_unique<RooProduct>(prodName,
"product", prodSetClone);
214 prod->setExpensiveObjectCache(expensiveObjectCache()) ;
215 prod->setOperMode(_operMode) ;
218 std::unique_ptr<RooAbsReal> integral{prod->createIntegral(numIntSet,emptyNormSet,isetRangeName)};
219 integral->setOperMode(_operMode) ;
220 auto ret = integral.get();
223 saveSet.
addOwned(std::move(prodSetClone));
225 saveSet.
addOwned(std::move(integral)) ;
237double RooGenProdProj::evaluate()
const
241 double nom =
static_cast<RooAbsReal*
>(_intList.at(0))->getVal(nset);
243 if (!_haveD)
return nom ;
245 double den =
static_cast<RooAbsReal*
>(_intList.at(1))->getVal(nset);
257void RooGenProdProj::operModeHook()
262 arg->setOperMode(_operMode) ;
266 arg->setOperMode(_operMode) ;
269 _intList.at(0)->setOperMode(_operMode) ;
270 if (_haveD) _intList.at(1)->setOperMode(Auto) ;
int Int_t
Signed integer 4 bytes (int)
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Common abstract base class for objects that represent a value and a "shape" in RooFit.
RooExpensiveObjectCache & expensiveObjectCache() const
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
const_iterator end() const
RooAbsArg * first() const
virtual bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
const_iterator begin() const
Abstract interface for all probability density functions.
Abstract base class for objects that represent a real value and implements functionality common to al...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
std::string GetName(TCppScope_t)