#ifndef ROOABSCACHEDPDF
#define ROOABSCACHEDPDF
#include "RooAbsPdf.h"
#include "RooRealProxy.h"
#include "RooAbsReal.h"
#include "RooHistPdf.h"
#include "RooObjCacheManager.h"
#include "RooAICRegistry.h"
#include <map>
class RooArgSet ;
class RooChangeTracker ;
class RooAbsCachedPdf : public RooAbsPdf {
public:
RooAbsCachedPdf() {
} ;
RooAbsCachedPdf(const char *name, const char *title, Int_t ipOrder=0);
RooAbsCachedPdf(const RooAbsCachedPdf& other, const char* name=0) ;
virtual ~RooAbsCachedPdf() ;
virtual Double_t getValV(const RooArgSet* set=0) const ;
virtual Bool_t selfNormalized() const {
return kTRUE ;
}
RooAbsPdf* getCachePdf(const RooArgSet& nset) const {
return getCachePdf(&nset) ;
}
RooDataHist* getCacheHist(const RooArgSet& nset) const {
return getCacheHist(&nset) ;
}
RooAbsPdf* getCachePdf(const RooArgSet* nset=0) const ;
RooDataHist* getCacheHist(const RooArgSet* nset=0) const ;
void setInterpolationOrder(Int_t order) ;
Int_t getInterpolationOrder() const {
return _ipOrder ;
}
virtual Bool_t forceAnalyticalInt(const RooAbsArg& dep) const ;
virtual Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& analVars, const RooArgSet* normSet, const char* rangeName=0) const ;
virtual Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=0) const ;
protected:
class PdfCacheElem : public RooAbsCacheElement {
public:
PdfCacheElem(const RooAbsCachedPdf& self, const RooArgSet* nset) ;
virtual ~PdfCacheElem() ;
virtual RooArgList containedArgs(Action) ;
virtual void printCompactTreeHook(std::ostream&, const char *, Int_t, Int_t) ;
RooHistPdf* pdf() { return _pdf ; }
RooDataHist* hist() { return _hist ; }
const RooArgSet& nset() { return _nset ; }
RooChangeTracker* paramTracker() { return _paramTracker ; }
private:
RooHistPdf* _pdf ;
RooChangeTracker* _paramTracker ;
RooDataHist* _hist ;
RooArgSet _nset ;
RooAbsReal* _norm ;
} ;
PdfCacheElem* getCache(const RooArgSet* nset, Bool_t recalculate=kTRUE) const ;
void clearCacheObject(PdfCacheElem& cache) const ;
virtual const char* payloadUniqueSuffix() const { return 0 ; }
friend class PdfCacheElem ;
virtual const char* binningName() const {
return "cache" ;
}
virtual PdfCacheElem* createCache(const RooArgSet* nset) const {
return new PdfCacheElem(*this,nset) ;
}
virtual const char* inputBaseName() const = 0 ;
virtual RooArgSet* actualObservables(const RooArgSet& nset) const = 0 ;
virtual RooArgSet* actualParameters(const RooArgSet& nset) const = 0 ;
virtual RooAbsArg& pdfObservable(RooAbsArg& histObservable) const { return histObservable ; }
virtual void fillCacheObject(PdfCacheElem& cache) const = 0 ;
mutable RooObjCacheManager _cacheMgr ;
Int_t _ipOrder ;
TString cacheNameSuffix(const RooArgSet& nset) const ;
virtual TString histNameSuffix() const { return TString("") ; }
void disableCache(Bool_t flag) {
_disableCache = flag ;
}
mutable RooAICRegistry _anaReg ;
class AnaIntConfig {
public:
RooArgSet _allVars ;
RooArgSet _anaVars ;
const RooArgSet* _nset ;
Bool_t _unitNorm ;
} ;
mutable std::map<Int_t,AnaIntConfig> _anaIntMap ;
private:
Bool_t _disableCache ;
ClassDef(RooAbsCachedPdf,1)
};
#endif