54 sigma(
"sigma",
"Width",this,_sigma),
55 rlife(
"rlife",
"Life time",this,_rlife),
58 _flip(type==Flipped),_nlo(nlo), _flatSFInt(
kFALSE), _asympInt(
kFALSE)
71 sigma(
"sigma",
"Width",this,_sigma),
72 rlife(
"rlife",
"Life time",this,_rlife),
73 ssf(
"ssf",
"Sigma Scale Factor",this,_rsSF),
74 rsf(
"rsf",
"RLife Scale Factor",this,_rsSF),
91 sigma(
"sigma",
"Width",this,_sigma),
92 rlife(
"rlife",
"Life time",this,_rlife),
93 ssf(
"ssf",
"Sigma Scale Factor",this,_sigmaSF),
94 rsf(
"rsf",
"RLife Scale Factor",this,_rlifeSF),
110 ssf(
"ssf",this,other.
ssf),
111 rsf(
"rsf",this,other.
rsf),
134 if (!TString(
"exp(-@0/@1)").CompareTo(name))
return expBasisPlus ;
135 if (!TString(
"exp(@0/@1)").CompareTo(name))
return expBasisMinus ;
136 if (!TString(
"exp(-abs(@0)/@1)").CompareTo(name))
return expBasisSum ;
137 if (!TString(
"exp(-@0/@1)*sin(@0*@2)").CompareTo(name))
return sinBasisPlus ;
138 if (!TString(
"exp(@0/@1)*sin(@0*@2)").CompareTo(name))
return sinBasisMinus ;
139 if (!TString(
"exp(-abs(@0)/@1)*sin(@0*@2)").CompareTo(name))
return sinBasisSum ;
140 if (!TString(
"exp(-@0/@1)*cos(@0*@2)").CompareTo(name))
return cosBasisPlus ;
141 if (!TString(
"exp(@0/@1)*cos(@0*@2)").CompareTo(name))
return cosBasisMinus ;
142 if (!TString(
"exp(-abs(@0)/@1)*cos(@0*@2)").CompareTo(name))
return cosBasisSum ;
143 if (!TString(
"exp(-@0/@1)*sinh(@0*@2/2)").CompareTo(name))
return sinhBasisPlus;
144 if (!TString(
"exp(@0/@1)*sinh(@0*@2/2)").CompareTo(name))
return sinhBasisMinus;
145 if (!TString(
"exp(-abs(@0)/@1)*sinh(@0*@2/2)").CompareTo(name))
return sinhBasisSum;
146 if (!TString(
"exp(-@0/@1)*cosh(@0*@2/2)").CompareTo(name))
return coshBasisPlus;
147 if (!TString(
"exp(@0/@1)*cosh(@0*@2/2)").CompareTo(name))
return coshBasisMinus;
148 if (!TString(
"exp(-abs(@0)/@1)*cosh(@0*@2/2)").CompareTo(name))
return coshBasisSum;
174 if (dGamma==0) basisType =
expBasis;
179 if (
verboseEval()>2) cout <<
"RooGExpModel::evaluate(" <<
GetName() <<
") 1st form" << endl ;
181 Double_t expArg = sig*sig/(2*rtau*rtau) + fsign*
x/rtau ;
185 result = 1/(2*rtau) *
exp(expArg) *
RooMath::erfc(sig/(root2*rtau) + fsign*
x/(root2*sig));
189 result = 1/(2*rtau) *
exp(expArg +
logErfC(sig/(root2*rtau) + fsign*
x/(root2*sig))) ;
209 if (
verboseEval()>2) cout <<
"RooGExpModel::evaluate(" <<
GetName() <<
") 2nd form" << endl ;
217 if (
verboseEval()>2) cout <<
"RooGExpModel::evaluate(" <<
GetName() <<
") 3d form tau=" << tau << endl ;
228 if (
verboseEval()>2) cout <<
"RooGExpModel::evaluate(" <<
GetName() <<
") 4th form omega = " 229 << omega <<
", tau = " << tau << endl ;
231 if (wt==0.)
return result ;
232 if (basisSign!=
Minus) result += -1*
calcSinConv(+1,sig,tau,omega,rtau,fsign).imag() ;
233 if (basisSign!=
Plus) result += -1*
calcSinConv(-1,sig,tau,omega,rtau,fsign).imag() ;
241 <<
") 5th form omega = " << omega <<
", tau = " << tau << endl ;
243 if (basisSign!=
Minus) result +=
calcSinConv(+1,sig,tau,omega,rtau,fsign).real() ;
244 if (basisSign!=
Plus) result +=
calcSinConv(-1,sig,tau,omega,rtau,fsign).real() ;
255 <<
") 6th form = " << dgamma <<
", tau = " << tau << endl;
260 Double_t tau1 = 1/(1/tau-dgamma/2) ;
261 Double_t tau2 = 1/(1/tau+dgamma/2) ;
275 <<
") 7th form = " << dgamma <<
", tau = " << tau << endl;
280 Double_t tau1 = 1/(1/tau-dgamma/2) ;
281 Double_t tau2 = 1/(1/tau+dgamma/2) ;
305 ans=
log(t)+(-z*z-1.26551223+t*(1.00002368+t*(0.37409196+t*(0.09678418+t*(-0.18628806+
306 t*(0.27886807+t*(-1.13520398+t*(1.48851587+t*(-0.82215223+t*0.17087277)))))))));
308 ans=
log(2.0-t*
exp(-z*z-1.26551223+t*(1.00002368+t*(0.37409196+t*(0.09678418+t*(-0.18628806+
309 t*(0.27886807+t*(-1.13520398+t*(1.48851587+t*(-0.82215223+t*0.17087277))))))))));
331 std::complex<Double_t> eins(1,0);
332 std::complex<Double_t> k(1/tau,sign*omega);
335 return (
evalCerf(-sign*omega*tau,u1,c1)+std::complex<Double_t>(
evalCerfRe(u2,c2),0)*fsign*sign) / (eins + k*fsign*sign*rtau) ;
389 if (
fabs(xp/MeanTau)>300) {
393 cFly=1./(MeanTau*MeanTau*root2pi) *
394 exp(-(-xp/MeanTau-sig*sig/(2*MeanTau*MeanTau)))
396 -(sig*sig/MeanTau+xp)*(rootpi/root2)*
RooMath::erfc(sig/(root2*MeanTau)+xp/(root2*sig)));
400 Double_t a=sig/(root2*MeanTau)+xp/(root2*sig);
401 cFly += 1./(MeanTau*MeanTau)
402 *
exp(-(-xp/MeanTau-sig*sig/(2*MeanTau*MeanTau)))
403 *0.5/MeanTau*epsilon*epsilon*
404 (
exp(-a*a)*(sig/MeanTau*root2/rootpi
405 -(4*a*sig*sig)/(2*rootpi*MeanTau*MeanTau)
406 +(-4/rootpi+8*a*a/rootpi)/6
408 +2/rootpi*(sig*sig/(MeanTau*MeanTau)+xp/MeanTau)*
409 (sig/(root2*MeanTau)-a*(sig*sig)/(2*MeanTau*MeanTau))
410 +2/rootpi*((3*sig*sig)/(2*MeanTau*MeanTau)+xp/MeanTau+
411 0.5*
TMath::Power(sig*sig/(MeanTau*MeanTau)+xp/MeanTau,2))*sig/(root2*MeanTau))
412 -(2*sig*sig/(MeanTau*MeanTau)+xp/MeanTau+(sig*sig/(MeanTau*MeanTau)+xp/MeanTau)*
413 (3*sig*sig/(2*MeanTau*MeanTau)+xp/MeanTau)
420 Double_t expArg2 = sig*sig/(2*rtau*rtau)+xp/rtau ;
426 term1 =
exp(expArg1+
logErfC(sig/(root2*
tau)-sign*xp/(root2*sig))) ; ;
431 term2 =
exp(expArg2+
logErfC(sig/(root2*rtau)+xp/(root2*sig))) ; ;
434 cFly=(term1+sign*term2)/(2*(
tau+sign*rtau));
452 Double_t RooGExpModel::calcCoshConv(Double_t sign, Double_t tau, Double_t dgamma, Double_t sig, Double_t rtau, Double_t fsign) const
456 static Double_t root2(sqrt(2.)) ;
457 static Double_t root2pi(sqrt(2*atan2(0.,-1.))) ;
458 static Double_t rootpi(sqrt(atan2(0.,-1.)));
459 Double_t tau1 = 1/(1/tau-dgamma/2);
460 Double_t tau2 = 1/(1/tau+dgamma/2);
468 xp *= fsign ; // modified FMV,08/13/03
469 sign *= fsign ; // modified FMV,08/13/03
471 cFly=tau1*(exp(sig*sig/(2*tau1*tau1)-sign*xp/tau1)
472 *RooMath::erfc(sig/(root2*tau1)-sign*xp/(root2*sig))
473 +sign*exp(sig*sig/(2*rtau*rtau)+xp/rtau)
474 *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)))/(2*(tau1+sign*rtau))
475 +tau2*(exp(sig*sig/(2*tau2*tau2)-sign*xp/tau2)
476 *RooMath::erfc(sig/(root2*tau2)-sign*xp/(root2*sig))
477 +sign*exp(sig*sig/(2*rtau*rtau)+xp/rtau)
478 *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)))/(2*(tau2+sign*rtau));;
487 Double_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
489 static Double_t root2(sqrt(2.)) ;
490 static Double_t root2pi(sqrt(2*atan2(0.,-1.))) ;
491 static Double_t rootpi(sqrt(atan2(0.,-1.)));
492 Double_t tau1 = 1/(1/tau-dgamma/2);
493 Double_t tau2 = 1/(1/tau+dgamma/2);
502 xp *= fsign ; // modified FMV,08/13/03
503 sign1 *= fsign ; // modified FMV,08/13/03
504 sign2 *= fsign ; // modified FMV,08/13/03
506 cFly=sign1*tau1*(exp(sig*sig/(2*tau1*tau1)-sign*xp/tau1)
507 *RooMath::erfc(sig/(root2*tau1)-sign*xp/(root2*sig))
508 +sign*exp(sig*sig/(2*rtau*rtau)+xp/rtau)
509 *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)))/(2*(tau1+sign*rtau))
510 +sign2*tau2*(exp(sig*sig/(2*tau2*tau2)-sign*xp/tau2)
511 *RooMath::erfc(sig/(root2*tau2)-sign*xp/(root2*sig))
512 +sign*exp(sig*sig/(2*rtau*rtau)+xp/rtau)
513 *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)))/(2*(tau2+sign*rtau));;
585 if (dGamma==0) basisType =
expBasis;
593 if (
verboseEval()>0) cout <<
"RooGExpModel::analyticalIntegral(" <<
GetName() <<
") 1st form" << endl ;
606 result = 0.5*
evalCerfInt(-fsign,rtau,fsign*umin,fsign*umax,c)/rtau ;
611 return result*ssfInt ;
619 if (
verboseEval()>0) cout <<
"RooGExpModel::analyticalIntegral(" <<
GetName() <<
") 2nd form" << endl ;
632 return result*ssfInt ;
638 if (
verboseEval()>0) cout <<
"RooGExpModel::analyticalIntegral(" <<
GetName() <<
") 4th form omega = " 639 << omega <<
", tau = " << tau << endl ;
642 if (wt==0)
return result ;
646 if (basisSign!=
Minus) result += -1*
calcSinConvNorm(+1,tau,omega,sig,rtau,fsign,rangeName).imag();
647 if (basisSign!=
Plus) result += -1*
calcSinConvNorm(-1,tau,omega,sig,rtau,fsign,rangeName).imag();
649 return result*ssfInt ;
655 <<
") 5th form omega = " << omega <<
", tau = " << tau << endl ;
662 if (basisSign!=
Plus) result +=
calcSinConvNorm(-1,tau,omega,sig,rtau,fsign,rangeName).real();
664 return result*ssfInt ;
672 <<
") 6th form dgamma = " << dgamma <<
", tau = " << tau << endl ;
691 <<
") 6th form dgamma = " << dgamma <<
", tau = " << tau << endl ;
736 std::complex<Double_t> eins(1,0);
737 std::complex<Double_t> k(1/tau,sign*omega);
738 std::complex<Double_t> term1 =
evalCerfInt(sign,-sign*omega*tau, tau, -sign*umin1, -sign*umax1, c1);
740 std::complex<Double_t> term2 = std::complex<Double_t>(
evalCerfInt(-fsign, rtau, fsign*umin2, fsign*umax2, c2)*fsign*sign,0);
741 return (term1+term2)/(eins + k*fsign*sign*rtau) ;
770 if (
fabs(tau-rtau)<1
e-10 &&
fabs(term1+term2)<1
e-10) {
771 cout <<
"epsilon method" << endl ;
773 return calcSinConvNorm(sign,tau+epsilon,sig,rtau-epsilon,fsign,rangeName) ;
775 return (term1+term2)/(eins + k*fsign*sign*rtau) ;
785 std::complex<Double_t> diff;
787 diff = std::complex<Double_t>(2,0) ;
791 return std::complex<Double_t>(tau/(1.+wt*wt),0)*std::complex<Double_t>(1,wt)*diff;
803 if ((umin<-8 && umax>8)||(umax<-8 && umin>8)) {
823 std::complex<Double_t>
z(swt*c,u+c);
824 std::complex<Double_t> zc(u+c,-swt*c);
825 std::complex<Double_t> zsq= z*
z;
826 std::complex<Double_t>
v= -zsq - u*u;
837 if (
matchArgs(directVars,generateVars,
x))
return 1 ;
virtual const char * GetName() const
Returns name of object.
XYZVector ans(TestRotation const &t, XYZVector const &v_in)
Double_t logErfC(Double_t x) const
Approximation of the log of the complex error function.
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...
Bool_t matchArgs(const RooArgSet &allDeps, RooArgSet &numDeps, const RooArgProxy &a) const
Utility function for use in getAnalyticalIntegral().
Double_t getVal(const RooArgSet *set=0) const
void generateEvent(Int_t code)
Interface for generation of anan event using the algorithm corresponding to the specified code...
virtual Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported...
RooRealVar & convVar() const
Return the convolution variable of the resolution model.
virtual Int_t basisCode(const char *name) const
RooRealConstant provides static functions to create and keep track of RooRealVar constants.
static int verboseEval()
Return global level of verbosity for p.d.f. evaluations.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
const RooFormulaVar & basis() const
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...
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t tau
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
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
RooRealVar represents a fundamental (non-derived) real valued object.
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
Double_t calcDecayConv(Double_t sign, Double_t tau, Double_t sig, Double_t rtau, Double_t fsign) const
static std::complex< double > erfc(const std::complex< double > z)
complex erfc function
static std::complex< Double_t > evalCerf(Double_t swt, Double_t u, Double_t c)
static Double_t uniform(TRandom *generator=randomGenerator())
Return a number uniformly distributed from (0,1)
Double_t min(const char *rname=0) const
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Double_t evalCerfRe(Double_t u, Double_t c) const
double atan2(double, double)
virtual ~RooGExpModel()
Destructor.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
std::complex< Double_t > evalCerfInt(Double_t sign, Double_t wt, Double_t tau, Double_t umin, Double_t umax, Double_t c) const
you should not use this method at all Int_t Int_t z
Double_t max(const char *rname=0) const
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 > 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...
Class RooGExpModel is a RooResolutionModel implementation that models a resolution function that is t...
static std::complex< double > erf(const std::complex< double > z)
complex erf function
const RooAbsReal & arg() 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