00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef ROO_REAL_INTEGRAL
00017 #define ROO_REAL_INTEGRAL
00018
00019 #include "RooAbsReal.h"
00020 #include "RooArgSet.h"
00021 #include "RooAbsPdf.h"
00022 #include "RooRealProxy.h"
00023 #include "RooSetProxy.h"
00024 #include "RooListProxy.h"
00025
00026 class RooArgSet ;
00027 class TH1F ;
00028 class RooAbsCategory ;
00029 class RooRealVar ;
00030 class RooAbsIntegrator ;
00031 class RooNumIntConfig ;
00032
00033 class RooRealIntegral : public RooAbsReal {
00034 public:
00035
00036
00037 RooRealIntegral() ;
00038 RooRealIntegral(const char *name, const char *title, const RooAbsReal& function, const RooArgSet& depList,
00039 const RooArgSet* funcNormSet=0, const RooNumIntConfig* config=0, const char* rangeName=0) ;
00040 RooRealIntegral(const RooRealIntegral& other, const char* name=0);
00041 virtual TObject* clone(const char* newname) const { return new RooRealIntegral(*this,newname); }
00042 virtual ~RooRealIntegral();
00043
00044 Bool_t isValid() const { return _valid; }
00045
00046 void printMultiline(ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const ;
00047 void printMetaArgs(ostream& os) const ;
00048
00049 const RooArgSet& numIntCatVars() const { return _sumList ; }
00050 const RooArgSet& numIntRealVars() const { return _intList ; }
00051 const RooArgSet& anaIntVars() const { return _anaList ; }
00052
00053 RooArgSet intVars() const { RooArgSet tmp(_sumList) ; tmp.add(_intList) ; tmp.add(_anaList) ; tmp.add(_facList) ; return tmp ; }
00054 const char* intRange() { return _rangeName ? _rangeName->GetName() : 0 ; }
00055 const RooAbsReal& integrand() const { return _function.arg() ; }
00056
00057 void setCacheNumeric(Bool_t flag) {
00058
00059 _cacheNum = flag ;
00060 }
00061
00062 Bool_t getCacheNumeric() {
00063
00064 return _cacheNum ;
00065 }
00066
00067 static void setCacheAllNumeric(Int_t ndim) {
00068
00069 _cacheAllNDim = ndim ;
00070 }
00071
00072 static Int_t getCacheAllNumeric() {
00073
00074 return _cacheAllNDim ;
00075 }
00076
00077 virtual std::list<Double_t>* plotSamplingHint(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const {
00078
00079 return _function.arg().plotSamplingHint(obs,xlo,xhi) ;
00080 }
00081
00082 virtual RooAbsReal* createIntegral(const RooArgSet& iset, const RooArgSet* nset=0, const RooNumIntConfig* cfg=0, const char* rangeName=0) const ;
00083
00084 protected:
00085
00086 mutable Bool_t _valid;
00087
00088 const RooArgSet& parameters() const ;
00089
00090 enum IntOperMode { Hybrid, Analytic, PassThrough } ;
00091
00092
00093 Bool_t initNumIntegrator() const;
00094 void autoSelectDirtyMode() ;
00095
00096 virtual Double_t sum() const ;
00097 virtual Double_t integrate() const ;
00098 virtual Double_t jacobianProduct() const ;
00099
00100
00101 Double_t evaluate() const ;
00102 virtual Bool_t isValidReal(Double_t value, Bool_t printError=kFALSE) const ;
00103 Bool_t servesExclusively(const RooAbsArg* server,const RooArgSet& exclLVBranches, const RooArgSet& allBranches) const ;
00104
00105
00106 virtual Bool_t redirectServersHook(const RooAbsCollection& newServerList,
00107 Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive) ;
00108
00109
00110 mutable RooSetProxy _sumList ;
00111 mutable RooSetProxy _intList ;
00112 mutable RooSetProxy _anaList ;
00113 mutable RooSetProxy _jacList ;
00114 mutable RooSetProxy _facList ;
00115
00116 mutable RooArgSet _facListOwned ;
00117 TIterator* _facListIter ;
00118 TIterator* _jacListIter ;
00119 RooRealProxy _function ;
00120 RooArgSet* _funcNormSet ;
00121
00122 mutable RooArgSet _saveInt ;
00123 mutable RooArgSet _saveSum ;
00124
00125 RooNumIntConfig* _iconfig ;
00126
00127 mutable RooListProxy _sumCat ;
00128 TIterator* _sumCatIter ;
00129
00130 Int_t _mode ;
00131 IntOperMode _intOperMode ;
00132
00133 mutable Bool_t _restartNumIntEngine ;
00134 mutable RooAbsIntegrator* _numIntEngine ;
00135 mutable RooAbsFunc *_numIntegrand;
00136
00137 TNamed* _rangeName ;
00138
00139 mutable RooArgSet* _params ;
00140
00141 Bool_t _cacheNum ;
00142 static Int_t _cacheAllNDim ;
00143
00144
00145 virtual void operModeHook() ;
00146
00147 ClassDef(RooRealIntegral,2)
00148 };
00149
00150 #endif