CMS 3D CMS Logo

MTDTopology.cc
Go to the documentation of this file.
8 #include <sstream>
9 #include <limits>
10 
11 MTDTopology::MTDTopology( const int& topologyMode, const BTLValues& btl, const ETLValues& etl )
12  : mtdTopologyMode_(topologyMode),
13  btlVals_(btl),
14  etlVals_(etl),
15  bits_per_field{
24 }
25 {}
26 
27 
28 
29 unsigned int MTDTopology::side(const DetId &id) const {
30  uint32_t subdet=MTDDetId(id).mtdSubDetector();
31  switch( subdet ) {
32  case MTDDetId::BTL:
33  return btlSide(id);
34  case MTDDetId::ETL:
35  return etlSide(id);
36  default:
37  throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::side";
38  }
40 }
41 
42 unsigned int MTDTopology::layer(const DetId &id) const {
43  uint32_t subdet=MTDDetId(id).mtdSubDetector();
44  switch( subdet ) {
45  case MTDDetId::BTL:
46  return btlLayer(id);
47  case MTDDetId::ETL:
48  return etlLayer(id);
49  default:
50  throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::layer";
51  }
53 }
54 
55 unsigned int MTDTopology::module(const DetId &id) const {
56  uint32_t subdet=MTDDetId(id).mtdSubDetector();
57  switch( subdet ) {
58  case MTDDetId::BTL:
59  return btlModule(id);
60  case MTDDetId::ETL:
61  return etlModule(id);
62  default:
63  throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::module";
64  }
66 }
67 
68 unsigned int MTDTopology::tray(const DetId &id) const {
69  uint32_t subdet=MTDDetId(id).mtdSubDetector();
70  switch( subdet ) {
71  case MTDDetId::BTL:
72  return btlTray(id);
73  case MTDDetId::ETL:
75  default:
76  throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::tray";
77  }
79 }
80 
81 unsigned int MTDTopology::ring(const DetId &id) const {
82  uint32_t subdet=MTDDetId(id).mtdSubDetector();
83  switch( subdet ) {
84  case MTDDetId::BTL:
86  case MTDDetId::ETL:
87  return etlModule(id);
88  default:
89  throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::ring";
90  }
92 }
93 
94 
95 
97  uint32_t subdet=MTDDetId(id).mtdSubDetector();
98  std::stringstream strstr;
99 
100  if ( subdet == MTDDetId::BTL ) {
101  unsigned int theSide = btlSide(id);
102  unsigned int theLayer = btlLayer(id);
103  unsigned int theTray = btlTray(id);
104  unsigned int theModule = btlModule(id);
105  std::string side = (btlSide(id) == 1 ) ? "-" : "+";
106  strstr << "BTL"
107  << " Side " << theSide << side
108  << " Layer " << theLayer
109  << " Tray " << theTray
110  << " Module " << theModule ;
111  strstr << " (" << id.rawId() << ")";
112  return strstr.str();
113  }
114 
115  if ( subdet == MTDDetId::ETL ) {
116  unsigned int theSide = etlSide(id);
117  unsigned int theLayer = etlLayer(id);
118  unsigned int theRing = etlRing(id);
119  unsigned int theModule = etlModule(id);
120  std::string side = (etlSide(id) == 1 ) ? "-" : "+";
121  strstr << "ETL"
122  << " Side " << theSide << side
123  << " Layer " << theLayer
124  << " Ring " << theRing
125  << " Module " << theModule ;
126  strstr << " (" << id.rawId() << ")";
127  return strstr.str();
128  }
129  throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::print";
130  return strstr.str();
131 }
132 
133 
134 
135 int MTDTopology::getMTDLayerNumber(const DetId &id) const {
136  int layer = -1;
137  uint32_t subdet=MTDDetId(id).mtdSubDetector();
138 
139  if (id.det() == DetId::Forward) {
140  if (subdet == MTDDetId::BTL) {
141  layer = btlLayer(id);
142  } else if (id.subdetId() == MTDDetId::ETL) {
143  layer = etlLayer(id);
144  } else {
145  edm::LogInfo("MTDTopology") << ">>> Invalid subdetId() " ;
146  }
147  }
148  return layer;
149 }
150 
unsigned int ringMask_
Definition: MTDTopology.h:39
MTDTopology(const int &topologyMode, const BTLValues &btl, const ETLValues &etl)
Definition: MTDTopology.cc:11
unsigned int btlTray(const DetId &id) const
Definition: MTDTopology.h:91
std::string print(DetId detid) const
Definition: MTDTopology.cc:96
unsigned int module(const DetId &id) const
Definition: MTDTopology.cc:55
unsigned int sideStartBit_
Definition: MTDTopology.h:22
unsigned int layer(const DetId &id) const
Definition: MTDTopology.cc:42
unsigned int sideStartBit_
Definition: MTDTopology.h:33
unsigned int btlSide(const DetId &id) const
Definition: MTDTopology.h:109
unsigned int moduleMask_
Definition: MTDTopology.h:29
const ETLValues etlVals_
Definition: MTDTopology.h:180
unsigned int moduleStartBit_
Definition: MTDTopology.h:25
unsigned int btlModule(const DetId &id) const
Definition: MTDTopology.h:83
unsigned int layerStartBit_
Definition: MTDTopology.h:34
unsigned int trayMask_
Definition: MTDTopology.h:28
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
unsigned int btlLayer(const DetId &id) const
Definition: MTDTopology.h:101
unsigned int moduleStartBit_
Definition: MTDTopology.h:36
unsigned int side(const DetId &id) const
Definition: MTDTopology.cc:29
unsigned int sideMask_
Definition: MTDTopology.h:26
unsigned int tray(const DetId &id) const
Definition: MTDTopology.cc:68
unsigned int etlSide(const DetId &id) const
Definition: MTDTopology.h:113
Definition: DetId.h:18
unsigned int trayStartBit_
Definition: MTDTopology.h:24
unsigned int ringStartBit_
Definition: MTDTopology.h:35
unsigned int moduleMask_
Definition: MTDTopology.h:40
unsigned int layerStartBit_
Definition: MTDTopology.h:23
unsigned int ring(const DetId &id) const
Definition: MTDTopology.cc:81
unsigned int etlModule(const DetId &id) const
Definition: MTDTopology.h:86
int mtdSubDetector() const
Definition: MTDDetId.h:58
int getMTDLayerNumber(const DetId &id) const
Definition: MTDTopology.cc:135
unsigned int sideMask_
Definition: MTDTopology.h:37
unsigned int etlRing(const DetId &id) const
Definition: MTDTopology.h:96
unsigned int layerMask_
Definition: MTDTopology.h:27
unsigned int layerMask_
Definition: MTDTopology.h:38
unsigned int etlLayer(const DetId &id) const
Definition: MTDTopology.h:104
const BTLValues btlVals_
Definition: MTDTopology.h:179