LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::LArVertexHelper Class Reference

LArVertexHelper class. More...

#include "LArVertexHelper.h"

Public Types

enum  ClusterDirection { DIRECTION_FORWARD_IN_Z, DIRECTION_BACKWARD_IN_Z, DIRECTION_UNKNOWN }
 

Static Public Member Functions

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. More...
 
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_PARAMETER exception if the detector is not recognised. More...
 

Detailed Description

LArVertexHelper class.

Definition at line 20 of file LArVertexHelper.h.

Member Enumeration Documentation

Member Function Documentation

LArVertexHelper::ClusterDirection lar_content::LArVertexHelper::GetClusterDirectionInZ ( const pandora::Pandora &  pandora,
const pandora::Vertex *const  pVertex,
const pandora::Cluster *const  pCluster,
const float  tanAngle,
const float  apexShift 
)
static

Get the direction of the cluster in z, using a projection of the provided vertex.

Parameters
pandorathe pandora instance
pVertexthe address of the vertex
pClusterthe address of the cluster
tanAnglelook for vertex inside triangle with apex shifted along the cluster length
apexShiftlook for vertex inside triangle with apex shifted along the cluster length
Returns
the cluster direction in z

Definition at line 25 of file LArVertexHelper.cc.

References lar_content::LArPointingCluster::GetInnerVertex(), lar_content::LArPointingCluster::GetOuterVertex(), and lar_content::LArPointingCluster::Vertex::GetPosition().

Referenced by lar_content::ShowerGrowingAlgorithm::AreClustersAssociated(), and lar_content::VertexBasedPfoMopUpAlgorithm::GetClusterAssociation().

27 {
28  if ((VERTEX_3D != pVertex->GetVertexType()) || (tanAngle < std::numeric_limits<float>::epsilon()))
29  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
30 
31  const HitType hitType(LArClusterHelper::GetClusterHitType(pCluster));
32  const CartesianVector theVertex2D(LArGeometryHelper::ProjectPosition(pandora, pVertex->GetPosition(), hitType));
33 
34  try
35  {
36  const LArPointingCluster pointingCluster(pCluster);
37  const float length((pointingCluster.GetInnerVertex().GetPosition() - pointingCluster.GetOuterVertex().GetPosition()).GetMagnitude());
38  const bool innerIsAtLowerZ(pointingCluster.GetInnerVertex().GetPosition().GetZ() < pointingCluster.GetOuterVertex().GetPosition().GetZ());
39 
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());
42  LArPointingClusterHelper::GetImpactParameters(pointingCluster.GetInnerVertex(), theVertex2D, rLInner, rTInner);
43  LArPointingClusterHelper::GetImpactParameters(pointingCluster.GetOuterVertex(), theVertex2D, rLOuter, rTOuter);
44 
45  const bool innerIsVertexAssociated(rLInner > (rTInner / tanAngle) - (length * apexShift));
46  const bool outerIsVertexAssociated(rLOuter > (rTInner / tanAngle) - (length * apexShift));
47 
48  if (innerIsVertexAssociated == outerIsVertexAssociated)
49  return DIRECTION_UNKNOWN;
50 
51  if ((innerIsVertexAssociated && innerIsAtLowerZ) || (outerIsVertexAssociated && !innerIsAtLowerZ))
53 
54  if ((innerIsVertexAssociated && !innerIsAtLowerZ) || (outerIsVertexAssociated && innerIsAtLowerZ))
56  }
57  catch (StatusCodeException &)
58  {
59  return DIRECTION_UNKNOWN;
60  }
61 
62  throw StatusCodeException(STATUS_CODE_FAILURE);
63 }
static void GetImpactParameters(const LArPointingCluster::Vertex &pointingVertex, const LArPointingCluster::Vertex &targetVertex, float &longitudinal, float &transverse)
Calculate impact parameters between a pair of pointing vertices.
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
HitType
Definition: HitType.h:12
bool lar_content::LArVertexHelper::IsInFiducialVolume ( const pandora::Pandora &  pandora,
const pandora::CartesianVector &  vertex,
const std::string &  detector 
)
static

Determine if a vertex is within a detector's fiducial volume. This throws a STATUS_CODE_INVALID_PARAMETER exception if the detector is not recognised.

Parameters
pandoraThe Pandora instance
vertexThe vertex to check
detectorThe string describing the detector of interest DUNEFD HD: dune_fd_hd
Returns
true if in fiducial volume, false if not

Definition at line 67 of file LArVertexHelper.cc.

References f, x, y, and z.

Referenced by lar_content::VertexMonitoringAlgorithm::AssessVertices(), and lar_content::HierarchyValidationAlgorithm::Run().

68 {
69  const LArTPCMap &larTPCMap(pandora.GetGeometry()->GetLArTPCMap());
70 
71  if (larTPCMap.empty())
72  {
73  std::cout << "LArVertexHelper::IsInFiducialVolume - LArTPC description not registered with Pandora as required " << std::endl;
74  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
75  }
76 
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()};
80 
81  for (const auto &[volumeId, pLArTPC] : larTPCMap)
82  {
83  (void)volumeId;
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);
93  }
94 
95  if (detector == "dune_fd_hd")
96  {
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);
102  }
103  else if (detector == "dune_nd")
104  {
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;
109  }
110  else
111  {
112  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
113  }
114 }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
TFile f
Definition: plotHisto.C:6
vertex reconstruction

The documentation for this class was generated from the following files: