125 using namespace std ;
138 _x("!
x","Convolution Variable",this,convVar),
139 _xprime("!xprime","External Convolution Variable",this,0),
140 _pdf1("!pdf1","pdf1",this,pdf1,
kFALSE),
141 _pdf2("!pdf2","pdf2",this,pdf2,kFALSE),
142 _params("!params","effective parameters",this),
147 _cacheObs("!cacheObs","Cached observables",this,kFALSE,kFALSE)
149 if (!convVar.hasBinning(
"cache")) {
150 convVar.setBinning(convVar.getBinning(),
"cache") ;
153 _shift2 = (convVar.getMax(
"cache")+convVar.getMin(
"cache"))/2 ;
168 _x(
"!x",
"Convolution Variable",this,convVar,
kFALSE,
kFALSE),
169 _xprime(
"!xprime",
"External Convolution Variable",this,pdfConvVar),
170 _pdf1(
"!pdf1",
"pdf1",this,pdf1,
kFALSE),
171 _pdf2(
"!pdf2",
"pdf2",this,pdf2,
kFALSE),
172 _params(
"!params",
"effective parameters",this),
177 _cacheObs(
"!cacheObs",
"Cached observables",this,
kFALSE,
kFALSE)
195 _x(
"!x",this,other.
_x),
224 static TString
name ;
226 name.Append(
"_CONV_") ;
250 fftr2c1(0),fftr2c2(0),fftc2r(0)
261 string refName =
Form(
"refrange_fft_%s",
self.
GetName()) ;
300 RooArgSet* fftParams =
self.getParameters(*convObs) ;
317 Int_t Nbuf =
static_cast<Int_t>((N*
self.bufferFraction())/2 + 0.5) ;
319 Int_t N2 = N+2*Nbuf ;
326 hist()->setDirtyProp(
kFALSE) ;
442 while(binCur[curObs]==binMax[curObs]) {
487 Int_t N,N2,binShift1,binShift2 ;
515 for (
Int_t i=0 ; i<N2/2+1 ; i++) {
528 Int_t totalShift = binShift1 + (N2-
N)/2 ;
533 for (
Int_t i =0 ; i<
N ; i++) {
536 Int_t j = i + totalShift ;
538 while (j>=N2) j-= N2 ;
582 }
else if (histX->
getMin()>0) {
592 zeroBin += binShift ;
593 while(zeroBin>=N2) zeroBin-= N2 ;
594 while(zeroBin<0) zeroBin+= N2 ;
603 for (k=0 ; k<N2 ; k++) {
615 for (k=0 ; k<Nbuf ; k++) {
618 for (k=0 ; k<
N ; k++) {
624 for (k=0 ; k<Nbuf ; k++) {
625 tmp[N+Nbuf+k] = val ;
633 for (k=0 ; k<
N ; k++) {
637 for (k=1 ; k<=Nbuf ; k++) {
641 tmp[Nbuf+N+k-1] = pdf.
getVal(hist.
get()) ;
647 for (
Int_t i=0 ; i<N2 ; i++) {
649 Int_t j = i - (zeroBin) ;
758 return histObservable ;
785 <<
" has internal generator that is safe to use in current context" << endl ;
789 <<
" has internal generator that is safe to use in current context" << endl ;
792 cxcoutI(
Generation) <<
"RooFFTConvPdf::genContext() generation requested for observables other than the convolution observable " <<
_x.
arg().
GetName() << endl ;
796 if (numAddDep>0 || !pdfCanDir || !resCanDir) {
799 cxcoutI(
Generation) <<
"RooFFTConvPdf::genContext() selecting accept/reject generator context because one or both of the input " 800 <<
"p.d.f.s cannot use internal generator and/or " 801 <<
"observables other than the convolution variable are requested for generation" << endl ;
802 return new RooGenContext(*
this,vars,prototype,auxProto,verbose) ;
806 cxcoutI(
Generation) <<
"RooFFTConvPdf::genContext() selecting specialized convolution generator context as both input " 807 <<
"p.d.fs are safe for internal generator and only " 808 <<
"the convolution observables is requested for generation" << endl ;
821 coutE(
InputArguments) <<
"RooFFTConvPdf::setBufferFraction(" <<
GetName() <<
") fraction should be greater than or equal to zero" << endl ;
virtual Double_t getMin(const char *name=0) const
RooArgSet * getVariables(Bool_t stripDisconnected=kTRUE) const
Return RooArgSet with all variables (tree leaf nodes of expresssion tree)
void calcParams()
(Re)calculate effective parameters of this p.d.f.
friend class RooConvGenContext
virtual const char * GetName() const
Returns name of object.
virtual void setBin(Int_t ibin, const char *rangeName=0)
Set value to center of bin 'ibin' of binning 'rangeName' (or of default binning if no range is specif...
virtual RooAbsArg * cloneTree(const char *newname=0) const
Clone tree expression of objects.
RooAbsBinning * scanBinning
TIterator * createIterator(Bool_t dir=kIterForward) const
Bool_t hasBinning(const char *name) const
Returns true if variable has a binning with 'name'.
virtual void fillCacheObject(PdfCacheElem &cache) const
Fill the contents of the cache the FFT convolution output.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
virtual RooArgSet * actualObservables(const RooArgSet &nset) const
Return the observables to be cached given the normalization set nset.
virtual Double_t getMax(const char *name=0) const
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
virtual const RooArgSet * get() const
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
virtual Int_t numBins(const char *rangeName=0) const
virtual void removeAll()
Remove all argument inset using remove(const RooAbsArg&).
Double_t getVal(const RooArgSet *set=0) const
const RooArgSet * ownedComponents() const
const RooAbsBinning & getBinning(const char *name=0, Bool_t verbose=kTRUE, Bool_t createOnTheFly=kFALSE) const
Return binning definition with name.
void set(Double_t weight, Double_t wgtErr=-1)
Increment the weight of the bin enclosing the coordinates given by 'row' by the specified amount...
void setBufferStrategy(BufStrat bs)
Change strategy to fill the overflow buffer on either side of the convolution observable range...
virtual RooAbsGenContext * genContext(const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, Bool_t verbose=kFALSE) const
Create appropriate generator context for this convolution.
void printMetaArgs(std::ostream &os) const
Customized printing of arguments of a RooNumConvPdf to more intuitively reflect the contents of the p...
virtual RooArgList containedArgs(Action)
Returns all RooAbsArg objects contained in the cache element.
FFTCacheElem(const RooFFTConvPdf &self, const RooArgSet *nset)
Clone input pdf and attach to dataset.
virtual PdfCacheElem * createCache(const RooArgSet *nset) const
Return specialized cache subclass for FFT calculations.
virtual void fixAddCoefRange(const char *rangeName=0, Bool_t force=kTRUE)
Fix the interpretation of the coefficient of any RooAddPdf component in the expression tree headed by...
Bool_t addOwnedComponents(const RooArgSet &comps)
Take ownership of the contents of 'comps'.
virtual RooAbsBinning * clone(const char *name=0) const =0
void attachDataSet(const RooAbsData &set)
Replace server nodes with names matching the dataset variable names with those data set variables...
Iterator abstract base class.
void setBinning(const RooAbsBinning &binning, const char *name=0)
Add given binning under name 'name' with this variable.
RooDataSet is a container class to hold N-dimensional binned data.
virtual TString histNameSuffix() const
Suffix for cache histogram (added in addition to suffix for cache name)
virtual RooArgList containedArgs(Action)
Returns all RooAbsArg objects contained in the cache element.
RooAbsGenContext is the abstract base class for generator contexts of RooAbsPdf objects.
friend class FFTCacheElem
virtual void SetPointComplex(Int_t ipoint, TComplex &c)=0
RooRealVar represents a fundamental (non-derived) real valued object.
virtual void setBin(Int_t ibin, const char *rangeName=0)=0
virtual const char * binningName() const
Double_t bufferFraction() const
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
Scan the values of 'pdf' in observable 'obs' using the bin values stored in 'hist' at slice position ...
void fillCacheSlice(FFTCacheElem &cache, const RooArgSet &slicePosition) const
Fill a slice of cachePdf with the output of the FFT convolution calculation.
virtual Double_t GetPointReal(Int_t ipoint, Bool_t fromInput=kFALSE) const =0
static TVirtualFFT * FFT(Int_t ndim, Int_t *n, Option_t *option)
Returns a pointer to the FFT of requested size and type.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
char * Form(const char *fmt,...)
virtual void Transform()=0
RooAbsArg * absArg() const
virtual RooAbsArg & pdfObservable(RooAbsArg &histObservable) const
Return p.d.f.
RooDataSet is a container class to hold unbinned data.
Class RooGenContext implement a universal generator context for all RooAbsPdf classes that do not hav...
virtual Int_t binNumber(Double_t x) const =0
virtual void SetPoints(const Double_t *data)=0
virtual Bool_t isDirectGenSafe(const RooAbsArg &arg) const
Check if given observable can be safely generated using the pdfs internal generator mechanism (if tha...
void replaceArg(const RooAbsArg &orig, const RooAbsArg &subst)
Replace any occurence of arg 'orig' with arg 'subst'.
virtual void GetPointComplex(Int_t ipoint, Double_t &re, Double_t &im, Bool_t fromInput=kFALSE) const =0
RooAbsCachedPdf is the abstract base class for p.d.f.s that need or want to cache their evaluate() ou...
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
virtual Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const
Load generatedVars with the subset of directVars that we can generate events for, and return a code t...
RooArgSet * getParameters(const RooAbsData *data, Bool_t stripDisconnected=kTRUE) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
static RooMathCoreReg dummy
virtual RooArgSet * actualParameters(const RooArgSet &nset) const
Return the parameters on which the cache depends given normalization set nset.
void setRange(const char *name, Double_t min, Double_t max)
Set range named 'name to [min,max].
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects...
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
RooAbsBinning * histBinning
RooConstVar & RooConst(Double_t val)
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
void setBufferFraction(Double_t frac)
Change the size of the buffer on either side of the observable range to frac times the size of the ra...
RooAbsArg * build(const char *masterCatState, Bool_t verbose=kFALSE)
Build a clone of the prototype executing all registered 'replace' rules and 'split' rules for the mas...
virtual TObject * Next()=0
virtual const char * inputBaseName() const
Return base name component for cache components in this case 'PDF1_CONV_PDF2'.
void setOperMode(OperMode mode, Bool_t recurseADirty=kTRUE)
Change cache operation mode to given mode.
virtual ~RooFFTConvPdf()
Destructor.
Abstract base class for objects that are lvalues, i.e.
RooObjCacheManager _cacheMgr
Bool_t contains(const RooAbsArg &var) const
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
const RooAbsReal & arg() const
Bool_t recursiveRedirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t recurseInNewSet=kTRUE)
Bool_t redirectServersHook(const RooAbsCollection &newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive)
calcParams() ;
virtual Int_t numBins(const char *rangeName=0) const =0
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Overloaded RooArgSet::add() method inserts 'var' into set and registers 'var' as server to owner with...