Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooRealIntegral.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * File: $Id: RooRealIntegral.h,v 1.44 2007/05/11 09:11:30 verkerke Exp $
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16#ifndef ROO_REAL_INTEGRAL
17#define ROO_REAL_INTEGRAL
18
19#include "RooAbsReal.h"
20#include "RooArgSet.h"
21#include "RooAbsPdf.h"
22#include "RooRealProxy.h"
23#include "RooSetProxy.h"
24#include "RooListProxy.h"
25#include <list>
26
27class RooArgSet ;
28class TH1F ;
29class RooAbsCategory ;
30class RooRealVar ;
31class RooAbsIntegrator ;
32class RooNumIntConfig ;
33
35public:
36
37 // Constructors, assignment etc
39 RooRealIntegral(const char *name, const char *title, const RooAbsReal& function, const RooArgSet& depList,
40 const RooArgSet* funcNormSet=0, const RooNumIntConfig* config=0, const char* rangeName=0) ;
41 RooRealIntegral(const RooRealIntegral& other, const char* name=0);
42 virtual TObject* clone(const char* newname) const { return new RooRealIntegral(*this,newname); }
43 virtual ~RooRealIntegral();
44
45 virtual Double_t getValV(const RooArgSet* set=0) const ;
46
47 Bool_t isValid() const { return _valid; }
48
49 void printMultiline(std::ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const ;
50 void printMetaArgs(std::ostream& os) const ;
51
52 const RooArgSet& numIntCatVars() const { return _sumList ; }
53 const RooArgSet& numIntRealVars() const { return _intList ; }
54 const RooArgSet& anaIntVars() const { return _anaList ; }
55
56 RooArgSet intVars() const { RooArgSet tmp(_sumList) ; tmp.add(_intList) ; tmp.add(_anaList) ; tmp.add(_facList) ; return tmp ; }
57 const char* intRange() { return _rangeName ? _rangeName->GetName() : 0 ; }
58 const RooAbsReal& integrand() const { return _function.arg() ; }
59
60 void setCacheNumeric(Bool_t flag) {
61 // If true, value of this interal is cached if it is (partially numeric)
62 _cacheNum = flag ;
63 }
64
66 // If true, value of this interal is cached if it is (partially numeric)
67 return _cacheNum ;
68 }
69
70 static void setCacheAllNumeric(Int_t ndim) ;
71
72 static Int_t getCacheAllNumeric() ;
73
74 virtual std::list<Double_t>* plotSamplingHint(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const {
75 // Forward plot sampling hint of integrand
76 return _function.arg().plotSamplingHint(obs,xlo,xhi) ;
77 }
78
79 virtual RooAbsReal* createIntegral(const RooArgSet& iset, const RooArgSet* nset=0, const RooNumIntConfig* cfg=0, const char* rangeName=0) const ;
80
83
84protected:
85
86 mutable Bool_t _valid;
88
89 const RooArgSet& parameters() const ;
90
92 //friend class RooAbsPdf ;
93
95 void autoSelectDirtyMode() ;
96
97 virtual Double_t sum() const ;
98 virtual Double_t integrate() const ;
99 virtual Double_t jacobianProduct() const ;
100
101 // Evaluation and validation implementation
102 Double_t evaluate() const ;
103 virtual Bool_t isValidReal(Double_t value, Bool_t printError=kFALSE) const ;
104 Bool_t servesExclusively(const RooAbsArg* server,const RooArgSet& exclLVBranches, const RooArgSet& allBranches) const ;
105
106
107 virtual Bool_t redirectServersHook(const RooAbsCollection& newServerList,
108 Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive) ;
109
110 // Function pointer and integrands list
111 mutable RooSetProxy _sumList ; // Set of discrete observable over which is summed numerically
112 mutable RooSetProxy _intList ; // Set of continuous observables over which is integrated numerically
113 mutable RooSetProxy _anaList ; // Set of observables over which is integrated/summed analytically
114 mutable RooSetProxy _jacList ; // Set of lvalue observables over which is analytically integration that have a non-unit Jacobian
115 mutable RooSetProxy _facList ; // Set of observables on which function does not depends, which are integrated nevertheless
116
117 mutable RooArgSet _facListOwned ; // Owned components in _facList
118 RooRealProxy _function ; // Function being integration
119 RooArgSet* _funcNormSet ; // Optional normalization set passed to function
120
121 mutable RooArgSet _saveInt ; //! do not persist
122 mutable RooArgSet _saveSum ; //! do not persist
123
125
126 mutable RooListProxy _sumCat ; //! do not persist
127
129 IntOperMode _intOperMode ; // integration operation mode
130
131 mutable Bool_t _restartNumIntEngine ; //! do not persist
132 mutable RooAbsIntegrator* _numIntEngine ; //! do not persist
133 mutable RooAbsFunc *_numIntegrand; //! do not persist
134
136
137 mutable RooArgSet* _params ; //! cache for set of parameters
138
139 Bool_t _cacheNum ; // Cache integral if numeric
140 static Int_t _cacheAllNDim ; //! Cache all integrals with given numeric dimension
141
142
143 virtual void operModeHook() ; // cache operation mode
144
145 ClassDef(RooRealIntegral,3) // Real-valued function representing an integral over a RooAbsReal object
146};
147
148#endif
const Bool_t kFALSE
Definition RtypesCore.h:92
double Double_t
Definition RtypesCore.h:59
#define ClassDef(name, id)
Definition Rtypes.h:325
static void indent(ostringstream &buf, int indent_level)
char name[80]
Definition TGX11.cxx:110
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition RooAbsArg.h:72
RooAbsCategory is the base class for objects that represent a discrete value with a finite number of ...
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition RooAbsFunc.h:27
RooAbsIntegrator is the abstract interface for integrators of real-valued functions that implement th...
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition RooAbsReal.h:61
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:29
Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Add element to non-owning set.
RooListProxy is the concrete proxy for RooArgList objects.
RooNumIntConfig holds the configuration parameters of the various numeric integrators used by RooReal...
RooRealIntegral performs hybrid numerical/analytical integrals of RooAbsReal objects.
RooNumIntConfig * _iconfig
do not persist
const RooArgSet & numIntRealVars() const
virtual void operModeHook()
Cache all integrals with given numeric dimension.
Bool_t getCacheNumeric()
RooArgSet * _params
Bool_t getAllowComponentSelection() const
Check if component selection is allowed.
Bool_t servesExclusively(const RooAbsArg *server, const RooArgSet &exclLVBranches, const RooArgSet &allBranches) const
Utility function that returns true if 'object server' is a server to exactly one of the RooAbsArgs in...
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
RooRealProxy _function
Int_t _mode
do not persist
const RooArgSet & anaIntVars() const
RooArgSet intVars() const
void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Print the state of this object to the specified output stream.
RooSetProxy _intList
const RooAbsReal & integrand() const
const RooArgSet & numIntCatVars() const
RooSetProxy _facList
RooAbsFunc * _numIntegrand
do not persist
static void setCacheAllNumeric(Int_t ndim)
Global switch to cache all integral values that integrate at least ndim dimensions numerically.
IntOperMode _intOperMode
RooArgSet * _funcNormSet
RooAbsIntegrator * _numIntEngine
do not persist
void printMetaArgs(std::ostream &os) const
Customized printing of arguments of a RooRealIntegral to more intuitively reflect the contents of the...
const RooArgSet & parameters() const
virtual Bool_t isValidReal(Double_t value, Bool_t printError=kFALSE) const
Check if current value is valid.
TNamed * _rangeName
do not persist
void setCacheNumeric(Bool_t flag)
virtual RooAbsReal * createIntegral(const RooArgSet &iset, const RooArgSet *nset=0, const RooNumIntConfig *cfg=0, const char *rangeName=0) const
Create an object that represents the integral of the function over one or more observables listed in ...
RooSetProxy _jacList
virtual TObject * clone(const char *newname) const
virtual Double_t sum() const
Perform summation of list of category dependents to be integrated.
RooSetProxy _anaList
RooSetProxy _sumList
Bool_t initNumIntegrator() const
(Re)Initialize numerical integration engine if necessary.
virtual Bool_t redirectServersHook(const RooAbsCollection &newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive)
Intercept server redirects and reconfigure internal object accordingly.
virtual Double_t getValV(const RooArgSet *set=0) const
Return value of object.
virtual Double_t jacobianProduct() const
Return product of jacobian terms originating from analytical integration.
RooListProxy _sumCat
Bool_t _cacheNum
cache for set of parameters
static Int_t getCacheAllNumeric()
Return minimum dimensions of numeric integration for which values are cached.
RooArgSet _saveSum
do not persist
static Int_t _cacheAllNDim
void setAllowComponentSelection(Bool_t allow)
Set component selection to be allowed/forbidden.
Double_t evaluate() const
Perform the integration and return the result.
virtual Double_t integrate() const
Perform hybrid numerical/analytical integration over all real-valued dependents.
void autoSelectDirtyMode()
Set appropriate cache operation mode for integral depending on cache operation mode of server objects...
const char * intRange()
RooArgSet _facListOwned
Bool_t isValid() const
Check if current value is valid.
RooRealVar represents a variable that can be changed from the outside.
Definition RooRealVar.h:39
RooSetProxy is the concrete proxy for RooArgSet objects.
Definition RooSetProxy.h:23
const T & arg() const
Return reference to object held in proxy.
1-D histogram with a float per channel (see TH1 documentation)}
Definition TH1.h:575
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
virtual const char * GetName() const
Returns name of object.
Definition TNamed.h:47
Mother of all ROOT objects.
Definition TObject.h:37
Basic string class.
Definition TString.h:136