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
unsigned int getLayerNumber() const
Definition: TrackingLayer.h:59
TrackingLayer::Side getSide() const
Definition: TrackingLayer.h:53
static TrackingLayer createFromDetId(const DetId &detId, const TrackerTopology &trackerTopology)
std::string toString() const
std::string toIdString() const
static const hashfct _hashfct
Definition: TrackingLayer.h:42
static const eqfct _eqfct
Definition: TrackingLayer.h:41
size_t operator()(const TrackingLayer &layerSpec) const
Definition: TrackingLayer.h:14
TrackingLayer::Det getSubDet() const
Definition: TrackingLayer.h:51
unsigned int getSubDetNumber() const
Definition: TrackingLayer.h:55
static TrackingLayer createFromString(std::string layerSpecification)
unsigned int _layerNumber
Definition: TrackingLayer.h:43
bool operator<(const TrackingLayer &layer) const
Definition: TrackingLayer.h:65
bool operator()(const TrackingLayer &l1, const TrackingLayer &l2) const
Definition: TrackingLayer.h:22
bool operator!=(const TrackingLayer &layer) const
Definition: TrackingLayer.h:63
Definition: DetId.h:17
bool operator==(const TrackingLayer &layer) const
Definition: TrackingLayer.h:61
unsigned int getSideNumber() const
Definition: TrackingLayer.h:57