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