34 #include "CLHEP/Random/RandGauss.h" 69 while (
j <
s.size() &&
s[
j] !=
',' && !isdigit(
s[
j]) &&
s[
j] !=
'.')
71 if (
j <
s.size() && (isdigit(
s[
j]) ||
s[
j] ==
'.')) {
72 x = atof(
s.c_str() +
j);
90 : _resolution_exponent(0) {
99 while (
i <
s.size() && isspace(
s[
i]))
106 }
else if (
s[
i] ==
'+') {
111 if (get_field(
s,
i,
x))
116 if (
i != string::npos) {
118 if (get_field(
s,
i,
x))
123 if (
i != string::npos) {
124 if (get_field(
s,
i + 1,
x))
131 : _constant_sigma(
C), _resolution_sigma(
R), _resolution_exponent(
m), _noise_sigma(
N), _inverse(inverse) {}
142 : _constant_sigma(0), _resolution_sigma(0), _resolution_exponent(0), _noise_sigma(
res), _inverse(inverse) {}
178 return sqrt((_constant_sigma * _constant_sigma *
p + _resolution_sigma * _resolution_sigma) *
p +
179 _noise_sigma * _noise_sigma);
197 CLHEP::RandGauss
gen(engine);
199 return 1 /
gen.fire(1 /
x, sigma(
p));
201 return gen.fire(
x, sigma(
p));
226 s << r._constant_sigma <<
"," << r._resolution_sigma <<
"," << r._noise_sigma;
double pick(double x, double p, CLHEP::HepRandomEngine &engine) const
Generate random value from a Gaussian distribution described by this resolution. Given a value ...
Calculate and represent resolution for a physical quantity.
double m() const
Return the exponent factor in the resolution term.
double sigma(double p) const
Return the uncertainty for a variable with magnitude p.
double _resolution_exponent
bool inverse() const
Return the setting of the inverse flag.
double N() const
Return the N term (noise term)
def gen(fragment, howMuch)
Tau Embedding 2016 HIPM ###.
Resolution(std::string s="")
Constructor, initialize from a string.
std::ostream & operator<<(std::ostream &s, const Constraint_Intermed &ci)
Output stream operator, print the content of this Constraint_Intermed to an output stream...
Calculate and represent resolution for a physical quantity.
double R() const
Return the R term (resolution term)
double C() const
Return the C term (constant term)