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 }
HcalOther
Definition: HcalAssistant.h:38
MuonSubdetId::GEM
static constexpr int GEM
Definition: MuonSubdetId.h:14
MuonSubdetId::CSC
static constexpr int CSC
Definition: MuonSubdetId.h:12
EBDetId::ieta
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
PixelSubdetector.h
RPCDetId::station
int station() const
Definition: RPCDetId.h:78
RPCDetId::region
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
GEMDetId::ring
constexpr int ring() const
Definition: GEMDetId.h:176
RPCDetId::subsector
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
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
GEMDetId::layer
constexpr int layer() const
Definition: GEMDetId.h:190
EEDetId::isc
int isc() const
Definition: EEDetId.cc:222
HcalDetId::iphi
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
GEMDetId::region
constexpr int region() const
Definition: GEMDetId.h:171
EBDetId
Definition: EBDetId.h:17
CSCDetId::ring
int ring() const
Definition: CSCDetId.h:68
TrackerTopology
Definition: TrackerTopology.h:16
EcalLaserPnDiode
Definition: EcalSubdetector.h:10
ME0DetId.h
RPCDetId
Definition: RPCDetId.h:16
EBDetId.h
EEDetId.h
DetId::Hcal
Definition: DetId.h:28
TrackerTopology::layer
unsigned int layer(const DetId &id) const
Definition: TrackerTopology.cc:47
HcalDetId::depth
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164
HcalBarrel
Definition: HcalAssistant.h:33
HcalEmpty
Definition: HcalAssistant.h:32
EEDetId::ix
int ix() const
Definition: EEDetId.h:77
DetId::Calo
Definition: DetId.h:29
EEDetId::ic
int ic() const
Definition: EEDetId.cc:245
EcalBarrel
Definition: EcalSubdetector.h:10
CSCDetId.h
DetId
Definition: DetId.h:17
TrackerTopology.h
EBDetId::tower_ieta
int tower_ieta() const
get the HCAL/trigger ieta of this crystal
Definition: EBDetId.h:53
DetIdInfo::info
static std::string info(const DetId &, const TrackerTopology *tTopo)
Definition: DetIdInfo.cc:25
CSCDetId::layer
int layer() const
Definition: CSCDetId.h:56
DetIdInfo.h
HcalOuter
Definition: HcalAssistant.h:35
StripSubdetector::TIB
static constexpr auto TIB
Definition: StripSubdetector.h:16
MuonSubdetId::DT
static constexpr int DT
Definition: MuonSubdetId.h:11
EEDetId::iquadrant
int iquadrant() const
Definition: EEDetId.cc:206
DTChamberId.h
EEDetId
Definition: EEDetId.h:14
EcalSubdetector.h
EcalEndcap
Definition: EcalSubdetector.h:10
RPCDetId.h
EBDetId::tower_iphi
int tower_iphi() const
get the HCAL/trigger iphi of this crystal
Definition: EBDetId.cc:100
RPCDetId::roll
int roll() const
Definition: RPCDetId.h:92
GEMDetId::chamber
constexpr int chamber() const
Definition: GEMDetId.h:183
HcalDetId::ieta
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
DetId::Tracker
Definition: DetId.h:25
HcalDetId.h
GEMDetId
Definition: GEMDetId.h:18
CSCDetId
Definition: CSCDetId.h:26
HcalDetId::subdet
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
HcalDetId
Definition: HcalDetId.h:12
ME0DetId::station
int station() const
Definition: ME0DetId.h:58
CSCDetId::chamber
int chamber() const
Definition: CSCDetId.h:62
CaloTowerDetId.h
ME0DetId
Definition: ME0DetId.h:16
HcalSubdetector.h
MuonSubdetId::ME0
static constexpr int ME0
Definition: MuonSubdetId.h:15
DetId::Ecal
Definition: DetId.h:27
EEDetId::iy
int iy() const
Definition: EEDetId.h:83
MuonSubdetId.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RPCDetId::ring
int ring() const
Definition: RPCDetId.h:59
CaloTowerDetId::iphi
int iphi() const
get the tower iphi
Definition: CaloTowerDetId.cc:30
HcalForward
Definition: HcalAssistant.h:36
EcalPreshower
Definition: EcalSubdetector.h:10
DTChamberId::sector
int sector() const
Definition: DTChamberId.h:49
GEMDetId.h
EcalTriggerTower
Definition: EcalSubdetector.h:10
CaloTowerDetId::ieta
int ieta() const
get the tower ieta
Definition: CaloTowerDetId.h:30
StripSubdetector::TEC
static constexpr auto TEC
Definition: StripSubdetector.h:19
HcalEndcap
Definition: HcalAssistant.h:34
MuonSubdetId::RPC
static constexpr int RPC
Definition: MuonSubdetId.h:13
CSCDetId::endcap
int endcap() const
Definition: CSCDetId.h:85
HcalTriggerTower
Definition: HcalAssistant.h:37
RPCDetId::sector
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:81
ME0DetId::chamber
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: ME0DetId.h:41
StripSubdetector::TOB
static constexpr auto TOB
Definition: StripSubdetector.h:18
GEMDetId::station
constexpr int station() const
Definition: GEMDetId.h:179
EBDetId::iphi
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
DetId::Muon
Definition: DetId.h:26
DTChamberId
Definition: DTChamberId.h:14
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
runonSM.text
text
Definition: runonSM.py:43
ME0DetId::region
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: ME0DetId.h:38
RPCDetId::layer
int layer() const
Definition: RPCDetId.h:85
StripSubdetector.h
ME0DetId::layer
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
DTChamberId::wheel
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
StripSubdetector::TID
static constexpr auto TID
Definition: StripSubdetector.h:17
DTChamberId::station
int station() const
Return the station number.
Definition: DTChamberId.h:42
CaloTowerDetId
Definition: CaloTowerDetId.h:12