File indexing completed on 2025-02-22 09:36:49
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include <DDSegmentation/CartesianStripZ.h>
0020
0021 namespace dd4hep {
0022 namespace DDSegmentation {
0023
0024 CartesianStripZ::CartesianStripZ(const std::string& cellEncoding) : CartesianStrip(cellEncoding) {
0025
0026 _type = "CartesianStripZ";
0027 _description = "Cartesian segmentation on the local Z axis";
0028
0029
0030 registerParameter("strip_size_x", "Cell size in Z", _stripSizeZ, 1., SegmentationParameter::LengthUnit);
0031 registerParameter("offset_x", "Cell offset in Z", _offsetZ, 0., SegmentationParameter::LengthUnit, true);
0032 registerIdentifier("identifier_x", "Cell ID identifier for Z", _xId, "strip");
0033 }
0034
0035
0036 CartesianStripZ::CartesianStripZ(const BitFieldCoder* decode) : CartesianStrip(decode) {
0037
0038 _type = "CartesianStripZ";
0039 _description = "Cartesian segmentation on the local Z axis";
0040
0041
0042 registerParameter("strip_size_x", "Cell size in Z", _stripSizeZ, 1., SegmentationParameter::LengthUnit);
0043 registerParameter("offset_x", "Cell offset in Z", _offsetZ, 0., SegmentationParameter::LengthUnit, true);
0044 registerIdentifier("identifier_x", "Cell ID identifier for Z", _xId, "strip");
0045 }
0046
0047
0048 CartesianStripZ::~CartesianStripZ() {}
0049
0050
0051 Vector3D CartesianStripZ::position(const CellID& cID) const {
0052 Vector3D cellPosition;
0053 cellPosition.Z = binToPosition(_decoder->get(cID, _xId), _stripSizeZ, _offsetZ);
0054 return cellPosition;
0055 }
0056
0057
0058 CellID CartesianStripZ::cellID(const Vector3D& localPosition, const Vector3D& ,
0059 const VolumeID& vID) const {
0060 CellID cID = vID;
0061 _decoder->set(cID, _xId, positionToBin(localPosition.Z, _stripSizeZ, _offsetZ));
0062 return cID;
0063 }
0064
0065 std::vector<double> CartesianStripZ::cellDimensions(const CellID&) const {
0066 #if __cplusplus >= 201103L
0067 return {_stripSizeZ};
0068 #else
0069 std::vector<double> cellDims(1, 0.0);
0070 cellDims[0] = _stripSizeZ;
0071 return cellDims;
0072 #endif
0073 }
0074
0075 }
0076 }