45 x(
"x",
"Observable",this,_x),
46 mean(
"mean",
"Mean",this,_mean),
47 sigma(
"sigma",
"Width",this,_sigma)
54 RooAbsPdf(other,
name),
x(
"x",this,other.
x), mean(
"mean",this,other.mean),
63 const double arg =
x -
mean;
64 const double sig =
sigma;
65 return exp(-0.5*arg*arg/(sig*sig));
75template<
class Tx,
class TMean,
class TSig>
79 for (
int i = 0; i <
n; ++i) {
80 const double arg =
x[i] - mean[i];
81 const double halfBySigmaSq = -0.5 / (
sigma[i] *
sigma[i]);
105 const bool batchX = !xData.empty();
106 const bool batchMean = !meanData.empty();
107 const bool batchSigma = !sigmaData.empty();
109 if (!(batchX || batchMean || batchSigma)) {
115 if (batchX && !batchMean && !batchSigma) {
118 else if (batchX && batchMean && !batchSigma) {
121 else if (batchX && !batchMean && batchSigma) {
124 else if (batchX && batchMean && batchSigma) {
125 compute(
output, xData, meanData, sigmaData);
127 else if (!batchX && batchMean && !batchSigma) {
130 else if (!batchX && !batchMean && batchSigma) {
133 else if (!batchX && batchMean && batchSigma) {
153 assert(code==1 || code==2);
165 max = (
x.
max(rangeName)-
mean)/xscale;
166 min = (
x.
min(rangeName)-
mean)/xscale;
168 max = (
mean.
max(rangeName)-
x)/xscale;
169 min = (
mean.
min(rangeName)-
x)/xscale;
177 const double ecmin =
std::erfc(std::abs(min));
178 const double ecmax =
std::erfc(std::abs(max));
181 return resultScale * 0.5 * (
182 min*max < 0.0 ? 2.0 - (ecmin + ecmax)
183 : max <= 0. ? ecmax - ecmin : ecmin - ecmax
191 if (
matchArgs(directVars,generateVars,
x))
return 1 ;
200 assert(code==1 || code==2) ;
219 cout <<
"error in RooGaussian generateEvent"<< endl;
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.
RooSpan< double > evaluateBatch(std::size_t begin, std::size_t batchSize) const override
Compute in batches.
void generateEvent(Int_t code) override
Interface for generation of an event using the algorithm corresponding to the specified code.
Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const override
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 override
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
Double_t evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const override
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...
double erfc(double x)
Complementary error function.
constexpr Double_t Sqrt2()
constexpr Double_t TwoPi()
static void output(int code)