CMS 3D CMS Logo

SiStripDetSummary.h
Go to the documentation of this file.
1 #ifndef SiStripDetSummary_h
2 #define SiStripDetSummary_h
3 
5 class TrackerTopology;
6 
7 #include <sstream>
8 #include <map>
9 #include <cmath>
10 #include <iomanip>
11 #include <iostream>
12 
29 public:
30  explicit SiStripDetSummary(const TrackerTopology* tTopo) : computeMean_(true), trackerTopo_(tTopo) {
31  // Initialize valueMap_ with zeros
32  // WARNING: this initialization is strongly connected with how the map is filled in the add method
33  // TIB: layers = 4, stereo = the first 2
34  // TOB: layers = 6, stereo = the first 2
35  // TEC: wheels = 9, stereo = 9
36  // TID: wheels = 3, stereo = 3
37  unsigned int layers[] = {4, 6, 9, 3};
38  unsigned int stereo[] = {2, 2, 9, 3};
39  Values initValues;
40  for (unsigned int subDet = 0; subDet < 4; ++subDet) {
41  // Layers start from 1
42  for (unsigned int layer = 1; layer <= layers[subDet]; ++layer) {
43  valueMap_[1000 * (subDet + 1) + layer * 10] = initValues;
44  if (layer <= stereo[subDet])
45  valueMap_[1000 * (subDet + 1) + layer * 10 + 1] = initValues;
46  }
47  }
48  }
49 
51  void add(DetId detid, float value);
53  inline void add(DetId detid) {
54  computeMean_ = false;
55  add(detid, 0);
56  }
57 
62  void print(std::stringstream& ss, const bool mean = true) const;
63 
64  inline void clear() { valueMap_.clear(); }
65 
66  struct Values {
67  Values() : mean(0.), rms(0.), count(0) {}
68  double mean;
69  double rms;
70  unsigned int count;
71  };
72  std::map<unsigned int, Values> getCounts() { return valueMap_; }
73 
74 protected:
75  // Maps to store the value and the counts
76  std::map<unsigned int, Values> valueMap_;
78 
79 private:
81 };
82 
83 #endif
std::map< unsigned int, Values > getCounts()
void print(std::stringstream &ss, const bool mean=true) const
std::map< unsigned int, Values > valueMap_
constexpr std::array< uint8_t, layerIndexSize > layer
const TrackerTopology * trackerTopo_
SiStripDetSummary(const TrackerTopology *tTopo)
void add(DetId detid, float value)
Used to compute the mean value of the value variable divided by subdetector, layer and mono/stereo...
Definition: value.py:1
void add(DetId detid)
Used to compute the number of entries divided by subdetector, layer and mono/stereo.
Definition: DetId.h:17