46 static const Double_t rootpi= std::sqrt(std::atan2(0.,-1.));
47 const std::complex<Double_t> z(_x *
c, u +
c);
48 const std::complex<Double_t> zc(u +
c, - _x *
c);
49 const std::complex<Double_t> zsq((z.real() + z.imag()) * (z.real() - z.imag()),
50 2. * z.real() * z.imag());
51 const std::complex<Double_t>
v(-zsq.real() - u*u, -zsq.imag());
52 const std::complex<Double_t> ev = std::exp(
v);
53 const std::complex<Double_t> mez2zcrootpi = -std::exp(zsq)/(zc*rootpi);
55 return 2. * (ev * (mez2zcrootpi + 1.));
61 std::complex<Double_t> z(swt*
c,u+
c);
79 mean(
"mean",
"Mean",this,_mean),
80 sigma(
"sigma",
"Width",this,_sigma),
94 mean(
"mean",
"Mean",this,_mean),
95 sigma(
"sigma",
"Width",this,_sigma),
96 msf(
"msf",
"Mean Scale Factor",this,_msSF),
97 ssf(
"ssf",
"Sigma Scale Factor",this,_msSF)
109 mean(
"mean",
"Mean",this,_mean),
110 sigma(
"sigma",
"Width",this,_sigma),
111 msf(
"msf",
"Mean Scale Factor",this,_meanSF),
112 ssf(
"ssf",
"Sigma Scale Factor",this,_sigmaSF)
120 _flatSFInt(other._flatSFInt),
121 _asympInt(other._asympInt),
122 mean(
"mean",this,other.mean),
124 msf(
"msf",this,other.msf),
125 ssf(
"ssf",this,other.ssf)
165 static Double_t root2(std::sqrt(2.)) ;
166 static Double_t root2pi(std::sqrt(2.*std::atan2(0.,-1.))) ;
167 static Double_t rootpi(std::sqrt(std::atan2(0.,-1.))) ;
175 if (dGamma==0) basisType =
expBasis;
180 if (
verboseEval()>2) cout <<
"RooGaussModel::evaluate(" <<
GetName() <<
") 1st form" << endl ;
189 if (
verboseEval()>2) cout <<
"RooGaussModel::evaluate(" <<
GetName() <<
") 2nd form" << endl ;
203 if (
verboseEval()>2) cout <<
"RooGaussModel::evaluate(" <<
GetName() <<
") 3d form tau=" << tau << endl ;
205 if (basisSign!=
Minus) result += evalCerf(0,-u,
c).real();
206 if (basisSign!=
Plus) result += evalCerf(0, u,
c).real();
207 if (
TMath::IsNaN(result)) {
cxcoutE(Tracing) <<
"RooGaussModel::getVal(" <<
GetName() <<
") got nan during case 1 " << endl; }
213 if (
verboseEval()>2) cout <<
"RooGaussModel::evaluate(" <<
GetName() <<
") 4th form omega = " << omega <<
", tau = " << tau << endl ;
215 if (_x==0.)
return result ;
216 if (basisSign!=
Minus) result += -evalCerf(-_x,-u,
c).imag();
217 if (basisSign!=
Plus) result += -evalCerf( _x, u,
c).imag();
224 if (
verboseEval()>2) cout <<
"RooGaussModel::evaluate(" <<
GetName() <<
") 5th form omega = " << omega <<
", tau = " << tau << endl ;
226 if (basisSign!=
Minus) result += evalCerf(-_x,-u,
c).real();
227 if (basisSign!=
Plus) result += evalCerf( _x, u,
c).real();
234 if (
verboseEval()>2) cout <<
"RooGaussModel::evaluate(" <<
GetName() <<
") 8th form tau = " << tau << endl ;
236 int sgn = ( basisType ==
coshBasis ? +1 : -1 );
237 if (basisSign!=
Minus) result += 0.5*( evalCerf(0,-u,
c*(1-_y)).real()+sgn*evalCerf(0,-u,
c*(1+_y)).real()) ;
238 if (basisSign!=
Plus) result += 0.5*(sgn*evalCerf(0, u,
c*(1-_y)).real()+ evalCerf(0, u,
c*(1+_y)).real()) ;
245 if (
verboseEval()>2) cout <<
"RooGaussModel::evaluate(" <<
GetName() <<
") 6th form tau = " << tau << endl ;
250 return (xprime - 2*
c*
c)*f0 + (2*
c/rootpi)*
f1 ;
255 if (
verboseEval()>2) cout <<
"RooGaussModel::evaluate(" <<
GetName() <<
") 7th form tau = " << tau << endl ;
261 return ( x2c2*x2c2*f0 + (2*
c/rootpi)*x2c2*
f1 + 2*
c*
c*f0 );
323 static const Double_t root2 = std::sqrt(2.) ;
325 static const Double_t rootpi = std::sqrt(std::atan2(0.0,-1.0));
330 if (code==2) ssfInt = (
ssf.
max(rangeName)-
ssf.
min(rangeName)) ;
339 if (dGamma==0) basisType =
expBasis;
343 if (
verboseEval()>0) cout <<
"RooGaussModel::analyticalIntegral(" <<
GetName() <<
") 1st form" << endl ;
357 if (
TMath::IsNaN(result)) {
cxcoutE(Tracing) <<
"RooGaussModel::analyticalIntegral(" <<
GetName() <<
") got nan during case 1 " << endl; }
358 return result*ssfInt ;
367 if (
verboseEval()>0) cout <<
"RooGaussModel::analyticalIntegral(" <<
GetName() <<
") 2nd form" << endl ;
379 if (
verboseEval()>0) cout <<
"RooGaussModel::analyticalIntegral(" <<
GetName() <<
") 3d form tau=" << tau << endl ;
383 if (
TMath::IsNaN(result)) {
cxcoutE(Tracing) <<
"RooGaussModel::analyticalIntegral(" <<
GetName() <<
") got nan during case 3 " << endl; }
384 return result*ssfInt ;
392 if (
verboseEval()>0) cout <<
"RooGaussModel::analyticalIntegral(" <<
GetName() <<
") 4th form omega = " << omega <<
", tau = " << tau << endl ;
394 if (_x==0)
return result*ssfInt ;
396 if (basisSign!=
Plus) result += -1*
evalCerfInt(-1, _x,tau, umin, umax,
c).imag();
397 if (
TMath::IsNaN(result)) {
cxcoutE(Tracing) <<
"RooGaussModel::analyticalIntegral(" <<
GetName() <<
") got nan during case 4 " << endl; }
398 return result*ssfInt ;
403 if (
verboseEval()>0) cout <<
"RooGaussModel::analyticalIntegral(" <<
GetName() <<
") 5th form omega = " << omega <<
", tau = " << tau << endl ;
406 if (basisSign!=
Plus) result +=
evalCerfInt(-1, _x,tau, umin, umax,
c).real();
407 if (
TMath::IsNaN(result)) {
cxcoutE(Tracing) <<
"RooGaussModel::analyticalIntegral(" <<
GetName() <<
") got nan during case 5 " << endl; }
408 return result*ssfInt ;
414 if (
verboseEval()>0) {cout <<
"RooGaussModel::analyticalIntegral(" <<
GetName() <<
") 8th form tau=" << tau << endl ; }
416 int sgn = ( basisType ==
coshBasis ? +1 : -1 );
417 if (basisSign!=
Minus) result += 0.5*(
evalCerfInt(+1,0,tau/(1-_y),-umin,-umax,
c*(1-_y)).real()+ sgn*
evalCerfInt(+1,0,tau/(1+_y),-umin,-umax,
c*(1+_y)).real());
418 if (basisSign!=
Plus) result += 0.5*(sgn*
evalCerfInt(-1,0,tau/(1-_y), umin, umax,
c*(1-_y)).real()+
evalCerfInt(-1,0,tau/(1+_y), umin, umax,
c*(1+_y)).real());
419 if (
TMath::IsNaN(result)) {
cxcoutE(Tracing) <<
"RooGaussModel::analyticalIntegral(" <<
GetName() <<
") got nan during case 6 " << endl; }
420 return result*ssfInt ;
425 if (
verboseEval()>0) cout <<
"RooGaussModel::analyticalIntegral(" <<
GetName() <<
") 6th form tau=" << tau << endl ;
428 Double_t f1 = std::exp(-umax*umax) - std::exp(-umin*umin);
434 Double_t f3 = xpmax*tmp1 - xpmin*tmp2;
440 (1 - 2*
c*
c)*expc2*f2 +
447 if (
verboseEval()>0) cout <<
"RooGaussModel::analyticalIntegral(" <<
GetName() <<
") 7th form tau=" << tau << endl ;
451 Double_t tmpA1 = std::exp(-umax*umax);
452 Double_t tmpA2 = std::exp(-umin*umin);
455 Double_t f2 = umax*tmpA1 - umin*tmpA2;
461 Double_t f4 = xpmax*tmpB1 - xpmin*tmpB2;
462 Double_t f5 = xpmax*xpmax*tmpB1 - xpmin*xpmin*tmpB2;
467 (4*
c/rootpi)*((1-
c*
c)*
f1 +
c*f2) +
468 (2*
c*
c*(2*
c*
c-1) + 2)*expc2*f3 - (4*
c*
c-2)*expc2*f4 + expc2*f5
480 std::complex<Double_t> diff(2., 0.);
482 diff = evalCerf(_x,umin,
c);
483 diff -= evalCerf(_x,umax,
c);
487 diff *= std::complex<Double_t>(1., _x);
488 diff *= tau / (1.+_x*_x);
496 if (
matchArgs(directVars,generateVars,
x))
return 1 ;
510 if (xgen<xmax && xgen>
xmin) {
static int verboseEval()
Return global level of verbosity for p.d.f. evaluations.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
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().
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Class RooGaussModel implements a RooResolutionModel that models a Gaussian distribution.
virtual ~RooGaussModel()
Destructor.
std::complex< Double_t > evalCerfInt(Double_t sign, Double_t wt, Double_t tau, Double_t umin, Double_t umax, Double_t c) const
virtual Double_t analyticalIntegral(Int_t code, const char *rangeName) const
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
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...
virtual Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
void generateEvent(Int_t code)
Interface for generation of an event using the algorithm corresponding to the specified code.
virtual Int_t basisCode(const char *name) const
virtual Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
static std::complex< double > erfc(const std::complex< double > z)
complex erfc function
static std::complex< double > erf(const std::complex< double > z)
complex erf function
static std::complex< double > faddeeva_fast(std::complex< double > z)
evaluate Faddeeva function for complex argument (fast version)
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
RooRealConstant provides static functions to create and keep track of RooRealVar constants.
RooRealVar represents a variable that can be changed from the outside.
RooResolutionModel is the base class for PDFs that represent a resolution model that can be convolute...
RooAbsRealLValue & convVar() const
Return the convolution variable of the resolution model.
const RooFormulaVar & basis() const
RooTemplateProxy< RooAbsRealLValue > x
double min(const char *rname=0) const
Query lower limit of range. This requires the payload to be RooAbsRealLValue or derived.
double max(const char *rname=0) const
Query upper limit of range. This requires the payload to be RooAbsRealLValue or derived.
const T & arg() const
Return reference to object held in proxy.
virtual const char * GetName() const
Returns name of object.
This is the base class for the ROOT Random number generators.
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...