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::AmbiguousDeltaRayTool Class Reference

AmbiguousDeltaRayTool class. More...

#include <AmbiguousDeltaRayTool.h>

Inheritance diagram for lar_content::AmbiguousDeltaRayTool:
lar_content::DeltaRayTensorTool

Public Member Functions

 AmbiguousDeltaRayTool ()
 Default constructor. More...
 

Private Member Functions

bool Run (ThreeViewDeltaRayMatchingAlgorithm *const pAlgorithm, TensorType &overlapTensor)
 Run the algorithm tool. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
void ExamineConnectedElements (TensorType &overlapTensor) const
 Identify ambiguous matches (e.g. 3:2:1) and, if possible, create pfos out of the best 1:1:1 cluster match. More...
 
void PickOutGoodMatches (const TensorType::ElementList &elementList, pandora::ClusterSet &usedClusters, ProtoParticleVector &protoParticleVector) const
 Identify the best 1:1:1 match in a group of connected elements and from it create a pfo. More...
 

Private Attributes

float m_maxGoodMatchReducedChiSquared
 The maximum reduced chi squared value of a good 1:1:1 match. More...
 

Additional Inherited Members

- Public Types inherited from lar_content::DeltaRayTensorTool
typedef
ThreeViewDeltaRayMatchingAlgorithm::MatchingType::TensorType 
TensorType
 
typedef std::vector
< TensorType::ElementList::const_iterator
IteratorList
 
- Public Attributes inherited from lar_content::DeltaRayTensorTool
ThreeViewDeltaRayMatchingAlgorithmm_pParentAlgorithm
 Address of the parent matching algorithm. More...
 

Detailed Description

AmbiguousDeltaRayTool class.

Definition at line 18 of file AmbiguousDeltaRayTool.h.

Constructor & Destructor Documentation

lar_content::AmbiguousDeltaRayTool::AmbiguousDeltaRayTool ( )

Default constructor.

Definition at line 18 of file AmbiguousDeltaRayTool.cc.

19 {
20 }
float m_maxGoodMatchReducedChiSquared
The maximum reduced chi squared value of a good 1:1:1 match.

Member Function Documentation

void lar_content::AmbiguousDeltaRayTool::ExamineConnectedElements ( TensorType overlapTensor) const
private

Identify ambiguous matches (e.g. 3:2:1) and, if possible, create pfos out of the best 1:1:1 cluster match.

Parameters
overlapTensorthe overlap tensor

Definition at line 39 of file AmbiguousDeltaRayTool.cc.

40 {
41  ClusterVector sortedKeyClusters;
42  overlapTensor.GetSortedKeyClusters(sortedKeyClusters);
43 
44  ClusterSet usedClusters;
45  ClusterSet usedKeyClusters;
46  ProtoParticleVector protoParticleVector;
47 
48  for (const Cluster *const pKeyCluster : sortedKeyClusters)
49  {
50  if (usedKeyClusters.count(pKeyCluster))
51  continue;
52 
53  TensorType::ElementList elementList;
54  overlapTensor.GetConnectedElements(pKeyCluster, true, elementList);
55 
56  for (const TensorType::Element &element : elementList)
57  usedKeyClusters.insert(element.GetClusterU());
58 
59  if (elementList.size() < 2)
60  continue;
61 
62  this->PickOutGoodMatches(elementList, usedClusters, protoParticleVector);
63  }
64 
65  if (!protoParticleVector.empty())
66  m_pParentAlgorithm->CreatePfos(protoParticleVector);
67 }
std::vector< ProtoParticle > ProtoParticleVector
ThreeViewDeltaRayMatchingAlgorithm * m_pParentAlgorithm
Address of the parent matching algorithm.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
bool CreatePfos(ProtoParticleVector &protoParticleVector)
Create delta ray pfos maxmising completeness by searching for and merging in any stray clusters...
void PickOutGoodMatches(const TensorType::ElementList &elementList, pandora::ClusterSet &usedClusters, ProtoParticleVector &protoParticleVector) const
Identify the best 1:1:1 match in a group of connected elements and from it create a pfo...
void lar_content::AmbiguousDeltaRayTool::PickOutGoodMatches ( const TensorType::ElementList elementList,
pandora::ClusterSet &  usedClusters,
ProtoParticleVector protoParticleVector 
) const
private

Identify the best 1:1:1 match in a group of connected elements and from it create a pfo.

Parameters
elementListthe tensor element list
usedClustersthe output list of clusters contained within to be created pfos
protoParticleVectorthe output vector of ProtoParticles

Definition at line 71 of file AmbiguousDeltaRayTool.cc.

73 {
74  bool found(false);
75 
76  do
77  {
78  found = false;
79 
80  unsigned int highestHitCount(0);
81  float bestChiSquared(std::numeric_limits<float>::max());
82  const Cluster *pBestClusterU(nullptr), *pBestClusterV(nullptr), *pBestClusterW(nullptr);
83 
84  for (const TensorType::Element &element : elementList)
85  {
86  const Cluster *const pClusterU(element.GetClusterU()), *const pClusterV(element.GetClusterV()), *const pClusterW(element.GetClusterW());
87 
88  if (usedClusters.count(pClusterU) || usedClusters.count(pClusterV) || usedClusters.count(pClusterW))
89  continue;
90 
91  const float chiSquared(element.GetOverlapResult().GetReducedChi2());
92 
93  if (chiSquared > m_maxGoodMatchReducedChiSquared)
94  continue;
95 
96  const unsigned int hitSum(pClusterU->GetNCaloHits() + pClusterV->GetNCaloHits() + pClusterW->GetNCaloHits());
97 
98  if ((hitSum > highestHitCount) || ((hitSum == highestHitCount) && (chiSquared < bestChiSquared)))
99  {
100  bestChiSquared = chiSquared;
101  highestHitCount = hitSum;
102  pBestClusterU = pClusterU;
103  pBestClusterV = pClusterV;
104  pBestClusterW = pClusterW;
105  }
106  }
107 
108  if (pBestClusterU && pBestClusterV && pBestClusterW)
109  {
110  found = true;
111  usedClusters.insert(pBestClusterU);
112  usedClusters.insert(pBestClusterV);
113  usedClusters.insert(pBestClusterW);
114 
115  ProtoParticle protoParticle;
116  protoParticle.m_clusterList.push_back(pBestClusterU);
117  protoParticle.m_clusterList.push_back(pBestClusterV);
118  protoParticle.m_clusterList.push_back(pBestClusterW);
119  protoParticleVector.push_back(protoParticle);
120  }
121  } while (found);
122 }
float m_maxGoodMatchReducedChiSquared
The maximum reduced chi squared value of a good 1:1:1 match.
StatusCode lar_content::AmbiguousDeltaRayTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 126 of file AmbiguousDeltaRayTool.cc.

127 {
128  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
129  XmlHelper::ReadValue(xmlHandle, "MaxGoodMatchReducedChiSquared", m_maxGoodMatchReducedChiSquared));
130 
131  return STATUS_CODE_SUCCESS;
132 }
float m_maxGoodMatchReducedChiSquared
The maximum reduced chi squared value of a good 1:1:1 match.
bool lar_content::AmbiguousDeltaRayTool::Run ( ThreeViewDeltaRayMatchingAlgorithm *const  pAlgorithm,
TensorType overlapTensor 
)
privatevirtual

Run the algorithm tool.

Parameters
pAlgorithmaddress of the calling algorithm
overlapTensorthe overlap tensor
Returns
whether changes have been made by the tool

Implements lar_content::DeltaRayTensorTool.

Definition at line 24 of file AmbiguousDeltaRayTool.cc.

25 {
26  m_pParentAlgorithm = pAlgorithm;
27 
28  if (PandoraContentApi::GetSettings(*m_pParentAlgorithm)->ShouldDisplayAlgorithmInfo())
29  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
30 
31  this->ExamineConnectedElements(overlapTensor);
32 
33  // ATTN: Prevent tensor tool loop running again
34  return false;
35 }
void ExamineConnectedElements(TensorType &overlapTensor) const
Identify ambiguous matches (e.g. 3:2:1) and, if possible, create pfos out of the best 1:1:1 cluster m...
ThreeViewDeltaRayMatchingAlgorithm * m_pParentAlgorithm
Address of the parent matching algorithm.
BEGIN_PROLOG could also be cout

Member Data Documentation

float lar_content::AmbiguousDeltaRayTool::m_maxGoodMatchReducedChiSquared
private

The maximum reduced chi squared value of a good 1:1:1 match.

Definition at line 46 of file AmbiguousDeltaRayTool.h.


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