# class RooNumConvolution: public RooAbsReal

```

```
Numeric 1-dimensional convolution operator PDF. This class can convolve any PDF with any other PDF

This class should not be used blindly as numeric convolution is computing intensive and prone to stability fitting problems. If an analytic convolution can be calculated, you should use that or implement it if not available. RooNumConvolution implements reasonable defaults that should convolve most functions reasonably well, but results strongly depend on the shape of your input PDFS so always check your result. The default integration engine for the numeric convolution is the adaptive Gauss-Kronrod method, which empirically seems the most robust for this task. You can override the convolution integration settings via the RooNumIntConfig object reference returned by the convIntConfig() member function

By default the numeric convolution is integrated from -infinity to +infinity through a

`x -> 1/x`
coordinate transformation of the tails. For convolution with a very small bandwidth it may be advantageous (for both CPU consumption and stability) if the integration domain is limited to a finite range. The function setConvolutionWindow(mean,width,scale) allows to set a sliding window around the x value to be calculated taking a RooAbsReal expression for an offset and a width to be taken around the x value. These input expression can be RooFormulaVars or other function objects although the 3d 'scale' argument 'scale' multiplies the width RooAbsReal expression given in the 2nd argument, allowing for an appropriate window definition for most cases without need for a RooFormulaVar object: e.g. a Gaussian resolution PDF do setConvolutionWindow(gaussMean,gaussSigma,5) Note that for a 'wide' Gaussian the -inf to +inf integration may converge more quickly than that over a finite range!

The default numeric precision is 1e-7, i.e. the global default for numeric integration but you should experiment with this value to see if it is sufficient for example by studying the number of function calls that MINUIT needs to fit your function as function of the convolution precision.

```
```

## Function Members (Methods)

public:
protected:
 void RooAbsArg::attachToStore(RooAbsDataStore& store) virtual void RooAbsReal::attachToTree(TTree& t, Int_t bufSize = 32000) virtual void RooAbsReal::attachToVStore(RooVectorDataStore& vstore) RooFitResult* RooAbsReal::chi2FitDriver(RooAbsReal& fcn, RooLinkedList& cmdList) TString RooAbsArg::cleanBranchName() const RooAbsReal& cloneModel() const RooAbsReal& clonePdf() const RooRealVar& cloneVar() const virtual void RooAbsReal::copyCache(const RooAbsArg* source, Bool_t valueOnly = kFALSE, Bool_t setValDirty = kTRUE) RooAbsReal* RooAbsReal::createIntObj(const RooArgSet& iset, const RooArgSet* nset, const RooNumIntConfig* cfg, const char* rangeName) const virtual void TObject::DoError(int level, const char* location, const char* fmt, va_list va) const virtual void RooAbsReal::fillTreeBranch(TTree& t) void RooAbsReal::findInnerMostIntegration(const RooArgSet& allObs, RooArgSet& innerObs, const char* rangeName) const virtual void RooAbsArg::getObservablesHook(const RooArgSet*, RooArgSet*) const virtual void RooAbsArg::getParametersHook(const RooArgSet*, RooArgSet*, Bool_t) const RooAbsProxy* RooAbsArg::getProxy(Int_t index) const static void RooAbsReal::globalSelectComp(Bool_t flag) void RooAbsArg::graphVizAddConnections(set >&) Bool_t RooAbsArg::inhibitDirty() const void initialize() const TString RooAbsReal::integralNameSuffix(const RooArgSet& iset, const RooArgSet* nset = 0, const char* rangeName = 0, Bool_t omitEmpty = kFALSE) const Bool_t RooAbsReal::isSelectedComp() const virtual Bool_t RooAbsReal::isValid() const virtual Bool_t RooAbsReal::isValidReal(Double_t value, Bool_t printError = kFALSE) const void RooAbsReal::makeProjectionSet(const RooAbsArg* plotVar, const RooArgSet* allVars, RooArgSet& projectedVars, Bool_t silent) const void TObject::MakeZombie() Bool_t RooAbsReal::matchArgs(const RooArgSet& allDeps, RooArgSet& numDeps, const RooArgProxy& a) const Bool_t RooAbsReal::matchArgs(const RooArgSet& allDeps, RooArgSet& numDeps, const RooArgSet& set) const Bool_t RooAbsReal::matchArgs(const RooArgSet& allDeps, RooArgSet& numDeps, const RooArgProxy& a, const RooArgProxy& b) const Bool_t RooAbsReal::matchArgs(const RooArgSet& allDeps, RooArgSet& numDeps, const RooArgProxy& a, const RooArgProxy& b, const RooArgProxy& c) const Bool_t RooAbsReal::matchArgs(const RooArgSet& allDeps, RooArgSet& numDeps, const RooArgProxy& a, const RooArgProxy& b, const RooArgProxy& c, const RooArgProxy& d) const Int_t RooAbsArg::numProxies() const virtual void RooAbsArg::operModeHook() virtual void RooAbsArg::optimizeDirtyHook(const RooArgSet*) virtual RooPlot* RooAbsReal::plotAsymOn(RooPlot* frame, const RooAbsCategoryLValue& asymCat, RooAbsReal::PlotOpt o) const virtual RooPlot* RooAbsReal::plotOn(RooPlot* frame, RooAbsReal::PlotOpt o) const void RooAbsReal::plotOnCompSelect(RooArgSet* selNodes) const RooPlot* RooAbsReal::plotOnWithErrorBand(RooPlot* frame, const RooFitResult& fr, Double_t Z, const RooArgSet* params, const RooLinkedList& argList, Bool_t method1) const Bool_t RooAbsReal::plotSanityChecks(RooPlot* frame) const void RooAbsArg::printAttribList(ostream& os) const virtual void printCompactTreeHook(ostream& os, const char* indent = "") virtual Bool_t redirectServersHook(const RooAbsCollection& newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive) void RooAbsArg::registerProxy(RooArgProxy& proxy) void RooAbsArg::registerProxy(RooSetProxy& proxy) void RooAbsArg::registerProxy(RooListProxy& proxy) void RooAbsReal::selectComp(Bool_t flag) virtual void RooAbsReal::selectNormalization(const RooArgSet* depSet = 0, Bool_t force = kFALSE) virtual void RooAbsReal::selectNormalizationRange(const char* rangeName = 0, Bool_t force = kFALSE) void RooAbsArg::setProxyNormSet(const RooArgSet* nset) void RooAbsArg::setShapeDirty(const RooAbsArg* source) const virtual void RooAbsReal::setTreeBranchStatus(TTree& t, Bool_t active) void RooAbsArg::setValueDirty(const RooAbsArg* source) const virtual void RooAbsReal::syncCache(const RooArgSet* set = 0) Double_t RooAbsReal::traceEval(const RooArgSet* set) const virtual Bool_t RooAbsReal::traceEvalHook(Double_t) const void RooAbsArg::unRegisterProxy(RooArgProxy& proxy) void RooAbsArg::unRegisterProxy(RooSetProxy& proxy) void RooAbsArg::unRegisterProxy(RooListProxy& proxy)

## Data Members

public:
 static RooAbsArg::OperMode RooAbsArg::AClean static RooAbsArg::OperMode RooAbsArg::ADirty static RooAbsArg::ConstOpCode RooAbsArg::Activate static RooAbsArg::CacheMode RooAbsArg::Always static RooAbsArg::OperMode RooAbsArg::Auto static RooAbsReal::ErrorLoggingMode RooAbsReal::CollectErrors static RooAbsArg::ConstOpCode RooAbsArg::ConfigChange static RooAbsReal::ErrorLoggingMode RooAbsReal::CountErrors static RooAbsArg::ConstOpCode RooAbsArg::DeActivate static RooAbsReal::ErrorLoggingMode RooAbsReal::Ignore static RooAbsArg::CacheMode RooAbsArg::Never static RooAbsArg::CacheMode RooAbsArg::NotAdvised static RooAbsReal::ScaleType RooAbsReal::NumEvent static RooAbsReal::ErrorLoggingMode RooAbsReal::PrintErrors static RooAbsReal::ScaleType RooAbsReal::Raw static RooAbsReal::ScaleType RooAbsReal::Relative static RooAbsReal::ScaleType RooAbsReal::RelativeExpected static RooAbsArg::ConstOpCode RooAbsArg::ValueChange static map RooAbsArg::_ioEvoList temporary holding list for proxies needed in schema evolution static stack RooAbsArg::_ioReadStack reading stack static const UInt_t RooAbsArg::fnv1a32start static const ULong64_t RooAbsArg::fnv1a64start static RooPrintable::ContentsOption RooPrintable::kAddress static RooPrintable::ContentsOption RooPrintable::kArgs static TObject::(anonymous) TObject::kBitMask static TObject::EStatusBits TObject::kCanDelete static TObject::EStatusBits TObject::kCannotPick static RooPrintable::ContentsOption RooPrintable::kClassName static RooPrintable::ContentsOption RooPrintable::kCollectionHeader static RooPrintable::ContentsOption RooPrintable::kExtras static TObject::EStatusBits TObject::kHasUUID static RooPrintable::StyleOption RooPrintable::kInline static TObject::EStatusBits TObject::kInvalidObject static TObject::(anonymous) TObject::kIsOnHeap static TObject::EStatusBits TObject::kIsReferenced static TObject::EStatusBits TObject::kMustCleanup static RooPrintable::ContentsOption RooPrintable::kName static TObject::EStatusBits TObject::kNoContextMenu static TObject::(anonymous) TObject::kNotDeleted static TObject::EStatusBits TObject::kObjInCanvas static TObject::(anonymous) TObject::kOverwrite static TObject::(anonymous) TObject::kSingleKey static RooPrintable::StyleOption RooPrintable::kSingleLine static RooPrintable::StyleOption RooPrintable::kStandard static RooPrintable::ContentsOption RooPrintable::kTitle static RooPrintable::StyleOption RooPrintable::kTreeStructure static RooPrintable::ContentsOption RooPrintable::kValue static RooPrintable::StyleOption RooPrintable::kVerbose static TObject::(anonymous) TObject::kWriteDelete static TObject::(anonymous) TObject::kZombie
protected:
 set RooAbsArg::_boolAttrib Boolean attributes set RooAbsArg::_boolAttribTransient ! Transient boolean attributes (not copied in ctor) Bool_t RooAbsReal::_boolValue ! Transient cache for bool values from tree branches UChar_t RooAbsReal::_byteValue ! Transient cache for byte values from tree branches static Bool_t RooAbsReal::_cacheCheck If true, always validate contents of clean which outcome of evaluate() deque RooAbsArg::_cacheList list of caches TH2* _callHist ! Histogram recording number of calls per convolution integral calculation RooRefCountList RooAbsArg::_clientList list of client objects RooRefCountList RooAbsArg::_clientListShape subset of clients that requested shape dirty flag propagation RooRefCountList RooAbsArg::_clientListValue subset of clients that requested value dirty flag propagation TIterator* RooAbsArg::_clientShapeIter ! Iterator over _clientListShape TIterator* RooAbsArg::_clientValueIter ! Iterator over _clientListValue RooAbsReal* _cloneModel Pointer to cloned model RooAbsReal* _clonePdf Pointer to cloned PDF RooAbsReal* _cloneVar Pointer to cloned convolution variable RooNumIntConfig _convIntConfig Configuration of numeric convolution integral ; Bool_t RooAbsArg::_deleteWatch ! Delete watch flag Bool_t _doProf Switch to activate profiling option RooExpensiveObjectCache* RooAbsArg::_eocache Pointer to global cache manager for any expensive components created by this object Bool_t RooAbsArg::_fast Allow fast access mode in getVal() and proxies Float_t RooAbsReal::_floatValue ! Transient cache for floating point values from tree branches Bool_t RooAbsReal::_forceNumInt Force numerical integration if flag set static Bool_t RooAbsReal::_globalSelectComp Global activation switch for component selection static Bool_t RooAbsReal::_hideOffset Offset hiding flag static Bool_t RooAbsArg::_inhibitDirty Static flag controlling global inhibit of dirty state propagation Bool_t _init Int_t RooAbsReal::_intValue ! Transient cache for integer values from tree branches RooConvIntegrandBinding* _integrand ! Binding of Convolution Integrand function RooAbsIntegrator* _integrator ! Numeric integrator of convolution integrand Bool_t RooAbsArg::_isConstant ! Cached isConstant status TString RooAbsReal::_label Plot label for objects value RooArgSet* RooAbsReal::_lastNSet ! Bool_t RooAbsArg::_localNoInhibitDirty ! Prevent 'AlwaysDirty' mode for this node static Int_t RooPrintable::_nameLength TNamed* RooAbsArg::_namePtr ! Do not persist. Pointer to global instance of string that matches object named RooAbsArg::OperMode RooAbsArg::_operMode Dirty state propagation mode RooRealProxy _origModel Original resolution model RooRealProxy _origPdf Original input PDF RooRealProxy _origVar Original convolution variable RooArgSet _ownedClonedModelSet Owning set of cloned model components RooArgSet _ownedClonedPdfSet Owning set of cloned PDF components RooArgSet* RooAbsArg::_ownedComponents ! Set of owned component Int_t RooAbsReal::_plotBins Number of plot bins Double_t RooAbsReal::_plotMax Maximum of plot range Double_t RooAbsReal::_plotMin Minimum of plot range Bool_t RooAbsArg::_prohibitServerRedirect ! Prohibit server redirects -- Debugging tool RooRefArray RooAbsArg::_proxyList list of proxies Char_t RooAbsReal::_sbyteValue ! Transient cache for signed byte values from tree branches Bool_t RooAbsReal::_selectComp ! Component selection flag for RooAbsPdf::plotCompOn RooRefCountList RooAbsArg::_serverList list of server objects Bool_t RooAbsArg::_shapeDirty Flag set if value needs recalculating because input shapes modified RooNumIntConfig* RooAbsReal::_specIntegratorConfig Numeric integrator configuration specific for this object map RooAbsArg::_stringAttrib String attributes Bool_t RooAbsReal::_treeVar !do not persist UInt_t RooAbsReal::_uintValue ! Transient cache for unsigned integer values from tree branches TString RooAbsReal::_unit Unit for objects value Bool_t _useWindow Switch to activate window convolution Double_t RooAbsReal::_value Cache for current value of object Bool_t RooAbsArg::_valueDirty Flag set if value needs recalculating because input values modified static Bool_t RooAbsArg::_verboseDirty Static flag controlling verbose messaging for dirty state changes Int_t _verboseThresh Call count threshold for verbose printing RooListProxy _windowParam Holder for optional convolution integration window scaling parameter Double_t _windowScale Scale factor for window parameter TString TNamed::fName object identifier TString TNamed::fTitle object title

## Function documentation

RooNumConvolution(const char* name, const char* title, RooRealVar& convVar, RooAbsReal& pdf, RooAbsReal& resmodel, const RooNumConvolution* proto = 0)
``` Constructor of convolution operator PDF

convVar  :  convolution variable (on which both pdf and resmodel should depend)
pdf      :  input 'physics' pdf
resmodel :  input 'resultion' pdf

output is pdf(x) (X) resmodel(x) = Int [ pdf(x') resmodel (x-x') ] dx'

```
RooNumConvolution(const RooNumConvolution& other, const char* name = 0)
``` Copy constructor
```
void initialize() const
``` One-time initialization of object
```

``` Destructor
```
Double_t evaluate() const
``` Calculate convolution integral
```
Bool_t redirectServersHook(const RooAbsCollection& newServerList, Bool_t mustReplaceAll, Bool_t nameChange, Bool_t isRecursive)
``` Intercept server redirects. Throw away cache, as figuring out redirections on the cache is an unsolvable problem.
```
void clearConvolutionWindow()
``` Removes previously defined convolution window, reverting to convolution from -inf to +inf
```
void setConvolutionWindow(RooAbsReal& centerParam, RooAbsReal& widthParam, Double_t widthScaleFactor = 1)
``` Restrict convolution integral to finite range [ x - C - S*W, x - C + S*W ]
where x is current value of convolution variablem, C = centerParam, W=widthParam and S = widthScaleFactor
Inputs centerParam and withParam can be function expressions (RooAbsReal, RooFormulaVar) etc.
```
void setCallWarning(Int_t threshold = 2000)
``` Activate warning messages if number of function calls needed for evaluation of convolution integral
exceeds given threshold
```
void setCallProfiling(Bool_t flag, Int_t nbinX = 40, Int_t nbinCall = 40, Int_t nCallHigh = 1000)
``` Activate call profile if flag is set to true. A 2-D histogram is kept that stores the required number
of function calls versus the value of x, the convolution variable

All clones of RooNumConvolution objects will keep logging to the histogram of the original class
so that performance of temporary object clones, such as used in e.g. fitting, plotting and generating
are all logged in a single place.

Function caller should take ownership of profiling histogram as it is not deleted at the RooNumConvolution dtor

Calling this function with flag set to false will deactivate call profiling and delete the profiling histogram
```
void printCompactTreeHook(ostream& os, const char* indent = "")
``` Hook function to intercept printCompactTree() calls so that it can print out
the content of its private cache in the print sequence
```
TObject* clone(const char* newname) const
`{ return new RooNumConvolution(*this,newname) ; }`

`{ _init = kFALSE ; return _convIntConfig ; }`
const RooNumIntConfig& convIntConfig() const
`{ _init = kFALSE ; return _convIntConfig ; }`
const TH2* profileData() const
`{ return _doProf ? _callHist : 0 ; }`
RooRealVar& var() const
``` Access components
```
`{ return (RooRealVar&) _origVar.arg() ; }`
RooAbsReal& pdf() const
`{ return (RooAbsReal&) _origPdf.arg() ; }`
RooAbsReal& model() const
`{ return (RooAbsReal&) _origModel.arg() ; }`
RooRealVar& cloneVar() const
`{ if (!_init) initialize() ; return (RooRealVar&) *_cloneVar ; }`
RooAbsReal& clonePdf() const
`{ if (!_init) initialize() ; return (RooAbsReal&) *_clonePdf ; }`
RooAbsReal& cloneModel() const
`{ if (!_init) initialize() ; return (RooAbsReal&) *_cloneModel ; }`