LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::LArPointingClusterHelper Class Reference

LArPointingClusterHelper class. More...

#include "LArPointingClusterHelper.h"

Static Public Member Functions

static float GetLengthSquared (const LArPointingCluster &pointingCluster)
 Calculate distance squared between inner and outer vertices of pointing cluster. More...
 
static float GetLength (const LArPointingCluster &pointingCluster)
 Calculate distance squared between inner and outer vertices of pointing cluster. More...
 
static bool IsNode (const pandora::CartesianVector &parentVertex, const LArPointingCluster::Vertex &daughterVertex, const float minLongitudinalDistance, const float maxTransverseDistance)
 Whether pointing vertex is adjacent to a given position. More...
 
static bool IsEmission (const pandora::CartesianVector &parentVertex, const LArPointingCluster::Vertex &daughterVertex, const float minLongitudinalDistance, const float maxLongitudinalDistance, const float maxTransverseDistance, const float angularAllowance)
 Whether pointing vertex is emitted from a given position. More...
 
static pandora::CartesianVector GetProjectedPosition (const pandora::CartesianVector &initialPosition, const pandora::CartesianVector &initialDirection, const pandora::Cluster *const pCluster, const float projectionAngularAllowance)
 Get projected position on a cluster from a specified position and direction. More...
 
static void GetClosestVertices (const bool useX, const bool useY, const bool useZ, const LArPointingCluster &pointingClusterI, const LArPointingCluster &pointingClusterJ, LArPointingCluster::Vertex &closestVertexI, LArPointingCluster::Vertex &closestVertexJ)
 Given a pair of pointing clusters, receive the closest or farthest pair of vertices. More...
 
static void GetClosestVertices (const LArPointingCluster &pointingClusterI, const LArPointingCluster &pointingClusterJ, LArPointingCluster::Vertex &closestVertexI, LArPointingCluster::Vertex &closestVertexJ)
 Given a pair of pointing clusters, find the closest pair of vertices. More...
 
static void GetClosestVerticesInX (const LArPointingCluster &pointingClusterI, const LArPointingCluster &pointingClusterJ, LArPointingCluster::Vertex &closestVertexI, LArPointingCluster::Vertex &closestVertexJ)
 Given a pair of pointing clusters, find the pair of vertices with smallest x-separation. More...
 
static void GetClosestVerticesInYZ (const LArPointingCluster &pointingClusterI, const LArPointingCluster &pointingClusterJ, LArPointingCluster::Vertex &closestVertexI, LArPointingCluster::Vertex &closestVertexJ)
 Given a pair of pointing clusters, find the pair of vertices with smallest yz-separation. More...
 
static void GetImpactParametersInYZ (const LArPointingCluster::Vertex &pointingVertex, const LArPointingCluster::Vertex &targetVertex, float &longitudinal, float &transverse)
 Calculate impact parameters between a pair of pointing vertices using yz-coordinates. More...
 
static void GetImpactParameters (const LArPointingCluster::Vertex &pointingVertex, const LArPointingCluster::Vertex &targetVertex, float &longitudinal, float &transverse)
 Calculate impact parameters between a pair of pointing vertices. More...
 
static void GetImpactParameters (const LArPointingCluster::Vertex &pointingVertex, const pandora::CartesianVector &targetPosition, float &longitudinal, float &transverse)
 Calculate impact parameters between a pointing cluster vertex and a target position. More...
 
static void GetImpactParameters (const pandora::CartesianVector &initialPosition, const pandora::CartesianVector &initialDirection, const pandora::CartesianVector &targetPosition, float &longitudinal, float &transverse)
 Calculate impact parameters of a specified position and direction to a target position. More...
 
static void GetIntersection (const LArPointingCluster::Vertex &firstVertex, const LArPointingCluster::Vertex &secondVertex, pandora::CartesianVector &intersectPosition, float &firstDisplacement, float &secondDisplacement)
 Get intersection of two vertices. More...
 
static void GetAverageDirection (const LArPointingCluster::Vertex &firstVertex, const LArPointingCluster::Vertex &secondVertex, pandora::CartesianVector &averageDirection)
 Get average direction of two vertices. More...
 
static void GetIntersection (const pandora::CartesianVector &firstPosition, const pandora::CartesianVector &firstDirection, const pandora::CartesianVector &secondPosition, const pandora::CartesianVector &secondDirection, pandora::CartesianVector &intersectPosition, float &firstDisplacement, float &secondDisplacement)
 Get intersection of two vertices. More...
 
static void GetIntersection (const LArPointingCluster::Vertex &vertexCluster, const pandora::Cluster *const pTargetCluster, pandora::CartesianVector &intersectPosition, float &displacementL, float &displacementT)
 Get intersection of vertex with target cluster. More...
 
static LArPointingCluster::Vertex GetBestVertexEstimate (const LArPointingClusterVertexList &vertexList, const LArPointingClusterList &pointingClusterList, const float minLongitudinalDistance, const float maxLongitudinalDistance, const float maxTransverseDistance, const float angularAllowance)
 Simple and fast vertex selection, choosing best vertex from a specified list to represent a set of pointing clusters. More...
 

Static Private Member Functions

static void CollectAssociatedClusters (const LArPointingCluster::Vertex &vertex, const LArPointingClusterList &inputList, const float minLongitudinalDistance, const float maxLongitudinalDistance, const float maxTransverseDistance, const float angularAllowance, LArPointingClusterVertexList &outputList)
 Collect cluster vertices, from a provided input list, associated with a specified vertex. More...
 
static float GetAssociatedEnergy (const LArPointingCluster::Vertex &vertex, const LArPointingClusterVertexList &clusterVertices)
 Get an estimate of the energy associated with a specified vertex. More...
 

Detailed Description

LArPointingClusterHelper class.

Definition at line 21 of file LArPointingClusterHelper.h.

Member Function Documentation

void lar_content::LArPointingClusterHelper::CollectAssociatedClusters ( const LArPointingCluster::Vertex vertex,
const LArPointingClusterList inputList,
const float  minLongitudinalDistance,
const float  maxLongitudinalDistance,
const float  maxTransverseDistance,
const float  angularAllowance,
LArPointingClusterVertexList outputList 
)
staticprivate

Collect cluster vertices, from a provided input list, associated with a specified vertex.

Parameters
vertexthe vertex
inputListthe input list of pointing clusters
minLongitudinalDistancethe min longitudinal distance cut
maxLongitudinalDistancethe max longitudinal distance cut
maxTransverseDistancethe max transverse distance cut
angularAllowancethe pointing angular allowance in degrees
outputListto receive the output list of cluster vertices associated with the specified vertex

Definition at line 361 of file LArPointingClusterHelper.cc.

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

364 {
365  for (LArPointingClusterList::const_iterator iter = inputList.begin(), iterEnd = inputList.end(); iter != iterEnd; ++iter)
366  {
367  const LArPointingCluster &pointingCluster = *iter;
368  const LArPointingCluster::Vertex &innerVertex = pointingCluster.GetInnerVertex();
369  const LArPointingCluster::Vertex &outerVertex = pointingCluster.GetOuterVertex();
370 
371  const float innerDistanceSquared = (innerVertex.GetPosition() - vertex.GetPosition()).GetMagnitudeSquared();
372  const float outerDistanceSquared = (outerVertex.GetPosition() - vertex.GetPosition()).GetMagnitudeSquared();
373 
374  const LArPointingCluster::Vertex &chosenVertex((innerDistanceSquared < outerDistanceSquared) ? innerVertex : outerVertex);
375 
376  if (LArPointingClusterHelper::IsNode(vertex.GetPosition(), chosenVertex, minLongitudinalDistance, maxTransverseDistance) ||
377  LArPointingClusterHelper::IsEmission(vertex.GetPosition(), chosenVertex, minLongitudinalDistance, maxLongitudinalDistance, maxTransverseDistance, angularAllowance))
378  {
379  outputList.push_back(chosenVertex);
380  }
381  }
382 }
static bool IsEmission(const pandora::CartesianVector &parentVertex, const LArPointingCluster::Vertex &daughterVertex, const float minLongitudinalDistance, const float maxLongitudinalDistance, const float maxTransverseDistance, const float angularAllowance)
Whether pointing vertex is emitted from a given position.
intermediate_table::const_iterator const_iterator
static bool IsNode(const pandora::CartesianVector &parentVertex, const LArPointingCluster::Vertex &daughterVertex, const float minLongitudinalDistance, const float maxTransverseDistance)
Whether pointing vertex is adjacent to a given position.
vertex reconstruction
float lar_content::LArPointingClusterHelper::GetAssociatedEnergy ( const LArPointingCluster::Vertex vertex,
const LArPointingClusterVertexList clusterVertices 
)
staticprivate

Get an estimate of the energy associated with a specified vertex.

Parameters
vertexthe vertex
clusterVerticesthe list of cluster vertices associated with the specified vertex
Returns
the energy associated with a specified vertex

Definition at line 386 of file LArPointingClusterHelper.cc.

References f, lar_content::LArPointingCluster::Vertex::GetCluster(), lar_content::LArPointingCluster::Vertex::GetDirection(), and lar_content::LArPointingCluster::Vertex::GetPosition().

387 {
388  float associatedEnergy(0.f);
389 
390  for (LArPointingClusterVertexList::const_iterator iter = associatedVertices.begin(), iterEnd = associatedVertices.end(); iter != iterEnd; ++iter)
391  {
392  const LArPointingCluster::Vertex &clusterVertex(*iter);
393  const Cluster *const pCluster(clusterVertex.GetCluster());
394 
395  const float clusterEnergy(LArClusterHelper::GetEnergyFromLength(pCluster));
396  const float clusterLength(LArClusterHelper::GetLength(pCluster));
397  const float deltaLength(clusterVertex.GetDirection().GetDotProduct(vertex.GetPosition() - clusterVertex.GetPosition()));
398 
399  if (deltaLength < std::numeric_limits<float>::epsilon())
400  {
401  associatedEnergy += clusterEnergy;
402  }
403  else if(deltaLength < clusterLength)
404  {
405  associatedEnergy += clusterEnergy * (1.f - (deltaLength / clusterLength));
406  }
407  }
408 
409  return associatedEnergy;
410 }
TFile f
Definition: plotHisto.C:6
static float GetEnergyFromLength(const pandora::Cluster *const pCluster)
Get energy of cluster, based on length.
intermediate_table::const_iterator const_iterator
static float GetLength(const pandora::Cluster *const pCluster)
Get length of cluster.
vertex reconstruction
void lar_content::LArPointingClusterHelper::GetAverageDirection ( const LArPointingCluster::Vertex firstVertex,
const LArPointingCluster::Vertex secondVertex,
pandora::CartesianVector &  averageDirection 
)
static

Get average direction of two vertices.

Parameters
firstVertexthe first vertex
secondVertexthe second vertex
averageDirectionthe average direction

Definition at line 231 of file LArPointingClusterHelper.cc.

References a1, a2, f, lar_content::LArPointingCluster::Vertex::GetCluster(), lar_content::LArPointingCluster::Vertex::GetDirection(), GetIntersection(), lar_content::LArPointingCluster::Vertex::GetPosition(), and max.

233 {
234  const Cluster *const pFirstCluster(firstVertex.GetCluster());
235  const Cluster *const pSecondCluster(secondVertex.GetCluster());
236 
237  if (pFirstCluster == pSecondCluster)
238  throw pandora::StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
239 
240  const float energy1(pFirstCluster->GetHadronicEnergy());
241  const float energy2(pSecondCluster->GetHadronicEnergy());
242 
243  if ((energy1 < std::numeric_limits<float>::epsilon()) || (energy2 < std::numeric_limits<float>::epsilon()))
244  throw pandora::StatusCodeException(STATUS_CODE_NOT_ALLOWED);
245 
246  averageDirection = (firstVertex.GetDirection() * energy1 + secondVertex.GetDirection() * energy2).GetUnitVector();
247 }
LArPointingCluster::Vertex lar_content::LArPointingClusterHelper::GetBestVertexEstimate ( const LArPointingClusterVertexList vertexList,
const LArPointingClusterList pointingClusterList,
const float  minLongitudinalDistance,
const float  maxLongitudinalDistance,
const float  maxTransverseDistance,
const float  angularAllowance 
)
static

Simple and fast vertex selection, choosing best vertex from a specified list to represent a set of pointing clusters.

Parameters
vertexListthe candidate vertex list
pointingClusterListthe pointing cluster list
minLongitudinalDistancethe min longitudinal distance cut
maxLongitudinalDistancethe max longitudinal distance cut
maxTransverseDistancethe max transverse distance cut
angularAllowancethe pointing angular allowance in degrees
Returns
the best vertex estimate

Definition at line 329 of file LArPointingClusterHelper.cc.

References f.

332 {
333  float bestAssociatedEnergy(0.f);
334  LArPointingClusterVertexList::const_iterator bestVertexIter(vertexList.end());
335 
336  for (LArPointingClusterVertexList::const_iterator iter = vertexList.begin(), iterEnd = vertexList.end(); iter != iterEnd; ++iter)
337  {
338  const LArPointingCluster::Vertex &vertex(*iter);
339 
340  LArPointingClusterVertexList associatedVertices;
341  LArPointingClusterHelper::CollectAssociatedClusters(vertex, pointingClusterList, minLongitudinalDistance,
342  maxLongitudinalDistance, maxTransverseDistance, angularAllowance, associatedVertices);
343 
344  const float associatedEnergy(LArPointingClusterHelper::GetAssociatedEnergy(vertex, associatedVertices));
345 
346  if (associatedEnergy > bestAssociatedEnergy)
347  {
348  bestVertexIter = iter;
349  bestAssociatedEnergy = associatedEnergy;
350  }
351  }
352 
353  if (vertexList.end() == bestVertexIter)
354  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
355 
356  return (*bestVertexIter);
357 }
std::vector< LArPointingCluster::Vertex > LArPointingClusterVertexList
TFile f
Definition: plotHisto.C:6
intermediate_table::const_iterator const_iterator
static void CollectAssociatedClusters(const LArPointingCluster::Vertex &vertex, const LArPointingClusterList &inputList, const float minLongitudinalDistance, const float maxLongitudinalDistance, const float maxTransverseDistance, const float angularAllowance, LArPointingClusterVertexList &outputList)
Collect cluster vertices, from a provided input list, associated with a specified vertex...
static float GetAssociatedEnergy(const LArPointingCluster::Vertex &vertex, const LArPointingClusterVertexList &clusterVertices)
Get an estimate of the energy associated with a specified vertex.
vertex reconstruction
void lar_content::LArPointingClusterHelper::GetClosestVertices ( const bool  useX,
const bool  useY,
const bool  useZ,
const LArPointingCluster pointingClusterI,
const LArPointingCluster pointingClusterJ,
LArPointingCluster::Vertex closestVertexI,
LArPointingCluster::Vertex closestVertexJ 
)
static

Given a pair of pointing clusters, receive the closest or farthest pair of vertices.

Parameters
useXuse relative X coordinates in the calculation
useYuse relative Y coordinates in the calculation
useZuse relative Z coordinates in the calculation
pointingClusterIthe first pointing cluster
pointingClusterJthe second pointing cluster
closestVertexIto receive the relevant vertex from the first pointing cluster
closestVertexJto receive the relevant vertex from the second pointing cluster

Definition at line 107 of file LArPointingClusterHelper.cc.

References f, lar_content::LArPointingCluster::GetCluster(), lar_content::LArPointingCluster::GetInnerVertex(), lar_content::LArPointingCluster::GetOuterVertex(), max, and min.

Referenced by lar_content::LongitudinalExtensionAlgorithm::FillClusterAssociationMatrix(), lar_content::CosmicRayExtensionAlgorithm::FillClusterAssociationMatrix(), lar_content::UndershootTracksTool::GetIteratorListModifications(), and lar_content::CosmicRayTrackRecoveryAlgorithm::MatchClusters().

110 {
111  if (pointingClusterI.GetCluster() == pointingClusterJ.GetCluster())
112  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
113 
114  if (!useX && !useY && !useZ)
115  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
116 
117  for (unsigned int useInnerI = 0; useInnerI < 2; ++useInnerI)
118  {
119  const LArPointingCluster::Vertex &vtxI(useInnerI == 1 ? pointingClusterI.GetInnerVertex() : pointingClusterI.GetOuterVertex());
120  const LArPointingCluster::Vertex &endI(useInnerI == 0 ? pointingClusterI.GetInnerVertex() : pointingClusterI.GetOuterVertex());
121 
122  for (unsigned int useInnerJ = 0; useInnerJ < 2; ++useInnerJ)
123  {
124  const LArPointingCluster::Vertex &vtxJ(useInnerJ == 1 ? pointingClusterJ.GetInnerVertex() : pointingClusterJ.GetOuterVertex());
125  const LArPointingCluster::Vertex &endJ(useInnerJ == 0 ? pointingClusterJ.GetInnerVertex() : pointingClusterJ.GetOuterVertex());
126 
127  const float vtxI_vtxJ_dx(useX ? (vtxI.GetPosition().GetX() - vtxJ.GetPosition().GetX()) : 0.f);
128  const float vtxI_vtxJ_dy(useY ? (vtxI.GetPosition().GetY() - vtxJ.GetPosition().GetY()) : 0.f);
129  const float vtxI_vtxJ_dz(useZ ? (vtxI.GetPosition().GetZ() - vtxJ.GetPosition().GetZ()) : 0.f);
130  const float vtxI_vtxJ(vtxI_vtxJ_dx * vtxI_vtxJ_dx + vtxI_vtxJ_dy * vtxI_vtxJ_dy + vtxI_vtxJ_dz * vtxI_vtxJ_dz);
131 
132  const float vtxI_endJ_dx(useX ? (vtxI.GetPosition().GetX() - endJ.GetPosition().GetX()) : 0.f);
133  const float vtxI_endJ_dy(useY ? (vtxI.GetPosition().GetY() - endJ.GetPosition().GetY()) : 0.f);
134  const float vtxI_endJ_dz(useZ ? (vtxI.GetPosition().GetZ() - endJ.GetPosition().GetZ()) : 0.f);
135  const float vtxI_endJ(vtxI_endJ_dx * vtxI_endJ_dx + vtxI_endJ_dy * vtxI_endJ_dy + vtxI_endJ_dz * vtxI_endJ_dz);
136 
137  const float endI_vtxJ_dx(useX ? (endI.GetPosition().GetX() - vtxJ.GetPosition().GetX()) : 0.f);
138  const float endI_vtxJ_dy(useY ? (endI.GetPosition().GetY() - vtxJ.GetPosition().GetY()) : 0.f);
139  const float endI_vtxJ_dz(useZ ? (endI.GetPosition().GetZ() - vtxJ.GetPosition().GetZ()) : 0.f);
140  const float endI_vtxJ(endI_vtxJ_dx * endI_vtxJ_dx + endI_vtxJ_dy * endI_vtxJ_dy + endI_vtxJ_dz * endI_vtxJ_dz);
141 
142  const float endI_endJ_dx(useX ? (endI.GetPosition().GetX() - endJ.GetPosition().GetX()) : 0.f);
143  const float endI_endJ_dy(useY ? (endI.GetPosition().GetY() - endJ.GetPosition().GetY()) : 0.f);
144  const float endI_endJ_dz(useZ ? (endI.GetPosition().GetZ() - endJ.GetPosition().GetZ()) : 0.f);
145  const float endI_endJ(endI_endJ_dx * endI_endJ_dx + endI_endJ_dy * endI_endJ_dy + endI_endJ_dz * endI_endJ_dz);
146 
147  if ((vtxI_vtxJ < std::min(vtxI_endJ, std::min(endI_vtxJ, endI_endJ))) &&
148  (endI_endJ > std::max(vtxI_endJ, std::max(endI_vtxJ, vtxI_vtxJ))))
149  {
150  closestVertexI = vtxI;
151  closestVertexJ = vtxJ;
152  return;
153  }
154  }
155  }
156 
157  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
158 }
TFile f
Definition: plotHisto.C:6
Int_t max
Definition: plot.C:27
Int_t min
Definition: plot.C:26
void lar_content::LArPointingClusterHelper::GetClosestVertices ( const LArPointingCluster pointingClusterI,
const LArPointingCluster pointingClusterJ,
LArPointingCluster::Vertex closestVertexI,
LArPointingCluster::Vertex closestVertexJ 
)
static

Given a pair of pointing clusters, find the closest pair of vertices.

Parameters
pointingClusterIthe first pointing cluster
pointingClusterJthe second pointing cluster
closestVertexIto receive the relevant vertex from the first pointing cluster
closestVertexJto receive the relevant vertex from the second pointing cluster

Definition at line 162 of file LArPointingClusterHelper.cc.

164 {
165  return LArPointingClusterHelper::GetClosestVertices(true, true, true, pointingClusterI, pointingClusterJ, closestVertexI, closestVertexJ);
166 }
static void GetClosestVertices(const bool useX, const bool useY, const bool useZ, const LArPointingCluster &pointingClusterI, const LArPointingCluster &pointingClusterJ, LArPointingCluster::Vertex &closestVertexI, LArPointingCluster::Vertex &closestVertexJ)
Given a pair of pointing clusters, receive the closest or farthest pair of vertices.
void lar_content::LArPointingClusterHelper::GetClosestVerticesInX ( const LArPointingCluster pointingClusterI,
const LArPointingCluster pointingClusterJ,
LArPointingCluster::Vertex closestVertexI,
LArPointingCluster::Vertex closestVertexJ 
)
static

Given a pair of pointing clusters, find the pair of vertices with smallest x-separation.

Parameters
pointingClusterIthe first pointing cluster
pointingClusterJthe second pointing cluster
closestVertexIto receive the relevant vertex from the first pointing cluster
closestVertexJto receive the relevant vertex from the second pointing cluster

Definition at line 170 of file LArPointingClusterHelper.cc.

Referenced by lar_content::OvershootTracksTool::GetIteratorListModifications().

172 {
173  return LArPointingClusterHelper::GetClosestVertices(true, false, false, pointingClusterI, pointingClusterJ, closestVertexI, closestVertexJ);
174 }
static void GetClosestVertices(const bool useX, const bool useY, const bool useZ, const LArPointingCluster &pointingClusterI, const LArPointingCluster &pointingClusterJ, LArPointingCluster::Vertex &closestVertexI, LArPointingCluster::Vertex &closestVertexJ)
Given a pair of pointing clusters, receive the closest or farthest pair of vertices.
void lar_content::LArPointingClusterHelper::GetClosestVerticesInYZ ( const LArPointingCluster pointingClusterI,
const LArPointingCluster pointingClusterJ,
LArPointingCluster::Vertex closestVertexI,
LArPointingCluster::Vertex closestVertexJ 
)
static

Given a pair of pointing clusters, find the pair of vertices with smallest yz-separation.

Parameters
pointingClusterIthe first pointing cluster
pointingClusterJthe second pointing cluster
closestVertexIto receive the relevant vertex from the first pointing cluster
closestVertexJto receive the relevant vertex from the second pointing cluster

Definition at line 178 of file LArPointingClusterHelper.cc.

180 {
181  return LArPointingClusterHelper::GetClosestVertices(false, true, true, pointingClusterI, pointingClusterJ, closestVertexI, closestVertexJ);
182 }
static void GetClosestVertices(const bool useX, const bool useY, const bool useZ, const LArPointingCluster &pointingClusterI, const LArPointingCluster &pointingClusterJ, LArPointingCluster::Vertex &closestVertexI, LArPointingCluster::Vertex &closestVertexJ)
Given a pair of pointing clusters, receive the closest or farthest pair of vertices.
void lar_content::LArPointingClusterHelper::GetImpactParameters ( const LArPointingCluster::Vertex pointingVertex,
const LArPointingCluster::Vertex targetVertex,
float &  longitudinal,
float &  transverse 
)
static

Calculate impact parameters between a pair of pointing vertices.

Parameters
pointingVertexthe pointing vertex
targetPositionthe target position
longitidinalthe longitudinal displacement
transversethe transverse displacement

Definition at line 202 of file LArPointingClusterHelper.cc.

References lar_content::LArPointingCluster::Vertex::GetDirection(), and lar_content::LArPointingCluster::Vertex::GetPosition().

Referenced by lar_content::CosmicRaySplittingAlgorithm::ConfirmSplitPosition(), lar_content::StitchingCosmicRayMergingTool::CreatePfoMatches(), lar_content::LongitudinalExtensionAlgorithm::FillClusterAssociationMatrix(), lar_content::DeltaRaySplittingAlgorithm::FindBestSplitPosition(), lar_content::BranchSplittingAlgorithm::FindBestSplitPosition(), lar_content::UndershootTracksTool::GetIteratorListModifications(), lar_content::TransverseExtensionAlgorithm::GetListOfCleanClusters(), lar_content::OvershootTracksTool::PassesVertexCuts(), and lar_content::VertexBasedPfoRecoveryAlgorithm::SelectVertexClusters().

204 {
205  return LArPointingClusterHelper::GetImpactParameters(pointingVertex.GetPosition(), pointingVertex.GetDirection(),
206  targetVertex.GetPosition(), longitudinal, transverse);
207 }
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 void lar_content::LArPointingClusterHelper::GetImpactParameters ( const LArPointingCluster::Vertex pointingVertex,
const pandora::CartesianVector &  targetPosition,
float &  longitudinal,
float &  transverse 
)
static

Calculate impact parameters between a pointing cluster vertex and a target position.

Parameters
pointingVertexthe pointing vertex
targetPositionthe target position
longitidinalthe longitudinal displacement
transversethe transverse displacement
static void lar_content::LArPointingClusterHelper::GetImpactParameters ( const pandora::CartesianVector &  initialPosition,
const pandora::CartesianVector &  initialDirection,
const pandora::CartesianVector &  targetPosition,
float &  longitudinal,
float &  transverse 
)
static

Calculate impact parameters of a specified position and direction to a target position.

Parameters
initialPositionthe initial position of the cluster
initialDirectionthe initial direction of the cluster
targetPositionthe target position
longitidinalthe longitudinal displacement
transversethe transverse displacement
void lar_content::LArPointingClusterHelper::GetImpactParametersInYZ ( const LArPointingCluster::Vertex pointingVertex,
const LArPointingCluster::Vertex targetVertex,
float &  longitudinal,
float &  transverse 
)
static

Calculate impact parameters between a pair of pointing vertices using yz-coordinates.

Parameters
pointingVertexthe pointing vertex
targetPositionthe target position
longitidinalthe longitudinal displacement
transversethe transverse displacement

Definition at line 186 of file LArPointingClusterHelper.cc.

References f, lar_content::LArPointingCluster::Vertex::GetDirection(), and lar_content::LArPointingCluster::Vertex::GetPosition().

Referenced by lar_content::StitchingCosmicRayMergingTool::CreatePfoMatches().

188 {
189  if (std::fabs(initialVertex.GetDirection().GetX()) > 1.f - std::numeric_limits<float>::epsilon())
190  throw pandora::StatusCodeException(pandora::STATUS_CODE_NOT_FOUND);
191 
192  const pandora::CartesianVector initialPosition(0.f, initialVertex.GetPosition().GetY(), initialVertex.GetPosition().GetZ());
193  const pandora::CartesianVector initialDirection(0.f, initialVertex.GetDirection().GetY(), initialVertex.GetDirection().GetZ());
194  const pandora::CartesianVector targetPosition(0.f, targetVertex.GetPosition().GetY(), targetVertex.GetPosition().GetZ());
195 
196  return LArPointingClusterHelper::GetImpactParameters(initialPosition, initialDirection.GetUnitVector(),
197  targetPosition, longitudinal, transverse);
198 }
static void GetImpactParameters(const LArPointingCluster::Vertex &pointingVertex, const LArPointingCluster::Vertex &targetVertex, float &longitudinal, float &transverse)
Calculate impact parameters between a pair of pointing vertices.
TFile f
Definition: plotHisto.C:6
static void lar_content::LArPointingClusterHelper::GetIntersection ( const LArPointingCluster::Vertex firstVertex,
const LArPointingCluster::Vertex secondVertex,
pandora::CartesianVector &  intersectPosition,
float &  firstDisplacement,
float &  secondDisplacement 
)
static

Get intersection of two vertices.

Parameters
firstVertexthe first vertex
secondVertexthe second vertex
intersectPositionthe position of the intersection
firstDisplacementthe displacement from first vertex to intersection
secondDisplacementthe displacement from second vertex to intersection

Referenced by lar_content::OvershootSplittingAlgorithm::BuildIntersectionMap(), lar_content::EventSlicingTool::CheckClosestApproach(), and lar_content::CrossedTrackSplittingAlgorithm::FindBestSplitPosition().

static void lar_content::LArPointingClusterHelper::GetIntersection ( const pandora::CartesianVector &  firstPosition,
const pandora::CartesianVector &  firstDirection,
const pandora::CartesianVector &  secondPosition,
const pandora::CartesianVector &  secondDirection,
pandora::CartesianVector &  intersectPosition,
float &  firstDisplacement,
float &  secondDisplacement 
)
static

Get intersection of two vertices.

Parameters
firstPositionthe position of the first vertex
firstDirectionthe direction of the first vertex
secondPositionthe position of the second vertex
secondDirectionthe direction of the second vertex
intersectPositionthe position of the intersection
firstDisplacementthe displacement from first vertex to intersection
secondDisplacementthe displacement from second vertex to intersection
static void lar_content::LArPointingClusterHelper::GetIntersection ( const LArPointingCluster::Vertex vertexCluster,
const pandora::Cluster *const  pTargetCluster,
pandora::CartesianVector &  intersectPosition,
float &  displacementL,
float &  displacementT 
)
static

Get intersection of vertex with target cluster.

Parameters
vertexClusterthe vertex
pTargetClusterthe target cluster
intersectPositionthe position of the intersection
displacementLthe longitudinal displacement
displacementTthe transverse displacement
float lar_content::LArPointingClusterHelper::GetLength ( const LArPointingCluster pointingCluster)
static

Calculate distance squared between inner and outer vertices of pointing cluster.

Parameters
pointingClusterthe input pointing cluster
Returns
float the distance

Definition at line 26 of file LArPointingClusterHelper.cc.

Referenced by lar_content::LongitudinalExtensionAlgorithm::FillClusterAssociationMatrix().

27 {
28  return std::sqrt(LArPointingClusterHelper::GetLengthSquared(pointingCluster));
29 }
static float GetLengthSquared(const LArPointingCluster &pointingCluster)
Calculate distance squared between inner and outer vertices of pointing cluster.
float lar_content::LArPointingClusterHelper::GetLengthSquared ( const LArPointingCluster pointingCluster)
static

Calculate distance squared between inner and outer vertices of pointing cluster.

Parameters
pointingClusterthe input pointing cluster
Returns
float the distance squared

Definition at line 17 of file LArPointingClusterHelper.cc.

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

Referenced by lar_content::CosmicRayExtensionAlgorithm::FillClusterAssociationMatrix().

18 {
19  const LArPointingCluster::Vertex &innerVertex(pointingCluster.GetInnerVertex());
20  const LArPointingCluster::Vertex &outerVertex(pointingCluster.GetOuterVertex());
21  return (innerVertex.GetPosition() - outerVertex.GetPosition()).GetMagnitudeSquared();
22 }
CartesianVector lar_content::LArPointingClusterHelper::GetProjectedPosition ( const pandora::CartesianVector &  initialPosition,
const pandora::CartesianVector &  initialDirection,
const pandora::Cluster *const  pCluster,
const float  projectionAngularAllowance 
)
static

Get projected position on a cluster from a specified position and direction.

Parameters
initialPositionthe initial position of the cluster
initialDirectionthe initial direction of the cluster
pClusteraddress of the cluster
projectionAngularAllowancethe projection angular allowance
Returns
the projected position

Definition at line 66 of file LArPointingClusterHelper.cc.

References f, and max.

Referenced by lar_content::BranchSplittingAlgorithm::FindBestSplitPosition().

68 {
69  const CaloHit *pClosestCaloHit(nullptr);
70  float closestDistanceSquared(std::numeric_limits<float>::max());
71  const float minCosTheta(std::cos(M_PI * projectionAngularAllowance / 180.f));
72 
73  for (const OrderedCaloHitList::value_type &layerEntry : pCluster->GetOrderedCaloHitList())
74  {
75  for (const CaloHit *const pCaloHit : *layerEntry.second)
76  {
77  const CartesianVector hitProjection(pCaloHit->GetPositionVector() - vertexPosition);
78  const float distanceSquared(hitProjection.GetMagnitudeSquared());
79 
80  if (distanceSquared > std::numeric_limits<float>::epsilon())
81  {
82  // TODO Try to give more weight to on-axis projections
83  if (distanceSquared < closestDistanceSquared)
84  {
85  if (-hitProjection.GetUnitVector().GetDotProduct(vertexDirection) > minCosTheta)
86  {
87  pClosestCaloHit = pCaloHit;
88  closestDistanceSquared = distanceSquared;
89  }
90  }
91  }
92  else
93  {
94  return pCaloHit->GetPositionVector();
95  }
96  }
97  }
98 
99  if (pClosestCaloHit)
100  return pClosestCaloHit->GetPositionVector();
101 
102  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
103 }
TFile f
Definition: plotHisto.C:6
Int_t max
Definition: plot.C:27
bool lar_content::LArPointingClusterHelper::IsEmission ( const pandora::CartesianVector &  parentVertex,
const LArPointingCluster::Vertex daughterVertex,
const float  minLongitudinalDistance,
const float  maxLongitudinalDistance,
const float  maxTransverseDistance,
const float  angularAllowance 
)
static

Whether pointing vertex is emitted from a given position.

Parameters
parentVertexthe parent vertex position
daughtervertexthe daughter pointing vertex
minLongitudinalDistancethe min longitudinal distance cut
maxLongitudinalDistancethe max longitudinal distance cut
maxTransverseDistancethe max transverse distance cut
angularAllowancethe pointing angular allowance in degrees
Returns
boolean

Definition at line 47 of file LArPointingClusterHelper.cc.

References f, lar_content::LArPointingCluster::Vertex::GetDirection(), and lar_content::LArPointingCluster::Vertex::GetPosition().

Referenced by lar_content::SplitShowersTool::CheckClusterVertexRelations(), lar_content::CrossGapsExtensionAlgorithm::IsAssociated(), lar_content::EventSlicingTool::IsEmission(), lar_content::ShowerPfoMopUpAlgorithm::IsVertexAssociated(), lar_content::ShowerGrowingAlgorithm::IsVertexAssociated(), lar_content::CosmicRayTrackRecoveryAlgorithm::MatchClusters(), lar_content::VertexAssociatedPfosTool::Run(), and lar_content::EndAssociatedPfosTool::Run().

49 {
50  float rL(0.f), rT(0.f);
51  LArPointingClusterHelper::GetImpactParameters(daughterVertex.GetPosition(), daughterVertex.GetDirection(), parentVertex, rL, rT);
52 
53  if (std::fabs(rL) > std::fabs(minLongitudinalDistance) && (rL < 0 || rL > maxLongitudinalDistance))
54  return false;
55 
56  const float tanSqTheta(std::pow(std::tan(M_PI * angularAllowance / 180.f), 2.0));
57 
58  if (rT * rT > maxTransverseDistance * maxTransverseDistance + rL * rL * tanSqTheta)
59  return false;
60 
61  return true;
62 }
static void GetImpactParameters(const LArPointingCluster::Vertex &pointingVertex, const LArPointingCluster::Vertex &targetVertex, float &longitudinal, float &transverse)
Calculate impact parameters between a pair of pointing vertices.
TFile f
Definition: plotHisto.C:6
bool lar_content::LArPointingClusterHelper::IsNode ( const pandora::CartesianVector &  parentVertex,
const LArPointingCluster::Vertex daughterVertex,
const float  minLongitudinalDistance,
const float  maxTransverseDistance 
)
static

Whether pointing vertex is adjacent to a given position.

Parameters
parentVertexthe parent vertex position
daughtervertexthe daughter pointing vertex
minLongitudinalDistancethe min longitudinal distance cut
maxTransverseDistancethe max transverse distance cut
Returns
boolean

Definition at line 33 of file LArPointingClusterHelper.cc.

References f, lar_content::LArPointingCluster::Vertex::GetDirection(), and lar_content::LArPointingCluster::Vertex::GetPosition().

Referenced by lar_content::SplitShowersTool::CheckClusterVertexRelations(), lar_content::SlidingConePfoMopUpAlgorithm::GetClusterMergeMap(), lar_content::EventSlicingTool::IsNode(), lar_content::ShowerPfoMopUpAlgorithm::IsVertexAssociated(), lar_content::ShowerGrowingAlgorithm::IsVertexAssociated(), lar_content::VertexAssociatedPfosTool::Run(), lar_content::EndAssociatedPfosTool::Run(), lar_content::VertexBasedPfoMopUpAlgorithm::Run(), and lar_content::ParticleRecoveryAlgorithm::VertexClusterSelection().

35 {
36  float rL(0.f), rT(0.f);
37  LArPointingClusterHelper::GetImpactParameters(daughterVertex.GetPosition(), daughterVertex.GetDirection(), parentVertex, rL, rT);
38 
39  if (std::fabs(rL) > std::fabs(minLongitudinalDistance) || rT > maxTransverseDistance)
40  return false;
41 
42  return true;
43 }
static void GetImpactParameters(const LArPointingCluster::Vertex &pointingVertex, const LArPointingCluster::Vertex &targetVertex, float &longitudinal, float &transverse)
Calculate impact parameters between a pair of pointing vertices.
TFile f
Definition: plotHisto.C:6

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