CMS 3D CMS Logo

SiStripSummary.h
Go to the documentation of this file.
1 #ifndef SiStripSummary_h
2 #define SiStripSummary_h
3 
5 
6 #include <vector>
7 #include <map>
8 #include <iostream>
10 #include <cstdint>
11 
18 namespace sistripsummary {
20  TRACKER = 0,
21  TIB = 1,
22  TIB_1 = 11,
23  TIB_2 = 12,
24  TIB_3 = 13,
25  TIB_4 = 14,
26  TOB = 2,
27  TOB_1 = 21,
28  TOB_2 = 22,
29  TOB_3 = 23,
30  TOB_4 = 24,
31  TOB_5 = 25,
32  TOB_6 = 26,
33  TID = 3,
34  TIDM = 31,
35  TIDP = 32,
36  TIDM_1 = 311,
37  TIDM_2 = 312,
38  TIDM_3 = 313,
39  TIDP_1 = 321,
40  TIDP_2 = 322,
41  TIDP_3 = 323,
42  TEC = 4,
43  TECM = 41,
44  TECP = 42,
45  TECM_1 = 411,
46  TECM_2 = 412,
47  TECM_3 = 413,
48  TECM_4 = 414,
49  TECM_5 = 415,
50  TECM_6 = 416,
51  TECM_7 = 417,
52  TECM_8 = 418,
53  TECM_9 = 419,
54  TECP_1 = 421,
55  TECP_2 = 422,
56  TECP_3 = 423,
57  TECP_4 = 424,
58  TECP_5 = 425,
59  TECP_6 = 426,
60  TECP_7 = 427,
61  TECP_8 = 428,
62  TECP_9 = 429
63  };
64 }
65 
67 public:
68  struct DetRegistry {
69  uint32_t detid;
70  uint32_t ibegin;
71 
73  };
74 
76  public:
77  bool operator()(const DetRegistry& p, const uint32_t& i) const { return p.detid < i; }
78  };
79 
80  // SOME DEFINITIONS
81  //
82  typedef std::vector<float>::const_iterator ContainerIterator;
83  typedef std::pair<ContainerIterator, ContainerIterator> Range;
84  typedef std::vector<DetRegistry> Registry;
85  typedef Registry::const_iterator RegistryIterator;
86  typedef std::vector<float> InputVector;
87 
88  SiStripSummary(std::vector<std::string>& userDBContent);
92 
93  ContainerIterator getDataVectorBegin() const { return v_sum_.begin(); }
94  ContainerIterator getDataVectorEnd() const { return v_sum_.end(); }
95  RegistryIterator getRegistryVectorBegin() const { return indexes_.begin(); }
97 
98  // RETURNS POSITION OF DETID IN v_sum_
99  //
100  const Range getRange(const uint32_t& detID) const;
101 
102  // RETURNS LIST OF DETIDS
103  //
104  std::vector<uint32_t> getDetIds() const;
105 
106  // INSERT SUMMARY OBJECTS...
107  //
108  bool put(const uint32_t& detID, InputVector& input, std::vector<std::string>& userContent);
109  bool put(sistripsummary::TrackerRegion region, InputVector& input, std::vector<std::string>& userContent);
110  void setObj(const uint32_t& detID, std::string elementName, float value);
111 
112  // RETRIEVE SUMMARY OBJECTS...
113  //
114 
115  // returns a vector of selected infos related to a given detId
116  std::vector<float> getSummaryObj(uint32_t& detID, const std::vector<std::string>& list) const;
117  std::vector<float> getSummaryObj(sistripsummary::TrackerRegion region, const std::vector<std::string>& list) const;
118 
119  // returns a vector filled with "info elementName" for each detId
120  // The order is SORTED according to the one used in getDetIds() !
121  std::vector<float> getSummaryObj(std::string elementName) const;
122 
123  // returns the entire SummaryObj related to one detId
124  std::vector<float> getSummaryObj(uint32_t& detID) const;
125 
126  // returns everything, all SummaryObjects for all detIds (unsorted !)
127  std::vector<float> getSummaryObj() const;
128 
129  // INLINE METHODS ABOUT RUN, TIME VALUE...
130  //
131  inline void setUserDBContent(const std::vector<std::string>& userDBContent) { userDBContent_ = userDBContent; }
132  inline void setRunNr(int inputRunNr) { runNr_ = inputRunNr; }
133  inline void setTimeValue(unsigned long long inputTimeValue) { timeValue_ = inputTimeValue; }
134 
135  inline unsigned long long getTimeValue() const { return timeValue_; }
136  inline std::vector<std::string> getUserDBContent() const { return userDBContent_; }
137  inline int getRunNr() const { return runNr_; }
138 
139  // PRINT METHOD...
140  //
141  void print();
142 
143  // SISTRIPSUMMARY MEMBERS...
144  //
145  std::vector<std::string> userDBContent_;
146  std::vector<float> v_sum_;
147  std::vector<DetRegistry> indexes_;
148 
149  int runNr_;
150  unsigned long long timeValue_;
151 
152 protected:
153  // RETURNS POSITION OF ELEMENTNAME IN userDBContent_
154  const short getPosition(std::string elementName) const;
155 
157 };
158 
159 #endif
std::vector< float > getSummaryObj() const
std::vector< DetRegistry > indexes_
void setRunNr(int inputRunNr)
Registry::const_iterator RegistryIterator
std::pair< ContainerIterator, ContainerIterator > Range
static std::string const input
Definition: EdmProvDump.cc:47
int getRunNr() const
std::vector< float > v_sum_
RegistryIterator getRegistryVectorBegin() const
const short getPosition(std::string elementName) const
RegistryIterator getRegistryVectorEnd() const
void setObj(const uint32_t &detID, std::string elementName, float value)
const Range getRange(const uint32_t &detID) const
std::vector< uint32_t > getDetIds() const
unsigned long long timeValue_
ContainerIterator getDataVectorBegin() const
std::vector< float > InputVector
Definition: value.py:1
ContainerIterator getDataVectorEnd() const
bool put(const uint32_t &detID, InputVector &input, std::vector< std::string > &userContent)
bool operator()(const DetRegistry &p, const uint32_t &i) const
#define COND_SERIALIZABLE
Definition: Serializable.h:39
std::vector< std::string > getUserDBContent() const
std::vector< float >::const_iterator ContainerIterator
std::vector< std::string > userDBContent_
void setUserDBContent(const std::vector< std::string > &userDBContent)
unsigned long long getTimeValue() const
void setTimeValue(unsigned long long inputTimeValue)
std::vector< DetRegistry > Registry