Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-10 02:58:37

0001 #ifndef _COMMONDET_MEASUREMENT1DFLOAT_H_
0002 #define _COMMONDET_MEASUREMENT1DFLOAT_H_
0003 
0004 /** A class that combines a value and it's associated uncertainty,
0005  *  or error, together. Provides a more explicit interface than
0006  *  a pair<float,float>. If you don't like the name, propose a better one!
0007  */
0008 
0009 class Measurement1DFloat {
0010 public:
0011   // construct
0012 
0013   Measurement1DFloat() : theValue(0.), theError(0.) {}
0014 
0015   Measurement1DFloat(const float& aValue) : theValue(aValue), theError(0.) {}
0016 
0017   Measurement1DFloat(const float& aValue, const float& aError) : theValue(aValue), theError(aError) {}
0018 
0019   //destruct
0020 
0021   ~Measurement1DFloat() {}
0022 
0023   float value() const { return theValue; }
0024 
0025   float error() const { return theError; }
0026 
0027   float significance() const {
0028     if (theError == 0)
0029       return 0;
0030     else
0031       return theValue / theError;
0032   }
0033 
0034 private:
0035   float theValue;
0036   float theError;
0037 };
0038 
0039 #endif