File indexing completed on 2024-09-07 04:35:41
0001 #ifndef SiStripSummary_h
0002 #define SiStripSummary_h
0003
0004 #include "CondFormats/Serialization/interface/Serializable.h"
0005
0006 #include <vector>
0007 #include <map>
0008 #include <iostream>
0009 #include "FWCore/Utilities/interface/Exception.h"
0010 #include <cstdint>
0011
0012
0013
0014
0015
0016
0017
0018 namespace sistripsummary {
0019 enum TrackerRegion {
0020 TRACKER = 0,
0021 TIB = 1,
0022 TIB_1 = 11,
0023 TIB_2 = 12,
0024 TIB_3 = 13,
0025 TIB_4 = 14,
0026 TOB = 2,
0027 TOB_1 = 21,
0028 TOB_2 = 22,
0029 TOB_3 = 23,
0030 TOB_4 = 24,
0031 TOB_5 = 25,
0032 TOB_6 = 26,
0033 TID = 3,
0034 TIDM = 31,
0035 TIDP = 32,
0036 TIDM_1 = 311,
0037 TIDM_2 = 312,
0038 TIDM_3 = 313,
0039 TIDP_1 = 321,
0040 TIDP_2 = 322,
0041 TIDP_3 = 323,
0042 TEC = 4,
0043 TECM = 41,
0044 TECP = 42,
0045 TECM_1 = 411,
0046 TECM_2 = 412,
0047 TECM_3 = 413,
0048 TECM_4 = 414,
0049 TECM_5 = 415,
0050 TECM_6 = 416,
0051 TECM_7 = 417,
0052 TECM_8 = 418,
0053 TECM_9 = 419,
0054 TECP_1 = 421,
0055 TECP_2 = 422,
0056 TECP_3 = 423,
0057 TECP_4 = 424,
0058 TECP_5 = 425,
0059 TECP_6 = 426,
0060 TECP_7 = 427,
0061 TECP_8 = 428,
0062 TECP_9 = 429
0063 };
0064 }
0065
0066 class SiStripSummary {
0067 public:
0068 struct DetRegistry {
0069 uint32_t detid;
0070 uint32_t ibegin;
0071
0072 COND_SERIALIZABLE;
0073 };
0074
0075 class StrictWeakOrdering {
0076 public:
0077 bool operator()(const DetRegistry& p, const uint32_t& i) const { return p.detid < i; }
0078 };
0079
0080
0081
0082 typedef std::vector<float>::const_iterator ContainerIterator;
0083 typedef std::pair<ContainerIterator, ContainerIterator> Range;
0084 typedef std::vector<DetRegistry> Registry;
0085 typedef Registry::const_iterator RegistryIterator;
0086 typedef std::vector<float> InputVector;
0087
0088 SiStripSummary(std::vector<std::string>& userDBContent);
0089 SiStripSummary(const SiStripSummary& input);
0090 SiStripSummary() {}
0091 ~SiStripSummary() {}
0092
0093 ContainerIterator getDataVectorBegin() const { return v_sum_.begin(); }
0094 ContainerIterator getDataVectorEnd() const { return v_sum_.end(); }
0095 RegistryIterator getRegistryVectorBegin() const { return indexes_.begin(); }
0096 RegistryIterator getRegistryVectorEnd() const { return indexes_.end(); }
0097
0098
0099
0100 const Range getRange(const uint32_t& detID) const;
0101
0102
0103
0104 std::vector<uint32_t> getDetIds() const;
0105
0106
0107
0108 bool put(const uint32_t& detID, InputVector& input, std::vector<std::string>& userContent);
0109 bool put(sistripsummary::TrackerRegion region, InputVector& input, std::vector<std::string>& userContent);
0110 void setObj(const uint32_t& detID, std::string elementName, float value);
0111
0112
0113
0114
0115
0116 std::vector<float> getSummaryObj(uint32_t& detID, const std::vector<std::string>& list) const;
0117 std::vector<float> getSummaryObj(sistripsummary::TrackerRegion region, const std::vector<std::string>& list) const;
0118
0119
0120
0121 std::vector<float> getSummaryObj(std::string elementName) const;
0122
0123
0124 std::vector<float> getSummaryObj(uint32_t& detID) const;
0125
0126
0127 std::vector<float> getSummaryObj() const;
0128
0129
0130
0131 inline void setUserDBContent(const std::vector<std::string>& userDBContent) { userDBContent_ = userDBContent; }
0132 inline void setRunNr(int inputRunNr) { runNr_ = inputRunNr; }
0133 inline void setTimeValue(unsigned long long inputTimeValue) { timeValue_ = inputTimeValue; }
0134
0135 inline unsigned long long getTimeValue() const { return timeValue_; }
0136 inline std::vector<std::string> getUserDBContent() const { return userDBContent_; }
0137 inline int getRunNr() const { return runNr_; }
0138
0139
0140
0141 void print();
0142
0143
0144
0145 std::vector<std::string> userDBContent_;
0146 std::vector<float> v_sum_;
0147 std::vector<DetRegistry> indexes_;
0148
0149 int runNr_;
0150 unsigned long long timeValue_;
0151
0152 protected:
0153
0154 const short getPosition(std::string elementName) const;
0155
0156 COND_SERIALIZABLE;
0157 };
0158
0159 #endif