LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::TwoViewAmbiguousDeltaRayTool Class Reference

TwoViewAmbiguousDeltaRayTool class. More...

#include "TwoViewAmbiguousDeltaRayTool.h"

Inheritance diagram for lar_content::TwoViewAmbiguousDeltaRayTool:
lar_content::DeltaRayMatrixTool

Public Types

typedef std::vector< pandora::HitType > HitTypeVector
 
typedef TwoViewDeltaRayMatchingAlgorithm::MatchingType::MatrixType MatrixType
 
typedef std::vector< MatrixType::ElementList::const_iteratorIteratorList
 

Public Member Functions

 TwoViewAmbiguousDeltaRayTool ()
 Default constructor. More...
 

Public Attributes

TwoViewDeltaRayMatchingAlgorithmm_pParentAlgorithm
 Address of the parent matching algorithm. More...
 

Private Member Functions

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

Detailed Description

Member Typedef Documentation

typedef std::vector<pandora::HitType> lar_content::TwoViewAmbiguousDeltaRayTool::HitTypeVector

Definition at line 22 of file TwoViewAmbiguousDeltaRayTool.h.

Constructor & Destructor Documentation

lar_content::TwoViewAmbiguousDeltaRayTool::TwoViewAmbiguousDeltaRayTool ( )

Default constructor.

Definition at line 18 of file TwoViewAmbiguousDeltaRayTool.cc.

19 {
20 }

Member Function Documentation

void lar_content::TwoViewAmbiguousDeltaRayTool::ExamineConnectedElements ( MatrixType overlapMatrix) 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
overlapMatrixthe overlap matrix

Definition at line 39 of file TwoViewAmbiguousDeltaRayTool.cc.

References lar_content::OverlapMatrix< T >::GetConnectedElements(), and lar_content::OverlapMatrix< T >::GetSortedKeyClusters().

40 {
41  bool particleCreated(false);
42 
43  do
44  {
45  particleCreated = false;
46 
47  ClusterVector sortedKeyClusters;
48  overlapMatrix.GetSortedKeyClusters(sortedKeyClusters);
49 
50  ClusterSet usedKeyClusters;
51 
52  for (const Cluster *const pKeyCluster : sortedKeyClusters)
53  {
54  if (usedKeyClusters.count(pKeyCluster))
55  continue;
56 
57  MatrixType::ElementList elementList;
58  overlapMatrix.GetConnectedElements(pKeyCluster, true, elementList);
59 
60  for (const MatrixType::Element &element : elementList)
61  usedKeyClusters.insert(element.GetCluster1());
62 
63  if (this->PickOutGoodMatches(elementList))
64  {
65  particleCreated = true;
66  break;
67  }
68  }
69  } while (particleCreated);
70 }
bool PickOutGoodMatches(const MatrixType::ElementList &elementList) const
Identify the best 1:1:1 match in a group of connected elements and from it create a pfo...
std::vector< art::Ptr< recob::Cluster > > ClusterVector
bool lar_content::TwoViewAmbiguousDeltaRayTool::PickOutGoodMatches ( const MatrixType::ElementList elementList) 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
Returns
whether any particles were created

Definition at line 74 of file TwoViewAmbiguousDeltaRayTool.cc.

75 {
76  unsigned int highestHitCount(0);
77  float bestChiSquared(std::numeric_limits<float>::max());
78  auto bestElementIter(elementList.end());
79 
80  for (auto iter = elementList.begin(); iter != elementList.end(); ++iter)
81  {
82  const MatrixType::Element &element(*iter);
83  const float chiSquared(element.GetOverlapResult().GetReducedChiSquared());
84  const Cluster *const pCluster1(element.GetCluster1()), *const pCluster2(element.GetCluster2());
85  const unsigned int hitSum(pCluster1->GetNCaloHits() + pCluster2->GetNCaloHits());
86 
87  if ((hitSum > highestHitCount) || ((hitSum == highestHitCount) && (chiSquared < bestChiSquared)))
88  {
89  bestChiSquared = chiSquared;
90  highestHitCount = hitSum;
91  bestElementIter = iter;
92  }
93  }
94 
95  if (bestElementIter != elementList.end())
96  {
97  m_pParentAlgorithm->CreatePfo(*bestElementIter);
98  return true;
99  }
100 
101  return false;
102 }
TwoViewDeltaRayMatchingAlgorithm * m_pParentAlgorithm
Address of the parent matching algorithm.
bool CreatePfo(const MatrixType::Element &element)
Create delta ray pfos out of a given element, merging the third view clusters together and adding in ...
StatusCode lar_content::TwoViewAmbiguousDeltaRayTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 106 of file TwoViewAmbiguousDeltaRayTool.cc.

107 {
108  return STATUS_CODE_SUCCESS;
109 }
bool lar_content::TwoViewAmbiguousDeltaRayTool::Run ( TwoViewDeltaRayMatchingAlgorithm *const  pAlgorithm,
MatrixType matrixTensor 
)
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::DeltaRayMatrixTool.

Definition at line 24 of file TwoViewAmbiguousDeltaRayTool.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(overlapMatrix);
32 
33  // ATTN: Prevent tensor tool loop running again
34  return false;
35 }
void ExamineConnectedElements(MatrixType &overlapMatrix) const
Identify ambiguous matches (e.g. 3:2:1) and, if possible, create pfos out of the best 1:1:1 cluster m...
TwoViewDeltaRayMatchingAlgorithm * m_pParentAlgorithm
Address of the parent matching algorithm.

Member Data Documentation


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