CMS 3D CMS Logo

DetIdInfo.cc
Go to the documentation of this file.
1 #include "DetIdInfo.h"
2 
10 
14 
17 
19 
22 
23 #include <sstream>
24 
26  std::ostringstream oss;
27 
28  oss << "DetId: " << id.rawId() << "\n";
29 
30  switch (id.det()) {
31  case DetId::Tracker:
32  switch (id.subdetId()) {
33  case StripSubdetector::TIB: {
34  oss << "TIB ";
35  } break;
36  case StripSubdetector::TOB: {
37  oss << "TOB ";
38  } break;
39  case StripSubdetector::TEC: {
40  oss << "TEC ";
41  } break;
42  case StripSubdetector::TID: {
43  oss << "TID ";
44  } break;
46  oss << "PixBarrel ";
47  } break;
49  oss << "PixEndcap ";
50  } break;
51  }
52  if (tTopo != nullptr)
53  oss << tTopo->layer(id);
54  break;
55 
56  case DetId::Muon:
57  switch (id.subdetId()) {
58  case MuonSubdetId::DT: {
59  DTChamberId detId(id.rawId());
60  oss << "DT chamber (wheel, station, sector): " << detId.wheel() << ", " << detId.station() << ", "
61  << detId.sector();
62  } break;
63  case MuonSubdetId::CSC: {
64  CSCDetId detId(id.rawId());
65  oss << "CSC chamber (endcap, station, ring, chamber, layer): " << detId.endcap() << ", " << detId.station()
66  << ", " << detId.ring() << ", " << detId.chamber() << ", " << detId.layer();
67  } break;
68  case MuonSubdetId::RPC: {
69  RPCDetId detId(id.rawId());
70  oss << "RPC chamber ";
71  switch (detId.region()) {
72  case 0:
73  oss << "/ barrel / (wheel, station, sector, layer, subsector, roll): " << detId.ring() << ", "
74  << detId.station() << ", " << detId.sector() << ", " << detId.layer() << ", " << detId.subsector()
75  << ", " << detId.roll();
76  break;
77  case 1:
78  oss << "/ forward endcap / (wheel, station, sector, layer, subsector, roll): " << detId.ring() << ", "
79  << detId.station() << ", " << detId.sector() << ", " << detId.layer() << ", " << detId.subsector()
80  << ", " << detId.roll();
81  break;
82  case -1:
83  oss << "/ backward endcap / (wheel, station, sector, layer, subsector, roll): " << detId.ring() << ", "
84  << detId.station() << ", " << detId.sector() << ", " << detId.layer() << ", " << detId.subsector()
85  << ", " << detId.roll();
86  break;
87  }
88  } break;
89  case MuonSubdetId::GEM: {
90  GEMDetId detId(id.rawId());
91  oss << "GEM chamber (endcap, station, ring, chamber, layer): " << detId.region() << ", " << detId.station()
92  << ", " << detId.ring() << ", " << detId.chamber() << ", " << detId.layer();
93  } break;
94  case MuonSubdetId::ME0: {
95  ME0DetId detId(id.rawId());
96  oss << "ME0 chamber (endcap, station, ring, chamber, layer): " << detId.region() << ", " << detId.station()
97  << ", " << detId.chamber() << ", " << detId.layer();
98  } break;
99  }
100  break;
101 
102  case DetId::Calo: {
103  CaloTowerDetId detId(id.rawId());
104  oss << "CaloTower (ieta, iphi): " << detId.ieta() << ", " << detId.iphi();
105  } break;
106 
107  case DetId::Ecal:
108  switch (id.subdetId()) {
109  case EcalBarrel: {
110  EBDetId detId(id);
111  oss << "EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): " << detId.ieta() << ", " << detId.iphi() << ", "
112  << detId.tower_ieta() << ", " << detId.tower_iphi();
113  } break;
114  case EcalEndcap: {
115  EEDetId detId(id);
116  oss << "EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): " << detId.ix() << ", " << detId.iy() << ", "
117  << detId.isc() << ", " << detId.ic() << ", " << detId.iquadrant();
118  } break;
119  case EcalPreshower:
120  oss << "EcalPreshower";
121  break;
122  case EcalTriggerTower:
123  oss << "EcalTriggerTower";
124  break;
125  case EcalLaserPnDiode:
126  oss << "EcalLaserPnDiode";
127  break;
128  }
129  break;
130 
131  case DetId::Hcal: {
132  HcalDetId detId(id);
133  switch (detId.subdet()) {
134  case HcalEmpty:
135  oss << "HcalEmpty ";
136  break;
137  case HcalBarrel:
138  oss << "HcalBarrel ";
139  break;
140  case HcalEndcap:
141  oss << "HcalEndcap ";
142  break;
143  case HcalOuter:
144  oss << "HcalOuter ";
145  break;
146  case HcalForward:
147  oss << "HcalForward ";
148  break;
149  case HcalTriggerTower:
150  oss << "HcalTriggerTower ";
151  break;
152  case HcalOther:
153  oss << "HcalOther ";
154  break;
155  }
156  oss << "(ieta, iphi, depth):" << detId.ieta() << ", " << detId.iphi() << ", " << detId.depth();
157  } break;
158  default:;
159  }
160  return oss.str();
161 }
162 
163 std::string DetIdInfo::info(const std::set<DetId>& idSet, const TrackerTopology* tTopo) {
165  for (std::set<DetId>::const_iterator id = idSet.begin(); id != idSet.end(); id++) {
166  text += info(*id, tTopo);
167  text += "\n";
168  }
169  return text;
170 }
171 
172 std::string DetIdInfo::info(const std::vector<DetId>& idSet, const TrackerTopology* tTopo) {
174  for (std::vector<DetId>::const_iterator id = idSet.begin(); id != idSet.end(); id++) {
175  text += info(*id, tTopo);
176  text += "\n";
177  }
178  return text;
179 }
static constexpr auto TEC
static constexpr int GEM
Definition: MuonSubdetId.h:14
unsigned int layer(const DetId &id) const
static constexpr int ME0
Definition: MuonSubdetId.h:15
static constexpr auto TOB
Definition: DetId.h:17
static constexpr auto TIB
static std::string info(const DetId &, const TrackerTopology *tTopo)
Definition: DetIdInfo.cc:25
static constexpr int RPC
Definition: MuonSubdetId.h:13
static constexpr int DT
Definition: MuonSubdetId.h:11
static constexpr int CSC
Definition: MuonSubdetId.h:12
static constexpr auto TID