Logo ROOT  
Reference Guide
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 
27 class RooArgSet ;
28 class TH1F ;
29 class RooAbsCategory ;
30 class RooRealVar ;
31 class RooAbsIntegrator ;
32 class RooNumIntConfig ;
33 
34 class RooRealIntegral : public RooAbsReal {
35 public:
36 
37  // Constructors, assignment etc
38  RooRealIntegral() ;
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 
84 protected:
85 
86  mutable Bool_t _valid;
88 
89  const RooArgSet& parameters() const ;
90 
92  //friend class RooAbsPdf ;
93 
94  Bool_t initNumIntegrator() const;
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
RooRealIntegral::_numIntEngine
RooAbsIntegrator * _numIntEngine
do not persist
Definition: RooRealIntegral.h:132
RooRealIntegral::printMetaArgs
void printMetaArgs(std::ostream &os) const
Customized printing of arguments of a RooRealIntegral to more intuitively reflect the contents of the...
Definition: RooRealIntegral.cxx:1074
RooAbsReal.h
RooAbsReal::plotSamplingHint
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...
Definition: RooAbsReal.cxx:3841
RooRealIntegral::_cacheNum
Bool_t _cacheNum
cache for set of parameters
Definition: RooRealIntegral.h:139
RooRealIntegral::evaluate
Double_t evaluate() const
Perform the integration and return the result.
Definition: RooRealIntegral.cxx:812
RooRealIntegral::parameters
const RooArgSet & parameters() const
Definition: RooRealIntegral.cxx:1017
RooTemplateProxy::arg
const T & arg() const
Return reference to object held in proxy.
Definition: RooTemplateProxy.h:259
RooRealIntegral::plotSamplingHint
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...
Definition: RooRealIntegral.h:74
RooRealIntegral::_anaList
RooSetProxy _anaList
Definition: RooRealIntegral.h:113
RooArgSet.h
RooRealIntegral::isValid
Bool_t isValid() const
Check if current value is valid.
Definition: RooRealIntegral.h:47
RooRealIntegral::numIntRealVars
const RooArgSet & numIntRealVars() const
Definition: RooRealIntegral.h:53
RooRealIntegral::_intList
RooSetProxy _intList
Definition: RooRealIntegral.h:112
RooSetProxy
RooSetProxy is the concrete proxy for RooArgSet objects.
Definition: RooSetProxy.h:23
RooRealIntegral::PassThrough
@ PassThrough
Definition: RooRealIntegral.h:91
RooRealIntegral::_saveSum
RooArgSet _saveSum
do not persist
Definition: RooRealIntegral.h:122
RooRealIntegral::RooRealIntegral
RooRealIntegral()
Definition: RooRealIntegral.cxx:65
RooRealIntegral::setAllowComponentSelection
void setAllowComponentSelection(Bool_t allow)
Set component selection to be allowed/forbidden.
Definition: RooRealIntegral.cxx:1066
RooRealIntegral::_rangeName
TNamed * _rangeName
do not persist
Definition: RooRealIntegral.h:135
RooRealIntegral::getAllowComponentSelection
Bool_t getAllowComponentSelection() const
Check if component selection is allowed.
Definition: RooRealIntegral.cxx:1059
RooRealIntegral::_iconfig
RooNumIntConfig * _iconfig
do not persist
Definition: RooRealIntegral.h:124
RooRealIntegral::_facList
RooSetProxy _facList
Definition: RooRealIntegral.h:115
RooRealIntegral::_facListOwned
RooArgSet _facListOwned
Definition: RooRealIntegral.h:117
indent
static void indent(ostringstream &buf, int indent_level)
Definition: TClingCallFunc.cxx:87
RooAbsReal
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:61
RooRealIntegral::_restartNumIntEngine
Bool_t _restartNumIntEngine
Definition: RooRealIntegral.h:131
RooRealIntegral::getCacheNumeric
Bool_t getCacheNumeric()
Definition: RooRealIntegral.h:65
RooSetProxy.h
RooRealIntegral::_respectCompSelect
Bool_t _respectCompSelect
Definition: RooRealIntegral.h:87
TString
Basic string class.
Definition: TString.h:136
RooRealIntegral::printMultiline
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.
Definition: RooRealIntegral.cxx:1111
RooRealIntegral::_sumList
RooSetProxy _sumList
Definition: RooRealIntegral.h:111
RooRealIntegral::_params
RooArgSet * _params
Definition: RooRealIntegral.h:137
RooRealIntegral::_sumCat
RooListProxy _sumCat
Definition: RooRealIntegral.h:126
bool
RooAbsFunc
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition: RooAbsFunc.h:27
RooRealIntegral
RooRealIntegral performs hybrid numerical/analytical integrals of RooAbsReal objects.
Definition: RooRealIntegral.h:34
RooAbsCategory
RooAbsCategory is the base class for objects that represent a discrete value with a finite number of ...
Definition: RooAbsCategory.h:38
RooRealIntegral::Analytic
@ Analytic
Definition: RooRealIntegral.h:91
RooRealIntegral::redirectServersHook
virtual Bool_t redirectServersHook(const RooAbsCollection &newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive)
Intercept server redirects and reconfigure internal object accordingly.
Definition: RooRealIntegral.cxx:991
RooAbsPdf.h
RooRealIntegral::_jacList
RooSetProxy _jacList
Definition: RooRealIntegral.h:114
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
RooArgSet::add
Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Add element to non-owning set.
Definition: RooArgSet.cxx:261
RooRealIntegral::_mode
Int_t _mode
do not persist
Definition: RooRealIntegral.h:128
RooRealIntegral::sum
virtual Double_t sum() const
Perform summation of list of category dependents to be integrated.
Definition: RooRealIntegral.cxx:949
RooRealProxy.h
RooRealIntegral::anaIntVars
const RooArgSet & anaIntVars() const
Definition: RooRealIntegral.h:54
RooAbsCollection
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
Definition: RooAbsCollection.h:31
RooRealIntegral::servesExclusively
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...
Definition: RooRealIntegral.cxx:591
RooRealIntegral::IntOperMode
IntOperMode
Definition: RooRealIntegral.h:91
RooRealIntegral::Hybrid
@ Hybrid
Definition: RooRealIntegral.h:91
RooListProxy
RooListProxy is the concrete proxy for RooArgList objects.
Definition: RooListProxy.h:24
RooRealIntegral::clone
virtual TObject * clone(const char *newname) const
Definition: RooRealIntegral.h:42
RooRealIntegral::intRange
const char * intRange()
Definition: RooRealIntegral.h:57
RooRealIntegral::_saveInt
RooArgSet _saveInt
Definition: RooRealIntegral.h:121
RooRealIntegral::operModeHook
virtual void operModeHook()
Cache all integrals with given numeric dimension.
Definition: RooRealIntegral.cxx:1036
RooListProxy.h
RooTemplateProxy< RooAbsReal >
RooRealIntegral::_funcNormSet
RooArgSet * _funcNormSet
Definition: RooRealIntegral.h:119
Double_t
double Double_t
Definition: RtypesCore.h:59
RooRealIntegral::~RooRealIntegral
virtual ~RooRealIntegral()
Definition: RooRealIntegral.cxx:727
RooRealIntegral::_intOperMode
IntOperMode _intOperMode
Definition: RooRealIntegral.h:129
RooRealIntegral::getCacheAllNumeric
static Int_t getCacheAllNumeric()
Return minimum dimensions of numeric integration for which values are cached.
Definition: RooRealIntegral.cxx:1148
RooRealIntegral::isValidReal
virtual Bool_t isValidReal(Double_t value, Bool_t printError=kFALSE) const
Check if current value is valid.
Definition: RooRealIntegral.cxx:1051
TH1F
1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:575
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
RooRealIntegral::_cacheAllNDim
static Int_t _cacheAllNDim
Definition: RooRealIntegral.h:140
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
RooRealIntegral::autoSelectDirtyMode
void autoSelectDirtyMode()
Set appropriate cache operation mode for integral depending on cache operation mode of server objects...
Definition: RooRealIntegral.cxx:564
name
char name[80]
Definition: TGX11.cxx:110
RooRealIntegral::getValV
virtual Double_t getValV(const RooArgSet *set=0) const
Return value of object.
Definition: RooRealIntegral.cxx:786
genreflex::verbose
bool verbose
Definition: rootcling_impl.cxx:133
RooRealIntegral::integrate
virtual Double_t integrate() const
Perform hybrid numerical/analytical integration over all real-valued dependents.
Definition: RooRealIntegral.cxx:976
RooRealIntegral::setCacheNumeric
void setCacheNumeric(Bool_t flag)
Definition: RooRealIntegral.h:60
RooAbsArg
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:72
RooNumIntConfig
RooNumIntConfig holds the configuration parameters of the various numeric integrators used by RooReal...
Definition: RooNumIntConfig.h:25
RooAbsIntegrator
RooAbsIntegrator is the abstract interface for integrators of real-valued functions that implement th...
Definition: RooAbsIntegrator.h:22
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
RooRealIntegral::_valid
Bool_t _valid
Definition: RooRealIntegral.h:86
RooRealIntegral::jacobianProduct
virtual Double_t jacobianProduct() const
Return product of jacobian terms originating from analytical integration.
Definition: RooRealIntegral.cxx:927
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:37
RooRealIntegral::initNumIntegrator
Bool_t initNumIntegrator() const
(Re)Initialize numerical integration engine if necessary.
Definition: RooRealIntegral.cxx:632
RooRealIntegral::setCacheAllNumeric
static void setCacheAllNumeric(Int_t ndim)
Global switch to cache all integral values that integrate at least ndim dimensions numerically.
Definition: RooRealIntegral.cxx:1140
RooRealIntegral::integrand
const RooAbsReal & integrand() const
Definition: RooRealIntegral.h:58
RooAbsRealLValue
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
Definition: RooAbsRealLValue.h:31
RooRealIntegral::intVars
RooArgSet intVars() const
Definition: RooRealIntegral.h:56
RooRealIntegral::_function
RooRealProxy _function
Definition: RooRealIntegral.h:118
RooRealIntegral::createIntegral
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 ...
Definition: RooRealIntegral.cxx:744
RooRealIntegral::numIntCatVars
const RooArgSet & numIntCatVars() const
Definition: RooRealIntegral.h:52
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:29
RooRealIntegral::_numIntegrand
RooAbsFunc * _numIntegrand
do not persist
Definition: RooRealIntegral.h:133
int