72 for (
const auto client :
server->valueClients()) {
75 if (
allBranches.find(client->GetName()) == client) {
93 bool isShapeServer =
false;
102 <<
function.GetName() <<
" : Observable " <<
leaf.GetName()
103 <<
" has parameterized binning, add value dependence of boundary objects rather than shape of leaf"
113 <<
" as shape dependent" << std::endl;
121 if (!isShapeServer) {
123 <<
" as value dependent" << std::endl;
126 <<
" as shape dependent" << std::endl;
131enum class MarkedState { Dependent, Independent, AlreadyAdded };
146std::vector<ServerToAdd>
163 std::vector<MarkedState>
marked(
allArgs.size(), MarkedState::Independent);
164 marked.back() = MarkedState::Dependent;
179 for (std::size_t i = 0; i <
allArgs.size(); ++i) {
180 if (
marked[i] == MarkedState::Dependent) {
218 for (
const auto arg :
function.servers()) {
223 }
else if (!arg->isValueServer(function) && !arg->isShapeServer(function)) {
231 if (arg->isDerived()) {
249 if (arg->overlaps(*
otherArg,
true)) {
265 <<
function.GetName() <<
": Observable " << arg->GetName()
266 <<
" is suitable for analytical integration (if supported by p.d.f)" << std::endl;
301 _respectCompSelect{!_globalSelectComp},
302 _sumList(
"!sumList",
"Categories to be summed numerically",
this,
false,
false),
303 _intList(
"!intList",
"Variables to be integrated numerically",
this,
false,
false),
304 _anaList(
"!anaList",
"Variables to be integrated analytically",
this,
false,
false),
306 _facList(
"!facList",
"Variables independent of function",
this,
false,
true),
309 _sumCat(
"!sumCat",
"SuperCategory for summation",
this,
false,
false),
333 oocxcoutI(&function,Integration) <<
"RooRealIntegral::ctor(" <<
GetName() <<
") Constructing integral of function "
334 << function.GetName() <<
" over observables" <<
depList <<
" with normalization "
350 if (function.dependsOn(*
nArg)) {
367 if(!arg->isLValue()) {
372 if (!function.dependsOn(*arg)) {
380 oocxcoutI(&function,Integration) << function.GetName() <<
": Factorizing obserables are " <<
_facList << std::endl ;
402 if (
branch != &function && function.dependsOnValue(*
branch)) {
469 if (function.forceAnalyticalInt(*arg)) {
475 oocxcoutI(&function,Integration) << function.GetName() <<
": Observables that function forcibly requires to be integrated internally " <<
anIntOKDepList << std::endl ;
502 oocxcoutI(&function,Integration) << function.GetName() <<
": Function integrated observables " <<
_anaList <<
" internally with code " <<
_mode << std::endl ;
549 for (
const auto arg : function.servers()) {
575 oocxcoutI(&function,Integration) << function.GetName() <<
": Observables " <<
_anaList <<
" are analytically integrated with code " <<
_mode << std::endl ;
578 oocxcoutI(&function,Integration) << function.GetName() <<
": Observables " <<
_intList <<
" are numerically integrated" << std::endl ;
581 oocxcoutI(&function,Integration) << function.GetName() <<
": Observables " <<
_sumList <<
" are numerically summed" << std::endl ;
632 if (
server->isValueServer(*
this)) {
640 if (
leaf->getAttribute(
"projectedDependent")) {
677 coutE(Integration) <<
ClassName() <<
"::" <<
GetName() <<
": failed to create valid integrand." << std::endl;
687 coutE(Integration) <<
ClassName() <<
"::" <<
GetName() <<
": failed to create valid integrator." << std::endl;
691 cxcoutI(NumIntegration) <<
"RooRealIntegral::init(" <<
GetName() <<
") using numeric integrator "
695 cxcoutI(NumIntegration) <<
"RooRealIntegral::init(" <<
GetName() <<
") evaluation requires " <<
_intList.
size() <<
"-D numeric integration step. Evaluation may be slow, sufficient numeric precision for fitting & minimization is not guaranteed" << std::endl ;
707 _valid(
other._valid),
708 _respectCompSelect(
other._respectCompSelect),
709 _sumList(
"!sumList",
this,
other._sumList),
710 _intList(
"!intList",
this,
other._intList),
711 _anaList(
"!anaList",
this,
other._anaList),
712 _jacList(
"!jacList",
this,
other._jacList),
713 _facList(
"!facList",
this,
other._facList),
714 _function(
"!func",
this,
other._function),
715 _iconfig(
other._iconfig),
718 _intOperMode(
other._intOperMode),
719 _rangeName(
other._rangeName)
721 if(
other._funcNormSet) {
756 std::unique_ptr<RooArgSet>
tmp;
762 tmp = std::make_unique<RooArgSet>();
826 <<
":evaluate: cannot initialize numerical integrator" << std::endl;
858 cxcoutD(Tracing) <<
"RooRealIntegral::evaluate_analytic(" <<
GetName()
997 _params = std::make_unique<RooArgSet>(
"params") ;
1048 os <<
"d[Ana]" <<
tmp <<
" ";
1054 if (!
tmp2.empty()) {
1055 os <<
" d[Num]" <<
tmp2 <<
" ";
1065 os <<
indent <<
"--- RooRealIntegral ---" << std::endl;
1066 os <<
indent <<
" Integrates ";
1070 os <<
indent <<
" operating mode is "
1072 os <<
indent <<
" Summed discrete args are " <<
_sumList << std::endl ;
1073 os <<
indent <<
" Numerically integrated args are " <<
_intList << std::endl;
1074 os <<
indent <<
" Analytically integrated args using mode " <<
_mode <<
" are " <<
_anaList << std::endl ;
1075 os <<
indent <<
" Arguments included in Jacobian are " <<
_jacList << std::endl ;
1076 os <<
indent <<
" Factorized arguments are " <<
_facList << std::endl ;
1077 os <<
indent <<
" Function normalization set " ;
1103std::unique_ptr<RooAbsArg>
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
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.
static unsigned int total
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
const_iterator begin() const
const_iterator end() const
Common abstract base class for objects that represent a value and a "shape" in RooFit.
RooExpensiveObjectCache & expensiveObjectCache() const
bool dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=nullptr, bool valueOnly=false) const
Test whether we depend on (ie, are served by) any object in the specified collection.
void setOperMode(OperMode mode, bool recurseADirty=true)
Set the operation mode of this node.
virtual void setExpensiveObjectCache(RooExpensiveObjectCache &cache)
bool addOwnedComponents(const RooAbsCollection &comps)
Take ownership of the contents of 'comps'.
static void setDirtyInhibit(bool flag)
Control global dirty inhibit mode.
virtual std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const
const RefCountList_t & servers() const
List of all servers of this object.
void addServer(RooAbsArg &server, bool valueProp=true, bool shapeProp=false, std::size_t refCount=1)
Register another RooAbsArg as a server to us, ie, declare that we depend on it.
virtual bool isDerived() const
Does value or shape of this arg depend on any other arg?
bool isValueOrShapeDirtyAndClear() const
bool inhibitDirty() const
Delete watch flag.
void setProxyNormSet(const RooArgSet *nset)
Forward a change in the cached normalization argset to all the registered proxies.
RefCountList_t _serverList
Abstract base class for objects that represent a discrete value that can be set from the outside,...
Abstract container object that can hold multiple RooAbsArg objects.
RooFit::UniqueId< RooAbsCollection > const & uniqueId() const
Returns a unique ID that is different for every instantiated RooAbsCollection.
virtual void removeAll()
Remove all arguments from our set, deleting them if we own them.
Int_t index(const RooAbsArg *arg) const
Returns index of given arg, or -1 if arg is not in the collection.
void assign(const RooAbsCollection &other) const
Sets the value, cache and constant attribute of any argument in our set that also appears in the othe...
Storage_t::size_type size() const
RooAbsArg * first() const
RooAbsArg * find(const char *name) const
Find object with given name in list.
Abstract base class for objects that are lvalues, i.e.
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...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Structure printing.
bool redirectServersHook(const RooAbsCollection &newServerList, bool mustReplaceAll, bool nameChange, bool isRecursiveStep) override
Function that is called at the end of redirectServers().
double _value
Cache for current value of object.
double traceEval(const RooArgSet *set) const
Calculate current value of object, with error tracing wrapper.
RooFit::UniqueId< RooArgSet >::Value_t _lastNormSetId
Component selection flag for RooAbsPdf::plotCompOn.
virtual double analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=nullptr) const
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
virtual bool isBinnedDistribution(const RooArgSet &) const
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
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 ...
RooArgList is a container object that can hold multiple RooAbsArg objects.
bool _valueServer
If true contents is value server of owner.
bool isValueServer() const
Returns true of contents is value server of owner.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
void removeAll() override
Remove all argument inset using remove(const RooAbsArg&).
bool addOwned(RooAbsArg &var, bool silent=false) override
Overloaded RooCollection_t::addOwned() method insert object into owning set and registers object as s...
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...
Represents a constant real-valued object.
Minimal implementation of a TObject holding a double value.
bool registerObject(const char *ownerName, const char *objectName, TObject &cacheObject, const RooArgSet ¶ms)
Register object associated with given name and given associated parameters with given values in cache...
const TObject * retrieveObject(const char *name, TClass *tclass, const RooArgSet ¶ms)
Retrieve object from cache that was registered under given name with given parameters,...
Registry for const char* names.
static const char * str(const TNamed *ptr)
Return C++ string corresponding to given TNamed pointer.
Holds the configuration parameters of the various numeric integrators used by RooRealIntegral.
static RooNumIntFactory & instance()
Static method returning reference to singleton instance of factory.
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
Performs hybrid numerical/analytical integrals of RooAbsReal objects.
RooNumIntConfig * _iconfig
bool initNumIntegrator() const
(Re)Initialize numerical integration engine if necessary.
RooArgSet const * funcNormSet() const
RooFit::OwningPtr< RooAbsReal > createIntegral(const RooArgSet &iset, const RooArgSet *nset=nullptr, const RooNumIntConfig *cfg=nullptr, const char *rangeName=nullptr) const override
Create an object that represents the integral of the function over one or more observables listed in ...
void setAllowComponentSelection(bool allow)
Set component selection to be allowed/forbidden.
RooRealProxy _function
Function being integrated.
RooArgSet intVars() const
RooSetProxy _intList
Set of continuous observables over which is integrated numerically.
virtual double sum() const
Perform summation of list of category dependents to be integrated.
RooSetProxy _facList
Set of observables on which function does not depends, which are integrated nevertheless.
std::unique_ptr< RooArgSet > _params
! cache for set of parameters
static void setCacheAllNumeric(Int_t ndim)
Global switch to cache all integral values that integrate at least ndim dimensions numerically.
IntOperMode _intOperMode
integration operation mode
bool _cacheNum
Cache integral if numeric.
double evaluate() const override
Perform the integration and return the result.
const RooArgSet & parameters() const
std::unique_ptr< RooAbsFunc > _numIntegrand
!
void addNumIntDep(RooAbsArg const &arg)
Sort numeric integration variables in summation and integration lists.
RooSetProxy _jacList
Set of lvalue observables over which is analytically integration that have a non-unit Jacobian.
bool isValidReal(double value, bool printError=false) const override
Check if current value is valid.
double getValV(const RooArgSet *set=nullptr) const override
Return value of object.
RooSetProxy _anaList
Set of observables over which is integrated/summed analytically.
bool _restartNumIntEngine
!
bool redirectServersHook(const RooAbsCollection &newServerList, bool mustReplaceAll, bool nameChange, bool isRecursive) override
Intercept server redirects and reconfigure internal object accordingly.
RooSetProxy _sumList
Set of discrete observable over which is summed numerically.
~RooRealIntegral() override
void printMetaArgs(std::ostream &os) const override
Customized printing of arguments of a RooRealIntegral to more intuitively reflect the contents of the...
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Print the state of this object to the specified output stream.
std::unique_ptr< RooAbsIntegrator > _numIntEngine
!
virtual double integrate() const
Perform hybrid numerical/analytical integration over all real-valued dependents.
virtual double jacobianProduct() const
Return product of jacobian terms originating from analytical integration.
static Int_t getCacheAllNumeric()
Return minimum dimensions of numeric integration for which values are cached.
static Int_t _cacheAllNDim
! Cache all integrals with given numeric dimension
RooArgSet const * actualFuncNormSet() const
std::unique_ptr< RooArgSet > _funcNormSet
Optional normalization set passed to function.
std::unique_ptr< RooAbsArg > compileForNormSet(RooArgSet const &normSet, RooFit::Detail::CompileContext &ctx) const override
void autoSelectDirtyMode()
Set appropriate cache operation mode for integral depending on cache operation mode of server objects...
const char * intRange() const
bool getAllowComponentSelection() const
Check if component selection is allowed.
Joins several RooAbsCategoryLValue objects into a single category.
bool setArg(T &newRef)
Change object held in proxy into newRef.
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...
constexpr Value_t value() const
Return numerical value of ID.