64 x(
"x",
"Observable",this,_x),
65 gamma(
"gamma",
"Mean",this,_gamma),
66 beta(
"beta",
"Width",this,_beta),
67 mu(
"mu",
"Para",this,_mu)
92 {ctx.at(x), ctx.at(gamma), ctx.at(beta), ctx.at(mu)});
114inline double randomGamma(
double gamma,
double beta,
double mu,
double xmin,
double xmax)
118 double d = gamma - 1. / 3.;
119 double c = 1. / std::sqrt(9. *
d);
129 if (u < 1. - .0331 * (xgen * xgen) * (xgen * xgen)) {
130 double x = ((
d *
v) *
beta + mu);
135 if (std::log(u) < 0.5 * xgen * xgen +
d * (1. -
v +
TMath::Log(
v))) {
136 double x = ((
d *
v) *
beta + mu);
172 bool accepted =
false;
176 double tmp = randomGamma(1 +
gamma,
beta,
mu, 0, std::numeric_limits<double>::infinity());
177 xVal = tmp * std::pow(u, 1.0 /
gamma);
178 accepted = xVal <
x.max() && xVal >
x.min();
int Int_t
Signed integer 4 bytes (int).
RooAbsPdf()
Default constructor.
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.
std::span< double > output()
RooBatchCompute::Config config(RooAbsArg const *arg) const
Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, bool staticInitOK=true) const override
Load generatedVars with the subset of directVars that we can generate events for, and return a code t...
void doEval(RooFit::EvalContext &) const override
Compute multiple values of Gamma PDF.
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
void generateEvent(Int_t code) override
algorithm adapted from code example in: Marsaglia, G.
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
double gamma_cdf(double x, double alpha, double theta, double x0=0)
Cumulative distribution function of the gamma distribution (lower tail).
double beta(double x, double y)
Calculates the beta function.
void compute(Config cfg, Computer comp, std::span< double > output, VarSpan vars, ArgSpan extraArgs={})
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.
Double_t Log(Double_t x)
Returns the natural logarithm of x.
Double_t GammaDist(Double_t x, Double_t gamma, Double_t mu=0, Double_t beta=1)