CMS 3D CMS Logo

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