CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
10 {
11  public:
12  struct hashfct
13  {
14  hashfct() { };
15 
16  inline size_t operator()(const TrackingLayer &layerSpec) const
17  {
18  return (layerSpec.getSubDetNumber() * 10000
19  + layerSpec.getLayerNumber() * 100
20  + layerSpec.getSideNumber() + 1);
21  }
22  };
23 
24  struct eqfct
25  {
26  eqfct() { };
27 
28  inline bool operator()(const TrackingLayer &l1, const TrackingLayer &l2) const
29  {
30  return (l1.getSubDetNumber() == l2.getSubDetNumber()
31  && l1.getLayerNumber() == l2.getLayerNumber()
32  && l1.getSideNumber() == l2.getSideNumber());
33  }
34  };
35 
36  enum class Det {
37  UNKNOWN,
38  PXB, //pixel barrel
39  PXD, //pixel disk
40  TIB, //tracker inner barrel
41  TID, //tracker inner disk
42  TOB, //tracker outer barrel
43  TEC //tracker endcap
44  };
45  enum class Side {
47  };
48 
49 
52  static const eqfct _eqfct;
53  static const hashfct _hashfct;
54  unsigned int _layerNumber;
55 
56  TrackingLayer();
57 
59  const DetId& detId,
60  const TrackerTopology& trackerTopology
61  );
62 
63  static TrackingLayer createFromString(std::string layerSpecification);
64 
66  {
67  return _subDet;
68  }
69 
71  {
72  return _side;
73  }
74 
75  inline unsigned int getSubDetNumber() const
76  {
77  return static_cast<unsigned int>(_subDet);
78  }
79 
80  inline unsigned int getSideNumber() const
81  {
82  return static_cast<unsigned int>(_side);
83  }
84 
85  inline unsigned int getLayerNumber() const
86  {
87  return _layerNumber;
88  }
89 
90  inline bool operator==(const TrackingLayer& layer) const
91  {
92  return _eqfct(*this, layer);
93  }
94 
95  inline bool operator<(const TrackingLayer& layer) const
96  {
97  return _hashfct(*this)<_hashfct(layer);
98  }
99 
100  std::string toString() const;
101  std::string toIdString() const;
102 };
103 
104 
105 #endif
106 
unsigned int getSubDetNumber() const
Definition: TrackingLayer.h:75
bool operator()(const TrackingLayer &l1, const TrackingLayer &l2) const
Definition: TrackingLayer.h:28
unsigned int getLayerNumber() const
Definition: TrackingLayer.h:85
static TrackingLayer createFromDetId(const DetId &detId, const TrackerTopology &trackerTopology)
std::string toIdString() const
bool operator==(const TrackingLayer &layer) const
Definition: TrackingLayer.h:90
static const hashfct _hashfct
Definition: TrackingLayer.h:53
TrackingLayer::Side getSide() const
Definition: TrackingLayer.h:70
static const eqfct _eqfct
Definition: TrackingLayer.h:52
bool operator<(const TrackingLayer &layer) const
Definition: TrackingLayer.h:95
TrackingLayer::Det getSubDet() const
Definition: TrackingLayer.h:65
unsigned int getSideNumber() const
Definition: TrackingLayer.h:80
static TrackingLayer createFromString(std::string layerSpecification)
unsigned int _layerNumber
Definition: TrackingLayer.h:54
std::string toString() const
Definition: DetId.h:18
size_t operator()(const TrackingLayer &layerSpec) const
Definition: TrackingLayer.h:16