39 x(
"x",
"Observable",this,_x),
40 mean(
"mean",
"Mean",this,_mean),
41 sigma(
"sigma",
"Width",this,_sigma)
49 RooAbsPdf(other,
name),
x(
"x",this,other.
x), mean(
"mean",this,other.mean),
58 const double arg =
x -
mean;
59 const double sig =
sigma;
60 return std::exp(-0.5*arg*arg/(sig*sig));
86 assert(code==1 || code==2);
98 max = (
x.
max(rangeName)-
mean)/xscale;
99 min = (
x.
min(rangeName)-
mean)/xscale;
101 max = (
mean.
max(rangeName)-
x)/xscale;
102 min = (
mean.
min(rangeName)-
x)/xscale;
110 const double ecmin = std::erfc(std::abs(min));
111 const double ecmax = std::erfc(std::abs(max));
114 return resultScale * 0.5 * (
115 min*max < 0.0 ? 2.0 - (ecmin + ecmax)
116 : max <= 0. ? ecmax - ecmin : ecmin - ecmax
124 if (
matchArgs(directVars,generateVars,
x))
return 1 ;
133 assert(code==1 || code==2) ;
152 std::cout <<
"error in RooGaussian generateEvent"<< std::endl;
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
bool matchArgs(const RooArgSet &allDeps, RooArgSet &numDeps, const RooArgProxy &a) const
Utility function for use in getAnalyticalIntegral().
RooArgSet is a container object that can hold multiple RooAbsArg objects.
virtual void compute(cudaStream_t *, Computer, RestrictArr, size_t, const VarVector &, ArgVector &)=0
RooSpan< const double > at(RooAbsArg const *arg, RooAbsArg const *caller=nullptr)
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
void generateEvent(Int_t code) override
Interface for generation of an event using the algorithm corresponding to the specified code.
void computeBatch(cudaStream_t *, double *output, size_t size, RooFit::Detail::DataMap const &) const override
Compute multiple values of Gaussian distribution.
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...
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
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.
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...
R__EXTERN RooBatchComputeInterface * dispatchCUDA
R__EXTERN RooBatchComputeInterface * dispatchCPU
This dispatch pointer points to an implementation of the compute library, provided one has been loade...
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.
constexpr Double_t Sqrt2()
constexpr Double_t TwoPi()