File indexing completed on 2024-04-06 12:08:34
0001 #ifndef DQM_SiStripCommissioningSources_Averages_H
0002 #define DQM_SiStripCommissioningSources_Averages_H
0003
0004 #include "DataFormats/SiStripCommon/interface/SiStripConstants.h"
0005 #include <vector>
0006 #include <map>
0007 #include <cstdint>
0008
0009
0010 class Averages {
0011 public:
0012 Averages();
0013 ~Averages() { ; }
0014
0015 class Params {
0016 public:
0017 float mean_;
0018 float median_;
0019 float mode_;
0020 float rms_;
0021 float weight_;
0022 float max_;
0023 float min_;
0024 uint32_t num_;
0025 Params()
0026 : mean_(1. * sistrip::invalid_),
0027 median_(1. * sistrip::invalid_),
0028 mode_(1. * sistrip::invalid_),
0029 rms_(1. * sistrip::invalid_),
0030 weight_(1. * sistrip::invalid_),
0031 max_(-1. * sistrip::invalid_),
0032 min_(1. * sistrip::invalid_),
0033 num_(sistrip::invalid_) {
0034 ;
0035 }
0036 ~Params() { ; }
0037 };
0038
0039
0040 void add(const float& value, const float& weight);
0041 void add(const float& value);
0042
0043 void add(const uint32_t& value, const uint32_t& weight);
0044 void add(const uint32_t& value);
0045
0046
0047 void calc(Params&);
0048
0049 private:
0050 uint32_t n_;
0051 float s_;
0052 float x_;
0053 float xx_;
0054 std::vector<float> median_;
0055 std::map<uint32_t, uint32_t> mode_;
0056 };
0057
0058 #endif