LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::EndAssociatedPfosTool Class Reference

EndAssociatedPfosTool class. More...

#include "EndAssociatedPfosTool.h"

Inheritance diagram for lar_content::EndAssociatedPfosTool:
lar_content::PfoRelationTool

Public Member Functions

 EndAssociatedPfosTool ()
 Default constructor. More...
 
void Run (NeutrinoHierarchyAlgorithm *const pAlgorithm, const pandora::Vertex *const pNeutrinoVertex, NeutrinoHierarchyAlgorithm::PfoInfoMap &pfoInfoMap)
 Run the algorithm tool. More...
 

Private Member Functions

bool IsCloseToParentEndpoint (const pandora::CartesianVector &parentEndpoint, const pandora::Cluster *const pParentCluster3D, const pandora::Cluster *const pDaughterCluster3D) const
 Whether a daughter 3D cluster is in close proximity to the endpoint of a parent 3D cluster. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

float m_minNeutrinoVertexDistance
 Min distance between candidate parent endpoint and neutrino vertex. More...
 
float m_minVertexLongitudinalDistance
 Vertex association check: min longitudinal distance cut. More...
 
float m_maxVertexLongitudinalDistance
 Vertex association check: max longitudinal distance cut. More...
 
float m_maxVertexTransverseDistance
 Vertex association check: max transverse distance cut. More...
 
float m_vertexAngularAllowance
 Vertex association check: pointing angular allowance in degrees. More...
 
float m_maxParentEndpointDistance
 Max distance between candidate parent endpoint and candidate daughter. More...
 

Detailed Description

EndAssociatedPfosTool class.

Definition at line 21 of file EndAssociatedPfosTool.h.

Constructor & Destructor Documentation

lar_content::EndAssociatedPfosTool::EndAssociatedPfosTool ( )

Default constructor.

Definition at line 26 of file EndAssociatedPfosTool.cc.

26  :
33 {
34 }
float m_minNeutrinoVertexDistance
Min distance between candidate parent endpoint and neutrino vertex.
float m_vertexAngularAllowance
Vertex association check: pointing angular allowance in degrees.
TFile f
Definition: plotHisto.C:6
float m_maxVertexLongitudinalDistance
Vertex association check: max longitudinal distance cut.
float m_maxParentEndpointDistance
Max distance between candidate parent endpoint and candidate daughter.
float m_maxVertexTransverseDistance
Vertex association check: max transverse distance cut.
float m_minVertexLongitudinalDistance
Vertex association check: min longitudinal distance cut.

Member Function Documentation

bool lar_content::EndAssociatedPfosTool::IsCloseToParentEndpoint ( const pandora::CartesianVector &  parentEndpoint,
const pandora::Cluster *const  pParentCluster3D,
const pandora::Cluster *const  pDaughterCluster3D 
) const
private

Whether a daughter 3D cluster is in close proximity to the endpoint of a parent 3D cluster.

Parameters
parentEndpointthe parent endpoint position
pParentCluster3Dthe address of the parent 3D cluster
pDaughterCluster3Dthe address of the daughter 3D cluster
Returns
boolean

Definition at line 100 of file EndAssociatedPfosTool.cc.

References f, lar_content::LArClusterHelper::GetClosestPositions(), and m_maxParentEndpointDistance.

Referenced by Run().

102 {
103  try
104  {
105  CartesianVector parentPosition3D(0.f, 0.f, 0.f), daughterPosition3D(0.f, 0.f, 0.f);
106  LArClusterHelper::GetClosestPositions(pParentCluster3D, pDaughterCluster3D, parentPosition3D, daughterPosition3D);
107 
108  if (((parentPosition3D - parentEndpoint).GetMagnitude() < m_maxParentEndpointDistance) && ((parentPosition3D - daughterPosition3D).GetMagnitude() < m_maxParentEndpointDistance))
109  return true;
110  }
111  catch (const StatusCodeException &)
112  {
113  }
114 
115  return false;
116 }
static void GetClosestPositions(const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, pandora::CartesianVector &position1, pandora::CartesianVector &position2)
Get pair of closest positions for a pair of clusters.
TFile f
Definition: plotHisto.C:6
float m_maxParentEndpointDistance
Max distance between candidate parent endpoint and candidate daughter.
StatusCode lar_content::EndAssociatedPfosTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 120 of file EndAssociatedPfosTool.cc.

References m_maxParentEndpointDistance, m_maxVertexLongitudinalDistance, m_maxVertexTransverseDistance, m_minNeutrinoVertexDistance, m_minVertexLongitudinalDistance, and m_vertexAngularAllowance.

121 {
122  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
123  "MinNeutrinoVertexDistance", m_minNeutrinoVertexDistance));
124 
125  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
126  "MinVertexLongitudinalDistance", m_minVertexLongitudinalDistance));
127 
128  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
129  "MaxVertexLongitudinalDistance", m_maxVertexLongitudinalDistance));
130 
131  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
132  "MaxVertexTransverseDistance", m_maxVertexTransverseDistance));
133 
134  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
135  "VertexAngularAllowance", m_vertexAngularAllowance));
136 
137  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
138  "MaxParentEndpointDistance", m_maxParentEndpointDistance));
139 
140  return STATUS_CODE_SUCCESS;
141 }
float m_minNeutrinoVertexDistance
Min distance between candidate parent endpoint and neutrino vertex.
float m_vertexAngularAllowance
Vertex association check: pointing angular allowance in degrees.
float m_maxVertexLongitudinalDistance
Vertex association check: max longitudinal distance cut.
float m_maxParentEndpointDistance
Max distance between candidate parent endpoint and candidate daughter.
float m_maxVertexTransverseDistance
Vertex association check: max transverse distance cut.
float m_minVertexLongitudinalDistance
Vertex association check: min longitudinal distance cut.
void lar_content::EndAssociatedPfosTool::Run ( NeutrinoHierarchyAlgorithm *const  pAlgorithm,
const pandora::Vertex *const  pNeutrinoVertex,
NeutrinoHierarchyAlgorithm::PfoInfoMap pfoInfoMap 
)
virtual

Run the algorithm tool.

Parameters
pAlgorithmaddress of the calling algorithm
pNeutrinoVertexthe address of the three dimensional neutrino interaction vertex
pfoInfoMapmapping from pfos to three dimensional clusters, sliding fits, vertices, etc.

Implements lar_content::PfoRelationTool.

Definition at line 38 of file EndAssociatedPfosTool.cc.

References IsCloseToParentEndpoint(), lar_content::LArPointingClusterHelper::IsEmission(), lar_content::LArPointingClusterHelper::IsNode(), m_maxVertexLongitudinalDistance, m_maxVertexTransverseDistance, m_minNeutrinoVertexDistance, m_minVertexLongitudinalDistance, m_vertexAngularAllowance, and lar_content::NeutrinoHierarchyAlgorithm::SeparatePfos().

39 {
40  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
41  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
42 
43  bool associationsMade(true);
44 
45  while (associationsMade)
46  {
47  associationsMade = false;
48  PfoVector assignedPfos, unassignedPfos;
49  pAlgorithm->SeparatePfos(pfoInfoMap, assignedPfos, unassignedPfos);
50 
51  if (unassignedPfos.empty())
52  break;
53 
54  // ATTN May want to reconsider precise association mechanics for complex situations
55  PfoSet recentlyAssigned;
56 
57  for (const ParticleFlowObject *const pParentPfo : assignedPfos)
58  {
59  PfoInfo *const pParentPfoInfo(pfoInfoMap.at(pParentPfo));
60  const LArPointingCluster parentPointingCluster(*(pParentPfoInfo->GetSlidingFitResult3D()));
61 
62  const LArPointingCluster::Vertex &parentEndpoint(pParentPfoInfo->IsInnerLayerAssociated() ? parentPointingCluster.GetOuterVertex() : parentPointingCluster.GetInnerVertex());
63  const float neutrinoVertexDistance((parentEndpoint.GetPosition() - pNeutrinoVertex->GetPosition()).GetMagnitude());
64 
65  if (neutrinoVertexDistance < m_minNeutrinoVertexDistance)
66  continue;
67 
68  for (const ParticleFlowObject *const pPfo : unassignedPfos)
69  {
70  if (recentlyAssigned.count(pPfo))
71  continue;
72 
73  PfoInfo *const pPfoInfo(pfoInfoMap.at(pPfo));
74 
75  const LArPointingCluster pointingCluster(*(pPfoInfo->GetSlidingFitResult3D()));
76  const bool useInner((pointingCluster.GetInnerVertex().GetPosition() - parentEndpoint.GetPosition()).GetMagnitudeSquared() <
77  (pointingCluster.GetOuterVertex().GetPosition() - parentEndpoint.GetPosition()).GetMagnitudeSquared());
78 
79  const LArPointingCluster::Vertex &daughterVertex(useInner ? pointingCluster.GetInnerVertex() : pointingCluster.GetOuterVertex());
80 
81  if (LArPointingClusterHelper::IsNode(parentEndpoint.GetPosition(), daughterVertex, m_minVertexLongitudinalDistance, m_maxVertexTransverseDistance) ||
85  this->IsCloseToParentEndpoint(parentEndpoint.GetPosition(), pParentPfoInfo->GetCluster3D(), pPfoInfo->GetCluster3D()) )
86  {
87  associationsMade = true;
88  pParentPfoInfo->AddDaughterPfo(pPfoInfo->GetThisPfo());
89  pPfoInfo->SetParentPfo(pParentPfoInfo->GetThisPfo());
90  pPfoInfo->SetInnerLayerAssociation(useInner);
91  recentlyAssigned.insert(pPfoInfo->GetThisPfo());
92  }
93  }
94  }
95  }
96 }
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.
float m_minNeutrinoVertexDistance
Min distance between candidate parent endpoint and neutrino vertex.
float m_vertexAngularAllowance
Vertex association check: pointing angular allowance in degrees.
float m_maxVertexLongitudinalDistance
Vertex association check: max longitudinal distance cut.
bool IsCloseToParentEndpoint(const pandora::CartesianVector &parentEndpoint, const pandora::Cluster *const pParentCluster3D, const pandora::Cluster *const pDaughterCluster3D) const
Whether a daughter 3D cluster is in close proximity to the endpoint of a parent 3D cluster...
float m_maxVertexTransverseDistance
Vertex association check: max transverse distance cut.
NeutrinoHierarchyAlgorithm::PfoInfo PfoInfo
float m_minVertexLongitudinalDistance
Vertex association check: min longitudinal distance cut.
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.

Member Data Documentation

float lar_content::EndAssociatedPfosTool::m_maxParentEndpointDistance
private

Max distance between candidate parent endpoint and candidate daughter.

Definition at line 51 of file EndAssociatedPfosTool.h.

Referenced by IsCloseToParentEndpoint(), and ReadSettings().

float lar_content::EndAssociatedPfosTool::m_maxVertexLongitudinalDistance
private

Vertex association check: max longitudinal distance cut.

Definition at line 48 of file EndAssociatedPfosTool.h.

Referenced by ReadSettings(), and Run().

float lar_content::EndAssociatedPfosTool::m_maxVertexTransverseDistance
private

Vertex association check: max transverse distance cut.

Definition at line 49 of file EndAssociatedPfosTool.h.

Referenced by ReadSettings(), and Run().

float lar_content::EndAssociatedPfosTool::m_minNeutrinoVertexDistance
private

Min distance between candidate parent endpoint and neutrino vertex.

Definition at line 46 of file EndAssociatedPfosTool.h.

Referenced by ReadSettings(), and Run().

float lar_content::EndAssociatedPfosTool::m_minVertexLongitudinalDistance
private

Vertex association check: min longitudinal distance cut.

Definition at line 47 of file EndAssociatedPfosTool.h.

Referenced by ReadSettings(), and Run().

float lar_content::EndAssociatedPfosTool::m_vertexAngularAllowance
private

Vertex association check: pointing angular allowance in degrees.

Definition at line 50 of file EndAssociatedPfosTool.h.

Referenced by ReadSettings(), and Run().


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