All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
lar_content::BranchAssociatedPfosTool Class Reference

BranchAssociatedPfosTool class. More...

#include <BranchAssociatedPfosTool.h>

Inheritance diagram for lar_content::BranchAssociatedPfosTool:
lar_content::PfoRelationTool

Public Member Functions

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

Private Member Functions

pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

float m_minNeutrinoVertexDistance
 Branch association: min distance from branch vertex to neutrino vertex. More...
 
float m_trackBranchAdditionFraction
 Branch association: min fraction of length along parent track before association allowed. More...
 
float m_maxParentClusterDistance
 Branch association: max distance from branch vertex to a hit in parent 3D cluster. More...
 

Detailed Description

BranchAssociatedPfosTool class.

Definition at line 19 of file BranchAssociatedPfosTool.h.

Constructor & Destructor Documentation

lar_content::BranchAssociatedPfosTool::BranchAssociatedPfosTool ( )

Default constructor.

Definition at line 27 of file BranchAssociatedPfosTool.cc.

27  :
31 {
32 }
float m_maxParentClusterDistance
Branch association: max distance from branch vertex to a hit in parent 3D cluster.
float m_minNeutrinoVertexDistance
Branch association: min distance from branch vertex to neutrino vertex.
float m_trackBranchAdditionFraction
Branch association: min fraction of length along parent track before association allowed.

Member Function Documentation

StatusCode lar_content::BranchAssociatedPfosTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 105 of file BranchAssociatedPfosTool.cc.

106 {
107  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
108  XmlHelper::ReadValue(xmlHandle, "MinNeutrinoVertexDistance", m_minNeutrinoVertexDistance));
109 
110  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
111  XmlHelper::ReadValue(xmlHandle, "TrackBranchAdditionFraction", m_trackBranchAdditionFraction));
112 
113  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
114  XmlHelper::ReadValue(xmlHandle, "MaxParentClusterDistance", m_maxParentClusterDistance));
115 
116  return STATUS_CODE_SUCCESS;
117 }
float m_maxParentClusterDistance
Branch association: max distance from branch vertex to a hit in parent 3D cluster.
float m_minNeutrinoVertexDistance
Branch association: min distance from branch vertex to neutrino vertex.
float m_trackBranchAdditionFraction
Branch association: min fraction of length along parent track before association allowed.
void lar_content::BranchAssociatedPfosTool::Run ( const 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 36 of file BranchAssociatedPfosTool.cc.

37 {
38  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
39  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
40 
41  bool associationsMade(true);
42 
43  while (associationsMade)
44  {
45  associationsMade = false;
46  PfoVector assignedPfos, unassignedPfos;
47  pAlgorithm->SeparatePfos(pfoInfoMap, assignedPfos, unassignedPfos);
48 
49  if (unassignedPfos.empty())
50  break;
51 
52  // ATTN May want to reconsider precise association mechanics for complex situations
53  PfoSet recentlyAssigned;
54 
55  for (const ParticleFlowObject *const pParentPfo : assignedPfos)
56  {
57  PfoInfo *const pParentPfoInfo(pfoInfoMap.at(pParentPfo));
58  const Cluster *const pParentCluster3D(pParentPfoInfo->GetCluster3D());
59 
60  const bool parentIsTrack(LArPfoHelper::IsTrack(pParentPfo));
61  const ThreeDSlidingFitResult &parentFitResult(*(pParentPfoInfo->GetSlidingFitResult3D()));
62 
63  const float parentLength3D((parentFitResult.GetGlobalMinLayerPosition() - parentFitResult.GetGlobalMaxLayerPosition()).GetMagnitude());
64  const CartesianVector &parentVertexPosition(pParentPfoInfo->IsInnerLayerAssociated() ? parentFitResult.GetGlobalMinLayerPosition()
65  : parentFitResult.GetGlobalMaxLayerPosition());
66 
67  for (const ParticleFlowObject *const pPfo : unassignedPfos)
68  {
69  if (recentlyAssigned.count(pPfo))
70  continue;
71 
72  PfoInfo *const pPfoInfo(pfoInfoMap.at(pPfo));
73  const LArPointingCluster pointingCluster(*(pPfoInfo->GetSlidingFitResult3D()));
74 
75  const float dNeutrinoVertex(std::min((pointingCluster.GetInnerVertex().GetPosition() - pNeutrinoVertex->GetPosition()).GetMagnitude(),
76  (pointingCluster.GetOuterVertex().GetPosition() - pNeutrinoVertex->GetPosition()).GetMagnitude()));
77 
78  if (dNeutrinoVertex < m_minNeutrinoVertexDistance)
79  continue;
80 
81  const float dParentVertex(std::min((pointingCluster.GetInnerVertex().GetPosition() - parentVertexPosition).GetMagnitude(),
82  (pointingCluster.GetOuterVertex().GetPosition() - parentVertexPosition).GetMagnitude()));
83 
84  if (parentIsTrack && (dParentVertex < m_trackBranchAdditionFraction * parentLength3D))
85  continue;
86 
87  const float dInnerVertex(LArClusterHelper::GetClosestDistance(pointingCluster.GetInnerVertex().GetPosition(), pParentCluster3D));
88  const float dOuterVertex(LArClusterHelper::GetClosestDistance(pointingCluster.GetOuterVertex().GetPosition(), pParentCluster3D));
89 
90  if ((dInnerVertex < m_maxParentClusterDistance) || (dOuterVertex < m_maxParentClusterDistance))
91  {
92  associationsMade = true;
93  pParentPfoInfo->AddDaughterPfo(pPfoInfo->GetThisPfo());
94  pPfoInfo->SetParentPfo(pParentPfoInfo->GetThisPfo());
95  pPfoInfo->SetInnerLayerAssociation(dInnerVertex < dOuterVertex);
96  recentlyAssigned.insert(pPfoInfo->GetThisPfo());
97  }
98  }
99  }
100  }
101 }
float m_maxParentClusterDistance
Branch association: max distance from branch vertex to a hit in parent 3D cluster.
static bool IsTrack(const pandora::ParticleFlowObject *const pPfo)
Return track flag based on Pfo Particle ID.
float m_minNeutrinoVertexDistance
Branch association: min distance from branch vertex to neutrino vertex.
float m_trackBranchAdditionFraction
Branch association: min fraction of length along parent track before association allowed.
NeutrinoHierarchyAlgorithm::PfoInfo PfoInfo
BEGIN_PROLOG could also be cout
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.

Member Data Documentation

float lar_content::BranchAssociatedPfosTool::m_maxParentClusterDistance
private

Branch association: max distance from branch vertex to a hit in parent 3D cluster.

Definition at line 35 of file BranchAssociatedPfosTool.h.

float lar_content::BranchAssociatedPfosTool::m_minNeutrinoVertexDistance
private

Branch association: min distance from branch vertex to neutrino vertex.

Definition at line 33 of file BranchAssociatedPfosTool.h.

float lar_content::BranchAssociatedPfosTool::m_trackBranchAdditionFraction
private

Branch association: min fraction of length along parent track before association allowed.

Definition at line 34 of file BranchAssociatedPfosTool.h.


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