Logo ROOT   6.08/07
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 
26 class RooArgSet ;
27 class TH1F ;
28 class RooAbsCategory ;
29 class RooRealVar ;
30 class RooAbsIntegrator ;
31 class RooNumIntConfig ;
32 
33 class RooRealIntegral : public RooAbsReal {
34 public:
35 
36  // Constructors, assignment etc
37  RooRealIntegral() ;
38  RooRealIntegral(const char *name, const char *title, const RooAbsReal& function, const RooArgSet& depList,
39  const RooArgSet* funcNormSet=0, const RooNumIntConfig* config=0, const char* rangeName=0) ;
40  RooRealIntegral(const RooRealIntegral& other, const char* name=0);
41  virtual TObject* clone(const char* newname) const { return new RooRealIntegral(*this,newname); }
42  virtual ~RooRealIntegral();
43 
44  virtual Double_t getValV(const RooArgSet* set=0) const ;
45 
46  Bool_t isValid() const { return _valid; }
47 
48  void printMultiline(std::ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const ;
49  void printMetaArgs(std::ostream& os) const ;
50 
51  const RooArgSet& numIntCatVars() const { return _sumList ; }
52  const RooArgSet& numIntRealVars() const { return _intList ; }
53  const RooArgSet& anaIntVars() const { return _anaList ; }
54 
55  RooArgSet intVars() const { RooArgSet tmp(_sumList) ; tmp.add(_intList) ; tmp.add(_anaList) ; tmp.add(_facList) ; return tmp ; }
56  const char* intRange() { return _rangeName ? _rangeName->GetName() : 0 ; }
57  const RooAbsReal& integrand() const { return _function.arg() ; }
58 
59  void setCacheNumeric(Bool_t flag) {
60  // If true, value of this interal is cached if it is (partially numeric)
61  _cacheNum = flag ;
62  }
63 
65  // If true, value of this interal is cached if it is (partially numeric)
66  return _cacheNum ;
67  }
68 
69  static void setCacheAllNumeric(Int_t ndim) ;
70 
71  static Int_t getCacheAllNumeric() ;
72 
73  virtual std::list<Double_t>* plotSamplingHint(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const {
74  // Forward plot sampling hint of integrand
75  return _function.arg().plotSamplingHint(obs,xlo,xhi) ;
76  }
77 
78  virtual RooAbsReal* createIntegral(const RooArgSet& iset, const RooArgSet* nset=0, const RooNumIntConfig* cfg=0, const char* rangeName=0) const ;
79 
80 protected:
81 
82  mutable Bool_t _valid;
83 
84  const RooArgSet& parameters() const ;
85 
87  //friend class RooAbsPdf ;
88 
89  Bool_t initNumIntegrator() const;
90  void autoSelectDirtyMode() ;
91 
92  virtual Double_t sum() const ;
93  virtual Double_t integrate() const ;
94  virtual Double_t jacobianProduct() const ;
95 
96  // Evaluation and validation implementation
97  Double_t evaluate() const ;
98  virtual Bool_t isValidReal(Double_t value, Bool_t printError=kFALSE) const ;
99  Bool_t servesExclusively(const RooAbsArg* server,const RooArgSet& exclLVBranches, const RooArgSet& allBranches) const ;
100 
101 
102  virtual Bool_t redirectServersHook(const RooAbsCollection& newServerList,
103  Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive) ;
104 
105  // Function pointer and integrands list
106  mutable RooSetProxy _sumList ; // Set of discrete observable over which is summed numerically
107  mutable RooSetProxy _intList ; // Set of continuous observables over which is integrated numerically
108  mutable RooSetProxy _anaList ; // Set of observables over which is integrated/summed analytically
109  mutable RooSetProxy _jacList ; // Set of lvalue observables over which is analytically integration that have a non-unit Jacobian
110  mutable RooSetProxy _facList ; // Set of observables on which function does not depends, which are integrated nevertheless
111 
112  mutable RooArgSet _facListOwned ; // Owned components in _facList
113  TIterator* _facListIter ; //! Iterator over factorizing observables
114  TIterator* _jacListIter ; //! Iterator over lvalue observables with Jacobian
115  RooRealProxy _function ; // Function being integration
116  RooArgSet* _funcNormSet ; // Optional normalization set passed to function
117 
118  mutable RooArgSet _saveInt ; //! do not persist
119  mutable RooArgSet _saveSum ; //! do not persist
120 
122 
123  mutable RooListProxy _sumCat ; //! do not persist
125 
127  IntOperMode _intOperMode ; // integration operation mode
128 
129  mutable Bool_t _restartNumIntEngine ; //! do not persist
130  mutable RooAbsIntegrator* _numIntEngine ; //! do not persist
131  mutable RooAbsFunc *_numIntegrand; //! do not persist
132 
134 
135  mutable RooArgSet* _params ; //! cache for set of parameters
136 
137  Bool_t _cacheNum ; // Cache integral if numeric
138  static Int_t _cacheAllNDim ; //! Cache all integrals with given numeric dimension
139 
140 
141  virtual void operModeHook() ; // cache operation mode
142 
143  ClassDef(RooRealIntegral,2) // Real-valued function representing an integral over a RooAbsReal object
144 };
145 
146 #endif
RooSetProxy _anaList
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
RooSetProxy _sumList
Bool_t initNumIntegrator() const
(Re)Initialize numerical integration engine if necessary.
RooAbsIntegrator is the abstract interface for integrators of real-valued functions that implement th...
const RooAbsReal & integrand() const
RooArgSet intVars() const
RooListProxy _sumCat
virtual ~RooRealIntegral()
RooNumIntConfig holds the configuration parameters of the various numeric integrators used by RooReal...
RooRealProxy _function
Iterator over lvalue observables with Jacobian.
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
Definition: RooArgSet.h:86
TIterator * _facListIter
virtual Bool_t isValidReal(Double_t value, Bool_t printError=kFALSE) const
Check if current value is valid.
Bool_t _restartNumIntEngine
Bool_t getCacheNumeric()
virtual Double_t jacobianProduct() const
Return product of jacobian terms originating from analytical integration.
Basic string class.
Definition: TString.h:137
tomato 1-D histogram with a float per channel (see TH1 documentation)}
Definition: TH1.h:575
int Int_t
Definition: RtypesCore.h:41
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.
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
Double_t evaluate() const
Perform the integration and return the result.
TIterator * _jacListIter
Iterator over factorizing observables.
const RooArgSet & parameters() const
RooArgSet * _params
const RooArgSet & numIntCatVars() const
Iterator abstract base class.
Definition: TIterator.h:32
RooSetProxy _intList
RooRealIntegral performs hybrid numerical/analytical integrals of RooAbsReal objects The class perfor...
#define ClassDef(name, id)
Definition: Rtypes.h:254
RooAbsIntegrator * _numIntEngine
do not persist
RooNumIntConfig * _iconfig
do not persist
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
RooSetProxy _jacList
Bool_t isValid() const
Check if current value is valid.
virtual Double_t sum() const
Perform summation of list of category dependents to be integrated.
static Int_t getCacheAllNumeric()
Return minimum dimensions of numeric integration for which values are cached.
RooRealVar represents a fundamental (non-derived) real valued object.
Definition: RooRealVar.h:37
const RooArgSet & numIntRealVars() const
RooArgSet _saveSum
do not persist
RooSetProxy _facList
RooArgSet _facListOwned
virtual void operModeHook()
Cache all integrals with given numeric dimension.
bool verbose
TIterator * _sumCatIter
do not persist
static void indent(ostringstream &buf, int indent_level)
IntOperMode _intOperMode
RooListProxy is the concrete proxy for RooArgList objects.
Definition: RooListProxy.h:26
static Int_t _cacheAllNDim
void autoSelectDirtyMode()
Set appropriate cache operation mode for integral depending on cache operation mode of server objects...
const RooArgSet & anaIntVars() const
Bool_t servesExclusively(const RooAbsArg *server, const RooArgSet &exclLVBranches, const RooArgSet &allBranches) const
Utility function that returns true if &#39;object server&#39; is a server to exactly one of the RooAbsArgs in...
double Double_t
Definition: RtypesCore.h:55
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
virtual Double_t integrate() const
Perform hybrid numerical/analytical integration over all real-valued dependents.
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &, Double_t, Double_t) const
Definition: RooAbsReal.h:279
Bool_t _cacheNum
cache for set of parameters
Mother of all ROOT objects.
Definition: TObject.h:37
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects...
static void setCacheAllNumeric(Int_t ndim)
Global switch to cache all integral values that integrate at least ndim dimensions numerically...
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
virtual Bool_t redirectServersHook(const RooAbsCollection &newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive)
Intercept server redirects and reconfigure internal object accordingly.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
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 ...
RooAbsCategory is the common abstract base class for objects that represent a discrete value with a f...
RooArgSet * _funcNormSet
RooSetProxy is the concrete proxy for RooArgSet objects.
Definition: RooSetProxy.h:25
RooAbsFunc * _numIntegrand
do not persist
RooRealProxy is the concrete proxy for RooAbsReal objects A RooRealProxy is the general mechanism to ...
Definition: RooRealProxy.h:23
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66
const RooAbsReal & arg() const
Definition: RooRealProxy.h:43
void printMetaArgs(std::ostream &os) const
Customized printing of arguments of a RooRealIntegral to more intuitively reflect the contents of the...
TNamed * _rangeName
do not persist
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Definition: RooAbsFunc.h:23
virtual Double_t getValV(const RooArgSet *set=0) const
Return value of object.
char name[80]
Definition: TGX11.cxx:109
void setCacheNumeric(Bool_t flag)
virtual TObject * clone(const char *newname) const
const char * intRange()