CMS 3D CMS Logo

TrackingLayer.h
Go to the documentation of this file.
1 #ifndef FastSimulation_Tracking_TrackingLayer_h
2 #define FastSimulation_Tracking_TrackingLayer_h
3 
6 
7 #include <sstream>
8 
9 class TrackingLayer {
10 public:
11  struct hashfct {
12  hashfct(){};
13 
14  inline size_t operator()(const TrackingLayer& layerSpec) const {
15  return (layerSpec.getSubDetNumber() * 10000 + layerSpec.getLayerNumber() * 100 + layerSpec.getSideNumber() + 1);
16  }
17  };
18 
19  struct eqfct {
20  eqfct(){};
21 
22  inline bool operator()(const TrackingLayer& l1, const TrackingLayer& l2) const {
23  return (l1.getSubDetNumber() == l2.getSubDetNumber() && l1.getLayerNumber() == l2.getLayerNumber() &&
24  l1.getSideNumber() == l2.getSideNumber());
25  }
26  };
27 
28  enum class Det {
29  UNKNOWN,
30  PXB, //pixel barrel
31  PXD, //pixel disk
32  TIB, //tracker inner barrel
33  TID, //tracker inner disk
34  TOB, //tracker outer barrel
35  TEC //tracker endcap
36  };
37  enum class Side { BARREL, NEG_ENDCAP, POS_ENDCAP };
38 
41  static const eqfct _eqfct;
42  static const hashfct _hashfct;
43  unsigned int _layerNumber;
44 
45  TrackingLayer();
46 
47  static TrackingLayer createFromDetId(const DetId& detId, const TrackerTopology& trackerTopology);
48 
49  static TrackingLayer createFromString(std::string layerSpecification);
50 
51  inline TrackingLayer::Det getSubDet() const { return _subDet; }
52 
53  inline TrackingLayer::Side getSide() const { return _side; }
54 
55  inline unsigned int getSubDetNumber() const { return static_cast<unsigned int>(_subDet); }
56 
57  inline unsigned int getSideNumber() const { return static_cast<unsigned int>(_side); }
58 
59  inline unsigned int getLayerNumber() const { return _layerNumber; }
60 
61  inline bool operator==(const TrackingLayer& layer) const { return _eqfct(*this, layer); }
62 
63  inline bool operator!=(const TrackingLayer& layer) const { return not _eqfct(*this, layer); }
64 
65  inline bool operator<(const TrackingLayer& layer) const { return _hashfct(*this) < _hashfct(layer); }
66 
67  std::string toString() const;
68  std::string toIdString() const;
69 };
70 
71 #endif
TrackingLayer::toIdString
std::string toIdString() const
Definition: TrackingLayer.cc:216
TrackingLayer::toString
std::string toString() const
Definition: TrackingLayer.cc:176
TrackerGeometry.h
TrackingLayer::Det
Det
Definition: TrackingLayer.h:28
TrackingLayer::createFromDetId
static TrackingLayer createFromDetId(const DetId &detId, const TrackerTopology &trackerTopology)
Definition: TrackingLayer.cc:9
TrackingLayer::operator<
bool operator<(const TrackingLayer &layer) const
Definition: TrackingLayer.h:65
TrackerTopology
Definition: TrackerTopology.h:16
TrackingLayer::Det::PXB
TrackingLayer::hashfct::hashfct
hashfct()
Definition: TrackingLayer.h:12
TrackingLayer::Side::POS_ENDCAP
TrackingLayer::Det::TEC
TrackingLayer::_layerNumber
unsigned int _layerNumber
Definition: TrackingLayer.h:43
TrackingLayer::eqfct::eqfct
eqfct()
Definition: TrackingLayer.h:20
TrackingLayer::_eqfct
static const eqfct _eqfct
Definition: TrackingLayer.h:41
TrackingLayer::Side::BARREL
DetId
Definition: DetId.h:17
TrackingLayer::Det::TOB
TrackingLayer::hashfct::operator()
size_t operator()(const TrackingLayer &layerSpec) const
Definition: TrackingLayer.h:14
TrackerTopology.h
TrackingLayer::getSideNumber
unsigned int getSideNumber() const
Definition: TrackingLayer.h:57
TrackingLayer::getSubDet
TrackingLayer::Det getSubDet() const
Definition: TrackingLayer.h:51
TrackingLayer::Side::NEG_ENDCAP
TrackingLayer::_hashfct
static const hashfct _hashfct
Definition: TrackingLayer.h:42
TrackingLayer::getSubDetNumber
unsigned int getSubDetNumber() const
Definition: TrackingLayer.h:55
TrackingLayer::Det::TID
TrackingLayer::Det::UNKNOWN
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackingLayer::_side
Side _side
Definition: TrackingLayer.h:40
TrackingLayer::hashfct
Definition: TrackingLayer.h:11
TrackingLayer::operator==
bool operator==(const TrackingLayer &layer) const
Definition: TrackingLayer.h:61
TrackingLayer::operator!=
bool operator!=(const TrackingLayer &layer) const
Definition: TrackingLayer.h:63
TrackingLayer::_subDet
Det _subDet
Definition: TrackingLayer.h:39
TrackingLayer::Side
Side
Definition: TrackingLayer.h:37
TrackingLayer::Det::PXD
TrackingLayer::eqfct::operator()
bool operator()(const TrackingLayer &l1, const TrackingLayer &l2) const
Definition: TrackingLayer.h:22
TrackingLayer::eqfct
Definition: TrackingLayer.h:19
TrackingLayer
Definition: TrackingLayer.h:9
TrackingLayer::TrackingLayer
TrackingLayer()
Definition: TrackingLayer.cc:7
TrackingLayer::createFromString
static TrackingLayer createFromString(std::string layerSpecification)
Definition: TrackingLayer.cc:79
TrackingLayer::getLayerNumber
unsigned int getLayerNumber() const
Definition: TrackingLayer.h:59
TrackingLayer::getSide
TrackingLayer::Side getSide() const
Definition: TrackingLayer.h:53
TrackingLayer::Det::TIB