43 static const double erflim = 5.0;
58 m(
"m",
"Dependent", this, _m),
59 m0(
"m0",
"M0", this, _m0),
60 sigma(
"sigma",
"Sigma", this, _sigma),
61 alpha(
"alpha",
"Alpha", this, _alpha),
62 n(
"n",
"Order", this, _n)
69 RooAbsPdf(other,
name),
m(
"m", this, other.
m), m0(
"m0", this, other.m0),
70 sigma(
"sigma", this, other.
sigma), alpha(
"alpha", this, other.alpha),
79 if (
alpha < 0) t = -t;
99template<
class Tm,
class Tm0,
class Tsigma,
class Talpha,
class Tn>
100void compute(
size_t batchSize,
101 double * __restrict
output,
102 Tm M, Tm0 M0, Tsigma
S, Talpha
A, Tn
N)
104 for (
size_t i=0; i<batchSize; i++) {
105 const double t = (M[i]-M0[i]) /
S[i];
106 if ((
A[i]>0 && t>=-
A[i]) || (
A[i]<0 && -t>=
A[i])) {
116 for (
size_t i=0; i<batchSize; i++) {
132 if (info.
nBatches==1 && !mData.empty()) {
133 compute(info.
size,
output.data(), mData.data(),
164 static const double sqrtPiOver2 = 1.2533141373;
165 static const double sqrt2 = 1.4142135624;
171 if(
fabs(
n-1.0) < 1.0e-05 )
176 double tmin = (
m.
min(rangeName)-
m0)/sig;
177 double tmax = (
m.
max(rangeName)-
m0)/sig;
187 if( tmin >= -absAlpha ) {
188 result += sig*sqrtPiOver2*(
ApproxErf(tmax/sqrt2)
191 else if( tmax <= -absAlpha ) {
193 double b =
n/absAlpha - absAlpha;
196 result +=
a*sig*(
log(
b-tmin) -
log(
b-tmax) );
205 double b =
n/absAlpha - absAlpha;
209 term1 =
a*sig*(
log(
b-tmin) -
log(
n/absAlpha));
216 double term2 = sig*sqrtPiOver2*(
ApproxErf(tmax/sqrt2)
220 result += term1 + term2;
223 return result != 0. ? result : 1.E-300;
static RooMathCoreReg dummy
RooSpan< double > makeWritableBatchUnInit(std::size_t begin, std::size_t batchSize)
Make a batch and return a span pointing to the pdf-local memory.
Little adapter that gives a bracket operator to types that don't have one.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Bool_t matchArgs(const RooArgSet &allDeps, RooArgSet &numDeps, const RooArgProxy &a) const
Utility function for use in getAnalyticalIntegral().
BatchHelpers::BatchData _batchData
RooArgSet is a container object that can hold multiple RooAbsArg objects.
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 > evaluateBatch(std::size_t begin, std::size_t batchSize) const
Evaluate function for a batch of input data points.
static std::complex< double > erf(const std::complex< double > z)
complex erf function
A simple container to hold a batch of data values.
Double_t min(const char *rname=0) const
Query lower limit of range. This requires the payload to be RooAbsRealLValue or derived.
RooSpan< const double > getValBatch(std::size_t begin, std::size_t batchSize) const
Double_t max(const char *rname=0) const
Query upper limit of range. This requires the payload to be RooAbsRealLValue or derived.
EvaluateInfo getInfo(std::vector< const RooRealProxy * > parameters, size_t begin, size_t batchSize)
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
RooArgSet S(const RooAbsArg &v1)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
static void output(int code)