Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:13

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