File indexing completed on 2024-09-07 04:36:19
0001 #ifndef FastSimulation_Tracking_TrackingLayer_h
0002 #define FastSimulation_Tracking_TrackingLayer_h
0003
0004 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0005 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
0006
0007 #include <sstream>
0008
0009 class TrackingLayer {
0010 public:
0011 struct hashfct {
0012 hashfct() {}
0013
0014 inline size_t operator()(const TrackingLayer& layerSpec) const {
0015 return (layerSpec.getSubDetNumber() * 10000 + layerSpec.getLayerNumber() * 100 + layerSpec.getSideNumber() + 1);
0016 }
0017 };
0018
0019 struct eqfct {
0020 eqfct() {}
0021
0022 inline bool operator()(const TrackingLayer& l1, const TrackingLayer& l2) const {
0023 return (l1.getSubDetNumber() == l2.getSubDetNumber() && l1.getLayerNumber() == l2.getLayerNumber() &&
0024 l1.getSideNumber() == l2.getSideNumber());
0025 }
0026 };
0027
0028 enum class Det {
0029 UNKNOWN,
0030 PXB,
0031 PXD,
0032 TIB,
0033 TID,
0034 TOB,
0035 TEC
0036 };
0037 enum class Side { BARREL, NEG_ENDCAP, POS_ENDCAP };
0038
0039 Det _subDet;
0040 Side _side;
0041 static const eqfct _eqfct;
0042 static const hashfct _hashfct;
0043 unsigned int _layerNumber;
0044
0045 TrackingLayer();
0046
0047 static TrackingLayer createFromDetId(const DetId& detId, const TrackerTopology& trackerTopology);
0048
0049 static TrackingLayer createFromString(std::string layerSpecification);
0050
0051 inline TrackingLayer::Det getSubDet() const { return _subDet; }
0052
0053 inline TrackingLayer::Side getSide() const { return _side; }
0054
0055 inline unsigned int getSubDetNumber() const { return static_cast<unsigned int>(_subDet); }
0056
0057 inline unsigned int getSideNumber() const { return static_cast<unsigned int>(_side); }
0058
0059 inline unsigned int getLayerNumber() const { return _layerNumber; }
0060
0061 inline bool operator==(const TrackingLayer& layer) const { return _eqfct(*this, layer); }
0062
0063 inline bool operator!=(const TrackingLayer& layer) const { return not _eqfct(*this, layer); }
0064
0065 inline bool operator<(const TrackingLayer& layer) const { return _hashfct(*this) < _hashfct(layer); }
0066
0067 std::string toString() const;
0068 std::string toIdString() const;
0069 };
0070
0071 #endif