CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/DQM/SiStripCommissioningAnalysis/src/Utility.h

Go to the documentation of this file.
00001 #ifndef DQM_SiStripCommissioningAnalysis_Utility_H
00002 #define DQM_SiStripCommissioningAnalysis_Utility_H
00003 
00004 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
00005 #include <boost/cstdint.hpp>
00006 #include <vector>
00007 #include <cmath>
00008 
00009 namespace sistrip {
00010 
00011   class LinearFit {
00012   
00013   public:
00014   
00015     LinearFit();
00016 
00017     ~LinearFit() {;}
00018     
00019     class Params {
00020     public:
00021       uint16_t n_;
00022       float a_;
00023       float b_;
00024       float erra_;
00025       float errb_;
00026       Params() :
00027         n_(sistrip::invalid_), 
00028         a_(sistrip::invalid_), 
00029         b_(sistrip::invalid_), 
00030         erra_(sistrip::invalid_), 
00031         errb_(sistrip::invalid_) {;}
00032       ~Params() {;}
00033     };
00034     
00035     void add( const float& value_x,
00036               const float& value_y );
00037 
00038     void add( const float& value_x,
00039               const float& value_y, 
00040               const float& error_y );
00041   
00042     void fit( Params& fit_params );
00043   
00044   private:
00045   
00046     std::vector<float> x_;
00047     std::vector<float> y_;
00048     std::vector<float> e_;
00049     float ss_;
00050     float sx_;
00051     float sy_;
00052   
00053   };
00054 
00055   class MeanAndStdDev {
00056   
00057   public:
00058   
00059     MeanAndStdDev();
00060 
00061     ~MeanAndStdDev() {;}
00062 
00063     class Params {
00064     public:
00065       float mean_;
00066       float rms_;
00067       float median_;
00068       Params() :
00069         mean_(sistrip::invalid_), 
00070         rms_(sistrip::invalid_), 
00071         median_(sistrip::invalid_) {;}
00072       ~Params() {;}
00073     };
00074   
00075     void add( const float& value,
00076               const float& error );
00077   
00078     void fit( Params& fit_params );
00079   
00080   private:
00081   
00082     float s_;
00083     float x_;
00084     float xx_;
00085     std::vector<float> vec_;
00086   
00087   };
00088 
00089 }
00090 
00091 #endif // DQM_SiStripCommissioningAnalysis_Utility_H