DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TiledLayerSegmentation.h
Go to the documentation of this file.
1 /*
2  * TiledLayerSegmentation.h
3  *
4  * Created on: Mar 10, 2014
5  * Author: cgrefe
6  */
7 
8 #ifndef DDSegmentation_TILEDLAYERSEGMENTATION_H_
9 #define DDSegmentation_TILEDLAYERSEGMENTATION_H_
10 
12 
13 // C/C++ includes
14 #include <string>
15 #include <vector>
16 
17 namespace DD4hep {
18 namespace DDSegmentation {
19 
21 public:
23  struct LayerDimensions {
24  LayerDimensions(double _x = 1., double _y = 1.) :
25  x(_x), y(_y) {}
26  double x, y;
27  };
28 
30  TiledLayerSegmentation(const std::string& cellEncoding = "");
34  virtual ~TiledLayerSegmentation();
35 
37  virtual Vector3D position(const CellID& cellID) const;
39  virtual CellID cellID(const Vector3D& localPosition, const Vector3D& globalPosition,
40  const VolumeID& volumeID) const;
41 
43  double gridSizeX() const {
44  return _gridSizeX;
45  }
47  double gridSizeY() const {
48  return _gridSizeY;
49  }
50 
52  double layerGridSizeX(int layerIndex) const;
54  double layerGridSizeY(int layerIndex) const;
55 
57  const std::string& identifierX() const {
58  return _identifierX;
59  }
61  const std::string& identifierY() const {
62  return _identifierY;
63  }
65  const std::string& identifierLayer() const {
66  return _identifierLayer;
67  }
68 
70  LayerDimensions layerDimensions(int layerIndex) const;
71 
73  void setGridSizeX(double cellSize) {
74  _gridSizeX = cellSize;
75  }
77  void setGridSizeY(double cellSize) {
78  _gridSizeY = cellSize;
79  }
80 
82  void setIdentifierX(const std::string& fieldName) {
83  _identifierX = fieldName;
84  }
86  void setIdentifierY(const std::string& fieldName) {
87  _identifierY = fieldName;
88  }
90  void setIdentifierLayer(const std::string& fieldName) {
91  _identifierLayer = fieldName;
92  }
93 
95  void setLayerDimensions(int layerIndex, double x, double y);
96 
97 
98 
99 protected:
100  double _gridSizeX;
101  double _gridSizeY;
102  std::string _identifierX;
103  std::string _identifierY;
104  std::string _identifierLayer;
105  std::vector<int> _layerIndices;
106  std::vector<double> _layerDimensionsX;
107  std::vector<double> _layerDimensionsY;
108 
110  static double calculateOptimalCellSize(double nominalCellSize, double totalSize);
112  static double calculateOffset(double cellSize, double totalSize);
113 };
114 
115 } /* namespace DDSegmentation */
116 } /* namespace DD4hep */
117 
118 #endif /* TILEDLAYERSEGMENTATION_H_ */
std::string _identifierY
encoding field used for X
std::vector< double > _layerDimensionsX
list of valid layer identifiers
Helper class to store x and y dimensions of a layer.
long long int CellID
Useful typedefs to differentiate cell IDs and volume IDs.
Definition: Primitives.h:32
std::vector< int > _layerIndices
encoding field used for the layer
static double calculateOptimalCellSize(double nominalCellSize, double totalSize)
list of layer y dimensions
virtual VolumeID volumeID(const CellID &cellID) const
Determine the volume ID from the full cell ID by removing all local fields.
void setIdentifierY(const std::string &fieldName)
set the encoding field name used for Y
double gridSizeY() const
access the default grid size in Y
virtual BitField64 * decoder() const
Access the underlying decoder.
Definition: Segmentation.h:105
void setIdentifierX(const std::string &fieldName)
set the encoding field name used for X
LayerDimensions layerDimensions(int layerIndex) const
access to the dimensions of the given layer
std::string _identifierX
default grid size in Y
std::vector< double > _layerDimensionsY
list of layer x dimensions
const std::string & identifierLayer() const
access the encoding field name used for Y
void setGridSizeX(double cellSize)
set the default grid size in X
void setGridSizeY(double cellSize)
set the default grid size in Y
const std::string & identifierY() const
access the encoding field name used for Y
static double calculateOffset(double cellSize, double totalSize)
helper method to calculate offset of bin 0 based on the total size
double layerGridSizeX(int layerIndex) const
access the actual grid size in X for a given layer
Simple container for a physics vector.
Definition: Segmentation.h:41
TiledLayerSegmentation(const std::string &cellEncoding="")
Default constructor passing the encoding string.
Base class for all segmentations.
Definition: Segmentation.h:68
void setIdentifierLayer(const std::string &fieldName)
set the encoding field name used for layer
virtual Vector3D position(const CellID &cellID) const
determine the position based on the cell ID
double layerGridSizeY(int layerIndex) const
access the actual grid size in Y for a given layer
long long int VolumeID
Definition: Primitives.h:35
void setLayerDimensions(int layerIndex, double x, double y)
set the dimensions of the given layer
virtual CellID cellID(const Vector3D &localPosition, const Vector3D &globalPosition, const VolumeID &volumeID) const
determine the cell ID based on the position
const std::string & identifierX() const
access the encoding field name used for X
std::string _identifierLayer
encoding field used for Y
double gridSizeX() const
access the default grid size in X