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