Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooGExpModel.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitModels *
4 * @(#)root/roofit:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16
17/** \class RooGExpModel
18 \ingroup Roofit
19
20The RooGExpModel is a RooResolutionModel implementation that models
21a resolution function that is the convolution of a Gaussian with
22a one-sided exponential. Such objects can be used
23for analytical convolutions with classes inheriting from RooAbsAnaConvPdf.
24\f[
25 \mathrm{GExp} = \exp \left( -\frac{1}{2} \left(\frac{x-\mu}{\sigma} \right)^2 \right)^2
26 \otimes \exp\left( -\frac{x}{\tau} \right)
27\f]
28
29**/
30
31#include "RooGExpModel.h"
32
33#include "RooMath.h"
34#include "RooRealConstant.h"
35#include "RooRandom.h"
36#include "TMath.h"
37
38namespace {
39
40enum RooGExpBasis {
41 noBasis = 0,
42 expBasisMinus = 1,
43 expBasisSum = 2,
44 expBasisPlus = 3,
45 sinBasisMinus = 11,
46 sinBasisSum = 12,
47 sinBasisPlus = 13,
48 cosBasisMinus = 21,
49 cosBasisSum = 22,
50 cosBasisPlus = 23,
51 sinhBasisMinus = 31,
52 sinhBasisSum = 32,
53 sinhBasisPlus = 33,
54 coshBasisMinus = 41,
55 coshBasisSum = 42,
56 coshBasisPlus = 43
57};
58
59enum BasisType { none = 0, expBasis = 1, sinBasis = 2, cosBasis = 3, sinhBasis = 4, coshBasis = 5 };
60
61enum BasisSign { Both = 0, Plus = +1, Minus = -1 };
62
63} // namespace
64
65
66
67////////////////////////////////////////////////////////////////////////////////
68/// Create a Gauss (x) Exp model with mean, sigma and tau parameters and scale factors for each parameter.
69///
70/// \note If scale factors for the parameters are not needed, `RooConst(1.)` can be passed.
71///
72/// \param[in] name Name of this instance.
73/// \param[in] title Title (e.g. for plotting)
74/// \param[in] xIn The convolution observable.
75/// \param[in] meanIn The mean of the Gaussian.
76/// \param[in] sigmaIn Width of the Gaussian.
77/// \param[in] rlifeIn Lifetime constant \f$ \tau \f$.
78/// \param[in] meanSF Scale factor for mean.
79/// \param[in] sigmaSF Scale factor for sigma.
80/// \param[in] rlifeSF Scale factor for rlife.
81/// \param[in] nlo Include next-to-leading order for higher accuracy of convolution.
82/// \param[in] type Switch between normal and flipped model.
83RooGExpModel::RooGExpModel(const char *name, const char *title, RooAbsRealLValue& xIn,
86 bool nlo, Type type) :
88 _mean("mean", "Mean of Gaussian component", this, meanIn),
89 sigma("sigma", "Width", this, sigmaIn),
90 rlife("rlife", "Life time", this, rlifeIn),
91 _meanSF("meanSF", "Scale factor for mean", this, meanSF),
92 ssf("ssf", "Sigma Scale Factor", this, sigmaSF),
93 rsf("rsf", "RLife Scale Factor", this, rlifeSF),
94 _flip(type==Flipped),
95 _nlo(nlo),
96 _flatSFInt(false),
97 _asympInt(false)
98{
99}
100
101
102////////////////////////////////////////////////////////////////////////////////
103/// Create a Gauss (x) Exp model with sigma and tau parameters.
104///
105/// \param[in] name Name of this instance.
106/// \param[in] title Title (e.g. for plotting)
107/// \param[in] xIn The convolution observable.
108/// \param[in] _sigma Width of the Gaussian.
109/// \param[in] _rlife Lifetime constant \f$ \tau \f$.
110/// \param[in] nlo Include next-to-leading order for higher accuracy of convolution.
111/// \param[in] type Switch between normal and flipped model.
112RooGExpModel::RooGExpModel(const char *name, const char *title, RooAbsRealLValue& xIn,
113 RooAbsReal& _sigma, RooAbsReal& _rlife,
114 bool nlo, Type type) :
116 _mean("mean", "Mean of Gaussian component", this, RooRealConstant::value(0.)),
117 sigma("sigma","Width",this,_sigma),
118 rlife("rlife","Life time",this,_rlife),
119 _meanSF("meanSF", "Scale factor for mean", this, RooRealConstant::value(1)),
120 ssf("ssf","Sigma Scale Factor",this,RooRealConstant::value(1)),
121 rsf("rsf","RLife Scale Factor",this,RooRealConstant::value(1)),
122 _flip(type==Flipped),_nlo(nlo), _flatSFInt(false), _asympInt(false)
123{
124}
125
126////////////////////////////////////////////////////////////////////////////////
127/// Create a Gauss (x) Exp model with sigma and tau parameters.
128///
129/// \param[in] name Name of this instance.
130/// \param[in] title Title (e.g. for plotting)
131/// \param[in] xIn The convolution observable.
132/// \param[in] _sigma Width of the Gaussian.
133/// \param[in] _rlife Lifetime constant \f$ \tau \f$.
134/// \param[in] _rsSF Scale factor for both sigma and tau.
135/// \param[in] nlo Include next-to-leading order for higher accuracy of convolution.
136/// \param[in] type Switch between normal and flipped model.
137RooGExpModel::RooGExpModel(const char *name, const char *title, RooAbsRealLValue& xIn,
138 RooAbsReal& _sigma, RooAbsReal& _rlife,
140 bool nlo, Type type) :
142 _mean("mean", "Mean of Gaussian component", this, RooRealConstant::value(0.)),
143 sigma("sigma","Width",this,_sigma),
144 rlife("rlife","Life time",this,_rlife),
145 _meanSF("meanSF", "Scale factor for mean", this, RooRealConstant::value(1)),
146 ssf("ssf","Sigma Scale Factor",this,_rsSF),
147 rsf("rsf","RLife Scale Factor",this,_rsSF),
148 _flip(type==Flipped),
149 _nlo(nlo),
150 _flatSFInt(false),
151 _asympInt(false)
152{
153}
154
155////////////////////////////////////////////////////////////////////////////////
156/// Create a Gauss (x) Exp model with sigma and tau parameters and scale factors.
157///
158/// \param[in] name Name of this instance.
159/// \param[in] title Title (e.g. for plotting)
160/// \param[in] xIn The convolution observable.
161/// \param[in] _sigma Width of the Gaussian.
162/// \param[in] _rlife Lifetime constant \f$ \tau \f$.
163/// \param[in] _sigmaSF Scale factor for sigma.
164/// \param[in] _rlifeSF Scale factor for rlife.
165/// \param[in] nlo Include next-to-leading order for higher accuracy of convolution.
166/// \param[in] type Switch between normal and flipped model.
167RooGExpModel::RooGExpModel(const char *name, const char *title, RooAbsRealLValue& xIn,
168 RooAbsReal& _sigma, RooAbsReal& _rlife,
170 bool nlo, Type type) :
172 _mean("mean", "Mean of Gaussian component", this, RooRealConstant::value(0.)),
173 sigma("sigma","Width",this,_sigma),
174 rlife("rlife","Life time",this,_rlife),
175 _meanSF("meanSF", "Scale factor for mean", this, RooRealConstant::value(1)),
176 ssf("ssf","Sigma Scale Factor",this,_sigmaSF),
177 rsf("rsf","RLife Scale Factor",this,_rlifeSF),
178 _flip(type==Flipped),
179 _nlo(nlo),
180 _flatSFInt(false),
181 _asympInt(false)
182{
183}
184
185////////////////////////////////////////////////////////////////////////////////
186
189 _mean("mean", this, other._mean),
190 sigma("sigma",this,other.sigma),
191 rlife("rlife",this,other.rlife),
192 _meanSF("meanSf", this, other._meanSF),
193 ssf("ssf",this,other.ssf),
194 rsf("rsf",this,other.rsf),
195 _flip(other._flip),
196 _nlo(other._nlo),
197 _flatSFInt(other._flatSFInt),
198 _asympInt(other._asympInt)
199{
200}
201
202////////////////////////////////////////////////////////////////////////////////
203
205{
206 std::string str = name;
207
208 // Remove whitespaces from the input string
209 str.erase(remove(str.begin(),str.end(),' '),str.end());
210
211 if (str == "exp(-@0/@1)") return expBasisPlus ;
212 if (str == "exp(@0/@1)") return expBasisMinus ;
213 if (str == "exp(-abs(@0)/@1)") return expBasisSum ;
214 if (str == "exp(-@0/@1)*sin(@0*@2)") return sinBasisPlus ;
215 if (str == "exp(@0/@1)*sin(@0*@2)") return sinBasisMinus ;
216 if (str == "exp(-abs(@0)/@1)*sin(@0*@2)") return sinBasisSum ;
217 if (str == "exp(-@0/@1)*cos(@0*@2)") return cosBasisPlus ;
218 if (str == "exp(@0/@1)*cos(@0*@2)") return cosBasisMinus ;
219 if (str == "exp(-abs(@0)/@1)*cos(@0*@2)") return cosBasisSum ;
220 if (str == "exp(-@0/@1)*sinh(@0*@2/2)") return sinhBasisPlus;
221 if (str == "exp(@0/@1)*sinh(@0*@2/2)") return sinhBasisMinus;
222 if (str == "exp(-abs(@0)/@1)*sinh(@0*@2/2)") return sinhBasisSum;
223 if (str == "exp(-@0/@1)*cosh(@0*@2/2)") return coshBasisPlus;
224 if (str == "exp(@0/@1)*cosh(@0*@2/2)") return coshBasisMinus;
225 if (str == "exp(-abs(@0)/@1)*cosh(@0*@2/2)") return coshBasisSum;
226
227 return 0 ;
228}
229
230
231namespace {
232////////////////////////////////////////////////////////////////////////////////
233/// Approximation of the log of the complex error function
234double logErfC(double xx)
235{
236 double t;
237 double z;
238 double ans;
239 z=std::abs(xx);
240 t=1.0/(1.0+0.5*z);
241
242 if (xx >= 0.0) {
243 ans = log(t) +
244 (-z * z - 1.26551223 +
245 t * (1.00002368 +
246 t * (0.37409196 +
247 t * (0.09678418 +
248 t * (-0.18628806 +
249 t * (0.27886807 +
250 t * (-1.13520398 + t * (1.48851587 + t * (-0.82215223 + t * 0.17087277)))))))));
251 } else {
252 ans = log(
253 2.0 -
254 t *
255 exp(-z * z - 1.26551223 +
256 t * (1.00002368 +
257 t * (0.37409196 +
258 t * (0.09678418 +
259 t * (-0.18628806 +
260 t * (0.27886807 + t * (-1.13520398 +
261 t * (1.48851587 + t * (-0.82215223 + t * 0.17087277))))))))));
262 }
263
264 return ans;
265}
266
267////////////////////////////////////////////////////////////////////////////////
268/// use the approximation: erf(z) = exp(-z*z)/(sqrt(pi)*z)
269/// to explicitly cancel the divergent exp(y*y) behaviour of
270/// CWERF for z = x + i y with large negative y
271
272std::complex<double> evalCerfApprox(double swt, double u, double c)
273{
274 static double rootpi= sqrt(atan2(0.,-1.));
275 std::complex<double> z(swt*c,u+c);
276 std::complex<double> zc(u+c,-swt*c);
277 std::complex<double> zsq= z*z;
278 std::complex<double> v= -zsq - u*u;
279
280 return std::exp(v)*(-std::exp(zsq)/(zc*rootpi) + 1.)*2.;
281}
282
283
284// Calculate exp(-u^2) cwerf(swt*c + i(u+c)), taking care of numerical instabilities
285std::complex<double> evalCerf(double swt, double u, double c)
286{
287 std::complex<double> z(swt*c,u+c);
288 return (z.imag()>-4.0) ? RooMath::faddeeva_fast(z)*std::exp(-u*u) : evalCerfApprox(swt,u,c) ;
289}
290
291
292// Calculate Re(exp(-u^2) cwerf(i(u+c)))
293// added FMV, 08/17/03
294inline double evalCerfRe(double u, double c) {
295 double expArg = u*2*c+c*c ;
296 if (expArg<300) {
297 return exp(expArg) * RooMath::erfc(u+c);
298 } else {
299 return exp(expArg+logErfC(u+c));
300 }
301}
302
303}
304
305
306
307////////////////////////////////////////////////////////////////////////////////
308
310{
311 static double root2(sqrt(2.)) ;
312
313 BasisType basisType = (BasisType)( (_basisCode == 0) ? 0 : (_basisCode/10) + 1 );
314 BasisSign basisSign = (BasisSign)( _basisCode - 10*(basisType-1) - 2 ) ;
315
316 double fsign = _flip?-1:1 ;
317
318 double sig = sigma*ssf ;
319 double rtau = rlife*rsf ;
320
321 double tau = (_basisCode!=noBasis)?(static_cast<RooAbsReal*>(basis().getParameter(1)))->getVal():0. ;
322 // added, FMV 07/27/03
324 double dGamma = (static_cast<RooAbsReal*>(basis().getParameter(2)))->getVal();
325 if (dGamma==0) basisType = expBasis;
326 }
327
328 // *** 1st form: Straight GExp, used for unconvoluted PDF or expBasis with 0 lifetime ***
329 if (basisType==none || ((basisType==expBasis || basisType==cosBasis) && tau==0.)) {
330 if (verboseEval()>2) std::cout << "RooGExpModel::evaluate(" << GetName() << ") 1st form" << std::endl ;
331
332 double expArg = sig*sig/(2*rtau*rtau) + fsign*(x - _mean*_meanSF)/rtau ;
333
334 double result ;
335 if (expArg<300) {
336 result = 1/(2*rtau) * exp(expArg) * RooMath::erfc(sig/(root2*rtau) + fsign*(x - _mean*_meanSF)/(root2*sig));
337 } else {
338 // If exponent argument is very large, bring canceling RooMath::erfc() term inside exponent
339 // to avoid floating point over/underflows of intermediate calculations
340 result = 1/(2*rtau) * exp(expArg + logErfC(sig/(root2*rtau) + fsign*(x - _mean*_meanSF)/(root2*sig))) ;
341 }
342
343// double result = 1/(2*rtau)
344// * exp(sig*sig/(2*rtau*rtau) + fsign*x/rtau)
345// * RooMath::erfc(sig/(root2*rtau) + fsign*x/(root2*sig));
346
347 // equivalent form, added FMV, 07/24/03
348 //double xprime = x/rtau ;
349 //double c = sig/(root2*rtau) ;
350 //double u = xprime/(2*c) ;
351 //double result = 0.5*evalCerf(fsign*u,c).real() ; // sign=-1 !
352
353 if (_basisCode!=0 && basisSign==Both) result *= 2 ;
354 //cout << "1st form " << "x= " << x << " result= " << result << std::endl;
355 return result ;
356 }
357
358 // *** 2nd form: 0, used for sinBasis and cosBasis with tau=0 ***
359 if (tau==0) {
360 if (verboseEval()>2) std::cout << "RooGExpModel::evaluate(" << GetName() << ") 2nd form" << std::endl ;
361 return 0. ;
362 }
363
364 double omega = (basisType!=expBasis)?(static_cast<RooAbsReal*>(basis().getParameter(2)))->getVal():0. ;
365
366 // *** 3nd form: Convolution with exp(-t/tau), used for expBasis and cosBasis(omega=0) ***
367 if (basisType==expBasis || (basisType==cosBasis && omega==0.)) {
368 if (verboseEval()>2) std::cout << "RooGExpModel::evaluate(" << GetName() << ") 3d form tau=" << tau << std::endl ;
369 double result(0) ;
370 if (basisSign!=Minus) result += calcDecayConv(+1,tau,sig,rtau,fsign) ; // modified FMV,08/13/03
371 if (basisSign!=Plus) result += calcDecayConv(-1,tau,sig,rtau,fsign) ; // modified FMV,08/13/03
372 //cout << "3rd form " << "x= " << x << " result= " << result << std::endl;
373 return result ;
374 }
375
376 // *** 4th form: Convolution with exp(-t/tau)*sin(omega*t), used for sinBasis(omega<>0,tau<>0) ***
377 double wt = omega *tau ;
378 if (basisType==sinBasis) {
379 if (verboseEval()>2) std::cout << "RooGExpModel::evaluate(" << GetName() << ") 4th form omega = "
380 << omega << ", tau = " << tau << std::endl ;
381 double result(0) ;
382 if (wt==0.) return result ;
383 if (basisSign!=Minus) result += -1*calcSinConv(+1,sig,tau,omega,rtau,fsign).imag() ;
384 if (basisSign!=Plus) result += -1*calcSinConv(-1,sig,tau,omega,rtau,fsign).imag() ;
385 //cout << "4th form " << "x= " << x << " result= " << result << std::endl;
386 return result ;
387 }
388
389 // *** 5th form: Convolution with exp(-t/tau)*cos(omega*t), used for cosBasis(omega<>0) ***
390 if (basisType==cosBasis) {
391 if (verboseEval()>2) std::cout << "RooGExpModel::evaluate(" << GetName()
392 << ") 5th form omega = " << omega << ", tau = " << tau << std::endl ;
393 double result(0) ;
394 if (basisSign!=Minus) result += calcSinConv(+1,sig,tau,omega,rtau,fsign).real() ;
395 if (basisSign!=Plus) result += calcSinConv(-1,sig,tau,omega,rtau,fsign).real() ;
396 //cout << "5th form " << "x= " << x << " result= " << result << std::endl;
397 return result ;
398 }
399
400
401 // *** 6th form: Convolution with exp(-t/tau)*sinh(dgamma*t/2), used for sinhBasis ***
402 if (basisType==sinhBasis) {
403 double dgamma = (static_cast<RooAbsReal*>(basis().getParameter(2)))->getVal();
404
405 if (verboseEval()>2) std::cout << "RooGExpModel::evaluate(" << GetName()
406 << ") 6th form = " << dgamma << ", tau = " << tau << std::endl;
407 double result(0);
408 //if (basisSign!=Minus) result += calcSinhConv(+1,+1,-1,tau,dgamma,sig,rtau,fsign);
409 //if (basisSign!=Plus) result += calcSinhConv(-1,-1,+1,tau,dgamma,sig,rtau,fsign);
410 // better form, since it also accounts for the numerical divergence region, added FMV, 07/24/03
411 double tau1 = 1/(1/tau-dgamma/2) ;
412 double tau2 = 1/(1/tau+dgamma/2) ;
413 if (basisSign!=Minus) result += 0.5*(calcDecayConv(+1,tau1,sig,rtau,fsign)-calcDecayConv(+1,tau2,sig,rtau,fsign));
414 // modified FMV,08/13/03
415 if (basisSign!=Plus) result += 0.5*(calcDecayConv(-1,tau2,sig,rtau,fsign)-calcDecayConv(-1,tau1,sig,rtau,fsign));
416 // modified FMV,08/13/03
417 //cout << "6th form " << "x= " << x << " result= " << result << std::endl;
418 return result;
419 }
420
421 // *** 7th form: Convolution with exp(-t/tau)*cosh(dgamma*t/2), used for coshBasis ***
422 if (basisType==coshBasis) {
423 double dgamma = (static_cast<RooAbsReal*>(basis().getParameter(2)))->getVal();
424
425 if (verboseEval()>2) std::cout << "RooGExpModel::evaluate(" << GetName()
426 << ") 7th form = " << dgamma << ", tau = " << tau << std::endl;
427 double result(0);
428 //if (basisSign!=Minus) result += calcCoshConv(+1,tau,dgamma,sig,rtau,fsign);
429 //if (basisSign!=Plus) result += calcCoshConv(-1,tau,dgamma,sig,rtau,fsign);
430 // better form, since it also accounts for the numerical divergence region, added FMV, 07/24/03
431 double tau1 = 1/(1/tau-dgamma/2) ;
432 double tau2 = 1/(1/tau+dgamma/2) ;
433 if (basisSign!=Minus) result += 0.5*(calcDecayConv(+1,tau1,sig,rtau,fsign)+calcDecayConv(+1,tau2,sig,rtau,fsign));
434 // modified FMV,08/13/03
435 if (basisSign!=Plus) result += 0.5*(calcDecayConv(-1,tau1,sig,rtau,fsign)+calcDecayConv(-1,tau2,sig,rtau,fsign));
436 // modified FMV,08/13/03
437 //cout << "7th form " << "x= " << x << " result= " << result << std::endl;
438 return result;
439 }
440 R__ASSERT(0) ;
441 return 0 ;
442 }
443
444
445////////////////////////////////////////////////////////////////////////////////
446
447std::complex<double> RooGExpModel::calcSinConv(double sign, double sig, double tau, double omega, double rtau, double fsign) const
448{
449 static double root2(sqrt(2.)) ;
450
451 double s1= -sign*(x - _mean*_meanSF)/tau;
452 //double s1= x/tau;
453 double c1= sig/(root2*tau);
454 double u1= s1/(2*c1);
455 double s2= (x - _mean*_meanSF)/rtau;
456 double c2= sig/(root2*rtau);
457 double u2= fsign*s2/(2*c2) ;
458 //double u2= s2/(2*c2) ;
459
460 std::complex<double> eins(1,0);
461 std::complex<double> k(1/tau,sign*omega);
462 //return (evalCerf(-sign*omega*tau,u1,c1)+evalCerf(0,u2,c2)*fsign*sign) / (eins + k*fsign*sign*rtau) ;
463
464 return (evalCerf(-sign*omega*tau,u1,c1)+std::complex<double>(evalCerfRe(u2,c2),0)*fsign*sign) / (eins + k*fsign*sign*rtau) ;
465 // equivalent form, added FMV, 07/24/03
466 //return (evalCerf(-sign*omega*tau,-sign*u1,c1)+evalCerf(0,fsign*u2,c2)*fsign*sign) / (eins + k*fsign*sign*rtau) ;
467}
468
469// added FMV,08/18/03
470
471////////////////////////////////////////////////////////////////////////////////
472
473double RooGExpModel::calcSinConv(double sign, double sig, double tau, double rtau, double fsign) const
474{
475 static double root2(sqrt(2.)) ;
476
477 double s1= -sign*(x - _mean*_meanSF)/tau;
478 //double s1= x/tau;
479 double c1= sig/(root2*tau);
480 double u1= s1/(2*c1);
481 double s2= (x - _mean*_meanSF)/rtau;
482 double c2= sig/(root2*rtau);
483 double u2= fsign*s2/(2*c2) ;
484 //double u2= s2/(2*c2) ;
485
486 double eins(1);
487 double k(1/tau);
488 return (evalCerfRe(u1,c1)+evalCerfRe(u2,c2)*fsign*sign) / (eins + k*fsign*sign*rtau) ;
489 // equivalent form, added FMV, 07/24/03
490 //return (evalCerf(-sign*u1,c1).real()+evalCerf(fsign*u2,c2).real()*fsign*sign) / (eins + k*fsign*sign*rtau) ;
491}
492
493////////////////////////////////////////////////////////////////////////////////
494
495double RooGExpModel::calcDecayConv(double sign, double tau, double sig, double rtau, double fsign) const
496// modified FMV,08/13/03
497{
498 static double root2(sqrt(2.)) ;
499 static double root2pi(sqrt(2*atan2(0.,-1.))) ;
500 static double rootpi(sqrt(atan2(0.,-1.)));
501
502 // Process flip status
503 double xp(x - _mean*_meanSF) ;
504 //if (_flip) {
505 // xp *= -1 ;
506 // sign *= -1 ;
507 //}
508 xp *= fsign ; // modified FMV,08/13/03
509 sign *= fsign ; // modified FMV,08/13/03
510
511 double cFly;
512 if ((sign<0)&&(std::abs(tau-rtau)<tau/260)) {
513
514 double MeanTau=0.5*(tau+rtau);
515 if (std::abs(xp/MeanTau)>300) {
516 return 0 ;
517 }
518
520 exp(-(-xp/MeanTau-sig*sig/(2*MeanTau*MeanTau)))
521 *(sig*exp(-1/(2*sig*sig)*std::pow((sig*sig/MeanTau+xp),2))
522 -(sig*sig/MeanTau+xp)*(rootpi/root2)*RooMath::erfc(sig/(root2*MeanTau)+xp/(root2*sig)));
523
524 if(_nlo) {
525 double epsilon=0.5*(tau-rtau);
526 double a=sig/(root2*MeanTau)+xp/(root2*sig);
527 cFly += 1./(MeanTau*MeanTau)
528 *exp(-(-xp/MeanTau-sig*sig/(2*MeanTau*MeanTau)))
529 *0.5/MeanTau*epsilon*epsilon*
530 (exp(-a*a)*(sig/MeanTau*root2/rootpi
531 -(4*a*sig*sig)/(2*rootpi*MeanTau*MeanTau)
532 +(-4/rootpi+8*a*a/rootpi)/6
533 *std::pow(sig/(root2*MeanTau),3)
534 +2/rootpi*(sig*sig/(MeanTau*MeanTau)+xp/MeanTau)*
535 (sig/(root2*MeanTau)-a*(sig*sig)/(2*MeanTau*MeanTau))
536 +2/rootpi*((3*sig*sig)/(2*MeanTau*MeanTau)+xp/MeanTau+
537 0.5*std::pow(sig*sig/(MeanTau*MeanTau)+xp/MeanTau,2))*sig/(root2*MeanTau))
538 -(2*sig*sig/(MeanTau*MeanTau)+xp/MeanTau+(sig*sig/(MeanTau*MeanTau)+xp/MeanTau)*
539 (3*sig*sig/(2*MeanTau*MeanTau)+xp/MeanTau)
540 +std::pow(sig*sig/(MeanTau*MeanTau)+xp/MeanTau,3)/6)*RooMath::erfc(a));
541 }
542
543 } else {
544
545 double expArg1 = sig*sig/(2*tau*tau)-sign*xp/tau ;
546 double expArg2 = sig*sig/(2*rtau*rtau)+xp/rtau ;
547
548 double term1;
549 double term2;
550 if (expArg1<300) {
551 term1 = exp(expArg1) *RooMath::erfc(sig/(root2*tau)-sign*xp/(root2*sig)) ;
552 } else {
553 term1 = exp(expArg1+logErfC(sig/(root2*tau)-sign*xp/(root2*sig))) ;
554 }
555 if (expArg2<300) {
556 term2 = exp(expArg2) *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)) ;
557 } else {
558 term2 = exp(expArg2+logErfC(sig/(root2*rtau)+xp/(root2*sig))) ;
559 }
560
561 cFly=(term1+sign*term2)/(2*(tau+sign*rtau));
562
563 // WVE prevent numeric underflows
564 if (cFly<1e-100) {
565 cFly = 0 ;
566 }
567
568 // equivalent form, added FMV, 07/24/03
569 //cFly = calcSinConv(sign, sig, tau, rtau, fsign)/(2*tau) ;
570 }
571
572 return cFly*2*tau ;
573}
574
575/* commented FMV, 07/24/03
576
577////////////////////////////////////////////////////////////////////////////////
578
579double RooGExpModel::calcCoshConv(double sign, double tau, double dgamma, double sig, double rtau, double fsign) const
580{
581
582
583 static double root2(sqrt(2.)) ;
584 static double root2pi(sqrt(2*atan2(0.,-1.))) ;
585 static double rootpi(sqrt(atan2(0.,-1.)));
586 double tau1 = 1/(1/tau-dgamma/2);
587 double tau2 = 1/(1/tau+dgamma/2);
588 double cFly;
589 double xp(x);
590
591 //if (_flip) {
592 // xp *= -1 ;
593 // sign *= -1 ;
594 //}
595 xp *= fsign ; // modified FMV,08/13/03
596 sign *= fsign ; // modified FMV,08/13/03
597
598 cFly=tau1*(exp(sig*sig/(2*tau1*tau1)-sign*xp/tau1)
599 *RooMath::erfc(sig/(root2*tau1)-sign*xp/(root2*sig))
600 +sign*exp(sig*sig/(2*rtau*rtau)+xp/rtau)
601 *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)))/(2*(tau1+sign*rtau))
602 +tau2*(exp(sig*sig/(2*tau2*tau2)-sign*xp/tau2)
603 *RooMath::erfc(sig/(root2*tau2)-sign*xp/(root2*sig))
604 +sign*exp(sig*sig/(2*rtau*rtau)+xp/rtau)
605 *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)))/(2*(tau2+sign*rtau));
606 return cFly;
607}
608*/
609
610/* commented FMV, 07/24/03
611
612////////////////////////////////////////////////////////////////////////////////
613
614double RooGExpModel::calcSinhConv(double sign, double sign1, double sign2, double tau, double dgamma, double sig, double rtau, double fsign) const
615{
616 static double root2(sqrt(2.)) ;
617 static double root2pi(sqrt(2*atan2(0.,-1.))) ;
618 static double rootpi(sqrt(atan2(0.,-1.)));
619 double tau1 = 1/(1/tau-dgamma/2);
620 double tau2 = 1/(1/tau+dgamma/2);
621 double cFly;
622 double xp(x);
623
624 //if (_flip) {
625 // xp *= -1 ;
626 // sign1 *= -1 ;
627 // sign2 *= -1 ;
628 //}
629 xp *= fsign ; // modified FMV,08/13/03
630 sign1 *= fsign ; // modified FMV,08/13/03
631 sign2 *= fsign ; // modified FMV,08/13/03
632
633 cFly=sign1*tau1*(exp(sig*sig/(2*tau1*tau1)-sign*xp/tau1)
634 *RooMath::erfc(sig/(root2*tau1)-sign*xp/(root2*sig))
635 +sign*exp(sig*sig/(2*rtau*rtau)+xp/rtau)
636 *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)))/(2*(tau1+sign*rtau))
637 +sign2*tau2*(exp(sig*sig/(2*tau2*tau2)-sign*xp/tau2)
638 *RooMath::erfc(sig/(root2*tau2)-sign*xp/(root2*sig))
639 +sign*exp(sig*sig/(2*rtau*rtau)+xp/rtau)
640 *RooMath::erfc(sig/(root2*rtau)+xp/(root2*sig)))/(2*(tau2+sign*rtau));
641 return cFly;
642}
643*/
644
645////////////////////////////////////////////////////////////////////////////////
646
647Int_t RooGExpModel::getAnalyticalIntegral(RooArgSet& allVars, RooArgSet& analVars, const char* /*rangeName*/) const
648{
649 switch(_basisCode) {
650
651 // Analytical integration capability of raw PDF
652 case noBasis:
653 if (matchArgs(allVars,analVars,convVar())) return 1 ;
654 break ;
655
656 // Analytical integration capability of convoluted PDF
657 case expBasisPlus:
658 case expBasisMinus:
659 case expBasisSum:
660 case sinBasisPlus:
661 case sinBasisMinus:
662 case sinBasisSum:
663 case cosBasisPlus:
664 case cosBasisMinus:
665 case cosBasisSum:
666 case sinhBasisPlus:
667 case sinhBasisMinus:
668 case sinhBasisSum:
669 case coshBasisPlus:
670 case coshBasisMinus:
671 case coshBasisSum:
672
673 // Optionally advertise flat integral over sigma scale factor
674 if (_flatSFInt) {
675 if (matchArgs(allVars,analVars,RooArgSet(convVar(),ssf.arg()))) {
676 return 2 ;
677 }
678 }
679
680 if (matchArgs(allVars,analVars,convVar())) return 1 ;
681 break ;
682 }
683
684 return 0 ;
685}
686
687////////////////////////////////////////////////////////////////////////////////
688
689double RooGExpModel::analyticalIntegral(Int_t code, const char* rangeName) const
690{
691 static double root2 = sqrt(2.) ;
692// static double rootPiBy2 = sqrt(atan2(0.0,-1.0)/2.0);
693 double ssfInt(1.0) ;
694
695 // Code must be 1 or 2
696 R__ASSERT(code==1||code==2) ;
697 if (code==2) {
698 ssfInt = (ssf.max(rangeName)-ssf.min(rangeName)) ;
699 }
700
701 BasisType basisType = (BasisType)( (_basisCode == 0) ? 0 : (_basisCode/10) + 1 );
702 BasisSign basisSign = (BasisSign)( _basisCode - 10*(basisType-1) - 2 ) ;
703
704 double tau = (_basisCode!=noBasis)?(static_cast<RooAbsReal*>(basis().getParameter(1)))->getVal():0 ;
705
706 // added FMV, 07/24/03
708 double dGamma = (static_cast<RooAbsReal*>(basis().getParameter(2)))->getVal();
709 if (dGamma==0) basisType = expBasis;
710 }
711 double fsign = _flip?-1:1 ;
712 double sig = sigma*ssf ;
713 double rtau = rlife*rsf ;
714
715 // *** 1st form????
716 if (basisType==none || ((basisType==expBasis || basisType==cosBasis) && tau==0.)) {
717 if (verboseEval()>0) std::cout << "RooGExpModel::analyticalIntegral(" << GetName() << ") 1st form" << std::endl ;
718
719 //double result = 1.0 ; // WVE inferred from limit(tau->0) of cosBasisNorm
720 // finite+asymtotic normalization, added FMV, 07/24/03
721 double xpmin = (x.min(rangeName) - _mean*_meanSF)/rtau ;
722 double xpmax = (x.max(rangeName) - _mean*_meanSF)/rtau ;
723 double c = sig/(root2*rtau) ;
724 double umin = xpmin/(2*c) ;
725 double umax = xpmax/(2*c) ;
726 double result ;
727 if (_asympInt) {
728 result = 1.0 ;
729 } else {
730 result = 0.5*evalCerfInt(-fsign,rtau,fsign*umin,fsign*umax,c)/rtau ; //WVEFIX add 1/rtau
731 }
732
733 if (_basisCode!=0 && basisSign==Both) result *= 2 ;
734 //cout << "Integral 1st form " << " result= " << result*ssfInt << std::endl;
735 return result*ssfInt ;
736 }
737
738 double omega = (basisType!=expBasis) ?(static_cast<RooAbsReal*>(basis().getParameter(2)))->getVal() : 0 ;
739
740 // *** 2nd form: unity, used for sinBasis and cosBasis with tau=0 (PDF is zero) ***
741 //if (tau==0&&omega!=0) {
742 if (tau==0) { // modified, FMV 07/24/03
743 if (verboseEval()>0) std::cout << "RooGExpModel::analyticalIntegral(" << GetName() << ") 2nd form" << std::endl ;
744 return 0. ;
745 }
746
747 // *** 3rd form: Convolution with exp(-t/tau), used for expBasis and cosBasis(omega=0) ***
748 if (basisType==expBasis || (basisType==cosBasis && omega==0.)) {
749 //double result = 2*tau ;
750 //if (basisSign==Both) result *= 2 ;
751 // finite+asymtotic normalization, added FMV, 07/24/03
752 double result(0.);
753 if (basisSign!=Minus) result += calcSinConvNorm(+1,tau,sig,rtau,fsign,rangeName);
754 if (basisSign!=Plus) result += calcSinConvNorm(-1,tau,sig,rtau,fsign,rangeName);
755 //cout << "Integral 3rd form " << " result= " << result*ssfInt << std::endl;
756 return result*ssfInt ;
757 }
758
759 // *** 4th form: Convolution with exp(-t/tau)*sin(omega*t), used for sinBasis(omega<>0,tau<>0) ***
760 double wt = omega * tau ;
761 if (basisType==sinBasis) {
762 if (verboseEval()>0) std::cout << "RooGExpModel::analyticalIntegral(" << GetName() << ") 4th form omega = "
763 << omega << ", tau = " << tau << std::endl ;
764 //cout << "sin integral" << std::endl;
765 double result(0) ;
766 if (wt==0) return result ;
767 //if (basisSign!=Minus) result += calcSinConvNorm(+1,tau,omega).imag() ;
768 //if (basisSign!=Plus) result += calcSinConvNorm(-1,tau,omega).imag() ;
769 // finite+asymtotic normalization, added FMV, 07/24/03
770 if (basisSign!=Minus) result += -1*calcSinConvNorm(+1,tau,omega,sig,rtau,fsign,rangeName).imag();
771 if (basisSign!=Plus) result += -1*calcSinConvNorm(-1,tau,omega,sig,rtau,fsign,rangeName).imag();
772 //cout << "Integral 4th form " << " result= " << result*ssfInt << std::endl;
773 return result*ssfInt ;
774 }
775
776 // *** 5th form: Convolution with exp(-t/tau)*cos(omega*t), used for cosBasis(omega<>0) ***
777 if (basisType==cosBasis) {
778 if (verboseEval()>0) std::cout << "RooGExpModel::analyticalIntegral(" << GetName()
779 << ") 5th form omega = " << omega << ", tau = " << tau << std::endl ;
780 //cout << "cos integral" << std::endl;
781 double result(0) ;
782 //if (basisSign!=Minus) result += calcSinConvNorm(+1,tau,omega).real() ;
783 //if (basisSign!=Plus) result += calcSinConvNorm(-1,tau,omega).real() ;
784 // finite+asymtotic normalization, added FMV, 07/24/03
785 if (basisSign!=Minus) result += calcSinConvNorm(+1,tau,omega,sig,rtau,fsign,rangeName).real();
786 if (basisSign!=Plus) result += calcSinConvNorm(-1,tau,omega,sig,rtau,fsign,rangeName).real();
787 //cout << "Integral 5th form " << " result= " << result*ssfInt << std::endl;
788 return result*ssfInt ;
789 }
790
791 double dgamma = ((basisType==coshBasis)||(basisType==sinhBasis))?(static_cast<RooAbsReal*>(basis().getParameter(2)))->getVal():0 ;
792
793 // *** 6th form: Convolution with exp(-t/tau)*sinh(dgamma*t/2), used for sinhBasis ***
794 if (basisType==sinhBasis) {
795 if (verboseEval()>0) std::cout << "RooGExpModel::analyticalIntegral(" << GetName()
796 << ") 6th form dgamma = " << dgamma << ", tau = " << tau << std::endl ;
797 double tau1 = 1/(1/tau-dgamma/2);
798 double tau2 = 1/(1/tau+dgamma/2);
799 //cout << "sinh integral" << std::endl;
800 double result(0) ;
801 //if (basisSign!=Minus) result += tau1-tau2 ;
802 //if (basisSign!=Plus) result += tau2-tau1 ;
803 // finite+asymtotic normalization, added FMV, 07/24/03
804 if (basisSign!=Minus) result += 0.5*(calcSinConvNorm(+1,tau1,sig,rtau,fsign,rangeName)-
805 calcSinConvNorm(+1,tau2,sig,rtau,fsign,rangeName));
806 if (basisSign!=Plus) result += 0.5*(calcSinConvNorm(-1,tau2,sig,rtau,fsign,rangeName)-
807 calcSinConvNorm(-1,tau1,sig,rtau,fsign,rangeName));
808 //cout << "Integral 6th form " << " result= " << result*ssfInt << std::endl;
809 return result;
810 }
811
812 // ** 7th form: Convolution with exp(-t/tau)*cosh(dgamma*t/2), used for coshBasis ***
813 if (basisType==coshBasis) {
814 if (verboseEval()>0) std::cout << "RooGExpModel::analyticalIntegral(" << GetName()
815 << ") 6th form dgamma = " << dgamma << ", tau = " << tau << std::endl ;
816 //cout << "cosh integral" << std::endl;
817 double tau1 = 1/(1/tau-dgamma/2);
818 double tau2 = 1/(1/tau+dgamma/2);
819 //double result = (tau1+tau2) ;
820 //if (basisSign==Both) result *= 2 ;
821 // finite+asymtotic normalization, added FMV, 07/24/03
822 double result(0);
823 if (basisSign!=Minus) result += 0.5*(calcSinConvNorm(+1,tau1,sig,rtau,fsign,rangeName)+
824 calcSinConvNorm(+1,tau2,sig,rtau,fsign,rangeName));
825 if (basisSign!=Plus) result += 0.5*(calcSinConvNorm(-1,tau1,sig,rtau,fsign,rangeName)+
826 calcSinConvNorm(-1,tau2,sig,rtau,fsign,rangeName));
827 //cout << "Integral 7th form " << " result= " << result*ssfInt << std::endl;
828 return result;
829
830 }
831
832 R__ASSERT(0) ;
833 return 1 ;
834}
835
836// modified FMV, 07/24/03. Finite+asymtotic normalization
837
838////////////////////////////////////////////////////////////////////////////////
839/// old code (asymptotic normalization only)
840/// std::complex<double> z(1/tau,sign*omega);
841/// return z*2/(omega*omega+1/(tau*tau));
842
843std::complex<double> RooGExpModel::calcSinConvNorm(double sign, double tau, double omega,
844 double sig, double rtau, double fsign, const char* rangeName) const
845{
846 static double root2(sqrt(2.)) ;
847
848 double smin1= (x.min(rangeName) - _mean*_meanSF)/tau;
849 double smax1= (x.max(rangeName) - _mean*_meanSF)/tau;
850 double c1= sig/(root2*tau);
851 double umin1= smin1/(2*c1);
852 double umax1= smax1/(2*c1);
853 double smin2= (x.min(rangeName) - _mean*_meanSF)/rtau;
854 double smax2= (x.max(rangeName) - _mean*_meanSF)/rtau;
855 double c2= sig/(root2*rtau);
856 double umin2= smin2/(2*c2) ;
857 double umax2= smax2/(2*c2) ;
858
859 std::complex<double> eins(1,0);
860 std::complex<double> k(1/tau,sign*omega);
861 std::complex<double> term1 = evalCerfInt(sign,-sign*omega*tau, tau, -sign*umin1, -sign*umax1, c1);
862 //std::complex<double> term2 = evalCerfInt(-fsign,0., rtau, fsign*umin2, fsign*umax2, c2)*std::complex<double>(fsign*sign,0);
863 std::complex<double> term2 = std::complex<double>(evalCerfInt(-fsign, rtau, fsign*umin2, fsign*umax2, c2)*fsign*sign,0);
864 return (term1+term2)/(eins + k*fsign*sign*rtau) ;
865}
866
867// added FMV, 08/17/03
868
869////////////////////////////////////////////////////////////////////////////////
870
871double RooGExpModel::calcSinConvNorm(double sign, double tau, double sig, double rtau, double fsign, const char* rangeName) const
872{
873 static double root2(sqrt(2.)) ;
874
875 double smin1= (x.min(rangeName) - _mean*_meanSF)/tau;
876 double smax1= (x.max(rangeName) - _mean*_meanSF)/tau;
877 double c1= sig/(root2*tau);
878 double umin1= smin1/(2*c1);
879 double umax1= smax1/(2*c1);
880 double smin2= (x.min(rangeName) - _mean*_meanSF)/rtau;
881 double smax2= (x.max(rangeName) - _mean*_meanSF)/rtau;
882 double c2= sig/(root2*rtau);
883 double umin2= smin2/(2*c2) ;
884 double umax2= smax2/(2*c2) ;
885
886 double eins(1);
887 double k(1/tau);
888 double term1 = evalCerfInt(sign, tau, -sign*umin1, -sign*umax1, c1);
890
891 // WVE Handle 0/0 numeric divergence
892 if (std::abs(tau-rtau)<1e-10 && std::abs(term1+term2)<1e-10) {
893 std::cout << "epsilon method" << std::endl ;
894 static double epsilon = 1e-4 ;
895 return calcSinConvNorm(sign,tau+epsilon,sig,rtau-epsilon,fsign,rangeName) ;
896 }
897 return (term1+term2)/(eins + k*fsign*sign*rtau) ;
898}
899
900// added FMV, 07/24/03
901////////////////////////////////////////////////////////////////////////////////
902
903std::complex<double> RooGExpModel::evalCerfInt(double sign, double wt, double tau, double umin, double umax, double c) const
904{
905 std::complex<double> diff;
906 if (_asympInt) {
907 diff = std::complex<double>(2,0) ;
908 } else {
909 diff = std::complex<double>(sign,0.)*(evalCerf(wt,umin,c) - evalCerf(wt,umax,c) + RooMath::erf(umin) - RooMath::erf(umax));
910 }
911 return std::complex<double>(tau/(1.+wt*wt),0)*std::complex<double>(1,wt)*diff;
912}
913// added FMV, 08/17/03. Modified FMV, 08/30/03
914
915////////////////////////////////////////////////////////////////////////////////
916
917double RooGExpModel::evalCerfInt(double sign, double tau, double umin, double umax, double c) const
918{
919 double diff;
920 if (_asympInt) {
921 diff = 2. ;
922 } else {
924 // If integral is over >8 sigma, approximate with full integral
925 diff = 2. ;
926 } else {
928 }
929 }
930 return tau*diff;
931}
932
933////////////////////////////////////////////////////////////////////////////////
934
936{
937 if (matchArgs(directVars,generateVars,x)) return 1 ;
938 return 0 ;
939}
940
941////////////////////////////////////////////////////////////////////////////////
942
944{
945 R__ASSERT(code==1) ;
946 double xgen ;
947 while (true) {
948 double xgau = RooRandom::randomGenerator()->Gaus(0,(sigma*ssf));
949 double xexp = RooRandom::uniform();
950 if (!_flip) {
951 xgen = xgau + (rlife*rsf)*log(xexp); // modified, FMV 08/13/03
952 } else {
953 xgen = xgau - (rlife * rsf) * log(xexp);
954 }
955
956 if (xgen < (x.max() - _mean*_meanSF) && xgen > (x.min() - _mean*_meanSF)) {
957 x = xgen + _mean*_meanSF;
958 return ;
959 }
960 }
961}
#define c(i)
Definition RSha256.hxx:101
#define a(i)
Definition RSha256.hxx:99
#define s1(x)
Definition RSha256.hxx:91
#define e(i)
Definition RSha256.hxx:103
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Definition TError.h:125
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
static int verboseEval()
Return global level of verbosity for p.d.f. evaluations.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition RooAbsReal.h:103
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.
Definition RooArgSet.h:24
The RooGExpModel is a RooResolutionModel implementation that models a resolution function that is the...
RooRealProxy ssf
RooGExpModel()=default
std::complex< double > evalCerfInt(double sign, double wt, double tau, double umin, double umax, double c) const
std::complex< double > calcSinConv(double sign, double sig, double tau, double omega, double rtau, double fsign) const
RooRealProxy rlife
double calcDecayConv(double sign, double tau, double sig, double rtau, double fsign) const
double evaluate() const override
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
void generateEvent(Int_t code) override
Interface for generation of an event using the algorithm corresponding to the specified code.
RooRealProxy sigma
RooRealProxy rsf
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...
RooRealProxy _meanSF
std::complex< double > calcSinConvNorm(double sign, double tau, double omega, double sig, double rtau, double fsign, const char *rangeName) const
old code (asymptotic normalization only) std::complex<double> z(1/tau,sign*omega); return z*2/(omega*...
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=nullptr) const override
Interface function getAnalyticalIntergral advertises the analytical integrals that are supported.
RooRealProxy _mean
Int_t basisCode(const char *name) const override
static std::complex< double > erfc(const std::complex< double > z)
complex erfc function
Definition RooMath.cxx:40
static std::complex< double > erf(const std::complex< double > z)
complex erf function
Definition RooMath.cxx:59
static std::complex< double > faddeeva_fast(std::complex< double > z)
evaluate Faddeeva function for complex argument (fast version)
Definition RooMath.cxx:35
static double uniform(TRandom *generator=randomGenerator())
Return a number uniformly distributed from (0,1)
Definition RooRandom.cxx:77
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
Definition RooRandom.cxx:47
Provides static functions to create and keep track of RooRealVar constants.
RooResolutionModel is the base class for PDFs that represent a resolution model that can be convolute...
Int_t _basisCode
Identifier code for selected basis function.
RooAbsRealLValue & convVar() const
Return the convolution variable of the resolution model.
const RooFormulaVar & basis() const
RooTemplateProxy< RooAbsRealLValue > x
Dependent/convolution variable.
double max(const char *rname=nullptr) 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.
double min(const char *rname=nullptr) const
Query lower limit of range. This requires the payload to be RooAbsRealLValue or derived.
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
const Double_t sigma
return c1
Definition legend1.C:41
Double_t x[n]
Definition legend1.C:17
return c2
Definition legend2.C:14