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/CartesianStripX.h>
0020
0021 namespace dd4hep {
0022 namespace DDSegmentation {
0023
0024 CartesianStripX::CartesianStripX(const std::string& cellEncoding) : CartesianStrip(cellEncoding) {
0025
0026 _type = "CartesianStripX";
0027 _description = "Cartesian segmentation on the local X axis";
0028
0029
0030 registerParameter("strip_size_x", "Cell size in X", _stripSizeX, 1., SegmentationParameter::LengthUnit);
0031 registerParameter("offset_x", "Cell offset in X", _offsetX, 0., SegmentationParameter::LengthUnit, true);
0032 registerIdentifier("identifier_x", "Cell ID identifier for X", _xId, "strip");
0033 }
0034
0035
0036 CartesianStripX::CartesianStripX(const BitFieldCoder* decode) : CartesianStrip(decode) {
0037
0038 _type = "CartesianStripX";
0039 _description = "Cartesian segmentation on the local X axis";
0040
0041
0042 registerParameter("strip_size_x", "Cell size in X", _stripSizeX, 1., SegmentationParameter::LengthUnit);
0043 registerParameter("offset_x", "Cell offset in X", _offsetX, 0., SegmentationParameter::LengthUnit, true);
0044 registerIdentifier("identifier_x", "Cell ID identifier for X", _xId, "strip");
0045 }
0046
0047
0048 CartesianStripX::~CartesianStripX() {}
0049
0050
0051 Vector3D CartesianStripX::position(const CellID& cID) const {
0052 Vector3D cellPosition;
0053 cellPosition.X = binToPosition(_decoder->get(cID, _xId), _stripSizeX, _offsetX);
0054 return cellPosition;
0055 }
0056
0057
0058 CellID CartesianStripX::cellID(const Vector3D& localPosition, const Vector3D& ,
0059 const VolumeID& vID) const {
0060 CellID cID = vID;
0061 _decoder->set(cID, _xId, positionToBin(localPosition.X, _stripSizeX, _offsetX));
0062 return cID;
0063 }
0064
0065 std::vector<double> CartesianStripX::cellDimensions(const CellID&) const {
0066 #if __cplusplus >= 201103L
0067 return {_stripSizeX};
0068 #else
0069 std::vector<double> cellDims(1, 0.0);
0070 cellDims[0] = _stripSizeX;
0071 return cellDims;
0072 #endif
0073 }
0074
0075 }
0076 }