Calculate and represent resolution for a physical quantity. More...
#include <Resolution.h>
Public Member Functions | |
double | C () const |
Return the C term (constant term) More... | |
bool | inverse () const |
Return the setting of the inverse flag. More... | |
double | m () const |
Return the exponent factor in the resolution term. More... | |
double | N () const |
Return the N term (noise term) More... | |
double | pick (double x, double p, CLHEP::HepRandomEngine &engine) const |
Generate random value from a Gaussian distribution described by this resolution. Given a value , measured for an object with momentum , pick a new value from a Gaussian distribution described by this resolution: with mean and width . More... | |
double | R () const |
Return the R term (resolution term) More... | |
Resolution (std::string s="") | |
Constructor, initialize from a string. More... | |
Resolution (double C, double R, double m, double N, bool inverse=false) | |
Constructor to initialize with four values for C, R, m, N, and the boolean for inverse. More... | |
Resolution (double res, bool inverse=false) | |
Constructor to initialize a constant resolution. More... | |
double | sigma (double p) const |
Return the uncertainty for a variable with magnitude p. More... | |
Private Attributes | |
double | _constant_sigma |
bool | _inverse |
double | _noise_sigma |
double | _resolution_exponent |
double | _resolution_sigma |
Friends | |
std::ostream & | operator<< (std::ostream &s, const Resolution &r) |
Output stream operator, print the content of this Resolution to an output stream. More... | |
Calculate and represent resolution for a physical quantity.
This class calculate resolutions for some quantity. In general we have three parameters:
Given a physical quantitiy , we calculate the uncertainty in quantity as:
In addition, we also have an inverse flag. If the flag is set, we take the inverse of before doing the calculations. Therefore is regarded as actually .
We encode he resolution parameters into a string, from which these objects get initialized. The format is
[-]C[,R[,N]]
where parameters within the brackets are optional. If the leading minus is present, the inverse flag is turned on. Omitted parameters are set to 0.
Definition at line 102 of file Resolution.h.
hitfit::Resolution::Resolution | ( | std::string | s = "" | ) |
Constructor, initialize from a string.
s | A string encoding the resolution parameters, as described in the class description. |
Definition at line 90 of file Resolution.cc.
References _constant_sigma, _inverse, _noise_sigma, _resolution_sigma, and mps_fire::i.
hitfit::Resolution::Resolution | ( | double | C, |
double | R, | ||
double | m, | ||
double | N, | ||
bool | inverse = false |
||
) |
Constructor to initialize with four values for C, R, m, N, and the boolean for inverse.
C | The constant term |
R | The resolution term |
m | The exponent factor term |
N | The noise term |
inverse | The inverse flag. |
Definition at line 138 of file Resolution.cc.
hitfit::Resolution::Resolution | ( | double | res, |
bool | inverse = false |
||
) |
Constructor to initialize a constant resolution.
res | The resolution value. |
inverse | The inverse flag. |
Definition at line 152 of file Resolution.cc.
double hitfit::Resolution::C | ( | ) | const |
Return the C term (constant term)
Definition at line 183 of file Resolution.cc.
References _constant_sigma.
bool hitfit::Resolution::inverse | ( | ) | const |
Return the setting of the inverse flag.
Definition at line 171 of file Resolution.cc.
References _inverse.
Referenced by hitfit::Constrained_Top::Constrained_Top(), hitfit::Constrained_Z::Constrained_Z(), and hitfit::Vector_Resolution::p_sigma().
double hitfit::Resolution::m | ( | ) | const |
Return the exponent factor in the resolution term.
Definition at line 195 of file Resolution.cc.
References _resolution_exponent.
double hitfit::Resolution::N | ( | ) | const |
Return the N term (noise term)
Definition at line 201 of file Resolution.cc.
References _noise_sigma.
double hitfit::Resolution::pick | ( | double | x, |
double | p, | ||
CLHEP::HepRandomEngine & | engine | ||
) | const |
Generate random value from a Gaussian distribution described by this resolution. Given a value , measured for an object with momentum , pick a new value from a Gaussian distribution described by this resolution: with mean and width .
x | The quantity value (distributed mean). |
p | The momentum, for calculating the width. |
engine | The underlying random number generator. |
Definition at line 227 of file Resolution.cc.
References _inverse, relval_steps::gen(), AlCaHLTBitMon_ParallelJobs::p, and sigma().
Referenced by hitfit::Vector_Resolution::phi_sigma(), hitfit::Vector_Resolution::smear(), and hitfit::Lepjets_Event::smear().
double hitfit::Resolution::R | ( | ) | const |
Return the R term (resolution term)
Definition at line 189 of file Resolution.cc.
References _resolution_sigma.
double hitfit::Resolution::sigma | ( | double | p | ) | const |
Return the uncertainty for a variable with magnitude p.
p | The momentum. |
Definition at line 207 of file Resolution.cc.
References _constant_sigma, _inverse, _noise_sigma, _resolution_sigma, AlCaHLTBitMon_ParallelJobs::p, and mathSSE::sqrt().
Referenced by hitfit::Constrained_Top::Constrained_Top(), hitfit::Constrained_Z::Constrained_Z(), pick(), and hitfit::Vector_Resolution::use_et().
|
friend |
Output stream operator, print the content of this Resolution to an output stream.
s | The stream to which to write. |
r | The instance of Resolution to be printed. |
Definition at line 258 of file Resolution.cc.
|
private |
The constant term.
Definition at line 211 of file Resolution.h.
Referenced by C(), hitfit::operator<<(), Resolution(), and sigma().
|
private |
The inverse flag.
Definition at line 231 of file Resolution.h.
Referenced by inverse(), hitfit::operator<<(), pick(), Resolution(), and sigma().
|
private |
The noise term.
Definition at line 226 of file Resolution.h.
Referenced by N(), hitfit::operator<<(), Resolution(), and sigma().
|
private |
The m exponential factor in the resolution term.
Definition at line 221 of file Resolution.h.
Referenced by m().
|
private |
The resolution term.
Definition at line 216 of file Resolution.h.
Referenced by hitfit::operator<<(), R(), Resolution(), and sigma().