CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Calibration/Tools/src/CalibCoeff.cc

Go to the documentation of this file.
00001 
00008 #include "Calibration/Tools/interface/CalibCoeff.h"
00009 #include <cmath>
00010 
00011 CalibCoeff::CalibCoeff (const double & value , 
00012                         const bool & isGood) :
00013   m_value (value),
00014   m_isGood (isGood),
00015   m_difference (m_value)
00016   {}
00017 
00018 
00019 // ------------------------------------------------------------
00020 
00021 
00022 CalibCoeff::~CalibCoeff () {}
00023 
00024 
00025 // ------------------------------------------------------------
00026 
00027 
00028 double 
00029 CalibCoeff::value () const 
00030 {
00031   return m_isGood * m_value + !m_isGood ;
00032 }
00033 
00034 
00035 // ------------------------------------------------------------
00036 
00037 
00038 double
00039 CalibCoeff::difference () const
00040 {
00041   return m_isGood * m_difference - !m_isGood ;
00042 }
00043 
00044 
00045 // ------------------------------------------------------------
00046 
00047 
00048 bool 
00049 CalibCoeff::status () const 
00050 {
00051   return m_isGood ;
00052 }
00053 
00054 
00055 // ------------------------------------------------------------
00056 
00057 
00058 void 
00059 CalibCoeff::setValue (const double & val)  
00060 {
00061   m_value = val ;
00062   m_difference = m_value ;
00063   m_isGood = true ;
00064   return ;
00065 }
00066 
00067 
00068 // ------------------------------------------------------------
00069 
00070 
00071 void 
00072 CalibCoeff::setStatus (const bool & stat)  
00073 {
00074   m_isGood = stat ;
00075   return ;
00076 }
00077 
00078 
00079 // ------------------------------------------------------------
00080 
00081 
00082 double 
00083 CalibCoeff::operator *= (const double & var) 
00084 {
00085   double oldval = m_value ;
00086   m_value *= var ;
00087   m_difference = fabs (m_value - oldval) ;
00088   m_isGood = true ;
00089   return m_value ;
00090 }
00091