73 x(
"x",
"Observable",this,_x),
74 gamma(
"gamma",
"Mean",this,_gamma),
75 beta(
"beta",
"Width",this,_beta),
76 mu(
"mu",
"Para",this,_mu)
85 beta(
"beta",this,other.
beta), mu(
"mu",this,other.mu)
101template<
class Tx,
class Tgamma,
class Tbeta,
class Tmu>
102void compute(
size_t batchSize,
103 double * __restrict
output,
104 Tx X, Tgamma
G, Tbeta
B, Tmu M)
106 constexpr double NaN = std::numeric_limits<double>::quiet_NaN();
107 for (
size_t i=0; i<batchSize; i++) {
108 if (X[i]<M[i] ||
G[i] <= 0.0 ||
B[i] <= 0.0) {
120 for (
size_t i=0; i<batchSize; i++) {
128 for (
size_t i=0; i<batchSize; i++) {
135 for (
size_t i=0; i<batchSize; i++) {
137 const double invBeta = 1/
B[i];
138 double arg = (X[i]-M[i])*invBeta;
159 if (info.
nBatches==1 && !xData.empty()) {
160 compute(info.
size,
output.data(), xData.data(),
198 if (
matchArgs(directVars,generateVars,
x))
return 1 ;
229 if( u < 1.-.0331*(xgen*xgen)*(xgen*xgen) ) {
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.
Implementation of the Gamma PDF for RooFit/RooStats.
Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
void generateEvent(Int_t code)
algorithm adapted from code example in: Marsaglia, G.
Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const
Load generatedVars with the subset of directVars that we can generate events for, and return a code t...
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
RooSpan< double > evaluateBatch(std::size_t begin, std::size_t batchSize) const
Evaluate function for a batch of input data points.
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
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.
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.
double lgamma(double x)
Calculates the logarithm of the gamma function.
EvaluateInfo getInfo(std::vector< const RooRealProxy * > parameters, size_t begin, size_t batchSize)
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 extraMessage="")
Check if the parameters have a range, and warn if the range extends below / above the set limits.
Double_t Sqrt(Double_t x)
Double_t GammaDist(Double_t x, Double_t gamma, Double_t mu=0, Double_t beta=1)
Computes the density function of Gamma distribution at point x.
static void output(int code)