65 _mean(
"mean",
"Mean of Gaussian component", this, meanIn),
66 sigma(
"sigma",
"Width", this, sigmaIn),
67 rlife(
"rlife",
"Life time", this, rlifeIn),
68 _meanSF(
"meanSF",
"Scale factor for mean", this, meanSF),
69 ssf(
"ssf",
"Sigma Scale Factor", this, sigmaSF),
70 rsf(
"rsf",
"RLife Scale Factor", this, rlifeSF),
93 _mean(
"mean",
"Mean of Gaussian component", this,
RooRealConstant::value(0.)),
94 sigma(
"sigma",
"Width",this,_sigma),
95 rlife(
"rlife",
"Life time",this,_rlife),
96 _meanSF(
"meanSF",
"Scale factor for mean", this,
RooRealConstant::value(1)),
119 _mean(
"mean",
"Mean of Gaussian component", this,
RooRealConstant::value(0.)),
120 sigma(
"sigma",
"Width",this,_sigma),
121 rlife(
"rlife",
"Life time",this,_rlife),
122 _meanSF(
"meanSF",
"Scale factor for mean", this,
RooRealConstant::value(1)),
123 ssf(
"ssf",
"Sigma Scale Factor",this,_rsSF),
124 rsf(
"rsf",
"RLife Scale Factor",this,_rsSF),
125 _flip(
type==Flipped),
149 _mean(
"mean",
"Mean of Gaussian component", this,
RooRealConstant::value(0.)),
150 sigma(
"sigma",
"Width",this,_sigma),
151 rlife(
"rlife",
"Life time",this,_rlife),
152 _meanSF(
"meanSF",
"Scale factor for mean", this,
RooRealConstant::value(1)),
153 ssf(
"ssf",
"Sigma Scale Factor",this,_sigmaSF),
154 rsf(
"rsf",
"RLife Scale Factor",this,_rlifeSF),
155 _flip(
type==Flipped),
166 _mean(
"mean", this, other._mean),
168 rlife(
"rlife",this,other.rlife),
169 _meanSF(
"meanSf", this, other._meanSF),
170 ssf(
"ssf",this,other.ssf),
171 rsf(
"rsf",this,other.rsf),
174 _flatSFInt(other._flatSFInt),
175 _asympInt(other._asympInt)
219 ans=
log(t)+(-z*z-1.26551223+t*(1.00002368+t*(0.37409196+t*(0.09678418+t*(-0.18628806+
220 t*(0.27886807+t*(-1.13520398+t*(1.48851587+t*(-0.82215223+t*0.17087277)))))))));
222 ans=
log(2.0-t*
exp(-z*z-1.26551223+t*(1.00002368+t*(0.37409196+t*(0.09678418+t*(-0.18628806+
223 t*(0.27886807+t*(-1.13520398+t*(1.48851587+t*(-0.82215223+t*0.17087277))))))))));
236 std::complex<Double_t> z(swt*
c,u+
c);
237 std::complex<Double_t> zc(u+
c,-swt*
c);
238 std::complex<Double_t> zsq= z*z;
239 std::complex<Double_t>
v= -zsq - u*u;
248 std::complex<Double_t> z(swt*
c,u+
c);
260 return exp(expArg+logErfC(u+
c));
286 if (dGamma==0) basisType =
expBasis;
291 if (
verboseEval()>2) cout <<
"RooGExpModel::evaluate(" <<
GetName() <<
") 1st form" << endl ;
301 result = 1/(2*rtau) *
exp(expArg + logErfC(sig/(root2*rtau) + fsign*(
x -
_mean*
_meanSF)/(root2*sig))) ;
321 if (
verboseEval()>2) cout <<
"RooGExpModel::evaluate(" <<
GetName() <<
") 2nd form" << endl ;
329 if (
verboseEval()>2) cout <<
"RooGExpModel::evaluate(" <<
GetName() <<
") 3d form tau=" << tau << endl ;
340 if (
verboseEval()>2) cout <<
"RooGExpModel::evaluate(" <<
GetName() <<
") 4th form omega = "
341 << omega <<
", tau = " << tau << endl ;
343 if (wt==0.)
return result ;
344 if (basisSign!=
Minus) result += -1*
calcSinConv(+1,sig,tau,omega,rtau,fsign).imag() ;
345 if (basisSign!=
Plus) result += -1*
calcSinConv(-1,sig,tau,omega,rtau,fsign).imag() ;
353 <<
") 5th form omega = " << omega <<
", tau = " << tau << endl ;
355 if (basisSign!=
Minus) result +=
calcSinConv(+1,sig,tau,omega,rtau,fsign).real() ;
356 if (basisSign!=
Plus) result +=
calcSinConv(-1,sig,tau,omega,rtau,fsign).real() ;
367 <<
") 6th form = " << dgamma <<
", tau = " << tau << endl;
372 Double_t tau1 = 1/(1/tau-dgamma/2) ;
373 Double_t tau2 = 1/(1/tau+dgamma/2) ;
387 <<
") 7th form = " << dgamma <<
", tau = " << tau << endl;
392 Double_t tau1 = 1/(1/tau-dgamma/2) ;
393 Double_t tau2 = 1/(1/tau+dgamma/2) ;
421 std::complex<Double_t> eins(1,0);
422 std::complex<Double_t> k(1/tau,sign*omega);
425 return (evalCerf(-sign*omega*tau,u1,
c1)+std::complex<Double_t>(evalCerfRe(u2,
c2),0)*fsign*sign) / (eins + k*fsign*sign*rtau) ;
449 return (evalCerfRe(u1,
c1)+evalCerfRe(u2,
c2)*fsign*sign) / (eins + k*fsign*sign*rtau) ;
473 if ((sign<0)&&(
fabs(tau-rtau)<tau/260)) {
476 if (
fabs(xp/MeanTau)>300) {
480 cFly=1./(MeanTau*MeanTau*root2pi) *
481 exp(-(-xp/MeanTau-sig*sig/(2*MeanTau*MeanTau)))
483 -(sig*sig/MeanTau+xp)*(rootpi/root2)*
RooMath::erfc(sig/(root2*MeanTau)+xp/(root2*sig)));
487 Double_t a=sig/(root2*MeanTau)+xp/(root2*sig);
488 cFly += 1./(MeanTau*MeanTau)
489 *
exp(-(-xp/MeanTau-sig*sig/(2*MeanTau*MeanTau)))
491 (
exp(-
a*
a)*(sig/MeanTau*root2/rootpi
492 -(4*
a*sig*sig)/(2*rootpi*MeanTau*MeanTau)
493 +(-4/rootpi+8*
a*
a/rootpi)/6
495 +2/rootpi*(sig*sig/(MeanTau*MeanTau)+xp/MeanTau)*
496 (sig/(root2*MeanTau)-
a*(sig*sig)/(2*MeanTau*MeanTau))
497 +2/rootpi*((3*sig*sig)/(2*MeanTau*MeanTau)+xp/MeanTau+
498 0.5*
TMath::Power(sig*sig/(MeanTau*MeanTau)+xp/MeanTau,2))*sig/(root2*MeanTau))
499 -(2*sig*sig/(MeanTau*MeanTau)+xp/MeanTau+(sig*sig/(MeanTau*MeanTau)+xp/MeanTau)*
500 (3*sig*sig/(2*MeanTau*MeanTau)+xp/MeanTau)
506 Double_t expArg1 = sig*sig/(2*tau*tau)-sign*xp/tau ;
507 Double_t expArg2 = sig*sig/(2*rtau*rtau)+xp/rtau ;
513 term1 =
exp(expArg1+logErfC(sig/(root2*tau)-sign*xp/(root2*sig))) ; ;
518 term2 =
exp(expArg2+logErfC(sig/(root2*rtau)+xp/(root2*sig))) ; ;
521 cFly=(term1+sign*term2)/(2*(tau+sign*rtau));
539Double_t RooGExpModel::calcCoshConv(Double_t sign, Double_t tau, Double_t dgamma, Double_t sig, Double_t rtau, Double_t fsign) const
543 static Double_t root2(sqrt(2.)) ;
544 static Double_t root2pi(sqrt(2*atan2(0.,-1.))) ;
545 static Double_t rootpi(sqrt(atan2(0.,-1.)));
546 Double_t tau1 = 1/(1/tau-dgamma/2);
547 Double_t tau2 = 1/(1/tau+dgamma/2);
555 xp *= fsign ; // modified FMV,08/13/03
556 sign *= fsign ; // modified FMV,08/13/03
558 cFly=tau1*(exp(sig*sig/(2*tau1*tau1)-sign*xp/tau1)
559 *RooMath::erfc(sig/(root2*tau1)-sign*xp/(root2*sig))
560 +sign*exp(sig*sig/(2*rtau*rtau)+xp/rtau)
561 *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)))/(2*(tau1+sign*rtau))
562 +tau2*(exp(sig*sig/(2*tau2*tau2)-sign*xp/tau2)
563 *RooMath::erfc(sig/(root2*tau2)-sign*xp/(root2*sig))
564 +sign*exp(sig*sig/(2*rtau*rtau)+xp/rtau)
565 *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)))/(2*(tau2+sign*rtau));;
574Double_t RooGExpModel::calcSinhConv(Double_t sign, Double_t sign1, Double_t sign2, Double_t tau, Double_t dgamma, Double_t sig, Double_t rtau, Double_t fsign) const
576 static Double_t root2(sqrt(2.)) ;
577 static Double_t root2pi(sqrt(2*atan2(0.,-1.))) ;
578 static Double_t rootpi(sqrt(atan2(0.,-1.)));
579 Double_t tau1 = 1/(1/tau-dgamma/2);
580 Double_t tau2 = 1/(1/tau+dgamma/2);
589 xp *= fsign ; // modified FMV,08/13/03
590 sign1 *= fsign ; // modified FMV,08/13/03
591 sign2 *= fsign ; // modified FMV,08/13/03
593 cFly=sign1*tau1*(exp(sig*sig/(2*tau1*tau1)-sign*xp/tau1)
594 *RooMath::erfc(sig/(root2*tau1)-sign*xp/(root2*sig))
595 +sign*exp(sig*sig/(2*rtau*rtau)+xp/rtau)
596 *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)))/(2*(tau1+sign*rtau))
597 +sign2*tau2*(exp(sig*sig/(2*tau2*tau2)-sign*xp/tau2)
598 *RooMath::erfc(sig/(root2*tau2)-sign*xp/(root2*sig))
599 +sign*exp(sig*sig/(2*rtau*rtau)+xp/rtau)
600 *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)))/(2*(tau2+sign*rtau));;
669 if (dGamma==0) basisType =
expBasis;
677 if (
verboseEval()>0) cout <<
"RooGExpModel::analyticalIntegral(" <<
GetName() <<
") 1st form" << endl ;
690 result = 0.5*
evalCerfInt(-fsign,rtau,fsign*umin,fsign*umax,
c)/rtau ;
695 return result*ssfInt ;
703 if (
verboseEval()>0) cout <<
"RooGExpModel::analyticalIntegral(" <<
GetName() <<
") 2nd form" << endl ;
716 return result*ssfInt ;
722 if (
verboseEval()>0) cout <<
"RooGExpModel::analyticalIntegral(" <<
GetName() <<
") 4th form omega = "
723 << omega <<
", tau = " << tau << endl ;
726 if (wt==0)
return result ;
730 if (basisSign!=
Minus) result += -1*
calcSinConvNorm(+1,tau,omega,sig,rtau,fsign,rangeName).imag();
731 if (basisSign!=
Plus) result += -1*
calcSinConvNorm(-1,tau,omega,sig,rtau,fsign,rangeName).imag();
733 return result*ssfInt ;
739 <<
") 5th form omega = " << omega <<
", tau = " << tau << endl ;
746 if (basisSign!=
Plus) result +=
calcSinConvNorm(-1,tau,omega,sig,rtau,fsign,rangeName).real();
748 return result*ssfInt ;
756 <<
") 6th form dgamma = " << dgamma <<
", tau = " << tau << endl ;
775 <<
") 6th form dgamma = " << dgamma <<
", tau = " << tau << endl ;
819 std::complex<Double_t> eins(1,0);
820 std::complex<Double_t> k(1/tau,sign*omega);
821 std::complex<Double_t> term1 =
evalCerfInt(sign,-sign*omega*tau, tau, -sign*umin1, -sign*umax1,
c1);
823 std::complex<Double_t> term2 = std::complex<Double_t>(
evalCerfInt(-fsign, rtau, fsign*umin2, fsign*umax2,
c2)*fsign*sign,0);
824 return (term1+term2)/(eins + k*fsign*sign*rtau) ;
852 if (
fabs(tau-rtau)<1
e-10 &&
fabs(term1+term2)<1
e-10) {
853 cout <<
"epsilon method" << endl ;
857 return (term1+term2)/(eins + k*fsign*sign*rtau) ;
865 std::complex<Double_t> diff;
867 diff = std::complex<Double_t>(2,0) ;
871 return std::complex<Double_t>(tau/(1.+wt*wt),0)*std::complex<Double_t>(1,wt)*diff;
883 if ((umin<-8 && umax>8)||(umax<-8 && umin>8)) {
897 if (
matchArgs(directVars,generateVars,
x))
return 1 ;
double atan2(double, double)
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.
The RooGExpModel is a RooResolutionModel implementation that models a resolution function that is the...
virtual Int_t basisCode(const char *name) const
std::complex< Double_t > calcSinConvNorm(Double_t sign, Double_t tau, Double_t omega, Double_t sig, Double_t rtau, Double_t fsign, const char *rangeName) const
old code (asymptotic normalization only) std::complex<Double_t> z(1/tau,sign*omega); return z*2/(omeg...
virtual ~RooGExpModel()
Destructor.
virtual Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
virtual Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
std::complex< Double_t > evalCerfInt(Double_t sign, Double_t wt, Double_t tau, Double_t umin, Double_t umax, Double_t c) const
void generateEvent(Int_t code)
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
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.
Double_t calcDecayConv(Double_t sign, Double_t tau, Double_t sig, Double_t rtau, Double_t fsign) const
std::complex< Double_t > calcSinConv(Double_t sign, Double_t sig, Double_t tau, Double_t omega, Double_t rtau, Double_t fsign) const
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 Double_t uniform(TRandom *generator=randomGenerator())
Return a number uniformly distributed from (0,1)
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.
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...
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
LongDouble_t Power(LongDouble_t x, LongDouble_t y)