CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 }
int chamber() const
Definition: CSCDetId.h:62
static constexpr auto TEC
static constexpr int GEM
Definition: MuonSubdetId.h:14
int ix() const
Definition: EEDetId.h:77
int ic() const
Definition: EEDetId.cc:245
int tower_ieta() const
get the HCAL/trigger ieta of this crystal
Definition: EBDetId.h:53
int tower_iphi() const
get the HCAL/trigger iphi of this crystal
Definition: EBDetId.cc:100
int isc() const
Definition: EEDetId.cc:222
int iquadrant() const
Definition: EEDetId.cc:206
int layer() const
Definition: CSCDetId.h:56
int station() const
Definition: ME0DetId.h:58
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
int endcap() const
Definition: CSCDetId.h:85
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: ME0DetId.h:41
int roll() const
Definition: RPCDetId.h:92
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
int ring() const
Definition: RPCDetId.h:59
constexpr int region() const
Definition: GEMDetId.h:171
int iphi() const
get the tower iphi
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
tuple text
Definition: runonSM.py:43
static constexpr int ME0
Definition: MuonSubdetId.h:15
int iy() const
Definition: EEDetId.h:83
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
static constexpr auto TOB
int ring() const
Definition: CSCDetId.h:68
int layer() const
Definition: RPCDetId.h:85
Definition: DetId.h:17
static constexpr auto TIB
static std::string info(const DetId &, const TrackerTopology *tTopo)
Definition: DetIdInfo.cc:25
constexpr int chamber() const
Definition: GEMDetId.h:183
constexpr int ring() const
Definition: GEMDetId.h:176
constexpr int layer() const
Definition: GEMDetId.h:190
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: ME0DetId.h:38
static constexpr int RPC
Definition: MuonSubdetId.h:13
constexpr int station() const
Definition: GEMDetId.h:179
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:81
unsigned int layer(const DetId &id) const
int subsector() const
SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel...
Definition: RPCDetId.h:88
int sector() const
Definition: DTChamberId.h:49
int station() const
Definition: CSCDetId.h:79
int layer() const
Layer id: each chamber has six layers of chambers: layer 1 is the inner layer and layer 6 is the oute...
Definition: ME0DetId.h:44
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164
static constexpr int DT
Definition: MuonSubdetId.h:11
int ieta() const
get the tower ieta
int station() const
Return the station number.
Definition: DTChamberId.h:42
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
static constexpr int CSC
Definition: MuonSubdetId.h:12
static constexpr auto TID
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
int station() const
Definition: RPCDetId.h:78