CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/DQM/SiStripCommissioningSources/interface/Averages.h

Go to the documentation of this file.
00001 #ifndef DQM_SiStripCommissioningSources_Averages_H
00002 #define DQM_SiStripCommissioningSources_Averages_H
00003 
00004 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
00005 #include <boost/cstdint.hpp>
00006 #include <vector>
00007 #include <map>
00008 
00010 class Averages {
00011   
00012  public:
00013   
00014   Averages();
00015   ~Averages() {;}
00016 
00017   class Params {
00018   public:
00019     float mean_;
00020     float median_;
00021     float mode_;
00022     float rms_;
00023     float weight_;
00024     float max_;
00025     float min_;
00026     uint32_t num_;
00027     Params() :
00028       mean_(1.*sistrip::invalid_), 
00029       median_(1.*sistrip::invalid_),
00030       mode_(1.*sistrip::invalid_),
00031       rms_(1.*sistrip::invalid_),
00032       weight_(1.*sistrip::invalid_),
00033       max_(-1.*sistrip::invalid_),
00034       min_(1.*sistrip::invalid_),
00035       num_(sistrip::invalid_) {;}
00036     ~Params() {;}
00037   };
00038   
00040   void add( const float& value, const float& weight );
00041   void add( const float& value );
00043   void add( const uint32_t& value, const uint32_t& weight );
00044   void add( const uint32_t& value );
00045 
00047   void calc( Params& );
00048   
00049  private:
00050 
00051   uint32_t n_;
00052   float s_;
00053   float x_;
00054   float xx_;
00055   std::vector<float> median_;
00056   std::map<uint32_t,uint32_t> mode_;
00057   
00058 };
00059 
00060 #endif // DQM_SiStripCommissioningSources_Averages_H
00061