CMS 3D CMS Logo

SiStripMiscalibrateHelper.cc
Go to the documentation of this file.
6 
7 /*--------------------------------------------------------------------*/
9 /*--------------------------------------------------------------------*/
10 {
11  std::map<std::string, sistripsummary::TrackerRegion> mapping = {
12  {"Tracker", sistripsummary::TRACKER}, {"TIB", sistripsummary::TIB}, {"TIB_1", sistripsummary::TIB_1},
13  {"TIB_2", sistripsummary::TIB_2}, {"TIB_3", sistripsummary::TIB_3}, {"TIB_4", sistripsummary::TIB_4},
14  {"TID", sistripsummary::TID}, {"TIDP", sistripsummary::TIDP}, {"TIDP_1", sistripsummary::TIDP_1},
15  {"TIDP_2", sistripsummary::TIDP_2}, {"TIDP_3", sistripsummary::TIDP_3}, {"TIDM", sistripsummary::TIDM},
16  {"TIDM_1", sistripsummary::TIDM_1}, {"TIDM_2", sistripsummary::TIDM_2}, {"TIDM_3", sistripsummary::TIDM_3},
17  {"TOB", sistripsummary::TOB}, {"TOB_1", sistripsummary::TOB_1}, {"TOB_2", sistripsummary::TOB_2},
18  {"TOB_3", sistripsummary::TOB_3}, {"TOB_4", sistripsummary::TOB_4}, {"TOB_5", sistripsummary::TOB_5},
19  {"TOB_6", sistripsummary::TOB_6}, {"TEC", sistripsummary::TEC}, {"TECP", sistripsummary::TECP},
20  {"TECP_1", sistripsummary::TECP_1}, {"TECP_2", sistripsummary::TECP_2}, {"TECP_3", sistripsummary::TECP_3},
21  {"TECP_4", sistripsummary::TECP_4}, {"TECP_5", sistripsummary::TECP_5}, {"TECP_6", sistripsummary::TECP_6},
22  {"TECP_7", sistripsummary::TECP_7}, {"TECP_8", sistripsummary::TECP_8}, {"TECP_9", sistripsummary::TECP_9},
23  {"TECM", sistripsummary::TECM}, {"TECM_1", sistripsummary::TECM_1}, {"TECM_2", sistripsummary::TECM_2},
24  {"TECM_3", sistripsummary::TECM_3}, {"TECM_4", sistripsummary::TECM_4}, {"TECM_5", sistripsummary::TECM_5},
25  {"TECM_6", sistripsummary::TECM_6}, {"TECM_7", sistripsummary::TECM_7}, {"TECM_8", sistripsummary::TECM_8},
26  {"TECM_9", sistripsummary::TECM_9}};
27 
28  if (mapping.find(region) == mapping.end()) {
29  edm::LogError("SiStripMiscalibrate") << "@SUB=analyze"
30  << "Unknown partition: " << region;
31  throw cms::Exception("Invalid Partition passed");
32  } else {
33  return mapping[region];
34  }
35 }
36 
37 /*--------------------------------------------------------------------*/
38 std::vector<sistripsummary::TrackerRegion> SiStripMiscalibrate::getRegionsFromDetId(
39  const TrackerTopology* m_trackerTopo, DetId detid)
40 /*--------------------------------------------------------------------*/
41 {
42  int layer = 0;
43  int side = 0;
44  int subdet = 0;
45  int detCode = 0;
46 
47  std::vector<sistripsummary::TrackerRegion> ret;
48 
49  switch (detid.subdetId()) {
51  layer = m_trackerTopo->tibLayer(detid);
52  subdet = 1;
53  break;
55  layer = m_trackerTopo->tobLayer(detid);
56  subdet = 2;
57  break;
59  // is this module in TID+ or TID-?
60  layer = m_trackerTopo->tidWheel(detid);
61  side = m_trackerTopo->tidSide(detid);
62  subdet = 3 * 10 + side;
63  break;
65  // is this module in TEC+ or TEC-?
66  layer = m_trackerTopo->tecWheel(detid);
67  side = m_trackerTopo->tecSide(detid);
68  subdet = 4 * 10 + side;
69  break;
70  }
71 
72  detCode = (subdet * 10) + layer;
73 
74  ret.push_back(static_cast<sistripsummary::TrackerRegion>(detCode));
75 
76  if (subdet / 10 > 0) {
77  ret.push_back(static_cast<sistripsummary::TrackerRegion>(subdet / 10));
78  }
79 
80  ret.push_back(static_cast<sistripsummary::TrackerRegion>(subdet));
81  ret.push_back(sistripsummary::TRACKER);
82 
83  return ret;
84 }
85 
86 /*--------------------------------------------------------------------*/
87 std::pair<float, float> SiStripMiscalibrate::getTruncatedRange(const TrackerMap* theMap) {
88  /*--------------------------------------------------------------------*/
89 
90  // ------------ trim the tracker map ------------
91 
92  auto map = theMap->smoduleMap;
93  std::map<unsigned int, float> info_per_detid;
94  for (int layer = 1; layer < 44; layer++) {
95  for (int ring = theMap->firstRing[layer - 1]; ring < theMap->ntotRing[layer - 1] + theMap->firstRing[layer - 1];
96  ring++) {
97  for (int module = 1; module < 200; module++) {
98  int key = layer * 100000 + ring * 1000 + module;
99  TmModule* mod = map[key];
100  if (mod != nullptr && !mod->notInUse() && mod->count > 0) {
101  info_per_detid[key] = mod->value;
102  }
103  } // loop on modules
104  } // loop on ring
105  } // loop on layers
106 
107  auto range = SiStripPI::getTheRange(info_per_detid, 2);
108  return range;
109 }
static constexpr auto TEC
unsigned int tobLayer(const DetId &id) const
SmoduleMap smoduleMap
Definition: TrackerMap.h:172
std::vector< sistripsummary::TrackerRegion > getRegionsFromDetId(const TrackerTopology *m_trackerTopo, DetId detid)
sistripsummary::TrackerRegion getRegionFromString(std::string region)
ret
prodAgent to be discontinued
unsigned int tidSide(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
int firstRing[43]
Definition: TrackerMap.h:655
Log< level::Error, false > LogError
std::pair< float, float > getTheRange(std::map< uint32_t, float > values, const float nsigma)
unsigned int tecSide(const DetId &id) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
static constexpr auto TOB
Definition: DetId.h:17
static constexpr auto TIB
std::pair< float, float > getTruncatedRange(const TrackerMap *theMap)
unsigned int tibLayer(const DetId &id) const
T mod(const T &a, const T &b)
Definition: ecalDccMap.h:4
static constexpr auto TID