CMS 3D CMS Logo

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