File indexing completed on 2025-01-18 09:55:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #ifndef DDSEGMENTATION_TILEDLAYERSEGMENTATION_H
0020 #define DDSEGMENTATION_TILEDLAYERSEGMENTATION_H
0021
0022 #include <DDSegmentation/Segmentation.h>
0023
0024
0025 #include <string>
0026 #include <vector>
0027
0028 namespace dd4hep {
0029 namespace DDSegmentation {
0030
0031
0032 class TiledLayerSegmentation: public Segmentation {
0033 public:
0034
0035 struct LayerDimensions {
0036 LayerDimensions(double _x = 1., double _y = 1.) :
0037 x(_x), y(_y) {}
0038 double x, y;
0039 };
0040
0041
0042 TiledLayerSegmentation(const std::string& cellEncoding = "");
0043
0044 TiledLayerSegmentation(const BitFieldCoder* decoder);
0045
0046 virtual ~TiledLayerSegmentation();
0047
0048
0049 virtual Vector3D position(const CellID& cellID) const;
0050
0051 virtual CellID cellID(const Vector3D& localPosition, const Vector3D& globalPosition,
0052 const VolumeID& volumeID) const;
0053
0054
0055 double gridSizeX() const {
0056 return _gridSizeX;
0057 }
0058
0059 double gridSizeY() const {
0060 return _gridSizeY;
0061 }
0062
0063
0064 double layerGridSizeX(int layerIndex) const;
0065
0066 double layerGridSizeY(int layerIndex) const;
0067
0068
0069 const std::string& identifierX() const {
0070 return _identifierX;
0071 }
0072
0073 const std::string& identifierY() const {
0074 return _identifierY;
0075 }
0076
0077 const std::string& identifierLayer() const {
0078 return _identifierLayer;
0079 }
0080
0081
0082 LayerDimensions layerDimensions(int layerIndex) const;
0083
0084
0085 void setGridSizeX(double cellSize) {
0086 _gridSizeX = cellSize;
0087 }
0088
0089 void setGridSizeY(double cellSize) {
0090 _gridSizeY = cellSize;
0091 }
0092
0093
0094 void setIdentifierX(const std::string& fieldName) {
0095 _identifierX = fieldName;
0096 }
0097
0098 void setIdentifierY(const std::string& fieldName) {
0099 _identifierY = fieldName;
0100 }
0101
0102 void setIdentifierLayer(const std::string& fieldName) {
0103 _identifierLayer = fieldName;
0104 }
0105
0106
0107 void setLayerDimensions(int layerIndex, double x, double y);
0108
0109
0110
0111 protected:
0112 double _gridSizeX;
0113 double _gridSizeY;
0114 std::string _identifierX;
0115 std::string _identifierY;
0116 std::string _identifierLayer;
0117 std::vector<int> _layerIndices;
0118 std::vector<double> _layerDimensionsX;
0119 std::vector<double> _layerDimensionsY;
0120
0121
0122 static double calculateOptimalCellSize(double nominalCellSize, double totalSize);
0123
0124 static double calculateOffset(double cellSize, double totalSize);
0125 };
0126
0127 }
0128 }
0129
0130 #endif