40 float rLInner(std::numeric_limits<float>::max()), rTInner(std::numeric_limits<float>::max());
41 float rLOuter(std::numeric_limits<float>::max()), rTOuter(std::numeric_limits<float>::max());
45 const bool innerIsVertexAssociated(rLInner > (rTInner / tanAngle) - (length * apexShift));
46 const bool outerIsVertexAssociated(rLOuter > (rTInner / tanAngle) - (length * apexShift));
48 if (innerIsVertexAssociated == outerIsVertexAssociated)
51 if ((innerIsVertexAssociated && innerIsAtLowerZ) || (outerIsVertexAssociated && !innerIsAtLowerZ))
54 if ((innerIsVertexAssociated && !innerIsAtLowerZ) || (outerIsVertexAssociated && innerIsAtLowerZ))
71 if (larTPCMap.empty())
73 std::cout <<
"LArVertexHelper::IsInFiducialVolume - LArTPC description not registered with Pandora as required " << std::endl;
77 float tpcMinX{std::numeric_limits<float>::max()}, tpcMaxX{-std::numeric_limits<float>::max()};
78 float tpcMinY{std::numeric_limits<float>::max()}, tpcMaxY{-std::numeric_limits<float>::max()};
79 float tpcMinZ{std::numeric_limits<float>::max()}, tpcMaxZ{-std::numeric_limits<float>::max()};
81 for (
const auto &[volumeId, pLArTPC] : larTPCMap)
84 const float centreX{pLArTPC->GetCenterX()}, halfWidthX{0.5f * pLArTPC->GetWidthX()};
85 const float centreY{pLArTPC->GetCenterY()}, halfWidthY{0.5f * pLArTPC->GetWidthY()};
86 const float centreZ{pLArTPC->GetCenterZ()}, halfWidthZ{0.5f * pLArTPC->GetWidthZ()};
87 tpcMinX = std::min(tpcMinX, centreX - halfWidthX);
88 tpcMaxX = std::max(tpcMaxX, centreX + halfWidthX);
89 tpcMinY = std::min(tpcMinY, centreY - halfWidthY);
90 tpcMaxY = std::max(tpcMaxY, centreY + halfWidthY);
91 tpcMinZ = std::min(tpcMinZ, centreZ - halfWidthZ);
92 tpcMaxZ = std::max(tpcMaxZ, centreZ + halfWidthZ);
95 if (detector ==
"dune_fd_hd")
97 const float x{vertex.
GetX()};
98 const float y{vertex.
GetY()};
99 const float z{vertex.
GetZ()};
100 return (tpcMinX + 50.f) < x && x < (tpcMaxX - 50.f) && (tpcMinY + 50.f) < y && y < (tpcMaxY - 50.f) && (tpcMinZ + 50.f) < z &&
101 z < (tpcMaxZ - 150.f);
103 else if (detector ==
"dune_nd")
105 const float x{vertex.
GetX()};
106 const float y{vertex.
GetY()};
107 const float z{vertex.
GetZ()};
108 return tpcMinX < x && x < tpcMaxX && tpcMinY < y && y < tpcMaxY && tpcMinZ < z && z < tpcMaxZ;
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
const pandora::CartesianVector & GetPosition() const
Get the vertex position.
static void GetImpactParameters(const LArPointingCluster::Vertex &pointingVertex, const LArPointingCluster::Vertex &targetVertex, float &longitudinal, float &transverse)
Calculate impact parameters between a pair of pointing vertices.
LArPointingCluster class.
const Vertex & GetInnerVertex() const
Get the inner vertex.
const Vertex & GetOuterVertex() const
Get the outer vertex.
static ClusterDirection GetClusterDirectionInZ(const pandora::Pandora &pandora, const pandora::Vertex *const pVertex, const pandora::Cluster *const pCluster, const float tanAngle, const float apexShift)
Get the direction of the cluster in z, using a projection of the provided vertex.
static bool IsInFiducialVolume(const pandora::Pandora &pandora, const pandora::CartesianVector &vertex, const std::string &detector)
Determine if a vertex is within a detector's fiducial volume. This throws a STATUS_CODE_INVALID_PARAM...
@ DIRECTION_BACKWARD_IN_Z