CMS 3D CMS Logo

DetIdInfo.cc
Go to the documentation of this file.
1 #include "DetIdInfo.h"
2 
10 
14 
23 
25 
28 
29 #include <sstream>
30 
32  std::ostringstream oss;
33 
34  oss << "DetId: " << id.rawId() << "\n";
35 
36  switch ( id.det() ) {
37 
38  case DetId::Tracker:
39  switch ( id.subdetId() ) {
41  {
42  oss <<"TIB ";
43  }
44  break;
46  {
47  oss <<"TOB ";
48  }
49  break;
51  {
52  oss <<"TEC ";
53  }
54  break;
56  {
57  oss <<"TID ";
58  }
59  break;
61  {
62  oss <<"PixBarrel ";
63  }
64  break;
66  {
67  oss <<"PixEndcap ";
68  }
69  break;
70  }
71  if ( tTopo!=0)
72  oss<< tTopo->layer(id);
73  break;
74 
75  case DetId::Muon:
76  switch ( id.subdetId() ) {
77  case MuonSubdetId::DT:
78  {
79  DTChamberId detId(id.rawId());
80  oss << "DT chamber (wheel, station, sector): "
81  << detId.wheel() << ", "
82  << detId.station() << ", "
83  << detId.sector();
84  }
85  break;
86  case MuonSubdetId::CSC:
87  {
88  CSCDetId detId(id.rawId());
89  oss << "CSC chamber (endcap, station, ring, chamber, layer): "
90  << detId.endcap() << ", "
91  << detId.station() << ", "
92  << detId.ring() << ", "
93  << detId.chamber() << ", "
94  << detId.layer();
95  }
96  break;
97  case MuonSubdetId::RPC:
98  {
99  RPCDetId detId(id.rawId());
100  oss << "RPC chamber ";
101  switch ( detId.region() ) {
102  case 0:
103  oss << "/ barrel / (wheel, station, sector, layer, subsector, roll): "
104  << detId.ring() << ", "
105  << detId.station() << ", "
106  << detId.sector() << ", "
107  << detId.layer() << ", "
108  << detId.subsector() << ", "
109  << detId.roll();
110  break;
111  case 1:
112  oss << "/ forward endcap / (wheel, station, sector, layer, subsector, roll): "
113  << detId.ring() << ", "
114  << detId.station() << ", "
115  << detId.sector() << ", "
116  << detId.layer() << ", "
117  << detId.subsector() << ", "
118  << detId.roll();
119  break;
120  case -1:
121  oss << "/ backward endcap / (wheel, station, sector, layer, subsector, roll): "
122  << detId.ring() << ", "
123  << detId.station() << ", "
124  << detId.sector() << ", "
125  << detId.layer() << ", "
126  << detId.subsector() << ", "
127  << detId.roll();
128  break;
129  }
130  }
131  break;
132  case MuonSubdetId::GEM:
133  {
134  GEMDetId detId(id.rawId());
135  oss << "GEM chamber (endcap, station, ring, chamber, layer): "
136  << detId.region() << ", "
137  << detId.station() << ", "
138  << detId.ring() << ", "
139  << detId.chamber() << ", "
140  << detId.layer();
141  }
142  break;
143  case MuonSubdetId::ME0:
144  {
145  ME0DetId detId(id.rawId());
146  oss << "ME0 chamber (endcap, station, ring, chamber, layer): "
147  << detId.region() << ", "
148  << detId.station() << ", "
149  << detId.chamber() << ", "
150  << detId.layer();
151  }
152  break;
153  }
154  break;
155 
156  case DetId::Calo:
157  {
158  CaloTowerDetId detId( id.rawId() );
159  oss << "CaloTower (ieta, iphi): "
160  << detId.ieta() << ", "
161  << detId.iphi();
162  }
163  break;
164 
165  case DetId::Ecal:
166  switch ( id.subdetId() ) {
167  case EcalBarrel:
168  {
169  EBDetId detId(id);
170  oss << "EcalBarrel (ieta, iphi, tower_ieta, tower_iphi): "
171  << detId.ieta() << ", "
172  << detId.iphi() << ", "
173  << detId.tower_ieta() << ", "
174  << detId.tower_iphi();
175  }
176  break;
177  case EcalEndcap:
178  {
179  EEDetId detId(id);
180  oss << "EcalEndcap (ix, iy, SuperCrystal, crystal, quadrant): "
181  << detId.ix() << ", "
182  << detId.iy() << ", "
183  << detId.isc() << ", "
184  << detId.ic() << ", "
185  << detId.iquadrant();
186  }
187  break;
188  case EcalPreshower:
189  oss << "EcalPreshower";
190  break;
191  case EcalTriggerTower:
192  oss << "EcalTriggerTower";
193  break;
194  case EcalLaserPnDiode:
195  oss << "EcalLaserPnDiode";
196  break;
197  }
198  break;
199 
200  case DetId::Hcal:
201  {
202  HcalDetId detId(id);
203  switch ( detId.subdet() ) {
204  case HcalEmpty:
205  oss << "HcalEmpty ";
206  break;
207  case HcalBarrel:
208  oss << "HcalBarrel ";
209  break;
210  case HcalEndcap:
211  oss << "HcalEndcap ";
212  break;
213  case HcalOuter:
214  oss << "HcalOuter ";
215  break;
216  case HcalForward:
217  oss << "HcalForward ";
218  break;
219  case HcalTriggerTower:
220  oss << "HcalTriggerTower ";
221  break;
222  case HcalOther:
223  oss << "HcalOther ";
224  break;
225  }
226  oss << "(ieta, iphi, depth):"
227  << detId.ieta() << ", "
228  << detId.iphi() << ", "
229  << detId.depth();
230  }
231  break;
232  default :;
233  }
234  return oss.str();
235 }
236 
237 
238 std::string DetIdInfo::info(const std::set<DetId>& idSet, const TrackerTopology *tTopo) {
240  for(std::set<DetId>::const_iterator id = idSet.begin(); id != idSet.end(); id++)
241  {
242  text += info(*id, tTopo);
243  text += "\n";
244  }
245  return text;
246 }
247 
248 std::string DetIdInfo::info(const std::vector<DetId>& idSet, const TrackerTopology *tTopo) {
250  for(std::vector<DetId>::const_iterator id = idSet.begin(); id != idSet.end(); id++)
251  {
252  text += info(*id, tTopo);
253  text += "\n";
254  }
255  return text;
256 }
257 
258 
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:31
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