Public Member Functions | Private Member Functions | Private Attributes | List of all members
lar_content::DeltaRaySplittingAlgorithm Class Reference

DeltaRaySplittingAlgorithm class. More...

#include <DeltaRaySplittingAlgorithm.h>

Inheritance diagram for lar_content::DeltaRaySplittingAlgorithm:
lar_content::TwoDSlidingFitSplittingAndSplicingAlgorithm

Public Member Functions

 DeltaRaySplittingAlgorithm ()
 Default constructor. More...
 
- Public Member Functions inherited from lar_content::TwoDSlidingFitSplittingAndSplicingAlgorithm
 TwoDSlidingFitSplittingAndSplicingAlgorithm ()
 Default constructor. More...
 

Private Member Functions

void FindBestSplitPosition (const TwoDSlidingFitResult &branchSlidingFit, const TwoDSlidingFitResult &replacementSlidingFit, pandora::CartesianVector &replacementStartPosition, pandora::CartesianVector &branchSplitPosition, pandora::CartesianVector &branchSplitDirection) const
 Output the best split positions in branch and replacement clusters. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

float m_stepSize
 
float m_maxTransverseDisplacement
 
float m_maxLongitudinalDisplacement
 
float m_minCosRelativeAngle
 

Additional Inherited Members

- Protected Types inherited from lar_content::TwoDSlidingFitSplittingAndSplicingAlgorithm
typedef std::vector< ClusterExtensionClusterExtensionList
 
- Protected Member Functions inherited from lar_content::TwoDSlidingFitSplittingAndSplicingAlgorithm
virtual pandora::StatusCode Run ()
 

Detailed Description

DeltaRaySplittingAlgorithm class.

Definition at line 19 of file DeltaRaySplittingAlgorithm.h.

Constructor & Destructor Documentation

lar_content::DeltaRaySplittingAlgorithm::DeltaRaySplittingAlgorithm ( )

Member Function Documentation

void lar_content::DeltaRaySplittingAlgorithm::FindBestSplitPosition ( const TwoDSlidingFitResult branchSlidingFit,
const TwoDSlidingFitResult replacementSlidingFit,
pandora::CartesianVector &  replacementStartPosition,
pandora::CartesianVector &  branchSplitPosition,
pandora::CartesianVector &  branchSplitDirection 
) const
privatevirtual

Output the best split positions in branch and replacement clusters.

Parameters
branchSlidingFitthe inputted sliding fit result for possible branch cluster
pReplacementClusterthe inputted sliding fit result for possible replacement cluster
replacementStartPositionthe outputted start position of the replacement
branchSplitPositionthe outputted start position of the branch
branchSplitDirectionthe outputted start direction of the branch

Implements lar_content::TwoDSlidingFitSplittingAndSplicingAlgorithm.

Definition at line 30 of file DeltaRaySplittingAlgorithm.cc.

32 {
33  // Conventions:
34  // (1) Delta ray is split from the branch cluster
35  // (2) Delta ray occurs where the vertex of the principal cluster meets the vertex of the branch cluster
36  // Method loops over the inner and outer positions of the principal and branch clusters, trying all
37  // possible assignments of vertex and end position until a split is found
38 
39  for (unsigned int principalForward = 0; principalForward < 2; ++principalForward)
40  {
41  const CartesianVector principalVertex(
42  1 == principalForward ? principalSlidingFit.GetGlobalMinLayerPosition() : principalSlidingFit.GetGlobalMaxLayerPosition());
43  const CartesianVector principalEnd(
44  1 == principalForward ? principalSlidingFit.GetGlobalMaxLayerPosition() : principalSlidingFit.GetGlobalMinLayerPosition());
45  const CartesianVector principalDirection(1 == principalForward ? principalSlidingFit.GetGlobalMinLayerDirection()
46  : principalSlidingFit.GetGlobalMaxLayerDirection() * -1.f);
47 
48  if (LArClusterHelper::GetClosestDistance(principalVertex, branchSlidingFit.GetCluster()) > m_maxLongitudinalDisplacement)
49  continue;
50 
51  for (unsigned int branchForward = 0; branchForward < 2; ++branchForward)
52  {
53  const CartesianVector branchVertex(
54  1 == branchForward ? branchSlidingFit.GetGlobalMinLayerPosition() : branchSlidingFit.GetGlobalMaxLayerPosition());
55  const CartesianVector branchEnd(
56  1 == branchForward ? branchSlidingFit.GetGlobalMaxLayerPosition() : branchSlidingFit.GetGlobalMinLayerPosition());
57  const CartesianVector branchDirection(
58  1 == branchForward ? branchSlidingFit.GetGlobalMinLayerDirection() : branchSlidingFit.GetGlobalMaxLayerDirection() * -1.f);
59 
60  // Require vertices to be closest two ends
61  const float vertex_to_vertex((principalVertex - branchVertex).GetMagnitudeSquared());
62  const float vertex_to_end((principalVertex - branchEnd).GetMagnitudeSquared());
63  const float end_to_vertex((principalEnd - branchVertex).GetMagnitudeSquared());
64  const float end_to_end((principalEnd - branchEnd).GetMagnitudeSquared());
65 
66  // (sign convention for vertexProjection: positive means that clusters overlap)
67  const float vertexProjection(+branchDirection.GetDotProduct(principalVertex - branchVertex));
68  const float cosRelativeAngle(-branchDirection.GetDotProduct(principalDirection));
69 
70  if (vertex_to_vertex > std::min(end_to_end, std::min(vertex_to_end, end_to_vertex)))
71  continue;
72 
73  if (end_to_end < std::max(vertex_to_vertex, std::max(vertex_to_end, end_to_vertex)))
74  continue;
75 
76  if (vertexProjection < 0.f && cosRelativeAngle > m_minCosRelativeAngle)
77  continue;
78 
79  if (cosRelativeAngle < 0.f)
80  continue;
81 
82  // Serach for a split by winding back the branch cluster sliding fit
83  bool foundSplit(false);
84 
85  const float halfWindowLength(branchSlidingFit.GetLayerFitHalfWindowLength());
86  const float deltaL(1 == branchForward ? +halfWindowLength : -halfWindowLength);
87 
88  float branchDistance(std::max(0.f, vertexProjection) + 0.5f * m_stepSize);
89 
90  while (!foundSplit)
91  {
92  branchDistance += m_stepSize;
93 
94  const CartesianVector linearProjection(branchVertex + branchDirection * branchDistance);
95 
96  if (principalDirection.GetDotProduct(linearProjection - principalVertex) < -m_maxLongitudinalDisplacement)
97  break;
98 
99  if ((linearProjection - branchVertex).GetMagnitudeSquared() > (linearProjection - branchEnd).GetMagnitudeSquared())
100  break;
101 
102  float localL(0.f), localT(0.f);
103  CartesianVector truncatedPosition(0.f, 0.f, 0.f);
104  CartesianVector forwardDirection(0.f, 0.f, 0.f);
105  branchSlidingFit.GetLocalPosition(linearProjection, localL, localT);
106 
107  if ((STATUS_CODE_SUCCESS != branchSlidingFit.GetGlobalFitPosition(localL, truncatedPosition)) ||
108  (STATUS_CODE_SUCCESS != branchSlidingFit.GetGlobalFitDirection(localL + deltaL, forwardDirection)))
109  {
110  continue;
111  }
112 
113  CartesianVector truncatedDirection(1 == branchForward ? forwardDirection : forwardDirection * -1.f);
114  const float cosTheta(-truncatedDirection.GetDotProduct(principalDirection));
115 
116  float rT1(0.f), rL1(0.f), rT2(0.f), rL2(0.f);
117  LArPointingClusterHelper::GetImpactParameters(truncatedPosition, truncatedDirection, principalVertex, rL1, rT1);
118  LArPointingClusterHelper::GetImpactParameters(principalVertex, principalDirection, truncatedPosition, rL2, rT2);
119 
120  if ((cosTheta > m_minCosRelativeAngle) && (rT1 < m_maxTransverseDisplacement) && (rT2 < m_maxTransverseDisplacement))
121  {
122  foundSplit = true;
123  principalStartPosition = principalVertex;
124  branchSplitPosition = truncatedPosition;
125  branchSplitDirection = truncatedDirection * -1.f;
126  }
127  }
128 
129  if (foundSplit)
130  return;
131  }
132  }
133 
134  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
135 }
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 int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.
StatusCode lar_content::DeltaRaySplittingAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::TwoDSlidingFitSplittingAndSplicingAlgorithm.

Definition at line 139 of file DeltaRaySplittingAlgorithm.cc.

140 {
141  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "StepSize", m_stepSize));
142 
143  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
144  XmlHelper::ReadValue(xmlHandle, "MaxTransverseDisplacement", m_maxTransverseDisplacement));
145 
146  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
147  XmlHelper::ReadValue(xmlHandle, "MaxLongitudinalDisplacement", m_maxLongitudinalDisplacement));
148 
149  PANDORA_RETURN_RESULT_IF_AND_IF(
150  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinCosRelativeAngle", m_minCosRelativeAngle));
151 
153 }
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)

Member Data Documentation

float lar_content::DeltaRaySplittingAlgorithm::m_maxLongitudinalDisplacement
private

Definition at line 36 of file DeltaRaySplittingAlgorithm.h.

float lar_content::DeltaRaySplittingAlgorithm::m_maxTransverseDisplacement
private

Definition at line 35 of file DeltaRaySplittingAlgorithm.h.

float lar_content::DeltaRaySplittingAlgorithm::m_minCosRelativeAngle
private

Definition at line 37 of file DeltaRaySplittingAlgorithm.h.

float lar_content::DeltaRaySplittingAlgorithm::m_stepSize
private

Definition at line 34 of file DeltaRaySplittingAlgorithm.h.


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