22 m_lineGapType(parameters.m_lineGapType.Get()),
23 m_lineStartX(parameters.m_lineStartX.Get()),
24 m_lineEndX(parameters.m_lineEndX.Get()),
25 m_lineStartZ(parameters.m_lineStartZ.Get()),
26 m_lineEndZ(parameters.m_lineEndZ.Get())
59 m_vertex(parameters.m_vertex.Get()),
60 m_side1(parameters.m_side1.Get()),
61 m_side2(parameters.m_side2.Get()),
62 m_side3(parameters.m_side3.Get())
97 m_minZCoordinate(parameters.m_minZCoordinate.Get()),
98 m_maxZCoordinate(parameters.m_maxZCoordinate.Get()),
99 m_innerRCoordinate(parameters.m_innerRCoordinate.Get()),
100 m_innerPhiCoordinate(parameters.m_innerPhiCoordinate.Get()),
101 m_innerSymmetryOrder(parameters.m_innerSymmetryOrder.Get()),
102 m_outerRCoordinate(parameters.m_outerRCoordinate.Get()),
103 m_outerPhiCoordinate(parameters.m_outerPhiCoordinate.Get()),
104 m_outerSymmetryOrder(parameters.m_outerSymmetryOrder.Get())
121 const float z(positionVector.
GetZ());
127 const float x(positionVector.
GetX()), y(positionVector.
GetY());
128 const float r(std::sqrt(x * x + y * y));
133 static const float pi(std::acos(-1.f));
150 const unsigned int symmetryOrder,
VertexPointList &vertexPointList)
const
152 if (0 == symmetryOrder)
155 static const float pi(std::acos(-1.f));
156 const float firstVertexAngle(pi /
static_cast<float>(symmetryOrder));
157 const float rMax(rCoordinate / std::cos(firstVertexAngle));
159 for (
unsigned int i = 0; i < symmetryOrder + 1; ++i)
161 const float phi = phiCoordinate + firstVertexAngle + (2.f * pi *
static_cast<float>(i) /
static_cast<float>(symmetryOrder));
162 const float sinPhi(std::sin(phi));
163 const float cosPhi(std::cos(phi));
164 vertexPointList.push_back(
CartesianVector(sinPhi * rMax, cosPhi * rMax, zCoordinate));
172 if (vertexPointList.size() != (symmetryOrder + 1))
175 int windingNumber(0);
177 for (
unsigned int i = 0; i < symmetryOrder; ++i)
179 if (vertexPointList[i].GetY() <= point.
GetY())
181 if (vertexPointList[i + 1].GetY() > point.
GetY())
184 if (((vertexPointList[i + 1].GetX() - vertexPointList[i].GetX()) * (point.
GetY() - vertexPointList[i].GetY()) -
185 (point.
GetX() - vertexPointList[i].GetX()) * (vertexPointList[i + 1].GetY() - vertexPointList[i].GetY()) ) > 0.f)
193 if (vertexPointList[i + 1].GetY() <= point.
GetY())
196 if (((vertexPointList[i + 1].GetX() - vertexPointList[i].GetX()) * (point.
GetY() - vertexPointList[i].GetY()) -
197 (point.
GetX() - vertexPointList[i].GetX()) * (vertexPointList[i + 1].GetY() - vertexPointList[i].GetY()) ) < 0.f)
205 return (0 != windingNumber);
Header file for the detector gap class.
const CartesianVector m_vertex
Cartesian coordinates of a gap vertex, units mm.
BoxGap(const object_creation::Geometry::BoxGap::Parameters ¶meters)
Constructor.
const CartesianVector m_side2
Cartesian vector describing second side meeting vertex, units mm.
const CartesianVector m_side3
Cartesian vector describing third side meeting vertex, units mm.
bool IsInGap(const CartesianVector &positionVector, const HitType hitType, const float gapTolerance) const
Whether a specified position lies within the gap.
const CartesianVector m_side1
Cartesian vector describing first side meeting vertex, units mm.
float GetX() const
Get the cartesian x coordinate.
CartesianVector GetUnitVector() const
Get a unit vector in the direction of the cartesian vector.
float GetZ() const
Get the cartesian z coordinate.
float GetDotProduct(const CartesianVector &rhs) const
Get the dot product of the cartesian vector with a second cartesian vector.
float GetMagnitude() const
Get the magnitude.
float GetY() const
Get the cartesian y coordinate.
const float m_outerPhiCoordinate
Outer cylindrical polar phi coordinate (angle wrt cartesian x axis)
VertexPointList m_outerVertexPointList
The vertex points of the outer polygon.
const float m_innerRCoordinate
Inner cylindrical polar r coordinate, origin interaction point, units mm.
VertexPointList m_innerVertexPointList
The vertex points of the inner polygon.
ConcentricGap(const object_creation::Geometry::ConcentricGap::Parameters ¶meters)
Constructor.
const float m_maxZCoordinate
Max cylindrical polar z coordinate, origin interaction point, units mm.
const unsigned int m_outerSymmetryOrder
Order of symmetry of the outermost edge of gap.
const float m_outerRCoordinate
Outer cylindrical polar r coordinate, origin interaction point, units mm.
bool IsIn2DPolygon(const CartesianVector &point, const VertexPointList &vertexPointList, const unsigned int symmetryOrder) const
Winding number test for a point in a 2D polygon in the XY plane (z coordinates are ignored)
bool IsInGap(const CartesianVector &positionVector, const HitType hitType, const float gapTolerance) const
Whether a specified position lies within the gap.
void GetPolygonVertices(const float rCoordinate, const float zCoordinate, const float phiCoordinate, const unsigned int symmetryOrder, VertexPointList &vertexPointList) const
Populate list of polygon vertices, assuming regular polygon in XY plane at constant z coordinate.
const float m_innerPhiCoordinate
Inner cylindrical polar phi coordinate (angle wrt cartesian x axis)
const float m_minZCoordinate
Min cylindrical polar z coordinate, origin interaction point, units mm.
const unsigned int m_innerSymmetryOrder
Order of symmetry of the innermost edge of gap.
virtual ~DetectorGap()
Destructor.
bool IsInGap(const CartesianVector &positionVector, const HitType hitType, const float gapTolerance) const
Whether a specified position lies within the gap.
const float m_lineStartZ
The line z start coordinate, units mm.
const float m_lineStartX
The line x start coordinate, units mm.
LineGap(const object_creation::Geometry::LineGap::Parameters ¶meters)
Constructor.
const LineGapType m_lineGapType
The type of line gap, e.g. TPC wire-type gap (u, v, w), or drift-type gap.
const float m_lineEndX
The line x end coordinate, units mm.
const float m_lineEndZ
The line z end coordinate, units mm.
StatusCodeException class.
HitType
Calorimeter hit type enum.
std::vector< CartesianVector > VertexPointList