42 static const double erflim = 5.0;
57 m(
"m",
"Dependent", this, _m),
58 m0(
"m0",
"M0", this, _m0),
59 sigma(
"sigma",
"Sigma", this, _sigma),
60 alpha(
"alpha",
"Alpha", this, _alpha),
61 n(
"n",
"Order", this, _n)
68 RooAbsPdf(other,
name),
m(
"m", this, other.
m), m0(
"m0", this, other.m0),
69 sigma(
"sigma", this, other.
sigma), alpha(
"alpha", this, other.alpha),
78 if (
alpha < 0) t = -t;
96 return RooBatchCompute::dispatch->
computeCBShape(
this, evalData,
m->
getValues(evalData, normSet),
m0->
getValues(evalData, normSet),
sigma->
getValues(evalData, normSet),
alpha->
getValues(evalData, normSet),
n->
getValues(evalData, normSet));
113 static const double sqrtPiOver2 = 1.2533141373;
114 static const double sqrt2 = 1.4142135624;
120 if( fabs(
n-1.0) < 1.0e-05 )
125 double tmin = (
m.
min(rangeName)-
m0)/sig;
126 double tmax = (
m.
max(rangeName)-
m0)/sig;
136 if( tmin >= -absAlpha ) {
137 result += sig*sqrtPiOver2*(
ApproxErf(tmax/sqrt2)
140 else if( tmax <= -absAlpha ) {
142 double b =
n/absAlpha - absAlpha;
145 result +=
a*sig*(
log(
b-tmin) -
log(
b-tmax) );
154 double b =
n/absAlpha - absAlpha;
158 term1 =
a*sig*(
log(
b-tmin) -
log(
n/absAlpha));
165 double term2 = sig*sqrtPiOver2*(
ApproxErf(tmax/sqrt2)
169 result += term1 + term2;
172 return result != 0. ? result : 1.E-300;
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
virtual RooSpan< const double > getValues(RooBatchCompute::RunContext &evalData, const RooArgSet *normSet=nullptr) const
by this change, please consult the release notes for ROOT 6.24 for guidance on how to make this trans...
Bool_t matchArgs(const RooArgSet &allDeps, RooArgSet &numDeps, const RooArgProxy &a) const
Utility function for use in getAnalyticalIntegral().
RooArgSet is a container object that can hold multiple RooAbsArg objects.
virtual RooSpan< double > computeCBShape(const RooAbsReal *, RunContext &, RooSpan< const double > m, RooSpan< const double > m0, RooSpan< const double > sigma, RooSpan< const double > alpha, RooSpan< const double > n)=0
PDF implementing the Crystal Ball line shape.
virtual Double_t maxVal(Int_t code) const
Return maximum value for set of observables identified by code assigned in getMaxVal.
virtual Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
Double_t ApproxErf(Double_t arg) const
virtual Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
virtual Int_t getMaxVal(const RooArgSet &vars) const
Advertise that we know the maximum of self for given (m0,alpha,n,sigma)
RooSpan< double > evaluateSpan(RooBatchCompute::RunContext &evalData, const RooArgSet *normSet) const
Compute multiple values of Crystal ball Shape distribution.
static std::complex< double > erf(const std::complex< double > z)
complex erf function
A simple container to hold a batch of data values.
double min(const char *rname=0) const
Query lower limit of range. This requires the payload to be RooAbsRealLValue or derived.
double max(const char *rname=0) const
Query upper limit of range. This requires the payload to be RooAbsRealLValue or derived.
R__EXTERN RooBatchComputeInterface * dispatch
This dispatch pointer points to an implementation of the compute library, provided one has been loade...
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
This struct enables passing computation data around between elements of a computation graph.