44 mean(
"mean",
"mean",this,_mean),
45 _noRounding(noRounding),
46 _protectNegative(false)
56 mean(
"mean",this,other.mean),
57 _noRounding(other._noRounding),
58 _protectNegative(other._protectNegative)
77template<
class Tx,
class TMean>
78void compute(
const size_t n,
double* __restrict
output, Tx
x, TMean mean,
79 const bool protectNegative,
const bool noRounding) {
81 for (
size_t i = 0; i <
n; ++i) {
82 const double x_i = noRounding ?
x[i] :
floor(
x[i]);
90 for (
size_t i = 0; i <
n; ++i) {
91 const double x_i = noRounding ?
x[i] :
floor(
x[i]);
93 const double logPoisson = x_i * logMean - mean[i] -
output[i];
102 if (protectNegative && mean[i] < 0.)
116 const bool batchX = !xData.empty();
117 const bool batchMean = !meanData.empty();
119 if (!batchX && !batchMean) {
122 batchSize =
findSize({ xData, meanData });
125 if (batchX && !batchMean ) {
128 else if (!batchX && batchMean ) {
131 else if (batchX && batchMean ) {
159 const double xmin = std::max(0.,
x.
min(rangeName));
160 const double xmax =
x.
max(rangeName);
171 const unsigned int ixmin =
xmin;
172 const unsigned int ixmax = std::min(
xmax + 1.,
173 (
double)std::numeric_limits<unsigned int>::max());
191 }
else if(code == 2) {
213 if (
matchArgs(directVars,generateVars,
x))
return 1 ;
226 if (xgen<=
x.
max() && xgen>=
x.
min()) {
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.
static Int_t isInfinite(Double_t x)
Return true if x is infinite by RooNumBer internal specification.
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const override
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
void generateEvent(Int_t code) override
Implement internal generator using TRandom::Poisson.
Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const override
Advertise internal generator in x.
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const override
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
Double_t evaluate() const override
Implementation in terms of the TMath::Poisson() function.
RooSpan< double > evaluateBatch(std::size_t begin, std::size_t batchSize) const override
Compute Poisson values in batches.
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
Bool_t hasMax(const char *rname=0) const
Check if the range has a upper bound. This requires the payload to be RooAbsRealLValue or derived.
Double_t max(const char *rname=0) const
Query upper limit of range. This requires the payload to be RooAbsRealLValue or derived.
virtual Int_t Poisson(Double_t mean)
Generates a random integer N according to a Poisson law.
double poisson_cdf(unsigned int n, double mu)
Cumulative distribution function of the Poisson distribution Lower tail of the integral of the poisso...
double poisson_cdf_c(unsigned int n, double mu)
Complement of the cumulative distribution function of the Poisson distribution.
double gamma_cdf(double x, double alpha, double theta, double x0=0)
Cumulative distribution function of the gamma distribution (lower tail).
size_t findSize(std::vector< RooSpan< const double > > parameters)
This function returns the minimum size of the non-zero-sized batches.
Double_t Floor(Double_t x)
Double_t Poisson(Double_t x, Double_t par)
Compute the Poisson distribution function for (x,par) The Poisson PDF is implemented by means of Eule...
Double_t LnGamma(Double_t z)
Computation of ln[gamma(z)] for all z.
static void output(int code)