CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Attributes
MTDTopology Class Reference

#include <MTDTopology.h>

Classes

struct  BitmaskAndSubdet
 
struct  BTLValues
 
struct  ETLValues
 
class  SameLayerComparator
 

Public Types

enum  DetIdFields {
  BTLModule, BTLTray, BTLLayer, BTLSide,
  ETLModule, ETLRing, ETLLayer, ETLSide,
  DETID_FIELDS_MAX
}
 

Public Member Functions

DetId btlDetId (uint32_t side, uint32_t layer, uint32_t tray, uint32_t module) const
 
std::pair< DetId, SameLayerComparatorbtlDetIdLayerComparator (uint32_t side, uint32_t layer) const
 
unsigned int btlLayer (const DetId &id) const
 
unsigned int btlModule (const DetId &id) const
 
unsigned int btlSide (const DetId &id) const
 
unsigned int btlTray (const DetId &id) const
 
DetId etlDetId (uint32_t side, uint32_t layer, uint32_t ring, uint32_t module) const
 
std::pair< DetId, SameLayerComparatoretlDetIdDiskComparator (uint32_t side, uint32_t layer) const
 
unsigned int etlDisc (const DetId &id) const
 
unsigned int etlLayer (const DetId &id) const
 
unsigned int etlModule (const DetId &id) const
 
unsigned int etlRing (const DetId &id) const
 
unsigned int etlSide (const DetId &id) const
 
unsigned int getField (const DetId &id, DetIdFields idx) const
 
int getMTDLayerNumber (const DetId &id) const
 
int getMTDTopologyMode () const
 
bool hasField (const DetId &id, DetIdFields idx) const
 
unsigned int layer (const DetId &id) const
 
unsigned int module (const DetId &id) const
 
 MTDTopology (const int &topologyMode, const BTLValues &btl, const ETLValues &etl)
 
std::string print (DetId detid) const
 
unsigned int ring (const DetId &id) const
 
unsigned int side (const DetId &id) const
 
unsigned int tray (const DetId &id) const
 

Private Attributes

const BitmaskAndSubdet bits_per_field [DETID_FIELDS_MAX]
 
const BTLValues btlVals_
 
const ETLValues etlVals_
 
const int mtdTopologyMode_
 

Detailed Description

Definition at line 16 of file MTDTopology.h.

Member Enumeration Documentation

◆ DetIdFields

Enumerator
BTLModule 
BTLTray 
BTLLayer 
BTLSide 
ETLModule 
ETLRing 
ETLLayer 
ETLSide 
DETID_FIELDS_MAX 

Definition at line 40 of file MTDTopology.h.

40  {
41  BTLModule,
42  BTLTray,
43  BTLLayer,
44  BTLSide,
45  ETLModule,
46  ETLRing,
47  ETLLayer,
48  ETLSide,
49  /* TODO: this can be extended for all subdetectors */
51  };

Constructor & Destructor Documentation

◆ MTDTopology()

MTDTopology::MTDTopology ( const int &  topologyMode,
const BTLValues btl,
const ETLValues etl 
)

Definition at line 11 of file MTDTopology.cc.

References MTDDetId::BTL, BTLLayer, BTLModule, BTLSide, BTLTray, btlVals_, MTDDetId::ETL, ETLLayer, ETLModule, ETLRing, ETLSide, etlVals_, MTDTopology::BTLValues::layerMask_, MTDTopology::ETLValues::layerMask_, MTDTopology::BTLValues::layerStartBit_, MTDTopology::ETLValues::layerStartBit_, MTDTopology::BTLValues::moduleMask_, MTDTopology::ETLValues::moduleMask_, MTDTopology::BTLValues::moduleStartBit_, MTDTopology::ETLValues::moduleStartBit_, MTDTopology::ETLValues::ringMask_, MTDTopology::ETLValues::ringStartBit_, MTDTopology::BTLValues::sideMask_, MTDTopology::ETLValues::sideMask_, MTDTopology::BTLValues::sideStartBit_, MTDTopology::ETLValues::sideStartBit_, MTDTopology::BTLValues::trayMask_, and MTDTopology::BTLValues::trayStartBit_.

Member Function Documentation

◆ btlDetId()

DetId MTDTopology::btlDetId ( uint32_t  side,
uint32_t  layer,
uint32_t  tray,
uint32_t  module 
) const
inline

◆ btlDetIdLayerComparator()

std::pair<DetId, SameLayerComparator> MTDTopology::btlDetIdLayerComparator ( uint32_t  side,
uint32_t  layer 
) const
inline

Definition at line 135 of file MTDTopology.h.

135  {
136  return std::make_pair(btlDetId(side, layer, 1, 1), SameLayerComparator(this));
137  }

References btlDetId(), layer(), and side().

◆ btlLayer()

unsigned int MTDTopology::btlLayer ( const DetId id) const
inline

Definition at line 96 of file MTDTopology.h.

96  {
97  return int((id.rawId() >> btlVals_.layerStartBit_) & btlVals_.layerMask_);
98  }

References btlVals_, createfilelist::int, MTDTopology::BTLValues::layerMask_, and MTDTopology::BTLValues::layerStartBit_.

Referenced by getMTDLayerNumber(), layer(), and print().

◆ btlModule()

unsigned int MTDTopology::btlModule ( const DetId id) const
inline

Definition at line 82 of file MTDTopology.h.

82  {
83  return ((id.rawId() >> btlVals_.moduleStartBit_) & btlVals_.moduleMask_);
84  }

References btlVals_, MTDTopology::BTLValues::moduleMask_, and MTDTopology::BTLValues::moduleStartBit_.

Referenced by module(), and print().

◆ btlSide()

unsigned int MTDTopology::btlSide ( const DetId id) const
inline

Definition at line 104 of file MTDTopology.h.

104 { return ((id.rawId() >> btlVals_.sideStartBit_) & btlVals_.sideMask_); }

References btlVals_, MTDTopology::BTLValues::sideMask_, and MTDTopology::BTLValues::sideStartBit_.

Referenced by print(), and side().

◆ btlTray()

unsigned int MTDTopology::btlTray ( const DetId id) const
inline

Definition at line 90 of file MTDTopology.h.

90 { return ((id.rawId() >> btlVals_.trayStartBit_) & btlVals_.trayMask_); }

References btlVals_, MTDTopology::BTLValues::trayMask_, and MTDTopology::BTLValues::trayStartBit_.

Referenced by print(), and tray().

◆ etlDetId()

DetId MTDTopology::etlDetId ( uint32_t  side,
uint32_t  layer,
uint32_t  ring,
uint32_t  module 
) const
inline

◆ etlDetIdDiskComparator()

std::pair<DetId, SameLayerComparator> MTDTopology::etlDetIdDiskComparator ( uint32_t  side,
uint32_t  layer 
) const
inline

Definition at line 139 of file MTDTopology.h.

139  {
140  return std::make_pair(etlDetId(side, layer, 1, 1), SameLayerComparator(this));
141  }

References etlDetId(), layer(), and side().

◆ etlDisc()

unsigned int MTDTopology::etlDisc ( const DetId id) const
inline

Definition at line 109 of file MTDTopology.h.

109  {
110  return int((id.rawId() >> etlVals_.ringStartBit_) & etlVals_.ringMask_) % 2;
111  }

References etlVals_, createfilelist::int, MTDTopology::ETLValues::ringMask_, and MTDTopology::ETLValues::ringStartBit_.

◆ etlLayer()

unsigned int MTDTopology::etlLayer ( const DetId id) const
inline

Definition at line 99 of file MTDTopology.h.

99  {
100  return int((id.rawId() >> etlVals_.layerStartBit_) & etlVals_.layerMask_);
101  }

References etlVals_, createfilelist::int, MTDTopology::ETLValues::layerMask_, and MTDTopology::ETLValues::layerStartBit_.

Referenced by getMTDLayerNumber(), layer(), and print().

◆ etlModule()

unsigned int MTDTopology::etlModule ( const DetId id) const
inline

Definition at line 85 of file MTDTopology.h.

85  {
86  return int((id.rawId() >> btlVals_.moduleStartBit_) & btlVals_.moduleMask_);
87  }

References btlVals_, createfilelist::int, MTDTopology::BTLValues::moduleMask_, and MTDTopology::BTLValues::moduleStartBit_.

Referenced by module(), print(), and ring().

◆ etlRing()

unsigned int MTDTopology::etlRing ( const DetId id) const
inline

Definition at line 93 of file MTDTopology.h.

93 { return ((id.rawId() >> etlVals_.ringStartBit_) & etlVals_.ringMask_); }

References etlVals_, MTDTopology::ETLValues::ringMask_, and MTDTopology::ETLValues::ringStartBit_.

Referenced by print().

◆ etlSide()

unsigned int MTDTopology::etlSide ( const DetId id) const
inline

Definition at line 106 of file MTDTopology.h.

106 { return ((id.rawId() >> etlVals_.sideStartBit_) & etlVals_.sideMask_); }

References etlVals_, MTDTopology::ETLValues::sideMask_, and MTDTopology::ETLValues::sideStartBit_.

Referenced by print(), and side().

◆ getField()

unsigned int MTDTopology::getField ( const DetId id,
DetIdFields  idx 
) const
inline

Definition at line 149 of file MTDTopology.h.

149  {
150  return ((id.rawId() >> bits_per_field[idx].startBit) & bits_per_field[idx].mask);
151  }

References bits_per_field, and training_settings::idx.

◆ getMTDLayerNumber()

int MTDTopology::getMTDLayerNumber ( const DetId id) const

Definition at line 122 of file MTDTopology.cc.

122  {
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 }

References MTDDetId::BTL, btlLayer(), MTDDetId::ETL, etlLayer(), DetId::Forward, layer(), and MTDDetId::mtdSubDetector().

◆ getMTDTopologyMode()

int MTDTopology::getMTDTopologyMode ( ) const
inline

◆ hasField()

bool MTDTopology::hasField ( const DetId id,
DetIdFields  idx 
) const
inline

Definition at line 154 of file MTDTopology.h.

154 { return id.subdetId() == bits_per_field[idx].subdet; }

References bits_per_field, training_settings::idx, and MTDTopology::BitmaskAndSubdet::subdet.

◆ layer()

unsigned int MTDTopology::layer ( const DetId id) const

Definition at line 37 of file MTDTopology.cc.

37  {
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 }

References MTDDetId::BTL, btlLayer(), MTDDetId::ETL, etlLayer(), Exception, SiStripPI::max, and MTDDetId::mtdSubDetector().

Referenced by btlDetId(), btlDetIdLayerComparator(), etlDetId(), etlDetIdDiskComparator(), getMTDLayerNumber(), geometryXMLparser.DTAlignable::index(), geometryXMLparser.CSCAlignable::index(), and MTDTopology::SameLayerComparator::operator()().

◆ module()

unsigned int MTDTopology::module ( const DetId id) const

Definition at line 50 of file MTDTopology.cc.

50  {
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 }

References MTDDetId::BTL, btlModule(), MTDDetId::ETL, etlModule(), Exception, SiStripPI::max, and MTDDetId::mtdSubDetector().

◆ print()

std::string MTDTopology::print ( DetId  detid) const

Definition at line 89 of file MTDTopology.cc.

89  {
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 }

References MTDDetId::BTL, btlLayer(), btlModule(), btlSide(), btlTray(), MTDDetId::ETL, etlLayer(), etlModule(), etlRing(), etlSide(), Exception, MTDDetId::mtdSubDetector(), side(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ring()

unsigned int MTDTopology::ring ( const DetId id) const

Definition at line 76 of file MTDTopology.cc.

76  {
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 }

References MTDDetId::BTL, MTDDetId::ETL, etlModule(), Exception, SiStripPI::max, and MTDDetId::mtdSubDetector().

Referenced by etlDetId(), and geometryXMLparser.CSCAlignable::index().

◆ side()

unsigned int MTDTopology::side ( const DetId id) const

Definition at line 24 of file MTDTopology.cc.

24  {
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 }

References MTDDetId::BTL, btlSide(), MTDDetId::ETL, etlSide(), Exception, SiStripPI::max, and MTDDetId::mtdSubDetector().

Referenced by btlDetId(), btlDetIdLayerComparator(), etlDetId(), etlDetIdDiskComparator(), MTDTopology::SameLayerComparator::operator()(), and print().

◆ tray()

unsigned int MTDTopology::tray ( const DetId id) const

Definition at line 63 of file MTDTopology.cc.

63  {
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 }

References MTDDetId::BTL, btlTray(), MTDDetId::ETL, Exception, SiStripPI::max, and MTDDetId::mtdSubDetector().

Referenced by btlDetId().

Member Data Documentation

◆ bits_per_field

const BitmaskAndSubdet MTDTopology::bits_per_field[DETID_FIELDS_MAX]
private

Definition at line 167 of file MTDTopology.h.

Referenced by getField(), and hasField().

◆ btlVals_

const BTLValues MTDTopology::btlVals_
private

Definition at line 159 of file MTDTopology.h.

Referenced by btlDetId(), btlLayer(), btlModule(), btlSide(), btlTray(), etlModule(), and MTDTopology().

◆ etlVals_

const ETLValues MTDTopology::etlVals_
private

Definition at line 160 of file MTDTopology.h.

Referenced by etlDetId(), etlDisc(), etlLayer(), etlRing(), etlSide(), and MTDTopology().

◆ mtdTopologyMode_

const int MTDTopology::mtdTopologyMode_
private

Definition at line 157 of file MTDTopology.h.

Referenced by getMTDTopologyMode().

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
MTDTopology::etlModule
unsigned int etlModule(const DetId &id) const
Definition: MTDTopology.h:85
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::etlDetId
DetId etlDetId(uint32_t side, uint32_t layer, uint32_t ring, uint32_t module) const
Definition: MTDTopology.h:125
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::bits_per_field
const BitmaskAndSubdet bits_per_field[DETID_FIELDS_MAX]
Definition: MTDTopology.h:167
MTDTopology::ring
unsigned int ring(const DetId &id) const
Definition: MTDTopology.cc:76
MTDTopology::BTLValues::layerMask_
unsigned int layerMask_
Definition: MTDTopology.h:24
training_settings.idx
idx
Definition: training_settings.py:16
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::btlDetId
DetId btlDetId(uint32_t side, uint32_t layer, uint32_t tray, uint32_t module) const
Definition: MTDTopology.h:114
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
FastTime
Definition: ForwardSubdetector.h:6
createfilelist.int
int
Definition: createfilelist.py:10
MTDTopology::BTLValues::sideMask_
unsigned int sideMask_
Definition: MTDTopology.h:23
MTDTopology::BTLTray
Definition: MTDTopology.h:42
MTDTopology::btlVals_
const BTLValues btlVals_
Definition: MTDTopology.h:159
module
Definition: vlib.h:198
MTDDetId::kMTDsubdOffset
static const uint32_t kMTDsubdOffset
Definition: MTDDetId.h:29
MTDTopology::ETLValues::sideMask_
unsigned int sideMask_
Definition: MTDTopology.h:34
MTDDetId::BTL
Definition: MTDDetId.h:27
MTDTopology::BitmaskAndSubdet::subdet
int subdet
Definition: MTDTopology.h:165
MTDTopology::mtdTopologyMode_
const int mtdTopologyMode_
Definition: MTDTopology.h:157
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
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::DETID_FIELDS_MAX
Definition: MTDTopology.h:50
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
MTDTopology::ETLValues::layerStartBit_
unsigned int layerStartBit_
Definition: MTDTopology.h:31
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
MTDTopology::ETLLayer
Definition: MTDTopology.h:47
MTDTopology::BTLValues::moduleStartBit_
unsigned int moduleStartBit_
Definition: MTDTopology.h:22
MTDTopology::layer
unsigned int layer(const DetId &id) const
Definition: MTDTopology.cc:37