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