BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtValError Class Reference

#include <EvtValError.hh>

Public Member Functions

 EvtValError ()
 
 EvtValError (double val)
 
 EvtValError (double val, double err)
 
 EvtValError (const EvtValError &other)
 
 ~EvtValError ()
 
int valueKnown () const
 
double value () const
 
int errorKnown () const
 
double error () const
 
double prec () const
 
void operator= (const EvtValError &other)
 
void operator*= (const EvtValError &other)
 
void operator/= (const EvtValError &other)
 
void operator+= (const EvtValError &other)
 
void operator*= (double c)
 
void print (std::ostream &) const
 

Detailed Description

Definition at line 20 of file EvtValError.hh.

Constructor & Destructor Documentation

◆ EvtValError() [1/4]

EvtValError::EvtValError ( )

Definition at line 18 of file EvtValError.cc.

19 : _valKnown(0), _val(0.), _errKnown(0), _err(0.)
20{}

◆ EvtValError() [2/4]

EvtValError::EvtValError ( double  val)

Definition at line 22 of file EvtValError.cc.

23 : _valKnown(1), _val(val), _errKnown(0), _err(0.)
24{}

◆ EvtValError() [3/4]

EvtValError::EvtValError ( double  val,
double  err 
)

Definition at line 26 of file EvtValError.cc.

27 : _valKnown(1), _val(val), _errKnown(1), _err(err)
28{}

◆ EvtValError() [4/4]

EvtValError::EvtValError ( const EvtValError other)

Definition at line 30 of file EvtValError.cc.

31 : _valKnown(other._valKnown), _val(other._val),
32 _errKnown(other._errKnown), _err(other._err)
33{}
Index other(Index i, Index j)
Definition: EvtCyclic3.cc:118

◆ ~EvtValError()

EvtValError::~EvtValError ( )

Definition at line 35 of file EvtValError.cc.

36{}

Member Function Documentation

◆ error()

double EvtValError::error ( ) const
inline

Definition at line 33 of file EvtValError.hh.

33{ assert(_errKnown); return _err; }

◆ errorKnown()

int EvtValError::errorKnown ( ) const
inline

Definition at line 32 of file EvtValError.hh.

32{ return _errKnown; }

◆ operator*=() [1/2]

void EvtValError::operator*= ( const EvtValError other)

Definition at line 52 of file EvtValError.cc.

53{
54 assert(_valKnown && other._valKnown);
55
56 // Relative errors add in quadrature
57 if(_errKnown && other._errKnown)
58 _err = _val * other._val * sqrt(prec()*prec() + other.prec() * other.prec());
59 else _errKnown = 0;
60
61 // Modify the value
62 _val *= other._val;
63}
double prec() const
Definition: EvtValError.cc:38

◆ operator*=() [2/2]

void EvtValError::operator*= ( double  c)

Definition at line 107 of file EvtValError.cc.

107 {
108
109 assert(_valKnown);
110 _val *= c;
111 if(_errKnown) _err*=c;
112}

◆ operator+=()

void EvtValError::operator+= ( const EvtValError other)

Definition at line 90 of file EvtValError.cc.

91{
92 assert(_valKnown); assert(other._valKnown);
93 _val += other._val;
94
95 // add errors in quadrature
96
97 if(_errKnown && other._errKnown) {
98
99 _err = sqrt(_err*_err + other._err*other._err);
100 }
101 else {
102
103 _errKnown = 0;
104 }
105}

◆ operator/=()

void EvtValError::operator/= ( const EvtValError other)

Definition at line 65 of file EvtValError.cc.

66{
67 assert(_valKnown && other._valKnown && other._val != 0.);
68
69 // Relative errors add in quadrature
70 if(_errKnown && other._errKnown)
71 _err = _val/other._val * sqrt(prec()*prec() + other.prec() * other.prec());
72 else _errKnown = 0;
73
74 // Modify the value
75 _val /= other._val;
76}

◆ operator=()

void EvtValError::operator= ( const EvtValError other)

Definition at line 44 of file EvtValError.cc.

45{
46 _valKnown = other._valKnown;
47 _val = other._val;
48 _errKnown = other._errKnown;
49 _err = other._err;
50}

◆ prec()

double EvtValError::prec ( ) const

Definition at line 38 of file EvtValError.cc.

39{
40 assert(_valKnown && _errKnown);
41 return ( _val != 0) ? _err/_val : 0;
42}

Referenced by operator*=(), and operator/=().

◆ print()

void EvtValError::print ( std::ostream &  ) const

Definition at line 79 of file EvtValError.cc.

80{
81 if(_valKnown) os << _val;
82 else os << "Undef";
83 os << " +/- ";
84 if(_errKnown) os << _err;
85 else os << "Undef";
86 os << endl;
87}

◆ value()

double EvtValError::value ( ) const
inline

Definition at line 31 of file EvtValError.hh.

31{ assert(_valKnown); return _val; }

◆ valueKnown()

int EvtValError::valueKnown ( ) const
inline

Definition at line 30 of file EvtValError.hh.

30{ return _valKnown; }

Referenced by EvtPdf< T >::getItg().


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