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),
23 
24 unsigned int MTDTopology::side(const DetId &id) const {
25  uint32_t subdet = MTDDetId(id).mtdSubDetector();
26  switch (subdet) {
27  case MTDDetId::BTL:
28  return btlSide(id);
29  case MTDDetId::ETL:
30  return etlSide(id);
31  default:
32  throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::side";
33  }
35 }
36 
37 unsigned int MTDTopology::layer(const DetId &id) const {
38  uint32_t subdet = MTDDetId(id).mtdSubDetector();
39  switch (subdet) {
40  case MTDDetId::BTL:
41  return btlLayer(id);
42  case MTDDetId::ETL:
43  return etlLayer(id);
44  default:
45  throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::layer";
46  }
48 }
49 
50 unsigned int MTDTopology::module(const DetId &id) const {
51  uint32_t subdet = MTDDetId(id).mtdSubDetector();
52  switch (subdet) {
53  case MTDDetId::BTL:
54  return btlModule(id);
55  case MTDDetId::ETL:
56  return etlModule(id);
57  default:
58  throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::module";
59  }
61 }
62 
63 unsigned int MTDTopology::tray(const DetId &id) const {
64  uint32_t subdet = MTDDetId(id).mtdSubDetector();
65  switch (subdet) {
66  case MTDDetId::BTL:
67  return btlTray(id);
68  case MTDDetId::ETL:
70  default:
71  throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::tray";
72  }
74 }
75 
76 unsigned int MTDTopology::ring(const DetId &id) const {
77  uint32_t subdet = MTDDetId(id).mtdSubDetector();
78  switch (subdet) {
79  case MTDDetId::BTL:
81  case MTDDetId::ETL:
82  return etlModule(id);
83  default:
84  throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::ring";
85  }
87 }
88 
90  uint32_t subdet = MTDDetId(id).mtdSubDetector();
91  std::stringstream strstr;
92 
93  if (subdet == MTDDetId::BTL) {
94  unsigned int theSide = btlSide(id);
95  unsigned int theLayer = btlLayer(id);
96  unsigned int theTray = btlTray(id);
97  unsigned int theModule = btlModule(id);
98  std::string side = (btlSide(id) == 1) ? "-" : "+";
99  strstr << "BTL"
100  << " Side " << theSide << side << " Layer " << theLayer << " Tray " << theTray << " Module "
101  << theModule;
102  strstr << " (" << id.rawId() << ")";
103  return strstr.str();
104  }
105 
106  if (subdet == MTDDetId::ETL) {
107  unsigned int theSide = etlSide(id);
108  unsigned int theLayer = etlLayer(id);
109  unsigned int theRing = etlRing(id);
110  unsigned int theModule = etlModule(id);
111  std::string side = (etlSide(id) == 1) ? "-" : "+";
112  strstr << "ETL"
113  << " Side " << theSide << side << " Layer " << theLayer << " Ring " << theRing << " Module "
114  << theModule;
115  strstr << " (" << id.rawId() << ")";
116  return strstr.str();
117  }
118  throw cms::Exception("Invalid DetId") << "Unsupported DetId in MTDTopology::print";
119  return strstr.str();
120 }
121 
122 int MTDTopology::getMTDLayerNumber(const DetId &id) const {
123  int layer = -1;
124  uint32_t subdet = MTDDetId(id).mtdSubDetector();
125 
126  if (id.det() == DetId::Forward) {
127  if (subdet == MTDDetId::BTL) {
128  layer = btlLayer(id);
129  } else if (id.subdetId() == MTDDetId::ETL) {
130  layer = etlLayer(id);
131  } else {
132  edm::LogInfo("MTDTopology") << ">>> Invalid subdetId() ";
133  }
134  }
135  return layer;
136 }
MTDTopology::ETLValues::moduleStartBit_
unsigned int moduleStartBit_
Definition: MTDTopology.h:33
MTDTopology::BTLModule
Definition: MTDTopology.h:41
MTDTopology::etlVals_
const ETLValues etlVals_
Definition: MTDTopology.h:160
MTDTopology::side
unsigned int side(const DetId &id) const
Definition: MTDTopology.cc:24
BTLDetId.h
MTDTopology::etlModule
unsigned int etlModule(const DetId &id) const
Definition: MTDTopology.h:85
PixelSubdetector.h
MessageLogger.h
MTDTopology::tray
unsigned int tray(const DetId &id) const
Definition: MTDTopology.cc:63
MTDTopology::ETLModule
Definition: MTDTopology.h:45
MTDTopology::BTLLayer
Definition: MTDTopology.h:43
MTDTopology::getMTDLayerNumber
int getMTDLayerNumber(const DetId &id) const
Definition: MTDTopology.cc:122
MTDTopology::BTLValues::trayStartBit_
unsigned int trayStartBit_
Definition: MTDTopology.h:21
edm::LogInfo
Definition: MessageLogger.h:254
MTDTopology::btlModule
unsigned int btlModule(const DetId &id) const
Definition: MTDTopology.h:82
MTDTopology::ETLValues::ringStartBit_
unsigned int ringStartBit_
Definition: MTDTopology.h:32
MTDTopology::ring
unsigned int ring(const DetId &id) const
Definition: MTDTopology.cc:76
MTDTopology::MTDTopology
MTDTopology(const int &topologyMode, const BTLValues &btl, const ETLValues &etl)
Definition: MTDTopology.cc:11
ETLDetId.h
MTDTopology::BTLValues::layerMask_
unsigned int layerMask_
Definition: MTDTopology.h:24
MTDTopology::BTLValues::moduleMask_
unsigned int moduleMask_
Definition: MTDTopology.h:26
DetId
Definition: DetId.h:17
MTDTopology::btlTray
unsigned int btlTray(const DetId &id) const
Definition: MTDTopology.h:90
MTDTopology::btlLayer
unsigned int btlLayer(const DetId &id) const
Definition: MTDTopology.h:96
MTDTopology::btlSide
unsigned int btlSide(const DetId &id) const
Definition: MTDTopology.h:104
MTDTopology::BTLValues
Definition: MTDTopology.h:18
MTDTopology::ETLValues
Definition: MTDTopology.h:29
MTDTopology::etlLayer
unsigned int etlLayer(const DetId &id) const
Definition: MTDTopology.h:99
MTDTopology::ETLValues::ringMask_
unsigned int ringMask_
Definition: MTDTopology.h:36
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
MTDTopology::ETLValues::sideStartBit_
unsigned int sideStartBit_
Definition: MTDTopology.h:30
MTDDetId::mtdSubDetector
int mtdSubDetector() const
Definition: MTDDetId.h:56
MTDTopology::etlSide
unsigned int etlSide(const DetId &id) const
Definition: MTDTopology.h:106
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
MTDTopology::BTLValues::sideStartBit_
unsigned int sideStartBit_
Definition: MTDTopology.h:19
MTDTopology::BTLValues::sideMask_
unsigned int sideMask_
Definition: MTDTopology.h:23
MTDTopology::print
std::string print(DetId detid) const
Definition: MTDTopology.cc:89
MTDTopology::BTLTray
Definition: MTDTopology.h:42
MTDTopology::btlVals_
const BTLValues btlVals_
Definition: MTDTopology.h:159
MTDTopology::ETLValues::sideMask_
unsigned int sideMask_
Definition: MTDTopology.h:34
MTDDetId::BTL
Definition: MTDDetId.h:27
MTDDetId::ETL
Definition: MTDDetId.h:27
MTDDetId
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
Exception
Definition: hltDiff.cc:246
MTDTopology::BTLSide
Definition: MTDTopology.h:44
MTDTopology::ETLRing
Definition: MTDTopology.h:46
MTDTopology::BTLValues::trayMask_
unsigned int trayMask_
Definition: MTDTopology.h:25
MTDTopology::ETLValues::moduleMask_
unsigned int moduleMask_
Definition: MTDTopology.h:37
Exception.h
MTDTopology::ETLValues::layerStartBit_
unsigned int layerStartBit_
Definition: MTDTopology.h:31
MTDTopology::module
unsigned int module(const DetId &id) const
Definition: MTDTopology.cc:50
MTDTopology::etlRing
unsigned int etlRing(const DetId &id) const
Definition: MTDTopology.h:93
DetId::Forward
Definition: DetId.h:30
MTDTopology::BTLValues::layerStartBit_
unsigned int layerStartBit_
Definition: MTDTopology.h:20
MTDTopology::ETLValues::layerMask_
unsigned int layerMask_
Definition: MTDTopology.h:35
MTDTopology::ETLSide
Definition: MTDTopology.h:48
StripSubdetector.h
MTDTopology::ETLLayer
Definition: MTDTopology.h:47
MTDTopology::BTLValues::moduleStartBit_
unsigned int moduleStartBit_
Definition: MTDTopology.h:22
MTDTopology.h
MTDTopology::layer
unsigned int layer(const DetId &id) const
Definition: MTDTopology.cc:37