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  struct Values {
65  Values() : mean(0.), rms(0.), count(0) {}
66  double mean;
67  double rms;
68  unsigned int count;
69  };
70  std::map<unsigned int, Values> getCounts() { return valueMap_; }
71 
72 protected:
73  // Maps to store the value and the counts
74  std::map<unsigned int, Values> valueMap_;
76 
77 private:
79 };
80 
81 #endif
SiStripDetSummary::Values::count
unsigned int count
Definition: SiStripDetSummary.h:68
SiStripDetSummary::Values::Values
Values()
Definition: SiStripDetSummary.h:65
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
SiStripDetSummary::Values::rms
double rms
Definition: SiStripDetSummary.h:67
TrackerTopology
Definition: TrackerTopology.h:16
SiStripDetSummary::print
void print(std::stringstream &ss, const bool mean=true) const
Definition: SiStripDetSummary.cc:43
SiStripDetSummary::trackerTopo_
const TrackerTopology * trackerTopo_
Definition: SiStripDetSummary.h:78
SiStripDetSummary::valueMap_
std::map< unsigned int, Values > valueMap_
Definition: SiStripDetSummary.h:74
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
DetId
Definition: DetId.h:17
SiStripDetSummary::SiStripDetSummary
SiStripDetSummary(const TrackerTopology *tTopo)
Definition: SiStripDetSummary.h:30
SiStripDetSummary::add
void add(DetId detid, float value)
Used to compute the mean value of the value variable divided by subdetector, layer and mono/stereo.
Definition: SiStripDetSummary.cc:6
funct::true
true
Definition: Factorize.h:173
SiStripDetSummary::Values
Definition: SiStripDetSummary.h:64
value
Definition: value.py:1
SiStripDetSummary::add
void add(DetId detid)
Used to compute the number of entries divided by subdetector, layer and mono/stereo.
Definition: SiStripDetSummary.h:53
SiStripDetSummary::computeMean_
bool computeMean_
Definition: SiStripDetSummary.h:75
SiStripDetSummary::Values::mean
double mean
Definition: SiStripDetSummary.h:66
DetId.h
SiStripDetSummary
Definition: SiStripDetSummary.h:28
hgcalTopologyTester_cfi.layers
layers
Definition: hgcalTopologyTester_cfi.py:8
SiStripDetSummary::getCounts
std::map< unsigned int, Values > getCounts()
Definition: SiStripDetSummary.h:70