Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:14:24

0001 /** 
0002 */
0003 
0004 #include "Calibration/Tools/interface/CalibCoeff.h"
0005 #include <cmath>
0006 
0007 CalibCoeff::CalibCoeff(const double& value, const bool& isGood)
0008     : m_value(value), m_isGood(isGood), m_difference(m_value) {}
0009 
0010 // ------------------------------------------------------------
0011 
0012 CalibCoeff::~CalibCoeff() {}
0013 
0014 // ------------------------------------------------------------
0015 
0016 double CalibCoeff::value() const { return m_isGood * m_value + !m_isGood; }
0017 
0018 // ------------------------------------------------------------
0019 
0020 double CalibCoeff::difference() const { return m_isGood * m_difference - !m_isGood; }
0021 
0022 // ------------------------------------------------------------
0023 
0024 bool CalibCoeff::status() const { return m_isGood; }
0025 
0026 // ------------------------------------------------------------
0027 
0028 void CalibCoeff::setValue(const double& val) {
0029   m_value = val;
0030   m_difference = m_value;
0031   m_isGood = true;
0032   return;
0033 }
0034 
0035 // ------------------------------------------------------------
0036 
0037 void CalibCoeff::setStatus(const bool& stat) {
0038   m_isGood = stat;
0039   return;
0040 }
0041 
0042 // ------------------------------------------------------------
0043 
0044 double CalibCoeff::operator*=(const double& var) {
0045   double oldval = m_value;
0046   m_value *= var;
0047   m_difference = fabs(m_value - oldval);
0048   m_isGood = true;
0049   return m_value;
0050 }