DD4hep  1.30.0
Detector Description Toolkit for High Energy Physics
TiledLayerSegmentation.h
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 //==========================================================================
11 
12 /*
13  * TiledLayerSegmentation.h
14  *
15  * Created on: Mar 10, 2014
16  * Author: cgrefe
17  */
18 
19 #ifndef DDSEGMENTATION_TILEDLAYERSEGMENTATION_H
20 #define DDSEGMENTATION_TILEDLAYERSEGMENTATION_H
21 
23 
24 // C/C++ includes
25 #include <string>
26 #include <vector>
27 
28 namespace dd4hep {
29  namespace DDSegmentation {
30 
33  public:
35  struct LayerDimensions {
36  LayerDimensions(double _x = 1., double _y = 1.) :
37  x(_x), y(_y) {}
38  double x, y;
39  };
40 
42  TiledLayerSegmentation(const std::string& cellEncoding = "");
46  virtual ~TiledLayerSegmentation();
47 
49  virtual Vector3D position(const CellID& cellID) const;
51  virtual CellID cellID(const Vector3D& localPosition, const Vector3D& globalPosition,
52  const VolumeID& volumeID) const;
53 
55  double gridSizeX() const {
56  return _gridSizeX;
57  }
59  double gridSizeY() const {
60  return _gridSizeY;
61  }
62 
64  double layerGridSizeX(int layerIndex) const;
66  double layerGridSizeY(int layerIndex) const;
67 
69  const std::string& identifierX() const {
70  return _identifierX;
71  }
73  const std::string& identifierY() const {
74  return _identifierY;
75  }
77  const std::string& identifierLayer() const {
78  return _identifierLayer;
79  }
80 
82  LayerDimensions layerDimensions(int layerIndex) const;
83 
85  void setGridSizeX(double cellSize) {
86  _gridSizeX = cellSize;
87  }
89  void setGridSizeY(double cellSize) {
90  _gridSizeY = cellSize;
91  }
92 
94  void setIdentifierX(const std::string& fieldName) {
95  _identifierX = fieldName;
96  }
98  void setIdentifierY(const std::string& fieldName) {
99  _identifierY = fieldName;
100  }
102  void setIdentifierLayer(const std::string& fieldName) {
103  _identifierLayer = fieldName;
104  }
105 
107  void setLayerDimensions(int layerIndex, double x, double y);
108 
109 
110 
111  protected:
112  double _gridSizeX;
113  double _gridSizeY;
114  std::string _identifierX;
115  std::string _identifierY;
116  std::string _identifierLayer;
117  std::vector<int> _layerIndices;
118  std::vector<double> _layerDimensionsX;
119  std::vector<double> _layerDimensionsY;
120 
122  static double calculateOptimalCellSize(double nominalCellSize, double totalSize);
124  static double calculateOffset(double cellSize, double totalSize);
125  };
126 
127  } /* namespace DDSegmentation */
128 } /* namespace dd4hep */
129 
130 #endif // DDSEGMENTATION_TILEDLAYERSEGMENTATION_H
dd4hep::DDSegmentation::VolumeID
uint64_t VolumeID
Definition: BitFieldCoder.h:27
dd4hep::DDSegmentation::TiledLayerSegmentation::gridSizeY
double gridSizeY() const
access the default grid size in Y
Definition: TiledLayerSegmentation.h:59
dd4hep::DDSegmentation::TiledLayerSegmentation::calculateOffset
static double calculateOffset(double cellSize, double totalSize)
helper method to calculate offset of bin 0 based on the total size
Definition: TiledLayerSegmentation.cpp:161
dd4hep::DDSegmentation::Vector3D
Simple container for a physics vector.
Definition: Segmentation.h:48
dd4hep::DDSegmentation::TiledLayerSegmentation::setGridSizeX
void setGridSizeX(double cellSize)
set the default grid size in X
Definition: TiledLayerSegmentation.h:85
dd4hep::DDSegmentation::TiledLayerSegmentation::_gridSizeY
double _gridSizeY
default grid size in X
Definition: TiledLayerSegmentation.h:113
dd4hep::DDSegmentation::TiledLayerSegmentation::_identifierY
std::string _identifierY
encoding field used for X
Definition: TiledLayerSegmentation.h:115
dd4hep::DDSegmentation::TiledLayerSegmentation::gridSizeX
double gridSizeX() const
access the default grid size in X
Definition: TiledLayerSegmentation.h:55
dd4hep::DDSegmentation::BitFieldCoder
Helper class for decoding and encoding a bit field of 64bits for convenient declaration.
Definition: BitFieldCoder.h:114
dd4hep::DDSegmentation::TiledLayerSegmentation::~TiledLayerSegmentation
virtual ~TiledLayerSegmentation()
destructor
Definition: TiledLayerSegmentation.cpp:75
dd4hep::DDSegmentation::TiledLayerSegmentation::setIdentifierY
void setIdentifierY(const std::string &fieldName)
set the encoding field name used for Y
Definition: TiledLayerSegmentation.h:98
dd4hep::DDSegmentation::TiledLayerSegmentation::LayerDimensions
Helper class to store x and y dimensions of a layer.
Definition: TiledLayerSegmentation.h:35
dd4hep::DDSegmentation::TiledLayerSegmentation::setGridSizeY
void setGridSizeY(double cellSize)
set the default grid size in Y
Definition: TiledLayerSegmentation.h:89
dd4hep::DDSegmentation::TiledLayerSegmentation::layerGridSizeX
double layerGridSizeX(int layerIndex) const
access the actual grid size in X for a given layer
Definition: TiledLayerSegmentation.cpp:79
dd4hep::DDSegmentation::TiledLayerSegmentation::LayerDimensions::y
double y
Definition: TiledLayerSegmentation.h:38
dd4hep::DDSegmentation::TiledLayerSegmentation::setLayerDimensions
void setLayerDimensions(int layerIndex, double x, double y)
set the dimensions of the given layer
Definition: TiledLayerSegmentation.cpp:91
dd4hep::DDSegmentation::TiledLayerSegmentation::LayerDimensions::LayerDimensions
LayerDimensions(double _x=1., double _y=1.)
Definition: TiledLayerSegmentation.h:36
dd4hep::DDSegmentation::TiledLayerSegmentation::cellID
virtual CellID cellID(const Vector3D &localPosition, const Vector3D &globalPosition, const VolumeID &volumeID) const
determine the cell ID based on the position
Definition: TiledLayerSegmentation.cpp:140
dd4hep::DDSegmentation::TiledLayerSegmentation::setIdentifierLayer
void setIdentifierLayer(const std::string &fieldName)
set the encoding field name used for layer
Definition: TiledLayerSegmentation.h:102
dd4hep::DDSegmentation::TiledLayerSegmentation::_gridSizeX
double _gridSizeX
Definition: TiledLayerSegmentation.h:112
dd4hep::DDSegmentation::TiledLayerSegmentation::identifierX
const std::string & identifierX() const
access the encoding field name used for X
Definition: TiledLayerSegmentation.h:69
dd4hep::DDSegmentation::TiledLayerSegmentation
A segmentation class to describe tiled layers.
Definition: TiledLayerSegmentation.h:32
dd4hep::DDSegmentation::TiledLayerSegmentation::layerDimensions
LayerDimensions layerDimensions(int layerIndex) const
access to the dimensions of the given layer
Definition: TiledLayerSegmentation.cpp:110
dd4hep::DDSegmentation::Segmentation::decoder
virtual const BitFieldCoder * decoder() const
Access the underlying decoder.
Definition: Segmentation.h:112
dd4hep::DDSegmentation::TiledLayerSegmentation::layerGridSizeY
double layerGridSizeY(int layerIndex) const
access the actual grid size in Y for a given layer
Definition: TiledLayerSegmentation.cpp:85
dd4hep::DDSegmentation::CellID
uint64_t CellID
Definition: BitFieldCoder.h:26
dd4hep::DDSegmentation::TiledLayerSegmentation::_identifierLayer
std::string _identifierLayer
encoding field used for Y
Definition: TiledLayerSegmentation.h:116
dd4hep::DDSegmentation::TiledLayerSegmentation::_identifierX
std::string _identifierX
default grid size in Y
Definition: TiledLayerSegmentation.h:114
dd4hep::DDSegmentation::TiledLayerSegmentation::_layerDimensionsX
std::vector< double > _layerDimensionsX
list of valid layer identifiers
Definition: TiledLayerSegmentation.h:118
dd4hep::DDSegmentation::TiledLayerSegmentation::setIdentifierX
void setIdentifierX(const std::string &fieldName)
set the encoding field name used for X
Definition: TiledLayerSegmentation.h:94
dd4hep::DDSegmentation::Segmentation::volumeID
virtual VolumeID volumeID(const CellID &cellID) const
Determine the volume ID from the full cell ID by removing all local fields.
Definition: Segmentation.cpp:66
dd4hep::DDSegmentation::TiledLayerSegmentation::calculateOptimalCellSize
static double calculateOptimalCellSize(double nominalCellSize, double totalSize)
list of layer y dimensions
Definition: TiledLayerSegmentation.cpp:155
dd4hep::DDSegmentation::TiledLayerSegmentation::position
virtual Vector3D position(const CellID &cellID) const
determine the position based on the cell ID
Definition: TiledLayerSegmentation.cpp:128
dd4hep::DDSegmentation::TiledLayerSegmentation::identifierLayer
const std::string & identifierLayer() const
access the encoding field name used for Y
Definition: TiledLayerSegmentation.h:77
dd4hep
Namespace for the AIDA detector description toolkit.
Definition: AlignmentsCalib.h:28
dd4hep::DDSegmentation::TiledLayerSegmentation::LayerDimensions::x
double x
Definition: TiledLayerSegmentation.h:38
Segmentation.h
dd4hep::DDSegmentation::TiledLayerSegmentation::_layerIndices
std::vector< int > _layerIndices
encoding field used for the layer
Definition: TiledLayerSegmentation.h:117
dd4hep::DDSegmentation::Segmentation
Base class for all segmentations.
Definition: Segmentation.h:75
dd4hep::DDSegmentation::TiledLayerSegmentation::identifierY
const std::string & identifierY() const
access the encoding field name used for Y
Definition: TiledLayerSegmentation.h:73
dd4hep::DDSegmentation::TiledLayerSegmentation::TiledLayerSegmentation
TiledLayerSegmentation(const std::string &cellEncoding="")
Default constructor passing the encoding string.
Definition: TiledLayerSegmentation.cpp:33
dd4hep::DDSegmentation::TiledLayerSegmentation::_layerDimensionsY
std::vector< double > _layerDimensionsY
list of layer x dimensions
Definition: TiledLayerSegmentation.h:119