Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
/** 
*/

#include "Calibration/Tools/interface/CalibCoeff.h"
#include <cmath>

CalibCoeff::CalibCoeff(const double& value, const bool& isGood)
    : m_value(value), m_isGood(isGood), m_difference(m_value) {}

// ------------------------------------------------------------

CalibCoeff::~CalibCoeff() {}

// ------------------------------------------------------------

double CalibCoeff::value() const { return m_isGood * m_value + !m_isGood; }

// ------------------------------------------------------------

double CalibCoeff::difference() const { return m_isGood * m_difference - !m_isGood; }

// ------------------------------------------------------------

bool CalibCoeff::status() const { return m_isGood; }

// ------------------------------------------------------------

void CalibCoeff::setValue(const double& val) {
  m_value = val;
  m_difference = m_value;
  m_isGood = true;
  return;
}

// ------------------------------------------------------------

void CalibCoeff::setStatus(const bool& stat) {
  m_isGood = stat;
  return;
}

// ------------------------------------------------------------

double CalibCoeff::operator*=(const double& var) {
  double oldval = m_value;
  m_value *= var;
  m_difference = fabs(m_value - oldval);
  m_isGood = true;
  return m_value;
}