74using std::endl, std::string, std::vector, std::list, std::ostream, std::map, std::ostringstream;
113 _pdfList(
"!pdfs",
"List of PDFs",
this)
116 _pdfNSetList.emplace_back(std::make_unique<RooArgSet>(
"nset")) ;
122 _pdfNSetList.emplace_back(std::make_unique<RooArgSet>(
"nset")) ;
127 coutW(InputArguments) <<
"RooProdPdf::RooProdPdf(" <<
GetName()
128 <<
") multiple components with extended terms detected,"
129 <<
" product will not be extendible." << endl ;
161 _pdfList(
"!pdfs",
"List of PDFs",
this)
209 _pdfList(
"!pdfs",
"List of PDFs",
this)
233 _pdfList(
"!pdfList",
"List of PDFs",
this)
253 _pdfList(
"!pdfs",
"List of PDFs",
this)
267 _genCode(
other._genCode),
268 _cutOff(
other._cutOff),
270 _extendedIndex(
other._extendedIndex),
271 _useDefaultGen(
other._useDefaultGen),
272 _refRangeName(
other._refRangeName),
273 _selfNorm(
other._selfNorm),
274 _defNormSet(
other._defNormSet)
277 for(
auto const& nset :
other._pdfNSetList) {
278 _pdfNSetList.emplace_back(std::make_unique<RooArgSet>(nset->GetName()));
297 _pdfNSetList.emplace_back(std::make_unique<RooArgSet>(
"nset")) ;
299 if (pdf->canBeExtended()) {
309 if (0 ==
strcmp(
carg->GetName(),
"Conditional")) {
321 if (
thePdf->canBeExtended()) {
329 coutW(InputArguments) <<
"Unknown arg: " <<
carg->GetName() << endl ;
335 coutW(InputArguments) <<
"RooProdPdf::RooProdPdf(" <<
GetName()
336 <<
") WARNING: multiple components with extended terms detected,"
337 <<
" product will not be extendible." << endl ;
386 cxcoutD(Eval) <<
"RooProdPdf::calculate(" <<
GetName() <<
") rearranged product calculation"
420 std::vector<std::span<const double>> factors;
423 auto span = ctx.
at(i);
424 factors.push_back(span);
426 std::array<double, 1>
special{
static_cast<double>(factors.size())};
435 v.erase(std::remove_if(
v.begin(),
v.end(), [](T*
x){ return x == nullptr; } ),
v.end());
440 for (
auto const& arg :
other) {
442 return elm !=
nullptr &&
elm->namePtr() == arg->namePtr();
446 if(found !=
v.end()) {
453void addCommon(std::vector<RooAbsArg*> &
v, std::vector<RooAbsArg*>
const&
o1, std::vector<RooAbsArg*>
const&
o2) {
455 for (
auto const& arg :
o1) {
457 return elm->namePtr() == arg->namePtr();
489 std::vector<RooAbsArg*>
pdfNSet;
490 std::vector<RooAbsArg*>
pdfCSet;
509 std::vector<RooAbsArg*> & out,
512 if (arg->dependsOnValue(
dataList) && arg->isLValue()) {
684 auto cache = std::make_unique<CacheElem>();
717 if (1 ==
group.size()) {
755 std::ostringstream str;
termImpSet.printValue(str);
757 ratioTerms[str.str()].addOwned(std::move(ratio));
792 std::ostringstream str;
termImpSet.printValue(str);
793 ratioTerms[str.str()].addOwned(std::move(ratio));
812 ostringstream str;
termNSet.printValue(str);
816 cache->_ownedList.addOwned(std::move(
ratioTerms[str.str()]));
825 if (1 ==
group.size()) {
852 cache->_partList.add(*func[0]);
853 if (
isOwned) cache->_ownedList.addOwned(std::unique_ptr<RooAbsArg>{func[0]});
855 cache->_normList.emplace_back(std::make_unique<RooArgSet>());
856 norm->snapshot(*cache->_normList.back(),
false);
858 cache->_numList.addOwned(std::unique_ptr<RooAbsArg>{func[1]});
859 cache->_denList.addOwned(std::unique_ptr<RooAbsArg>{func[2]});
893 if (
isOwned) cache->_ownedList.addOwned(std::unique_ptr<RooAbsArg>{func[0]});
918 inttmp->setStringAttribute(
"PROD_TERM_TYPE",
"SPECINT");
920 cache->_partList.add(*
inttmp);
938 numtmp->addOwnedComponents(std::move(
ndr));
940 cache->_ownedList.addOwned(std::move(
prodtmp));
941 cache->_ownedList.addOwned(std::move(
inttmp));
942 cache->_ownedList.addOwned(std::move(
prodtmp_num));
943 cache->_ownedList.addOwned(std::move(
prodtmp_den));
944 cache->_numList.addOwned(std::move(
numtmp));
946 cache->_normList.emplace_back(std::make_unique<RooArgSet>());
975 auto ratio = std::make_unique<RooFormulaVar>(
Form(
"ratio(%s,%s)",
ratio_num->GetName(),
ratio_den->GetName()),
"@0/@1",
978 ratio->addOwnedComponents(std::move(
ratio_num));
979 ratio->addOwnedComponents(std::move(
ratio_den));
980 ratio->setAttribute(
"RATIO_TERM") ;
1000 char* save(
nullptr) ;
1030 if (
string(
"SPECINT")==
part->getStringAttribute(
"PROD_TERM_TYPE")) {
1036 std::unique_ptr<RooArgSet> components{
orig->getComponents()};
1038 if (
carg->getAttribute(
"RATIO_TERM")) {
1067 if (arg->getAttribute(
"RATIO_TERM")) {
1090 if (
string(
"SPECINT")==
part->getStringAttribute(
"PROD_TERM_TYPE")) {
1096 if (
orig->intRange()) {
1109 if (ratio &&
parg->dependsOn(*ratio)) {
1171 auto specDenProd = std::make_unique<RooProduct>(pname.c_str(),pname.c_str(),tmp) ;
1172 std::unique_ptr<RooAbsReal>
specInt;
1183 throw string(
"this should not happen") ;
1218 prod_comp->addOwnedComponents(std::move(iter->second));
1292 std::stringstream
errMsg;
1293 errMsg <<
"specializeIntegral: unknown input type " <<
input.ClassName() <<
"::" <<
input.GetName();
1294 throw std::runtime_error(
errMsg.str());
1330 std::vector<RooArgSet*>*
newGroup = nullptr ;
1411 if (
term->size()==1) {
1420 partInt->setStringAttribute(
"PROD_TERM_TYPE",
"IIIa") ;
1443 partInt->setStringAttribute(
"PROD_TERM_TYPE",
"IIIb") ;
1465 if (nset && !nset->
empty() &&
term->size()>1) {
1472 partInt->setStringAttribute(
"PROD_TERM_TYPE",
"IVa") ;
1499 name.Append(
"_NORM[") ;
1507 name.Append(arg->GetName()) ;
1516 partInt->setStringAttribute(
"PROD_TERM_TYPE",
"IVb") ;
1523 ret[1] = std::unique_ptr<RooAbsReal>{pdf->createIntegral(
RooArgSet())}.release();
1535 pdf->setStringAttribute(
"PROD_TERM_TYPE",
"IVb") ;
1538 ret[1] = std::unique_ptr<RooAbsReal>{pdf->createIntegral(
RooArgSet())}.release();
1545 coutE(Eval) <<
"RooProdPdf::processProductTerm(" <<
GetName() <<
") unidentified term!!!" << endl ;
1560 std::ostringstream os(
pfx);
1566 if (!first) os <<
"_X_";
1568 os << pdf->GetName();
1636 if (cache==
nullptr) {
1674 coutF(Generation) <<
"Requesting expected number of events from a RooProdPdf that does not contain an extended p.d.f" << endl ;
1675 throw std::logic_error(std::string(
"RooProdPdf ") +
GetName() +
" could not be extended.");
1684 coutF(Generation) <<
"Requesting expected number of events from a RooProdPdf that does not contain an extended p.d.f" << endl ;
1685 throw std::logic_error(std::string(
"RooProdPdf ") +
GetName() +
" could not be extended.");
1720 std::vector<Int_t> code;
1806 os <<
indent <<
"RooProdPdf begin partial integral cache" << endl ;
1810 for(
auto const& arg : _partList) {
1811 arg->printCompactTree(os,
indent2.c_str()) ;
1815 os <<
indent <<
"RooProdPdf end partial integral cache" << endl ;
1834 if (pdf->dependsOn(arg)) {
1855 if (idx<0)
return nullptr;
1866 for(
auto arg :
pdfs) {
1869 coutW(InputArguments) <<
"RooProdPdf::addPdfs(" <<
GetName() <<
") list arg "
1870 << arg->GetName() <<
" is not a PDF, ignored" << endl ;
1881 _pdfNSetList.emplace_back(std::make_unique<RooArgSet>(
"nset"));
1886 coutW(InputArguments) <<
"RooProdPdf::addPdfs(" <<
GetName()
1887 <<
") WARNING: multiple components with extended terms detected,"
1888 <<
" product will not be extendible." << endl ;
1928 std::vector<TNamed const*>
ptrs;
1931 ptrs.push_back(arg->namePtr());
1944 }
else if (*
pB < *
pA) {
1978 pdf->getParameters(
nullptr, tmp);
2002 constraints.
add(*pdf) ;
2010 tmp.remove(observables,
false,
true);
2026 coutI(Minimization) <<
"RooProdPdf::getConstraints(" <<
GetName() <<
") omitting term " << pdf->GetName()
2027 <<
" as constraint term as it does not share any parameters with the other pdfs in product. "
2028 <<
"To force inclusion in likelihood, add an explicit Constrain() argument for the target parameter" << endl ;
2061 pdf->getParameters(&observables, tmp);
2084 for (
auto param : *params) {
2087 if (
term->dependsOnValue(*param)) {
2135 if (std::list<double>*
hint = pdf->plotSamplingHint(obs,xlo,xhi)) {
2151 if (pdf->dependsOn(obs) && !pdf->isBinnedDistribution(obs)) {
2170 if (std::list<double>*
hint = pdf->binBoundaries(obs,xlo,xhi)) {
2197 parg->setStringAttribute(
"CATNormSet",getColonSeparatedNameString(*pdf_nset).c_str()) ;
2199 if (
string(
"cset")==
pdf_nset->GetName()) {
2200 parg->setStringAttribute(
"CATCondSet",getColonSeparatedNameString(*pdf_nset).c_str()) ;
2203 coutW(Optimization) <<
"RooProdPdf::setCacheAndTrackHints(" <<
GetName() <<
") WARNING product pdf does not specify a normalization set for component " <<
parg->GetName() << endl ;
2218 if (i>0) os <<
" * " ;
2221 if (!
ncset->empty()) {
2222 if (
string(
"nset")==
ncset->GetName()) {
2227 for (
auto const* arg : *
ncset) {
2233 os << arg->GetName() ;
2250 cxcoutD(LinkStateMgmt) <<
"RooProdPdf::redirectServersHook(" <<
GetName() <<
"): removing REMOVAL_DUMMY" << endl ;
2269 normSet->replace(arg, std::unique_ptr<RooAbsArg>{
newArg->cloneTree()});
2279 os <<
"_partList\n";
2280 os << getColonSeparatedNameString(_partList) <<
"\n";
2282 os << getColonSeparatedNameString(_numList) <<
"\n";
2284 os << getColonSeparatedNameString(_denList) <<
"\n";
2285 os <<
"_ownedList\n";
2286 os << getColonSeparatedNameString(_ownedList) <<
"\n";
2287 os <<
"_normList\n";
2288 for(
auto const& set : _normList) {
2289 os << getColonSeparatedNameString(*set) <<
"\n";
2291 os <<
"_isRearranged" <<
"\n";
2292 os << _isRearranged <<
"\n";
2293 os <<
"_rearrangedNum" <<
"\n";
2294 if(_rearrangedNum) {
2295 os << getColonSeparatedNameString(*_rearrangedNum) <<
"\n";
2297 os <<
"nullptr" <<
"\n";
2299 os <<
"_rearrangedDen" <<
"\n";
2300 if(_rearrangedDen) {
2301 os << getColonSeparatedNameString(*_rearrangedDen) <<
"\n";
2303 os <<
"nullptr" <<
"\n";
2313 std::unique_ptr<RooArgSet> out;
2318 out = std::make_unique<RooArgSet>(
normSet);
2323 out = std::make_unique<RooArgSet>(*
pdfNset);
2328 if (!arg->getStringAttribute(
"__prefix__")) {
2329 arg->SetName((std::string(prefix) + arg->GetName()).c_str());
2330 arg->setStringAttribute(
"__prefix__", prefix);
2348 _servers(
"!servers",
"List of servers",
this), _prodPdf{std::
move(
prodPdf)}
2366 _prodPdf->doEvalImpl(
this, *_cache, ctx);
2371 if (_cache->_isRearranged) {
2372 ctx.
addResult(
this, ctx.
buildCall(
"RooFit::Detail::MathFuncs::ratio", *_cache->_rearrangedNum, *_cache->_rearrangedDen));
2374 ctx.
addResult(
this, ctx.
buildCall(
"RooFit::Detail::MathFuncs::product", _cache->_partList, _cache->_partList.size()));
2382 return _prodPdf->createExpectedEventsFunc(&
_normSet);
2388 const char *rangeName =
nullptr)
const override
2390 return _prodPdf->getAnalyticalIntegralWN(allVars,
analVars,
normSet, rangeName);
2394 return _prodPdf->getAnalyticalIntegral(allVars,
numVars, rangeName);
2398 return _prodPdf->analyticalIntegralWN(code,
normSet, rangeName);
2402 return _prodPdf->analyticalIntegral(code, rangeName);
2408 _cache = _prodPdf->createCacheElem(&
_normSet,
nullptr);
2409 auto &cache = *_cache;
2414 if (cache._isRearranged) {
2415 _servers.add(*cache._rearrangedNum);
2416 _servers.add(*cache._rearrangedDen);
2418 for (std::size_t i = 0; i < cache._partList.size(); ++i) {
2419 _servers.add(cache._partList[i]);
2424 double evaluate()
const override {
return _prodPdf->calculate(*_cache); }
2427 std::unique_ptr<RooProdPdf::CacheElem>
_cache;
2432std::unique_ptr<RooAbsArg>
static void indent(ostringstream &buf, int indent_level)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
const_iterator begin() const
const_iterator end() const
const std::vector< Int_t > & retrieve(Int_t masterCode) const
Retrieve the array of integer codes associated with the given master code.
Int_t store(const std::vector< Int_t > &codeList, RooArgSet *set1=nullptr, RooArgSet *set2=nullptr, RooArgSet *set3=nullptr, RooArgSet *set4=nullptr)
Store given arrays of integer codes, and up to four RooArgSets in the registry (each setX pointer may...
Common abstract base class for objects that represent a value and a "shape" in RooFit.
RooExpensiveObjectCache & expensiveObjectCache() const
RooFit::OwningPtr< RooArgSet > getParameters(const RooAbsData *data, bool stripDisconnected=true) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
bool addOwnedComponents(const RooAbsCollection &comps)
Take ownership of the contents of 'comps'.
const Text_t * getStringAttribute(const Text_t *key) const
Get string attribute mapped under key 'key'.
friend class RooRealIntegral
TObject * Clone(const char *newname=nullptr) const override
Make a clone of an object using the Streamer facility.
void treeNodeServerList(RooAbsCollection *list, const RooAbsArg *arg=nullptr, bool doBranch=true, bool doLeaf=true, bool valueOnly=false, bool recurseNonDerived=false) const
Fill supplied list with nodes of the arg tree, following all server links, starting with ourself as t...
OperMode operMode() const
Query the operation mode of this node.
Abstract container object that can hold multiple RooAbsArg objects.
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.
Int_t index(const RooAbsArg *arg) const
Returns index of given arg, or -1 if arg is not in the collection.
Storage_t::size_type size() const
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract base class for generator contexts of RooAbsPdf objects.
Abstract interface for all probability density functions.
TString _normRange
Normalization range.
virtual bool isDirectGenSafe(const RooAbsArg &arg) const
Check if given observable can be safely generated using the pdfs internal generator mechanism (if tha...
RooArgSet const * _normSet
Normalization integral (owned by _normMgr)
bool canBeExtended() const
If true, PDF can provide extended likelihood term.
const char * normRange() const
bool redirectServersHook(const RooAbsCollection &newServerList, bool mustReplaceAll, bool nameChange, bool isRecursiveStep) override
The cache manager.
virtual RooAbsGenContext * genContext(const RooArgSet &vars, const RooDataSet *prototype=nullptr, const RooArgSet *auxProto=nullptr, bool verbose=false) const
Interface function to create a generator context from a p.d.f.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
Abstract base class for objects that represent a real value and implements functionality common to al...
RooFit::OwningPtr< RooAbsReal > createIntegral(const RooArgSet &iset, const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Create an object that represents the integral of the function over one or more observables listed in ...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
bool _forceNumInt
Force numerical integration if flag set.
TString integralNameSuffix(const RooArgSet &iset, const RooArgSet *nset=nullptr, const char *rangeName=nullptr, bool omitEmpty=false) const
Construct string with unique suffix name to give to integral object that encodes integrated observabl...
Calculates the sum of a set of RooAbsReal terms, or when constructed with two sets,...
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.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=nullptr)
Setter function without integration set.
RooArgSet selectFromSet1(RooArgSet const &argSet, int index) const
Create RooArgSet containing the objects that are both in the cached set 1 with a given index and an i...
T * getObjByIndex(Int_t index) const
Retrieve payload object by slot index.
RooArgSet selectFromSet2(RooArgSet const &argSet, int index) const
Create RooArgSet containing the objects that are both in the cached set 2 with a given index and an i...
void reset()
Clear the cache.
Int_t lastIndex() const
Return index of slot used in last get or set operation.
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=nullptr, const TNamed *isetRangeName=nullptr)
Getter function without integration set.
Named container for two doubles, two integers two object points and three string pointers that can be...
bool add(const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
Overloaded RooCollection_t::add() method insert object into set and registers object as server to own...
bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false) override
Remove object 'var' from set and deregister 'var' as server to owner.
TObject * clone(const char *newname) const override
RooCustomizer is a factory class to produce clones of a prototype composite PDF object with the same ...
Container class to hold unbinned data.
A class to maintain the context for squashing of RooFit models into code.
std::string buildCall(std::string const &funcname, Args_t const &...args)
Build the code to call the function with name funcname, passing some arguments.
void addResult(RooAbsArg const *key, std::string const &value)
A function to save an expression that includes/depends on the result of the input node.
void markAsCompiled(RooAbsArg &arg) const
bool likelihoodMode() const
void compileServer(RooAbsArg &server, RooAbsArg &arg, RooArgSet const &normSet)
std::span< const double > at(RooAbsArg const *arg, RooAbsArg const *caller=nullptr)
std::span< double > output()
RooBatchCompute::Config config(RooAbsArg const *arg) const
A RooProdPdf with a fixed normalization set can be replaced by this class.
void translate(RooFit::Detail::CodeSquashContext &ctx) const override
This function defines a translation for each RooAbsReal based object that can be used to express the ...
std::unique_ptr< RooProdPdf::CacheElem > _cache
RooFixedProdPdf(const RooFixedProdPdf &other, const char *name=nullptr)
RooFixedProdPdf(std::unique_ptr< RooProdPdf > &&prodPdf, RooArgSet const &normSet)
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
bool selfNormalized() const override
Shows if a PDF is self-normalized, which means that no attempt is made to add a normalization term.
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &numVars, const char *rangeName=nullptr) const override
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Variant of getAnalyticalIntegral that is also passed the normalization set that should be applied to ...
std::unique_ptr< RooAbsReal > createExpectedEventsFunc(const RooArgSet *) const override
Returns an object that represents the expected number of events for a given normalization set,...
TObject * clone(const char *newname) const override
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
std::unique_ptr< RooProdPdf > _prodPdf
double expectedEvents(const RooArgSet *) const override
Return expected number of events to be used in calculation of extended likelihood.
void doEval(RooFit::EvalContext &ctx) const override
Base function for computing multiple values of a RooAbsReal.
bool canComputeBatchWithCuda() const override
bool forceAnalyticalInt(const RooAbsArg &dep) const override
double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName) const override
Analytical integral with normalization (see RooAbsReal::analyticalIntegralWN() for further informatio...
ExtendMode extendMode() const override
Returns ability of PDF to provide extended likelihood terms.
General form of projected integral of product of PDFs, utility class for RooProdPdf.
Collection class for internal use, storing a collection of RooAbsArg pointers in a doubly linked list...
void Delete(Option_t *o=nullptr) override
Remove all elements in collection and delete all elements NB: Collection does not own elements,...
Int_t IndexOf(const char *name) const
Return position of given object in list.
static const char * str(const TNamed *ptr)
Return C++ string corresponding to given TNamed pointer.
static const TNamed * ptr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
RooArgList containedArgs(Action) override
Return RooAbsArg components contained in the cache.
std::unique_ptr< RooAbsReal > _rearrangedNum
void printCompactTreeHook(std::ostream &, const char *, Int_t, Int_t) override
Hook function to print cache contents in tree printing of RooProdPdf.
std::vector< std::unique_ptr< RooArgSet > > _normList
std::unique_ptr< RooAbsReal > _rearrangedDen
void writeToStream(std::ostream &os) const
Efficient implementation of a product of PDFs of the form.
void setCacheAndTrackHints(RooArgSet &) override
Label OK'ed components of a RooProdPdf with cache-and-track, and label all RooProdPdf descendants wit...
Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, bool staticInitOK=true) const override
Query internal generation capabilities of component p.d.f.s and aggregate capabilities into master co...
void rearrangeProduct(CacheElem &) const
void factorizeProduct(const RooArgSet &normSet, const RooArgSet &intSet, RooLinkedList &termList, RooLinkedList &normList, RooLinkedList &impDepList, RooLinkedList &crossDepList, RooLinkedList &intList) const
Factorize product in irreducible terms for given choice of integration/normalization.
double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Return analytical integral defined by given scenario code.
RooArgSet * getConstraints(const RooArgSet &observables, RooArgSet &constrainedParams, bool stripDisconnected, bool removeConstraintsFromPdf=false) const override
Return all parameter constraint p.d.f.s on parameters listed in constrainedParams.
~RooProdPdf() override
Destructor.
Int_t _extendedIndex
Index of extended PDF (if any)
std::unique_ptr< RooAbsReal > specializeRatio(RooFormulaVar &input, const char *targetRangeName) const
RooProdPdf()
Default constructor.
void removePdfs(RooAbsCollection const &pdfs)
Remove some PDFs from the factors of this RooProdPdf.
bool _useDefaultGen
Use default or distributed event generator.
std::vector< std::unique_ptr< RooArgSet > > _pdfNSetList
List of PDF component normalization sets.
std::unique_ptr< RooArgSet > fillNormSetForServer(RooArgSet const &normSet, RooAbsArg const &server) const
std::unique_ptr< RooAbsReal > specializeIntegral(RooAbsReal &orig, const char *targetRangeName) const
bool forceAnalyticalInt(const RooAbsArg &dep) const override
Force RooRealIntegral to offer all observables for internal integration.
std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const override
void getParametersHook(const RooArgSet *, RooArgSet *, bool stripDisconnected) const override
RooAbsGenContext * genContext(const RooArgSet &vars, const RooDataSet *prototype=nullptr, const RooArgSet *auxProto=nullptr, bool verbose=false) const override
Return generator context optimized for generating events from product p.d.f.s.
TNamed * _refRangeName
Reference range name for interpretation of conditional products.
RooAICRegistry _genCode
! Registry of composite direct generator codes
void addPdfs(RooAbsCollection const &pdfs)
Add some full PDFs to the factors of this RooProdPdf.
RooListProxy _pdfList
List of PDF components.
Int_t getPartIntList(const RooArgSet *nset, const RooArgSet *iset, const char *isetRangeName=nullptr) const
Return list of (partial) integrals of product terms for integration of p.d.f over observables iset wh...
void printMetaArgs(std::ostream &os) const override
Customized printing of arguments of a RooProdPdf to more intuitively reflect the contents of the prod...
std::list< double > * binBoundaries(RooAbsRealLValue &, double, double) const override
Forward the plot sampling hint from the p.d.f. that defines the observable obs.
RooObjCacheManager _cacheMgr
std::string makeRGPPName(const char *pfx, const RooArgSet &term, const RooArgSet &iset, const RooArgSet &nset, const char *isetRangeName) const
Make an appropriate automatic name for a RooGenProdProj object in getPartIntList()
bool isDirectGenSafe(const RooAbsArg &arg) const override
Forward determination of safety of internal generator code to component p.d.f that would generate the...
std::unique_ptr< RooAbsReal > makeCondPdfRatioCorr(RooAbsReal &term, const RooArgSet &termNset, const RooArgSet &termImpSet, const char *normRange, const char *refRange) const
For single normalization ranges.
RooArgSet * findPdfNSet(RooAbsPdf const &pdf) const
Look up user specified normalization set for given input PDF component.
ExtendMode extendMode() const override
If this product contains exactly one extendable p.d.f return the extension abilities of that p....
std::list< double > * plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const override
Forward the plot sampling hint from the p.d.f. that defines the observable obs.
double expectedEvents(const RooArgSet *nset) const override
Return the expected number of events associated with the extendable input PDF in the product.
std::vector< RooAbsReal * > processProductTerm(const RooArgSet *nset, const RooArgSet *iset, const char *isetRangeName, const RooArgSet *term, const RooArgSet &termNSet, const RooArgSet &termISet, bool &isOwned, bool forceWrap=false) const
Calculate integrals of factorized product terms over observables iset while normalized to observables...
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &numVars, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Determine which part (if any) of given integral can be performed analytically.
friend class RooFixedProdPdf
bool isBinnedDistribution(const RooArgSet &obs) const override
If all components that depend on obs are binned that so is the product.
friend class RooProdGenContext
RooArgSet * getConnectedParameters(const RooArgSet &observables) const
Return all parameter constraint p.d.f.s on parameters listed in constrainedParams.
double calculate(const RooProdPdf::CacheElem &cache, bool verbose=false) const
Calculate running product of pdfs terms, using the supplied normalization set in 'normSetList' for ea...
RooArgSet _defNormSet
Default normalization set.
std::unique_ptr< RooAbsReal > createExpectedEventsFunc(const RooArgSet *nset) const override
Returns an object that represents the expected number of events for a given normalization set,...
CacheElem * getCacheElem(RooArgSet const *nset) const
The cache manager.
bool redirectServersHook(const RooAbsCollection &, bool, bool, bool) override
Implement support for node removal.
void initGenerator(Int_t code) override
Forward one-time initialization call to component generation initialization methods.
void doEvalImpl(RooAbsArg const *caller, const RooProdPdf::CacheElem &cache, RooFit::EvalContext &) const
Evaluate product of PDFs in batch mode.
void generateEvent(Int_t code) override
Generate a single event with configuration specified by 'code' Defer internal generation to component...
void groupProductTerms(std::list< std::vector< RooArgSet * > > &groupedTerms, RooArgSet &outerIntDeps, const RooLinkedList &terms, const RooLinkedList &norms, const RooLinkedList &imps, const RooLinkedList &ints, const RooLinkedList &cross) const
Group product into terms that can be calculated independently.
void fixRefRange(const char *rangeName)
std::unique_ptr< CacheElem > createCacheElem(const RooArgSet *nset, const RooArgSet *iset, const char *isetRangeName=nullptr) const
double evaluate() const override
Calculate current value of object.
void initializeFromCmdArgList(const RooArgSet &fullPdfSet, const RooLinkedList &l)
Initialize RooProdPdf configuration from given list of RooCmdArg configuration arguments and set of '...
void selectNormalizationRange(const char *rangeName=nullptr, bool force=false) override
Interface function used by test statistics to freeze choice of range for interpretation of conditiona...
double _cutOff
Cutoff parameter for running product.
Represents the product of a given set of RooAbsReal objects.
Performs hybrid numerical/analytical integrals of RooAbsReal objects.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
Mother of all ROOT objects.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
const char * Data() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
RooConstVar & RooConst(double val)
void compute(Config cfg, Computer comp, std::span< double > output, VarSpan vars, ArgSpan extraArgs={})
BinnedLOutput getBinnedL(RooAbsPdf const &pdf)
std::string getColonSeparatedNameString(RooArgSet const &argSet, char delim=':')