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 
32  case DetId::Tracker:
33  switch ( id.subdetId() ) {
35  {
36  oss <<"TIB ";
37  }
38  break;
40  {
41  oss <<"TOB ";
42  }
43  break;
45  {
46  oss <<"TEC ";
47  }
48  break;
50  {
51  oss <<"TID ";
52  }
53  break;
55  {
56  oss <<"PixBarrel ";
57  }
58  break;
60  {
61  oss <<"PixEndcap ";
62  }
63  break;
64  }
65  if ( tTopo!=0)
66  oss<< tTopo->layer(id);
67  break;
68 
69  case DetId::Muon:
70  switch ( id.subdetId() ) {
71  case MuonSubdetId::DT:
72  {
73  DTChamberId detId(id.rawId());
74  oss << "DT chamber (wheel, station, sector): "
75  << detId.wheel() << ", "
76  << detId.station() << ", "
77  << detId.sector();
78  }
79  break;
80  case MuonSubdetId::CSC:
81  {
82  CSCDetId detId(id.rawId());
83  oss << "CSC chamber (endcap, station, ring, chamber, layer): "
84  << detId.endcap() << ", "
85  << detId.station() << ", "
86  << detId.ring() << ", "
87  << detId.chamber() << ", "
88  << detId.layer();
89  }
90  break;
91  case MuonSubdetId::RPC:
92  {
93  RPCDetId detId(id.rawId());
94  oss << "RPC chamber ";
95  switch ( detId.region() ) {
96  case 0:
97  oss << "/ barrel / (wheel, station, sector, layer, subsector, roll): "
98  << detId.ring() << ", "
99  << detId.station() << ", "
100  << detId.sector() << ", "
101  << detId.layer() << ", "
102  << detId.subsector() << ", "
103  << detId.roll();
104  break;
105  case 1:
106  oss << "/ forward endcap / (wheel, station, sector, layer, subsector, roll): "
107  << detId.ring() << ", "
108  << detId.station() << ", "
109  << detId.sector() << ", "
110  << detId.layer() << ", "
111  << detId.subsector() << ", "
112  << detId.roll();
113  break;
114  case -1:
115  oss << "/ backward endcap / (wheel, station, sector, layer, subsector, roll): "
116  << detId.ring() << ", "
117  << detId.station() << ", "
118  << detId.sector() << ", "
119  << detId.layer() << ", "
120  << detId.subsector() << ", "
121  << detId.roll();
122  break;
123  }
124  }
125  break;
126  case MuonSubdetId::GEM:
127  {
128  GEMDetId detId(id.rawId());
129  oss << "GEM chamber (endcap, station, ring, chamber, layer): "
130  << detId.region() << ", "
131  << detId.station() << ", "
132  << detId.ring() << ", "
133  << detId.chamber() << ", "
134  << detId.layer();
135  }
136  break;
137  case MuonSubdetId::ME0:
138  {
139  ME0DetId detId(id.rawId());
140  oss << "ME0 chamber (endcap, station, ring, chamber, layer): "
141  << detId.region() << ", "
142  << detId.station() << ", "
143  << detId.chamber() << ", "
144  << detId.layer();
145  }
146  break;
147  }
148  break;
149 
150  case DetId::Calo:
151  {
152  CaloTowerDetId detId( id.rawId() );
153  oss << "CaloTower (ieta, iphi): "
154  << detId.ieta() << ", "
155  << detId.iphi();
156  }
157  break;
158 
159  case DetId::Ecal:
160  switch ( id.subdetId() ) {
161  case EcalBarrel:
162  {
163  EBDetId detId(id);
164  oss << "EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): "
165  << detId.ieta() << ", "
166  << detId.iphi() << ", "
167  << detId.tower_ieta() << ", "
168  << detId.tower_iphi();
169  }
170  break;
171  case EcalEndcap:
172  {
173  EEDetId detId(id);
174  oss << "EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): "
175  << detId.ix() << ", "
176  << detId.iy() << ", "
177  << detId.isc() << ", "
178  << detId.ic() << ", "
179  << detId.iquadrant();
180  }
181  break;
182  case EcalPreshower:
183  oss << "EcalPreshower";
184  break;
185  case EcalTriggerTower:
186  oss << "EcalTriggerTower";
187  break;
188  case EcalLaserPnDiode:
189  oss << "EcalLaserPnDiode";
190  break;
191  }
192  break;
193 
194  case DetId::Hcal:
195  {
196  HcalDetId detId(id);
197  switch ( detId.subdet() ) {
198  case HcalEmpty:
199  oss << "HcalEmpty ";
200  break;
201  case HcalBarrel:
202  oss << "HcalBarrel ";
203  break;
204  case HcalEndcap:
205  oss << "HcalEndcap ";
206  break;
207  case HcalOuter:
208  oss << "HcalOuter ";
209  break;
210  case HcalForward:
211  oss << "HcalForward ";
212  break;
213  case HcalTriggerTower:
214  oss << "HcalTriggerTower ";
215  break;
216  case HcalOther:
217  oss << "HcalOther ";
218  break;
219  }
220  oss << "(ieta, iphi, depth):"
221  << detId.ieta() << ", "
222  << detId.iphi() << ", "
223  << detId.depth();
224  }
225  break;
226  default :;
227  }
228  return oss.str();
229 }
230 
231 
232 std::string DetIdInfo::info(const std::set<DetId>& idSet, const TrackerTopology *tTopo) {
234  for(std::set<DetId>::const_iterator id = idSet.begin(); id != idSet.end(); id++)
235  {
236  text += info(*id, tTopo);
237  text += "\n";
238  }
239  return text;
240 }
241 
242 std::string DetIdInfo::info(const std::vector<DetId>& idSet, const TrackerTopology *tTopo) {
244  for(std::vector<DetId>::const_iterator id = idSet.begin(); id != idSet.end(); id++)
245  {
246  text += info(*id, tTopo);
247  text += "\n";
248  }
249  return text;
250 }
251 
252 
int chamber() const
Definition: CSCDetId.h:68
int ix() const
Definition: EEDetId.h:76
int ic() const
Definition: EEDetId.cc:324
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
int tower_ieta() const
get the HCAL/trigger ieta of this crystal
Definition: EBDetId.h:55
int tower_iphi() const
get the HCAL/trigger iphi of this crystal
Definition: EBDetId.cc:114
int isc() const
Definition: EEDetId.cc:285
static const int GEM
Definition: MuonSubdetId.h:15
int ring() const
Definition: GEMDetId.h:59
int iquadrant() const
Definition: EEDetId.cc:264
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: GEMDetId.h:74
int layer() const
Definition: CSCDetId.h:61
int station() const
Definition: ME0DetId.h:76
int iphi() const
get the crystal iphi
Definition: EBDetId.h:53
int endcap() const
Definition: CSCDetId.h:93
static const int ME0
Definition: MuonSubdetId.h:16
int depth() const
get the tower depth
Definition: HcalDetId.cc:108
int chamber() const
Chamber id: it identifies a chamber in a ring it goes from 1 to 36.
Definition: ME0DetId.h:51
static const int CSC
Definition: MuonSubdetId.h:13
int roll() const
Definition: RPCDetId.h:120
int ring() const
Definition: RPCDetId.h:72
int layer() const
Layer id: each station have two layers of chambers: layer 1 is the inner chamber and layer 2 is the o...
Definition: GEMDetId.h:69
int ieta() const
get the cell ieta
Definition: HcalDetId.h:56
int iphi() const
get the tower iphi
int station() const
Station id : the station is the pair of chambers at same disk.
Definition: GEMDetId.h:64
int iy() const
Definition: EEDetId.h:82
int ieta() const
get the crystal ieta
Definition: EBDetId.h:51
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: GEMDetId.h:53
int iphi() const
get the cell iphi
Definition: HcalDetId.cc:103
int ring() const
Definition: CSCDetId.h:75
int layer() const
Definition: RPCDetId.h:108
Definition: DetId.h:18
static std::string info(const DetId &, const TrackerTopology *tTopo)
Definition: DetIdInfo.cc:25
int region() const
Region id: 0 for Barrel Not in use, +/-1 For +/- Endcap.
Definition: ME0DetId.h:46
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:102
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:114
static const int RPC
Definition: MuonSubdetId.h:14
int sector() const
Definition: DTChamberId.h:61
int station() const
Definition: CSCDetId.h:86
static const int DT
Definition: MuonSubdetId.h:12
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:56
int ieta() const
get the tower ieta
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
int station() const
Definition: RPCDetId.h:96