#ifndef ROO_ADD_PDF
#define ROO_ADD_PDF
#include "RooAbsPdf.h"
#include "RooListProxy.h"
#include "RooSetProxy.h"
#include "RooAICRegistry.h"
#include "RooNormSetCache.h"
#include "RooNameSet.h"
#include "RooCacheManager.h"
#include "RooObjCacheManager.h"
#include "RooNameReg.h"
class RooAddPdf : public RooAbsPdf {
public:
RooAddPdf() ;
RooAddPdf(const char *name, const char *title=0);
RooAddPdf(const char *name, const char *title,
RooAbsPdf& pdf1, RooAbsPdf& pdf2, RooAbsReal& coef1) ;
RooAddPdf(const char *name, const char *title, const RooArgList& pdfList) ;
RooAddPdf(const char *name, const char *title, const RooArgList& pdfList, const RooArgList& coefList, Bool_t recursiveFraction=kFALSE) ;
RooAddPdf(const RooAddPdf& other, const char* name=0) ;
virtual TObject* clone(const char* newname) const { return new RooAddPdf(*this,newname) ; }
virtual ~RooAddPdf() ;
Double_t evaluate() const ;
virtual Bool_t checkObservables(const RooArgSet* nset) const ;
virtual Bool_t forceAnalyticalInt(const RooAbsArg& ) const {
return kTRUE ;
}
Int_t getAnalyticalIntegralWN(RooArgSet& allVars, RooArgSet& numVars, const RooArgSet* normSet, const char* rangeName=0) const ;
Double_t analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName=0) const ;
virtual Bool_t selfNormalized() const {
return kTRUE ;
}
virtual ExtendMode extendMode() const {
return (_haveLastCoef || _allExtendable) ? MustBeExtended : CanNotBeExtended;
}
virtual Double_t expectedEvents(const RooArgSet* nset) const ;
virtual Double_t expectedEvents(const RooArgSet& nset) const {
return expectedEvents(&nset) ;
}
const RooArgList& pdfList() const {
return _pdfList ;
}
const RooArgList& coefList() const {
return _coefList ;
}
void fixCoefNormalization(const RooArgSet& refCoefNorm) ;
void fixCoefRange(const char* rangeName) ;
const RooArgSet& getCoefNormalization() const { return _refCoefNorm ; }
const char* getCoefRange() const { return _refCoefRangeName?RooNameReg::str(_refCoefRangeName):"" ; }
virtual void resetErrorCounters(Int_t resetValue=10) ;
virtual std::list<Double_t>* plotSamplingHint(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const ;
void printMetaArgs(ostream& os) const ;
protected:
virtual void selectNormalization(const RooArgSet* depSet=0, Bool_t force=kFALSE) ;
virtual void selectNormalizationRange(const char* rangeName=0, Bool_t force=kFALSE) ;
mutable RooSetProxy _refCoefNorm ;
mutable TNamed* _refCoefRangeName ;
Bool_t _projectCoefs ;
mutable Double_t* _coefCache ;
class CacheElem : public RooAbsCacheElement {
public:
virtual ~CacheElem() {} ;
RooArgList _suppNormList ;
RooArgList _projList ;
RooArgList _suppProjList ;
RooArgList _refRangeProjList ;
RooArgList _rangeProjList ;
virtual RooArgList containedArgs(Action) ;
} ;
mutable RooObjCacheManager _projCacheMgr ;
CacheElem* getProjCache(const RooArgSet* nset, const RooArgSet* iset=0, const char* rangeName=0) const ;
void updateCoefficients(CacheElem& cache, const RooArgSet* nset) const ;
friend class RooAddGenContext ;
virtual RooAbsGenContext* genContext(const RooArgSet &vars, const RooDataSet *prototype=0,
const RooArgSet* auxProto=0, Bool_t verbose= kFALSE) const ;
mutable RooAICRegistry _codeReg ;
RooListProxy _pdfList ;
RooListProxy _coefList ;
mutable RooArgList* _snormList ;
TIterator* _pdfIter ;
TIterator* _coefIter ;
Bool_t _haveLastCoef ;
Bool_t _allExtendable ;
mutable Int_t _coefErrCount ;
private:
ClassDef(RooAddPdf,2)
};
#endif