test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CalibCoeff.cc
Go to the documentation of this file.
1 
5 #include <cmath>
6 
7 CalibCoeff::CalibCoeff (const double & value ,
8  const bool & isGood) :
9  m_value (value),
10  m_isGood (isGood),
11  m_difference (m_value)
12  {}
13 
14 
15 // ------------------------------------------------------------
16 
17 
19 
20 
21 // ------------------------------------------------------------
22 
23 
24 double
26 {
27  return m_isGood * m_value + !m_isGood ;
28 }
29 
30 
31 // ------------------------------------------------------------
32 
33 
34 double
36 {
37  return m_isGood * m_difference - !m_isGood ;
38 }
39 
40 
41 // ------------------------------------------------------------
42 
43 
44 bool
46 {
47  return m_isGood ;
48 }
49 
50 
51 // ------------------------------------------------------------
52 
53 
54 void
55 CalibCoeff::setValue (const double & val)
56 {
57  m_value = val ;
59  m_isGood = true ;
60  return ;
61 }
62 
63 
64 // ------------------------------------------------------------
65 
66 
67 void
68 CalibCoeff::setStatus (const bool & stat)
69 {
70  m_isGood = stat ;
71  return ;
72 }
73 
74 
75 // ------------------------------------------------------------
76 
77 
78 double
79 CalibCoeff::operator *= (const double & var)
80 {
81  double oldval = m_value ;
82  m_value *= var ;
83  m_difference = fabs (m_value - oldval) ;
84  m_isGood = true ;
85  return m_value ;
86 }
87 
void setValue(const double &val)
set its value and turn into good the coefficient
Definition: CalibCoeff.cc:55
bool status() const
its status
Definition: CalibCoeff.cc:45
double value() const
its value
Definition: CalibCoeff.cc:25
double difference() const
the abs difference wrt prev value
Definition: CalibCoeff.cc:35
return((rh^lh)&mask)
double operator*=(const double &var)
update the value and turn into good the coefficient
Definition: CalibCoeff.cc:79
double m_difference
the difference with the previous value
Definition: CalibCoeff.h:39
bool m_isGood
if it is good
Definition: CalibCoeff.h:37
CalibCoeff(const double &value=1., const bool &isGood=0)
ctor
Definition: CalibCoeff.cc:7
double m_value
the actual value
Definition: CalibCoeff.h:35
void setStatus(const bool &stat)
set its value and turn into good the coefficient
Definition: CalibCoeff.cc:68
~CalibCoeff()
dtor
Definition: CalibCoeff.cc:18