diff --git a/DDSegmentation/include/DDSegmentation/PolarGridRPhi2.h b/DDSegmentation/include/DDSegmentation/PolarGridRPhi2.h index f339dc1382b31be3edd83c86659c28b5f40a0e27..2a3163eb092ffea450b7dc2655020e25e88e9fcb 100644 --- a/DDSegmentation/include/DDSegmentation/PolarGridRPhi2.h +++ b/DDSegmentation/include/DDSegmentation/PolarGridRPhi2.h @@ -31,8 +31,8 @@ public: return _gridRValues; } /// access the grid size in Phi - double gridSizePhi() const { - return _gridSizePhi; + std::vector<double> gridPhiValues() const { + return _gridPhiValues; } /// access the coordinate offset in R double offsetR() const { @@ -51,12 +51,12 @@ public: return _phiId; } /// set the grid size in R - void setgridRValues(double cellSize, int value) { - _gridRValues[value] = cellSize; + void setgridRValues(double cellSize, int position) { + _gridRValues[position] = cellSize; } /// set the grid size in Phi - void setGridSizePhi(double cellSize) { - _gridSizePhi = cellSize; + void setGridSizePhi(double cellSize, int position) { + _gridPhiValues[position] = cellSize; } /// set the coordinate offset in R void setOffsetR(double offset) { @@ -76,17 +76,17 @@ public: } protected: - /// the grid size in X + /// the grid boundaries in R std::vector<double> _gridRValues; - /// the coordinate offset in X + /// the coordinate offset in R double _offsetR; - /// the grid size in Y - double _gridSizePhi; - /// the coordinate offset in Y + /// the grid sizes in Phi + std::vector<double> _gridPhiValues; + /// the coordinate offset in Phi double _offsetPhi; - /// the field name used for X + /// the field name used for R std::string _rId; - /// the field name used for Y + /// the field name used for Phi std::string _phiId; }; diff --git a/DDSegmentation/src/PolarGridRPhi2.cpp b/DDSegmentation/src/PolarGridRPhi2.cpp index 3b9efcabd001368ff74c5e4247afa17a5ac87b45..5c978e148978c67a71bbc4197798c5d1dbe3a795 100644 --- a/DDSegmentation/src/PolarGridRPhi2.cpp +++ b/DDSegmentation/src/PolarGridRPhi2.cpp @@ -20,8 +20,8 @@ PolarGridRPhi2::PolarGridRPhi2(const string& cellEncoding) : _description = "Polar RPhi segmentation in the local XY-plane"; // register all necessary parameters - registerParameter("grid_r_values", "Vector or R values", _gridRValues, std::vector<double>(), SegmentationParameter::LengthUnit, true); - registerParameter("grid_size_phi", "Cell size in Phi", _gridSizePhi, 1., SegmentationParameter::AngleUnit); + registerParameter("grid_r_values", "Vector of R values", _gridRValues, std::vector<double>(), SegmentationParameter::LengthUnit, true); + registerParameter("grid_phi_values", "Cell size in Phi", _gridPhiValues, std::vector<double>(), SegmentationParameter::AngleUnit); registerParameter("offset_r", "Cell offset in R", _offsetR, 0., SegmentationParameter::LengthUnit, true); registerParameter("offset_phi", "Cell offset in Phi", _offsetPhi, 0., SegmentationParameter::AngleUnit, true); registerIdentifier("identifier_r", "Cell ID identifier for R", _rId, "r"); @@ -38,7 +38,7 @@ Vector3D PolarGridRPhi2::position(const CellID& cellID) const { _decoder->setValue(cellID); Vector3D position; double R = binToPosition((*_decoder)[_rId].value(), _gridRValues[0], _offsetR); - double phi = binToPosition((*_decoder)[_phiId].value(), _gridSizePhi, _offsetPhi); + double phi = binToPosition((*_decoder)[_phiId].value(), _gridPhiValues[0], _offsetPhi); position.X = R * cos(phi); position.Y = R * sin(phi); @@ -53,7 +53,7 @@ Vector3D PolarGridRPhi2::position(const CellID& cellID) const { double R = sqrt( localPosition.X * localPosition.X + localPosition.Y * localPosition.Y ); (*_decoder)[_rId] = positionToBin(R, _gridRValues[0], _offsetR); - (*_decoder)[_phiId] = positionToBin(phi, _gridSizePhi, _offsetPhi); + (*_decoder)[_phiId] = positionToBin(phi, _gridPhiValues[0], _offsetPhi); return _decoder->getValue(); }