CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
Genfun::PuncturedSmearedExp Class Reference

#include <PuncturedSmearedExp.hh>

+ Inheritance diagram for Genfun::PuncturedSmearedExp:

Public Member Functions

 PuncturedSmearedExp ()
 
 PuncturedSmearedExp (const PuncturedSmearedExp &right)
 
virtual ~PuncturedSmearedExp ()
 
virtual double operator() (double argument) const override
 
virtual double operator() (const Argument &a) const override
 
Parameterlifetime ()
 
const Parameterlifetime () const
 
Parametersigma ()
 
const Parametersigma () const
 
void puncture (double min, double max)
 
Parametermin (unsigned int i)
 
Parametermax (unsigned int i)
 
const Parametermin (unsigned int i) const
 
const Parametermax (unsigned int i) const
 
- Public Member Functions inherited from Genfun::AbsFunction
 AbsFunction ()
 
 AbsFunction (const AbsFunction &right)
 
virtual ~AbsFunction ()
 
virtual unsigned int dimensionality () const
 
virtual double operator() (double argument) const =0
 
virtual double operator() (const Argument &argument) const =0
 
virtual AbsFunctionclone () const =0
 
virtual FunctionComposition operator() (const AbsFunction &f) const
 
virtual ParameterComposition operator() (const AbsParameter &p) const
 
Derivative derivative (const Variable &v) const
 
Derivative prime () const
 
virtual bool hasAnalyticDerivative () const
 
virtual Derivative partial (unsigned int) const
 

Detailed Description

Author

Definition at line 22 of file PuncturedSmearedExp.hh.

Constructor & Destructor Documentation

◆ PuncturedSmearedExp() [1/2]

Genfun::PuncturedSmearedExp::PuncturedSmearedExp ( )

Definition at line 11 of file PuncturedSmearedExp.cc.

11 :
12 _lifetime ("Lifetime", 1.0, 0.0), // Bounded from below by zero, by default
13 _sigma ("Sigma", 1.0, 0.0) // Bounded from below by zero, by default
14{
15}

◆ PuncturedSmearedExp() [2/2]

Genfun::PuncturedSmearedExp::PuncturedSmearedExp ( const PuncturedSmearedExp right)

Definition at line 17 of file PuncturedSmearedExp.cc.

17 :
18 AbsFunction(right),
19 _lifetime (right._lifetime),
20 _sigma (right._sigma),
21 _punctures (right._punctures)
22{
23}

◆ ~PuncturedSmearedExp()

Genfun::PuncturedSmearedExp::~PuncturedSmearedExp ( )
virtual

Definition at line 53 of file PuncturedSmearedExp.cc.

53 {
54}

Member Function Documentation

◆ lifetime() [1/2]

Parameter & Genfun::PuncturedSmearedExp::lifetime ( )

Definition at line 56 of file PuncturedSmearedExp.cc.

56 {
57 return _lifetime;
58}

◆ lifetime() [2/2]

const Parameter & Genfun::PuncturedSmearedExp::lifetime ( ) const

Definition at line 60 of file PuncturedSmearedExp.cc.

60 {
61 return _lifetime;
62}

◆ max() [1/2]

Parameter & Genfun::PuncturedSmearedExp::max ( unsigned int  i)

Definition at line 43 of file PuncturedSmearedExp.cc.

43 {
44 return _punctures[2*i+1];
45
46}

◆ max() [2/2]

const Parameter & Genfun::PuncturedSmearedExp::max ( unsigned int  i) const

Definition at line 48 of file PuncturedSmearedExp.cc.

48 {
49 return _punctures[2*i+1];
50}

◆ min() [1/2]

Parameter & Genfun::PuncturedSmearedExp::min ( unsigned int  i)

Definition at line 34 of file PuncturedSmearedExp.cc.

34 {
35 return _punctures[2*i];
36}

◆ min() [2/2]

const Parameter & Genfun::PuncturedSmearedExp::min ( unsigned int  i) const

Definition at line 38 of file PuncturedSmearedExp.cc.

38 {
39 return _punctures[2*i];
40}

◆ operator()() [1/2]

virtual double Genfun::PuncturedSmearedExp::operator() ( const Argument a) const
inlineoverridevirtual

Implements Genfun::AbsFunction.

Definition at line 39 of file PuncturedSmearedExp.hh.

39{return operator() (a[0]);}
virtual double operator()(double argument) const override

◆ operator()() [2/2]

double Genfun::PuncturedSmearedExp::operator() ( double  argument) const
overridevirtual

Implements Genfun::AbsFunction.

Definition at line 73 of file PuncturedSmearedExp.cc.

73 {
74 // Fetch the paramters. This operator does not convolve numerically.
75 static const double sqrtTwo = sqrt(2.0);
76
77 double xsigma = _sigma.getValue();
78 double tau = _lifetime.getValue();
79 double x = argument;
80
81 // Copy:
82 std::vector<double> punctures(_punctures.size());
83 for (size_t i=0;i<_punctures.size();i++) punctures[i]=_punctures[i].getValue();
84
85 // Overlap elimination:
86 bool overlap=true;
87
88 while (overlap) {
89
90 overlap=false;
91
92 for (size_t i=0;i<punctures.size()/2;i++) {
93 std::sort(punctures.begin()+2*i, punctures.begin()+2*i+2);
94 double min1=punctures[2*i];
95 double max1=punctures[2*i+1];
96 for (size_t j=i+1;j<punctures.size()/2;j++) {
97 std::sort(punctures.begin()+2*j, punctures.begin()+2*j+2);
98 double min2=punctures[2*j];
99 double max2=punctures[2*j+1];
100 if ((min2>min1 && max1>min2) || (min1>min2 && max2<min1)) {
101 punctures[2*i] =std::min(min1,min2);
102 punctures[2*i+1]=std::max(max1,max2);
103 std::vector<double>::iterator t0=punctures.begin()+2*j, t1=t0+2;
104 punctures.erase(t0,t1);
105 overlap=true;
106 break;
107 }
108 }
109 if (overlap) break;
110 }
111 }
112
113 double expG=0,norm=0;
114 for (size_t i=0;i<punctures.size()/2;i++) {
115
116 double a = punctures[2*i];
117 double b = punctures[2*i+1];
118
119 double alpha = (a/xsigma + xsigma/tau)/sqrtTwo;
120 double beta = (b/xsigma + xsigma/tau)/sqrtTwo;
121 double delta = 1/sqrtTwo/xsigma;
122
123
124 norm += 2*tau*exp(1/(4*delta*delta*tau*tau))*(exp(-alpha/(delta*tau)) - exp(-beta/(delta*tau)));
125
126 expG += ((erfc(alpha-delta*x) - erfc(beta-delta*x))*exp(-x/tau) );
127
128
129 }
130
131 // protection:
132 if (norm==0) return norm;
133
134 return expG/norm;
135}
virtual double getValue() const
Definition: Parameter.cc:29
double norm(const HepGenMatrix &m)
Definition: GenMatrix.cc:54

Referenced by operator()().

◆ puncture()

void Genfun::PuncturedSmearedExp::puncture ( double  min,
double  max 
)

Definition at line 25 of file PuncturedSmearedExp.cc.

25 {
26 std::ostringstream mn, mx;
27 mn << "Min_" << _punctures.size()/2;
28 mx << "Max_" << _punctures.size()/2;
29 _punctures.push_back(Parameter(mn.str(), xmin, 0.0, 10.0));
30 _punctures.push_back(Parameter(mx.str(), xmax, 0.0, 10.0));
31}

◆ sigma() [1/2]

Parameter & Genfun::PuncturedSmearedExp::sigma ( )

Definition at line 64 of file PuncturedSmearedExp.cc.

64 {
65 return _sigma;
66}

◆ sigma() [2/2]

const Parameter & Genfun::PuncturedSmearedExp::sigma ( ) const

Definition at line 68 of file PuncturedSmearedExp.cc.

68 {
69 return _sigma;
70}

The documentation for this class was generated from the following files: