#ifndef ROOFFTCONVPDF
#define ROOFFTCONVPDF
#include "RooAbsCachedPdf.h"
#include "RooRealProxy.h"
#include "RooSetProxy.h"
#include "RooAbsReal.h"
#include "RooHistPdf.h"
#include "TVirtualFFT.h"
class RooRealVar ;
#include <map>
class RooFFTConvPdf : public RooAbsCachedPdf {
public:
RooFFTConvPdf() {
} ;
RooFFTConvPdf(const char *name, const char *title, RooRealVar& convVar, RooAbsPdf& pdf1, RooAbsPdf& pdf2, Int_t ipOrder=2);
RooFFTConvPdf(const char *name, const char *title, RooAbsReal& pdfConvVar, RooRealVar& convVar, RooAbsPdf& pdf1, RooAbsPdf& pdf2, Int_t ipOrder=2);
RooFFTConvPdf(const RooFFTConvPdf& other, const char* name=0) ;
virtual TObject* clone(const char* newname) const { return new RooFFTConvPdf(*this,newname); }
virtual ~RooFFTConvPdf() ;
void setShift(Double_t val1, Double_t val2) { _shift1 = val1 ; _shift2 = val2 ; }
void setCacheObservables(const RooArgSet& obs) { _cacheObs.removeAll() ; _cacheObs.add(obs) ; }
const RooArgSet& cacheObservables() const { return _cacheObs ; }
Double_t bufferFraction() const {
return _bufFrac ;
}
enum BufStrat { Extend=0, Mirror=1, Flat=2 } ;
BufStrat bufferStrategy() const {
return _bufStrat ;
}
void setBufferStrategy(BufStrat bs) ;
void setBufferFraction(Double_t frac) ;
void printMetaArgs(ostream& os) const ;
virtual Int_t getMaxVal(const RooArgSet& vars) const { return _pdf1.arg().getMaxVal(vars) ; }
virtual Double_t maxVal(Int_t code) const { return _pdf1.arg().maxVal(code) ; }
protected:
RooRealProxy _x ;
RooRealProxy _xprime ;
RooRealProxy _pdf1 ;
RooRealProxy _pdf2 ;
RooSetProxy _params ;
void calcParams() ;
Bool_t redirectServersHook(const RooAbsCollection& newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive) ;
Double_t* scanPdf(RooRealVar& obs, RooAbsPdf& pdf, const RooDataHist& hist, const RooArgSet& slicePos, Int_t& N, Int_t& N2, Int_t& zeroBin, Double_t shift) const ;
class FFTCacheElem : public PdfCacheElem {
public:
FFTCacheElem(const RooFFTConvPdf& self, const RooArgSet* nset) ;
~FFTCacheElem() ;
virtual RooArgList containedArgs(Action) ;
TVirtualFFT* fftr2c1 ;
TVirtualFFT* fftr2c2 ;
TVirtualFFT* fftc2r ;
RooAbsPdf* pdf1Clone ;
RooAbsPdf* pdf2Clone ;
RooAbsBinning* histBinning ;
RooAbsBinning* scanBinning ;
};
friend class FFTCacheElem ;
virtual Double_t evaluate() const { RooArgSet dummy(_x.arg()) ; return getVal(&dummy) ; } ;
virtual const char* inputBaseName() const ;
virtual RooArgSet* actualObservables(const RooArgSet& nset) const ;
virtual RooArgSet* actualParameters(const RooArgSet& nset) const ;
virtual RooAbsArg& pdfObservable(RooAbsArg& histObservable) const ;
virtual void fillCacheObject(PdfCacheElem& cache) const ;
void fillCacheSlice(FFTCacheElem& cache, const RooArgSet& slicePosition) const ;
virtual PdfCacheElem* createCache(const RooArgSet* nset) const ;
virtual TString histNameSuffix() const ;
Double_t _bufFrac ;
BufStrat _bufStrat ;
Double_t _shift1 ;
Double_t _shift2 ;
virtual RooAbsGenContext* genContext(const RooArgSet &vars, const RooDataSet *prototype=0,
const RooArgSet* auxProto=0, Bool_t verbose= kFALSE) const ;
friend class RooConvGenContext ;
RooSetProxy _cacheObs ;
private:
ClassDef(RooFFTConvPdf,1)
};
#endif