ATLAS Offline Software
StatVal.h
Go to the documentation of this file.
1 /* emacs: this is -*- c++ -*- */
16 #ifndef RESPLOT_STATVAL_H
17 #define RESPLOT_STATVAL_H
18 
19 #include <iostream>
20 #include <iomanip>
21 #include <cmath>
22 
23 
25 
26 class StatVal {
27 
28 public:
29 
30  double value;
31  double error;
32 
33  StatVal() : value(0), error(0) { }
34  StatVal(double v) : value(v) { error=( v>=0 ? sqrt(v) : sqrt(-v) ); }
35  StatVal(double v, double e) : value(v), error(e) { }
36 
37 
38  // operator for StatVal*=double
39  StatVal operator*=(const double& d) { value*=d; error*=d; return (*this); }
40  // operator for StatVal*double (for double*StatVal see later)
41  StatVal operator*(const double& d) const { return StatVal(d*value, d*error); }
42  // StatVal/double
43  StatVal operator/(const double& d) const { return StatVal(value/d, error/d); }
44 
45  // can't be bothered with the rest...
46 
47 };
48 
49 
50 // operator for double*StatVal
51 inline StatVal operator*(double d, const StatVal& sv) { return sv*d; }
52 
53 // streamer;
54 inline std::ostream& operator<<(std::ostream& s, const StatVal& sv) {
55  return s << sv.value << "+-" << sv.error;
56 }
57 
58 
59 
60 
61 #endif /* RESPLOT_STATVAL_H */
62 
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
StatVal::operator*=
StatVal operator*=(const double &d)
Definition: StatVal.h:39
hist_file_dump.d
d
Definition: hist_file_dump.py:137
operator<<
std::ostream & operator<<(std::ostream &s, const StatVal &sv)
Definition: StatVal.h:54
StatVal::error
double error
Definition: StatVal.h:31
StatVal::StatVal
StatVal(double v)
Definition: StatVal.h:34
StatVal::value
double value
Definition: StatVal.h:30
StatVal::operator*
StatVal operator*(const double &d) const
Definition: StatVal.h:41
StatVal::operator/
StatVal operator/(const double &d) const
Definition: StatVal.h:43
operator*
StatVal operator*(double d, const StatVal &sv)
Definition: StatVal.h:51
python.PyAthena.v
v
Definition: PyAthena.py:154
StatVal::StatVal
StatVal()
Definition: StatVal.h:33
StatVal
simple struct to hold a value and it's associated uncertainty.
Definition: StatVal.h:26
LArCellConditions.sv
bool sv
Definition: LArCellConditions.py:45
StatVal::StatVal
StatVal(double v, double e)
Definition: StatVal.h:35
error
Definition: IImpactPoint3dEstimator.h:70