16 namespace DDSegmentation {
19 using std::runtime_error;
20 using std::stringstream;
25 _type =
"TiledLayerSegmentation";
26 _description =
"Cartesian segmentation using optimal tiling depending on the layer dimensions";
46 _type =
"TiledLayerSegmentation";
47 _description =
"Cartesian segmentation using optimal tiling depending on the layer dimensions";
85 "TiledLayerSegmentation::setLayerDimensions: inconsistent size of layer parameter vectors.");
104 "TiledLayerSegmentation::layerDimensions: inconsistent size of layer parameter vectors.");
108 stringstream message;
109 message <<
"TiledLayerSegmentation::layerDimensions: invalid layer index " << layerIndex;
110 throw runtime_error(message.str());
128 return Vector3D(localX, localY, 0.);
142 return _decoder->getValue();
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.
std::vector< int > _layerIndices
encoding field used for the layer
static double calculateOptimalCellSize(double nominalCellSize, double totalSize)
list of layer y dimensions
double x() const
Access to x value (required for use with ROOT GenVector)
void registerIdentifier(const std::string &nam, const std::string &desc, std::string &ident, const std::string &defaultVal)
Add a cell identifier to this segmentation. Used by derived classes to define their required identifi...
LayerDimensions layerDimensions(int layerIndex) const
access to the dimensions of the given layer
BitField64 * _decoder
The cell ID encoder and decoder.
std::string _identifierX
default grid size in Y
double y() const
Access to y value (required for use with ROOT GenVector)
std::vector< double > _layerDimensionsY
list of layer x dimensions
double _gridSizeY
default grid size in X
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.
static T::const_iterator find(const T &c, const string &s)
std::string _description
The description of the segmentation.
TiledLayerSegmentation(const std::string &cellEncoding="")
Default constructor passing the encoding string.
Base class for all segmentations.
static int positionToBin(double position, double cellSize, double offset=0.)
Helper method to convert a 1D position to a cell ID.
void registerParameter(const std::string &nam, const std::string &desc, TYPE ¶m, const TYPE &defaultVal, UnitType unitTyp=SegmentationParameter::NoUnit, bool isOpt=false)
Add a parameter to this segmentation. Used by derived classes to define their parameters.
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
std::string _type
The segmentation type.
void setLayerDimensions(int layerIndex, double x, double y)
set the dimensions of the given layer
void setValue(long64 value)
virtual CellID cellID(const Vector3D &localPosition, const Vector3D &globalPosition, const VolumeID &volumeID) const
determine the cell ID based on the position
static double binToPosition(CellID bin, double cellSize, double offset=0.)
Helper method to convert a bin number to a 1D position.
std::string _identifierLayer
encoding field used for Y
virtual ~TiledLayerSegmentation()
destructor