File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ namespace Math {
107
107
MATH_ERROR_MSG (" crystalball_integral" , " CrystalBall function not defined at alpha=0" );
108
108
return 0 .;
109
109
}
110
- bool useLog = (n == 1.0 );
110
+ bool useLog = (std::abs (n - 1 .) < 1.0e-5 );
111
111
if (n <= 0 )
112
112
MATH_WARN_MSG (" crystalball_integral" , " No physical meaning when n<=0" );
113
113
@@ -132,11 +132,13 @@ namespace Math {
132
132
double B = r - abs_alpha;
133
133
134
134
if (!useLog) {
135
- intpow = A * (1 - std::pow (r / (B - z), n - 1 )) / (n - 1 );
135
+ intpow = A * (1 . - std::pow (r / (B - z), n - 1 . )) / (n - 1 . );
136
136
}
137
137
else {
138
138
// for n=1 the primitive of 1/x is log(x)
139
- intpow = A * std::pow (r, n - 1 ) * (std::log (B - z) - std::log (r));
139
+ double log_B_z = std::log (B - z);
140
+ double log_r = std::log (r);
141
+ intpow = A * std::pow (r, n - 1 .) * (log_B_z - log_r + 0.5 * (1 . - n) * (log_B_z * log_B_z - log_r * log_r));
140
142
}
141
143
intgaus = sqrtpiover2 * (1 . + ROOT::Math::erf (abs_alpha * oneoversqrt2));
142
144
}
You can’t perform that action at this time.
0 commit comments