51 intpdf(
"!IntegratedPdf",
"intpdf",this,_intpdf,false,false),
52 intobs(
"!IntegrationObservables",
"intobs",this,false,true),
53 deps(
"!Dependents",
"deps",this,true,false),
62 for(
RooAbsArg* server : proj->servers()) {
63 if(server->isShapeServer(*proj)) {
65 }
else if(server->isValueServer(*proj)) {
109 Int_t sterileIdx(-1) ;
112 return static_cast<const RooAbsReal*
>(cache->_projection.get());
116 intpdf.arg().getObservables(nset, nset2);
123 cache->
_projection = std::unique_ptr<RooAbsReal>{
intpdf.arg().createIntegral(iset?*iset:
RooArgSet(),&nset2,
nullptr,rangeName)};
127 coutI(Integration) <<
"RooProjectedPdf::getProjection(" <<
GetName() <<
") creating new projection "
128 << cache->_projection->GetName() <<
" with code " << code << std::endl;
130 return cache->_projection.get();
165 analVars.
add(allVars) ;
184 return cache->_projection->getVal() ;
208 bool nameChange,
bool isRecursive)
216 newPdf->getParameters(&
intobs, newdeps);
219 newdeps.
remove(common,
true,
true) ;
220 olddeps.
remove(common,
true,
true) ;
223 if (!newdeps.
empty()) {
226 if (!olddeps.
empty()) {
227 deps.remove(olddeps,
true,
true) ;
252 os <<
"Int " <<
intpdf.arg().GetName() <<
" d" <<
intobs <<
" ";
264 os <<
indent <<
"RooProjectedPdf begin projection cache" << std::endl ;
268 indent2 +=
Form(
"[%d] ",curElem) ;
272 if(curElem==maxElem) {
273 os <<
indent <<
"RooProjectedPdf end projection cache" << std::endl ;
278std::unique_ptr<RooAbsArg>
282 intpdf->getObservables(&normSet, nset2);
285 bool forcedAnalyticalInt =
false;
287 forcedAnalyticalInt |=
intpdf->forceAnalyticalInt(*obs);
295 if (forcedAnalyticalInt) {
296 auto newArg = std::unique_ptr<RooAbsReal>{
intpdf->createIntegral(
intobs, &nset2)};
298 std::string namePdf = std::string{newArg->GetName()} +
"_wrapped_pdf";
300 auto newArgPdf = std::make_unique<RooWrapperPdf>(namePdf.c_str(), namePdf.c_str(), *newArg);
303 newArgPdf->addOwnedComponents(std::move(newArg));
316 std::unique_ptr<RooAbsReal> numerator{
intpdf->createIntegral(
intobs)};
317 std::unique_ptr<RooAbsReal> denominator{
intpdf->createIntegral(nset2)};
319 std::string nameRatio =
321 auto ratio = std::make_unique<RooRatio>(nameRatio.c_str(), nameRatio.c_str(), *numerator, *denominator);
323 std::string namePdf = nameRatio +
"_wrapped_pdf";
324 auto newArgPdf = std::make_unique<RooWrapperPdf>(namePdf.c_str(), namePdf.c_str(), *ratio);
331 newArgPdf->addOwnedComponents(std::move(numerator));
332 newArgPdf->addOwnedComponents(std::move(denominator));
333 newArgPdf->addOwnedComponents(std::move(ratio));
int Int_t
Signed integer 4 bytes (int).
static void indent(ostringstream &buf, int indent_level)
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
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...
RooAbsArg()
Default constructor.
friend class RooAbsCollection
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.
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooArgSet const * _normSet
! Normalization set with for above integral
const char * normRange() const
RooAbsPdf()
Default constructor.
bool redirectServersHook(const RooAbsCollection &newServerList, bool mustReplaceAll, bool nameChange, bool isRecursiveStep) override
Hook function intercepting redirectServer calls.
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * selectCommon(const RooAbsCollection &refColl) const
Use RooAbsCollection::selecCommon(), but return as RooArgSet.
void markAsCompiled(RooAbsArg &arg) const
static const TNamed * ptr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
RooArgList containedArgs(Action) override
Return RooAbsArg elements contained in projection cache element.
void printCompactTreeHook(std::ostream &, const char *, Int_t, Int_t) override
Print contents of cache when printing self as part of object tree.
std::unique_ptr< RooAbsReal > _projection
RooRealProxy intpdf
p.d.f that is integrated
RooObjCacheManager _cacheMgr
! The cache manager
double evaluate() const override
Evaluate projected p.d.f.
double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Return analytical integral represent by appropriate element of projection cache.
bool forceAnalyticalInt(const RooAbsArg &dep) const override
Force RooRealIntegral to relegate integration of all observables to internal logic.
bool redirectServersHook(const RooAbsCollection &newServerList, bool, bool, bool) override
Intercept a server redirection all and update list of dependents if necessary Specifically update the...
RooAbsPdf * createProjection(const RooArgSet &iset) override
Special version of RooAbsReal::createProjection that deals with projections of projections.
void printMetaArgs(std::ostream &os) const override
Customized printing of arguments of a RooRealIntegral to more intuitively reflect the contents of the...
std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const override
RooProjectedPdf()
Default constructor.
const RooAbsReal * getProjection(const RooArgSet *iset, const RooArgSet *nset, const char *rangeName, int &code) const
Retrieve object representing projection integral of input p.d.f over observables iset,...
RooSetProxy intobs
observables that p.d.f is integrated over
RooSetProxy deps
dependents of this p.d.f
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Mark all requested variables as internally integrated.
const char * GetName() const override
Returns name of object.
std::string getColonSeparatedNameString(RooArgSet const &argSet, char delim=':')