75 :
RooAbsPdf(
name, title), x_(
"x",
"Dependent", this,
x), x0_(
"x0",
"X0", this, x0),
76 sigmaL_(
"sigmaL",
"Left Sigma", this, sigmaL), sigmaR_(
"sigmaR",
"Right Sigma", this, sigmaR),
77 alphaL_{
"alphaL",
"Left Alpha", this, alphaL}, nL_{
"nL",
"Left Order", this, nL},
78 alphaR_{std::make_unique<
RooRealProxy>(
"alphaR",
"Right Alpha", this, alphaR)},
79 nR_{std::make_unique<
RooRealProxy>(
"nR",
"Right Order", this, nR)}
103 :
RooAbsPdf(
name, title), x_(
"x",
"Dependent", this,
x), x0_(
"x0",
"X0", this, x0),
104 sigmaL_(
"sigmaL",
"Left Sigma", this, sigmaLR), sigmaR_(
"sigmaR",
"Right Sigma", this, sigmaLR),
105 alphaL_{
"alphaL",
"Left Alpha", this, alphaL}, nL_{
"nL",
"Left Order", this, nL},
106 alphaR_{std::make_unique<
RooRealProxy>(
"alphaR",
"Right Alpha", this, alphaR)},
107 nR_{std::make_unique<
RooRealProxy>(
"nR",
"Right Order", this, nR)}
130 :
RooAbsPdf(
name, title), x_(
"x",
"Dependent", this,
x), x0_(
"x0",
"X0", this, x0),
131 sigmaL_{
"sigmaL",
"Left Sigma", this, sigmaLR}, sigmaR_{
"sigmaR",
"Right Sigma", this, sigmaLR},
132 alphaL_{
"alphaL",
"Left Alpha", this, alpha},
133 nL_{
"nL",
"Left Order", this,
n}
136 alphaR_ = std::make_unique<RooRealProxy>(
"alphaR",
"Right Alpha",
this, alpha);
137 nR_ = std::make_unique<RooRealProxy>(
"nR",
"Right Order",
this,
n);
150 :
RooAbsPdf(other,
name), x_(
"x", this, other.x_), x0_(
"x0", this, other.x0_),
151 sigmaL_(
"sigmaL", this, other.sigmaL_),
152 sigmaR_(
"sigmaR", this, other.sigmaR_), alphaL_{
"alphaL", this, other.alphaL_},
153 nL_{
"nL", this, other.nL_},
154 alphaR_{other.alphaR_ ? std::make_unique<
RooRealProxy>(
"alphaR", this, *other.alphaR_) : nullptr},
155 nR_{other.nR_ ? std::make_unique<
RooRealProxy>(
"nR", this, *other.nR_) : nullptr}
163inline double evaluateCrystalBallTail(
double t,
double alpha,
double n)
165 double r =
n / alpha;
166 double b =
r - alpha;
168 return std::exp(-0.5 * alpha * alpha) * std::pow(
r / (
b - t),
n);
171inline double integrateGaussian(
double sigmaL,
double sigmaR,
double tmin,
double tmax)
173 constexpr double sqrtPiOver2 = 1.2533141373;
174 constexpr double sqrt2 = 1.4142135624;
176 const double sigmaMin = tmin < 0 ? sigmaL : sigmaR;
177 const double sigmaMax = tmax < 0 ? sigmaL : sigmaR;
179 return sqrtPiOver2 * (sigmaMax * std::erf(tmax / sqrt2) - sigmaMin * std::erf(tmin / sqrt2));
182inline double integrateTailLogVersion(
double sigma,
double alpha,
double n,
double tmin,
double tmax)
184 double r =
n / alpha;
185 double a = std::pow(
r,
n) *
exp(-0.5 * alpha * alpha);
186 double b =
r - alpha;
188 double log_b_tmin =
log(
b - tmin);
189 double log_b_tmax =
log(
b - tmax);
191 return a *
sigma * (log_b_tmin - log_b_tmax + 0.5 * (1.0 -
n) * (log_b_tmin * log_b_tmin - log_b_tmax * log_b_tmax));
194inline double integrateTailRegular(
double sigma,
double alpha,
double n,
double tmin,
double tmax)
196 double r =
n / alpha;
197 double b =
r - alpha;
199 return r *
exp(-0.5 * alpha * alpha) *
sigma / (1.0 -
n) * (std::pow(
r / (
b - tmin),
n - 1.0) - std::pow(
r / (
b - tmax),
n - 1.0));
209 const double x0 =
x0_;
227 return evaluateCrystalBallTail(t,
alphaL,
nL);
229 return std::exp(-0.5 * t * t);
231 return evaluateCrystalBallTail(-t,
alphaR,
nR);
248 const double x0 =
x0_;
263 constexpr double switchToLogThreshold = 1.0e-05;
273 auto integrateTailL = std::abs(
nL - 1.0) < switchToLogThreshold ? integrateTailLogVersion : integrateTailRegular;
277 auto integrateTailR = std::abs(
nR - 1.0) < switchToLogThreshold ? integrateTailLogVersion : integrateTailRegular;
280 if (tmin < alphaR && tmax > -
alphaL) {
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Abstract interface for all probability density functions.
Abstract base class for objects that represent a real value and implements functionality common to al...
bool matchArgs(const RooArgSet &allDeps, RooArgSet &analDeps, const RooArgProxy &a, const Proxies &... proxies) const
RooArgSet is a container object that can hold multiple RooAbsArg objects.
PDF implementing the generalized Asymmetrical Double-Sided Crystall Ball line shape.
std::unique_ptr< RooRealProxy > nR_
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
RooAbsReal const * nR() const
RooAbsReal const * alphaR() const
RooAbsReal const & sigmaR() const
std::unique_ptr< RooRealProxy > alphaR_
RooAbsReal const & nL() const
RooAbsReal const & x0() const
RooAbsReal const & x() const
double maxVal(Int_t code) const override
Return maximum value for set of observables identified by code assigned in getMaxVal.
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
RooAbsReal const & sigmaL() const
Int_t getMaxVal(const RooArgSet &vars) const override
Advertise that we know the maximum of self for given (m0,alpha,n,sigma).
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
RooAbsReal const & alphaL() const
double max(const char *rname=nullptr) const
Query upper limit of range. This requires the payload to be RooAbsRealLValue or derived.
double min(const char *rname=nullptr) const
Query lower limit of range. This requires the payload to be RooAbsRealLValue or derived.
RVec< PromoteType< T > > log(const RVec< T > &v)
RVec< PromoteType< T > > exp(const RVec< T > &v)
void checkRangeOfParameters(const RooAbsReal *callingClass, std::initializer_list< const RooAbsReal * > pars, double min=-std::numeric_limits< double >::max(), double max=std::numeric_limits< double >::max(), bool limitsInAllowedRange=false, std::string const &extraMessage="")
Check if the parameters have a range, and warn if the range extends below / above the set limits.