49 sigma(
"sigma",
"Width",this,_sigma),
50 rlife(
"rlife",
"Life time",this,_rlife),
64 sigma(
"sigma",
"Width",this,_sigma),
65 rlife(
"rlife",
"Life time",this,_rlife),
66 ssf(
"ssf",
"Sigma Scale Factor",this,_rsSF),
67 rsf(
"rsf",
"RLife Scale Factor",this,_rsSF),
82 sigma(
"sigma",
"Width",this,_sigma),
83 rlife(
"rlife",
"Life time",this,_rlife),
84 ssf(
"ssf",
"Sigma Scale Factor",this,_sigmaSF),
85 rsf(
"rsf",
"RLife Scale Factor",this,_rlifeSF),
98 rlife(
"rlife",this,other.rlife),
99 ssf(
"ssf",this,other.ssf),
100 rsf(
"rsf",this,other.rsf),
103 _flatSFInt(other._flatSFInt),
104 _asympInt(other._asympInt)
157 if (dGamma==0) basisType =
expBasis;
162 if (
verboseEval()>2) cout <<
"RooGExpModel::evaluate(" <<
GetName() <<
") 1st form" << endl ;
164 Double_t expArg = sig*sig/(2*rtau*rtau) + fsign*
x/rtau ;
168 result = 1/(2*rtau) *
exp(expArg) *
RooMath::erfc(sig/(root2*rtau) + fsign*
x/(root2*sig));
172 result = 1/(2*rtau) *
exp(expArg +
logErfC(sig/(root2*rtau) + fsign*
x/(root2*sig))) ;
192 if (
verboseEval()>2) cout <<
"RooGExpModel::evaluate(" <<
GetName() <<
") 2nd form" << endl ;
200 if (
verboseEval()>2) cout <<
"RooGExpModel::evaluate(" <<
GetName() <<
") 3d form tau=" << tau << endl ;
211 if (
verboseEval()>2) cout <<
"RooGExpModel::evaluate(" <<
GetName() <<
") 4th form omega = "
212 << omega <<
", tau = " << tau << endl ;
214 if (wt==0.)
return result ;
215 if (basisSign!=
Minus) result += -1*
calcSinConv(+1,sig,tau,omega,rtau,fsign).imag() ;
216 if (basisSign!=
Plus) result += -1*
calcSinConv(-1,sig,tau,omega,rtau,fsign).imag() ;
224 <<
") 5th form omega = " << omega <<
", tau = " << tau << endl ;
226 if (basisSign!=
Minus) result +=
calcSinConv(+1,sig,tau,omega,rtau,fsign).real() ;
227 if (basisSign!=
Plus) result +=
calcSinConv(-1,sig,tau,omega,rtau,fsign).real() ;
238 <<
") 6th form = " << dgamma <<
", tau = " << tau << endl;
243 Double_t tau1 = 1/(1/tau-dgamma/2) ;
244 Double_t tau2 = 1/(1/tau+dgamma/2) ;
258 <<
") 7th form = " << dgamma <<
", tau = " << tau << endl;
263 Double_t tau1 = 1/(1/tau-dgamma/2) ;
264 Double_t tau2 = 1/(1/tau+dgamma/2) ;
286 ans=
log(t)+(-z*z-1.26551223+t*(1.00002368+t*(0.37409196+t*(0.09678418+t*(-0.18628806+
287 t*(0.27886807+t*(-1.13520398+t*(1.48851587+t*(-0.82215223+t*0.17087277)))))))));
289 ans=
log(2.0-t*
exp(-z*z-1.26551223+t*(1.00002368+t*(0.37409196+t*(0.09678418+t*(-0.18628806+
290 t*(0.27886807+t*(-1.13520398+t*(1.48851587+t*(-0.82215223+t*0.17087277))))))))));
310 std::complex<Double_t> eins(1,0);
311 std::complex<Double_t> k(1/tau,sign*omega);
314 return (
evalCerf(-sign*omega*tau,u1,
c1)+std::complex<Double_t>(
evalCerfRe(u2,
c2),0)*fsign*sign) / (eins + k*fsign*sign*rtau) ;
362 if ((sign<0)&&(
fabs(tau-rtau)<tau/260)) {
365 if (
fabs(xp/MeanTau)>300) {
369 cFly=1./(MeanTau*MeanTau*root2pi) *
370 exp(-(-xp/MeanTau-sig*sig/(2*MeanTau*MeanTau)))
372 -(sig*sig/MeanTau+xp)*(rootpi/root2)*
RooMath::erfc(sig/(root2*MeanTau)+xp/(root2*sig)));
376 Double_t a=sig/(root2*MeanTau)+xp/(root2*sig);
377 cFly += 1./(MeanTau*MeanTau)
378 *
exp(-(-xp/MeanTau-sig*sig/(2*MeanTau*MeanTau)))
380 (
exp(-
a*
a)*(sig/MeanTau*root2/rootpi
381 -(4*
a*sig*sig)/(2*rootpi*MeanTau*MeanTau)
382 +(-4/rootpi+8*
a*
a/rootpi)/6
384 +2/rootpi*(sig*sig/(MeanTau*MeanTau)+xp/MeanTau)*
385 (sig/(root2*MeanTau)-
a*(sig*sig)/(2*MeanTau*MeanTau))
386 +2/rootpi*((3*sig*sig)/(2*MeanTau*MeanTau)+xp/MeanTau+
387 0.5*
TMath::Power(sig*sig/(MeanTau*MeanTau)+xp/MeanTau,2))*sig/(root2*MeanTau))
388 -(2*sig*sig/(MeanTau*MeanTau)+xp/MeanTau+(sig*sig/(MeanTau*MeanTau)+xp/MeanTau)*
389 (3*sig*sig/(2*MeanTau*MeanTau)+xp/MeanTau)
395 Double_t expArg1 = sig*sig/(2*tau*tau)-sign*xp/tau ;
396 Double_t expArg2 = sig*sig/(2*rtau*rtau)+xp/rtau ;
402 term1 =
exp(expArg1+logErfC(sig/(root2*tau)-sign*xp/(root2*sig))) ; ;
407 term2 =
exp(expArg2+logErfC(sig/(root2*rtau)+xp/(root2*sig))) ; ;
410 cFly=(term1+sign*term2)/(2*(tau+sign*rtau));
428Double_t RooGExpModel::calcCoshConv(Double_t sign, Double_t tau, Double_t dgamma, Double_t sig, Double_t rtau, Double_t fsign) const
432 static Double_t root2(sqrt(2.)) ;
433 static Double_t root2pi(sqrt(2*atan2(0.,-1.))) ;
434 static Double_t rootpi(sqrt(atan2(0.,-1.)));
435 Double_t tau1 = 1/(1/tau-dgamma/2);
436 Double_t tau2 = 1/(1/tau+dgamma/2);
444 xp *= fsign ; // modified FMV,08/13/03
445 sign *= fsign ; // modified FMV,08/13/03
447 cFly=tau1*(exp(sig*sig/(2*tau1*tau1)-sign*xp/tau1)
448 *RooMath::erfc(sig/(root2*tau1)-sign*xp/(root2*sig))
449 +sign*exp(sig*sig/(2*rtau*rtau)+xp/rtau)
450 *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)))/(2*(tau1+sign*rtau))
451 +tau2*(exp(sig*sig/(2*tau2*tau2)-sign*xp/tau2)
452 *RooMath::erfc(sig/(root2*tau2)-sign*xp/(root2*sig))
453 +sign*exp(sig*sig/(2*rtau*rtau)+xp/rtau)
454 *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)))/(2*(tau2+sign*rtau));;
463Double_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
465 static Double_t root2(sqrt(2.)) ;
466 static Double_t root2pi(sqrt(2*atan2(0.,-1.))) ;
467 static Double_t rootpi(sqrt(atan2(0.,-1.)));
468 Double_t tau1 = 1/(1/tau-dgamma/2);
469 Double_t tau2 = 1/(1/tau+dgamma/2);
478 xp *= fsign ; // modified FMV,08/13/03
479 sign1 *= fsign ; // modified FMV,08/13/03
480 sign2 *= fsign ; // modified FMV,08/13/03
482 cFly=sign1*tau1*(exp(sig*sig/(2*tau1*tau1)-sign*xp/tau1)
483 *RooMath::erfc(sig/(root2*tau1)-sign*xp/(root2*sig))
484 +sign*exp(sig*sig/(2*rtau*rtau)+xp/rtau)
485 *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)))/(2*(tau1+sign*rtau))
486 +sign2*tau2*(exp(sig*sig/(2*tau2*tau2)-sign*xp/tau2)
487 *RooMath::erfc(sig/(root2*tau2)-sign*xp/(root2*sig))
488 +sign*exp(sig*sig/(2*rtau*rtau)+xp/rtau)
489 *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)))/(2*(tau2+sign*rtau));;
558 if (dGamma==0) basisType =
expBasis;
566 if (
verboseEval()>0) cout <<
"RooGExpModel::analyticalIntegral(" <<
GetName() <<
") 1st form" << endl ;
579 result = 0.5*
evalCerfInt(-fsign,rtau,fsign*umin,fsign*umax,
c)/rtau ;
584 return result*ssfInt ;
592 if (
verboseEval()>0) cout <<
"RooGExpModel::analyticalIntegral(" <<
GetName() <<
") 2nd form" << endl ;
605 return result*ssfInt ;
611 if (
verboseEval()>0) cout <<
"RooGExpModel::analyticalIntegral(" <<
GetName() <<
") 4th form omega = "
612 << omega <<
", tau = " << tau << endl ;
615 if (wt==0)
return result ;
619 if (basisSign!=
Minus) result += -1*
calcSinConvNorm(+1,tau,omega,sig,rtau,fsign,rangeName).imag();
620 if (basisSign!=
Plus) result += -1*
calcSinConvNorm(-1,tau,omega,sig,rtau,fsign,rangeName).imag();
622 return result*ssfInt ;
628 <<
") 5th form omega = " << omega <<
", tau = " << tau << endl ;
635 if (basisSign!=
Plus) result +=
calcSinConvNorm(-1,tau,omega,sig,rtau,fsign,rangeName).real();
637 return result*ssfInt ;
645 <<
") 6th form dgamma = " << dgamma <<
", tau = " << tau << endl ;
664 <<
") 6th form dgamma = " << dgamma <<
", tau = " << tau << endl ;
708 std::complex<Double_t> eins(1,0);
709 std::complex<Double_t> k(1/tau,sign*omega);
710 std::complex<Double_t> term1 =
evalCerfInt(sign,-sign*omega*tau, tau, -sign*umin1, -sign*umax1,
c1);
712 std::complex<Double_t> term2 = std::complex<Double_t>(
evalCerfInt(-fsign, rtau, fsign*umin2, fsign*umax2,
c2)*fsign*sign,0);
713 return (term1+term2)/(eins + k*fsign*sign*rtau) ;
741 if (
fabs(tau-rtau)<1
e-10 &&
fabs(term1+term2)<1
e-10) {
742 cout <<
"epsilon method" << endl ;
746 return (term1+term2)/(eins + k*fsign*sign*rtau) ;
754 std::complex<Double_t> diff;
756 diff = std::complex<Double_t>(2,0) ;
760 return std::complex<Double_t>(tau/(1.+wt*wt),0)*std::complex<Double_t>(1,wt)*diff;
772 if ((umin<-8 && umax>8)||(umax<-8 && umin>8)) {
790 std::complex<Double_t> z(swt*
c,u+
c);
791 std::complex<Double_t> zc(u+
c,-swt*
c);
792 std::complex<Double_t> zsq= z*z;
793 std::complex<Double_t>
v= -zsq - u*u;
802 if (
matchArgs(directVars,generateVars,
x))
return 1 ;
double atan2(double, double)
static int verboseEval()
Return global level of verbosity for p.d.f. evaluations.
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 RooGExpModel is a RooResolutionModel implementation that models a resolution function that is t...
Double_t logErfC(Double_t x) const
Approximation of the log of the complex error function.
static std::complex< Double_t > evalCerf(Double_t swt, Double_t u, Double_t c)
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.
static std::complex< Double_t > evalCerfApprox(Double_t swt, Double_t u, Double_t c)
use the approximation: erf(z) = exp(-z*z)/(sqrt(pi)*z) to explicitly cancel the divergent exp(y*y) be...
Double_t evalCerfRe(Double_t u, Double_t c) const
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 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.
Double_t min(const char *rname=0) const
const RooAbsReal & arg() const
Double_t max(const char *rname=0) const
RooRealVar represents a fundamental (non-derived) real valued object.
RooRealVar & convVar() const
Return the convolution variable of the resolution model.
const RooFormulaVar & basis() const
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)