CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CalibCoeff.cc
Go to the documentation of this file.
1 
5 #include <cmath>
6 
7 CalibCoeff::CalibCoeff(const double& value, const bool& isGood)
8  : m_value(value), m_isGood(isGood), m_difference(m_value) {}
9 
10 // ------------------------------------------------------------
11 
13 
14 // ------------------------------------------------------------
15 
16 double CalibCoeff::value() const { return m_isGood * m_value + !m_isGood; }
17 
18 // ------------------------------------------------------------
19 
20 double CalibCoeff::difference() const { return m_isGood * m_difference - !m_isGood; }
21 
22 // ------------------------------------------------------------
23 
24 bool CalibCoeff::status() const { return m_isGood; }
25 
26 // ------------------------------------------------------------
27 
28 void CalibCoeff::setValue(const double& val) {
29  m_value = val;
31  m_isGood = true;
32  return;
33 }
34 
35 // ------------------------------------------------------------
36 
37 void CalibCoeff::setStatus(const bool& stat) {
38  m_isGood = stat;
39  return;
40 }
41 
42 // ------------------------------------------------------------
43 
44 double CalibCoeff::operator*=(const double& var) {
45  double oldval = m_value;
46  m_value *= var;
47  m_difference = fabs(m_value - oldval);
48  m_isGood = true;
49  return m_value;
50 }
void setValue(const double &val)
set its value and turn into good the coefficient
Definition: CalibCoeff.cc:28
bool status() const
its status
Definition: CalibCoeff.cc:24
double value() const
its value
Definition: CalibCoeff.cc:16
double difference() const
the abs difference wrt prev value
Definition: CalibCoeff.cc:20
double operator*=(const double &var)
update the value and turn into good the coefficient
Definition: CalibCoeff.cc:44
list var
if using global norm cols_to_minmax = [&#39;t_delta&#39;, &#39;t_hmaxNearP&#39;,&#39;t_emaxNearP&#39;, &#39;t_hAnnular&#39;, &#39;t_eAnnular&#39;,&#39;t_pt&#39;,&#39;t_nVtx&#39;,&#39;t_ieta&#39;,&#39;t_eHcal10&#39;, &#39;t_eHcal30&#39;,&#39;t_rhoh&#39;,&#39;t_eHcal&#39;] df[cols_to_minmax] = df[cols_to_minmax].apply(lambda x: (x - x.min()) / (x.max() - x.min()) if (x.max() - x.min() &gt; 0) else 1.0/200.0)
double m_difference
the difference with the previous value
Definition: CalibCoeff.h:36
bool m_isGood
if it is good
Definition: CalibCoeff.h:34
CalibCoeff(const double &value=1., const bool &isGood=false)
ctor
Definition: CalibCoeff.cc:7
double m_value
the actual value
Definition: CalibCoeff.h:32
void setStatus(const bool &stat)
set its value and turn into good the coefficient
Definition: CalibCoeff.cc:37
~CalibCoeff()
dtor
Definition: CalibCoeff.cc:12