LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
LArVertexHelper.cc
Go to the documentation of this file.
1 
13 
14 #include <limits>
15 
16 using namespace pandora;
17 
18 namespace lar_content
19 {
20 
21 LArVertexHelper::ClusterDirection LArVertexHelper::GetClusterDirectionInZ(const Pandora &pandora, const Vertex *const pVertex,
22  const Cluster *const pCluster, const float tanAngle, const float apexShift)
23 {
24  if ((VERTEX_3D != pVertex->GetVertexType()) || (tanAngle < std::numeric_limits<float>::epsilon()))
25  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
26 
27  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
28  const CartesianVector theVertex2D(LArGeometryHelper::ProjectPosition(pandora, pVertex->GetPosition(), hitType));
29 
30  try
31  {
32  const LArPointingCluster pointingCluster(pCluster);
33  const float length((pointingCluster.GetInnerVertex().GetPosition() - pointingCluster.GetOuterVertex().GetPosition()).GetMagnitude());
34  const bool innerIsAtLowerZ(pointingCluster.GetInnerVertex().GetPosition().GetZ() < pointingCluster.GetOuterVertex().GetPosition().GetZ());
35 
38  LArPointingClusterHelper::GetImpactParameters(pointingCluster.GetInnerVertex(), theVertex2D, rLInner, rTInner);
39  LArPointingClusterHelper::GetImpactParameters(pointingCluster.GetOuterVertex(), theVertex2D, rLOuter, rTOuter);
40 
41  const bool innerIsVertexAssociated(rLInner > (rTInner / tanAngle) - (length * apexShift));
42  const bool outerIsVertexAssociated(rLOuter > (rTInner / tanAngle) - (length * apexShift));
43 
44  if (innerIsVertexAssociated == outerIsVertexAssociated)
45  return DIRECTION_UNKNOWN;
46 
47  if ((innerIsVertexAssociated && innerIsAtLowerZ) || (outerIsVertexAssociated && !innerIsAtLowerZ))
48  return DIRECTION_FORWARD_IN_Z;
49 
50  if ((innerIsVertexAssociated && !innerIsAtLowerZ) || (outerIsVertexAssociated && innerIsAtLowerZ))
51  return DIRECTION_BACKWARD_IN_Z;
52  }
53  catch (StatusCodeException &)
54  {
55  return DIRECTION_UNKNOWN;
56  }
57 
58  throw StatusCodeException(STATUS_CODE_FAILURE);
59 }
60 
61 } // namespace lar_content
LArPointingCluster class.
Header file for the geometry helper class.
Int_t max
Definition: plot.C:27
Header file for the cluster helper class.
const Vertex & GetOuterVertex() const
Get the outer vertex.
const Vertex & GetInnerVertex() const
Get the inner vertex.
Header file for the vertex helper class.
const pandora::CartesianVector & GetPosition() const
Get the vertex position.