#ifndef ROO_ADD_MODEL
#define ROO_ADD_MODEL
#include "RooResolutionModel.h"
#include "RooListProxy.h"
#include "RooAICRegistry.h"
#include "RooNormSetCache.h"
#include "RooNameSet.h"
#include "RooCacheManager.h"
#include "RooObjCacheManager.h"
class RooAddModel : public RooResolutionModel {
public:
RooAddModel() ;
RooAddModel(const char *name, const char *title, const RooArgList& pdfList, const RooArgList& coefList, Bool_t ownPdfList=kFALSE) ;
RooAddModel(const RooAddModel& other, const char* name=0) ;
virtual TObject* clone(const char* newname) const { return new RooAddModel(*this,newname) ; }
virtual RooResolutionModel* convolution(RooFormulaVar* basis, RooAbsArg* owner) const ;
virtual ~RooAddModel() ;
Double_t evaluate() const ;
virtual Bool_t checkObservables(const RooArgSet* nset) const ;
virtual Int_t basisCode(const char* name) 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 _basisCode==0 ? kTRUE : kFALSE ;
}
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 ;
}
Bool_t isDirectGenSafe(const RooAbsArg& arg) const ;
Int_t getGenerator(const RooArgSet& directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const;
void generateEvent(Int_t code);
void fixCoefNormalization(const RooArgSet& refCoefNorm) ;
void fixCoefRange(const char* rangeName) ;
virtual void resetErrorCounters(Int_t resetValue=10) ;
void printMetaArgs(ostream& os) const ;
protected:
friend class RooAddGenContext ;
virtual RooAbsGenContext* genContext(const RooArgSet &vars, const RooDataSet *prototype=0,
const RooArgSet* auxProto=0, Bool_t verbose= kFALSE) const ;
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 ;
typedef RooArgList* pRooArgList ;
void getCompIntList(const RooArgSet* nset, const RooArgSet* iset, pRooArgList& compIntList, Int_t& code, const char* isetRangeName) const ;
class IntCacheElem : public RooAbsCacheElement {
public:
virtual ~IntCacheElem() {} ;
RooArgList _intList ;
virtual RooArgList containedArgs(Action) ;
} ;
mutable RooObjCacheManager _intCacheMgr ;
mutable RooAICRegistry _codeReg ;
RooListProxy _pdfList ;
RooListProxy _coefList ;
mutable RooArgList* _snormList ;
TIterator* _pdfIter ;
TIterator* _coefIter ;
Bool_t _haveLastCoef ;
Bool_t _allExtendable ;
mutable Int_t _coefErrCount ;
mutable RooArgSet _ownedComps ;
private:
ClassDef(RooAddModel,1)
};
#endif