Warning, file /DD4hep/DDCore/src/segmentations/CartesianGridYZ.cpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include <DDSegmentation/CartesianGridYZ.h>
0017
0018 namespace dd4hep {
0019 namespace DDSegmentation {
0020
0021
0022 CartesianGridYZ::CartesianGridYZ(const std::string& cellEncoding) :
0023 CartesianGrid(cellEncoding) {
0024
0025 _type = "CartesianGridYZ";
0026 _description = "Cartesian segmentation in the local YZ-plane";
0027
0028
0029 registerParameter("grid_size_y", "Cell size in Y", _gridSizeY, 1., SegmentationParameter::LengthUnit);
0030 registerParameter("grid_size_z", "Cell size in Z", _gridSizeZ, 1., SegmentationParameter::LengthUnit);
0031 registerParameter("offset_y", "Cell offset in Y", _offsetY, 0., SegmentationParameter::LengthUnit, true);
0032 registerParameter("offset_z", "Cell offset in Z", _offsetZ, 0., SegmentationParameter::LengthUnit, true);
0033 registerIdentifier("identifier_y", "Cell ID identifier for Y", _yId, "y");
0034 registerIdentifier("identifier_z", "Cell ID identifier for Z", _zId, "z");
0035 }
0036
0037
0038
0039 CartesianGridYZ::CartesianGridYZ(const BitFieldCoder* decode) : CartesianGrid(decode)
0040 {
0041
0042 _type = "CartesianGridYZ";
0043 _description = "Cartesian segmentation in the local YZ-plane";
0044
0045
0046 registerParameter("grid_size_y", "Cell size in Y", _gridSizeY, 1., SegmentationParameter::LengthUnit);
0047 registerParameter("grid_size_z", "Cell size in Z", _gridSizeZ, 1., SegmentationParameter::LengthUnit);
0048 registerParameter("offset_y", "Cell offset in Y", _offsetY, 0., SegmentationParameter::LengthUnit, true);
0049 registerParameter("offset_z", "Cell offset in Z", _offsetZ, 0., SegmentationParameter::LengthUnit, true);
0050 registerIdentifier("identifier_y", "Cell ID identifier for Y", _yId, "y");
0051 registerIdentifier("identifier_z", "Cell ID identifier for Z", _zId, "z");
0052 }
0053
0054
0055 CartesianGridYZ::~CartesianGridYZ() {
0056
0057 }
0058
0059
0060 Vector3D CartesianGridYZ::position(const CellID& cID) const {
0061 Vector3D cellPosition;
0062 cellPosition.Y = binToPosition( _decoder->get(cID,_yId ), _gridSizeY, _offsetY);
0063 cellPosition.Z = binToPosition( _decoder->get(cID,_zId ), _gridSizeZ, _offsetZ);
0064 return cellPosition;
0065 }
0066
0067
0068 CellID CartesianGridYZ::cellID(const Vector3D& localPosition, const Vector3D& , const VolumeID& vID) const {
0069 CellID cID = vID ;
0070 _decoder->set( cID,_yId, positionToBin(localPosition.Y, _gridSizeY, _offsetY) );
0071 _decoder->set( cID,_zId, positionToBin(localPosition.Z, _gridSizeZ, _offsetZ) );
0072 return cID ;
0073 }
0074
0075 std::vector<double> CartesianGridYZ::cellDimensions(const CellID&) const {
0076 return {_gridSizeY, _gridSizeZ};
0077 }
0078
0079
0080 }
0081 }