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

RecursivePfoMopUpAlgorithm class. More...

#include "RecursivePfoMopUpAlgorithm.h"

Inheritance diagram for lar_content::RecursivePfoMopUpAlgorithm:

Classes

struct  PfoMergeStats
 PfoMergeStats class: Object to compare PFO before/after merging algs have run to see if anything changed. More...
 

Public Member Functions

 RecursivePfoMopUpAlgorithm ()
 Default constructor. More...
 

Private Types

typedef std::vector< unsigned int > ClusterNumHitsList
 
typedef std::vector< PfoMergeStatsPfoMergeStatsList
 

Private Member Functions

PfoMergeStatsList GetPfoMergeStats () const
 Get the PfoMergeStats for all of the particles in the event from m_pfoListNames. More...
 
pandora::StatusCode Run ()
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Static Private Member Functions

static bool PfoMergeStatsComp (const PfoMergeStats &lhs, const PfoMergeStats &rhs)
 Equality comparator for two PfoMergeStats. More...
 

Private Attributes

unsigned int m_maxIterations
 Maximum number of iterations. More...
 
pandora::StringVector m_pfoListNames
 The list of pfo list names. More...
 
pandora::StringVector m_mopUpAlgorithms
 Ordered list of mop up algorithms to run. More...
 

Detailed Description

RecursivePfoMopUpAlgorithm class.

Definition at line 20 of file RecursivePfoMopUpAlgorithm.h.

Member Typedef Documentation

typedef std::vector<unsigned int> lar_content::RecursivePfoMopUpAlgorithm::ClusterNumHitsList
private

Definition at line 29 of file RecursivePfoMopUpAlgorithm.h.

Constructor & Destructor Documentation

lar_content::RecursivePfoMopUpAlgorithm::RecursivePfoMopUpAlgorithm ( )
inline

Default constructor.

Definition at line 78 of file RecursivePfoMopUpAlgorithm.h.

78  :
79  m_maxIterations(10)
80 {
81 }
unsigned int m_maxIterations
Maximum number of iterations.

Member Function Documentation

RecursivePfoMopUpAlgorithm::PfoMergeStatsList lar_content::RecursivePfoMopUpAlgorithm::GetPfoMergeStats ( ) const
private

Get the PfoMergeStats for all of the particles in the event from m_pfoListNames.

Returns
List of PfoMergeStats for each Pfo

Definition at line 42 of file RecursivePfoMopUpAlgorithm.cc.

43 {
44  PfoMergeStatsList pfoMergeStatsList;
45 
46  for (auto const &pfoListName : m_pfoListNames)
47  {
48  const PfoList *pPfoList(nullptr);
49  if (STATUS_CODE_SUCCESS != PandoraContentApi::GetList(*this, pfoListName, pPfoList))
50  continue;
51 
52  for (const ParticleFlowObject *const pPfo : *pPfoList)
53  {
54  ClusterNumHitsList pfoHits;
55  ClusterList clusterList;
56  LArPfoHelper::GetTwoDClusterList(pPfo, clusterList);
57 
58  for (auto const &cluster : clusterList)
59  pfoHits.push_back(cluster->GetNCaloHits());
60 
61  const PropertiesMap &pfoMeta(pPfo->GetPropertiesMap());
62  const auto &trackScoreIter(pfoMeta.find("TrackScore"));
63  const float trackScore(trackScoreIter != pfoMeta.end() ? trackScoreIter->second : -1.f);
64 
65  pfoMergeStatsList.emplace_back(PfoMergeStats{pfoHits, trackScore});
66  }
67  }
68  return pfoMergeStatsList;
69 }
pandora::StringVector m_pfoListNames
The list of pfo list names.
static void GetTwoDClusterList(const pandora::ParticleFlowObject *const pPfo, pandora::ClusterList &clusterList)
Get the list of 2D clusters from an input pfo.
Cluster finding and building.
bool lar_content::RecursivePfoMopUpAlgorithm::PfoMergeStatsComp ( const PfoMergeStats lhs,
const PfoMergeStats rhs 
)
inlinestaticprivate

Equality comparator for two PfoMergeStats.

Parameters
lhsPfoMergeStats for comparison
rhsPfoMergeStats for comparison
Returns
boolean if the lhs and rhs are the same

Definition at line 93 of file RecursivePfoMopUpAlgorithm.h.

References util::abs(), lar_content::RecursivePfoMopUpAlgorithm::PfoMergeStats::m_numClusterHits, and lar_content::RecursivePfoMopUpAlgorithm::PfoMergeStats::m_trackScore.

95 {
96  return ((lhs.m_numClusterHits == rhs.m_numClusterHits) && (std::abs(lhs.m_trackScore - rhs.m_trackScore) < std::numeric_limits<float>::epsilon()));
97 }
constexpr auto abs(T v)
Returns the absolute value of the argument.
StatusCode lar_content::RecursivePfoMopUpAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 73 of file RecursivePfoMopUpAlgorithm.cc.

74 {
75  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithmList(*this, xmlHandle, "MopUpAlgorithms", m_mopUpAlgorithms));
76 
77  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "PfoListNames", m_pfoListNames));
78 
79  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "MaxIterations", m_maxIterations));
80 
81  return STATUS_CODE_SUCCESS;
82 }
pandora::StringVector m_pfoListNames
The list of pfo list names.
unsigned int m_maxIterations
Maximum number of iterations.
pandora::StringVector m_mopUpAlgorithms
Ordered list of mop up algorithms to run.
StatusCode lar_content::RecursivePfoMopUpAlgorithm::Run ( )
private

Definition at line 20 of file RecursivePfoMopUpAlgorithm.cc.

21 {
22  PfoMergeStatsList mergeStatsListBefore(this->GetPfoMergeStats());
23 
24  for (unsigned int iter = 0; iter < m_maxIterations; ++iter)
25  {
26  for (auto const &mopUpAlg : m_mopUpAlgorithms)
27  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::RunDaughterAlgorithm(*this, mopUpAlg));
28 
29  PfoMergeStatsList mergeStatsListAfter(this->GetPfoMergeStats());
30 
31  if (std::equal(mergeStatsListBefore.cbegin(), mergeStatsListBefore.cend(), mergeStatsListAfter.cbegin(), mergeStatsListAfter.cend(), PfoMergeStatsComp))
32  break;
33 
34  mergeStatsListBefore = std::move(mergeStatsListAfter);
35  }
36 
37  return STATUS_CODE_SUCCESS;
38 }
unsigned int m_maxIterations
Maximum number of iterations.
PfoMergeStatsList GetPfoMergeStats() const
Get the PfoMergeStats for all of the particles in the event from m_pfoListNames.
static bool PfoMergeStatsComp(const PfoMergeStats &lhs, const PfoMergeStats &rhs)
Equality comparator for two PfoMergeStats.
pandora::StringVector m_mopUpAlgorithms
Ordered list of mop up algorithms to run.

Member Data Documentation

unsigned int lar_content::RecursivePfoMopUpAlgorithm::m_maxIterations
private

Maximum number of iterations.

Definition at line 71 of file RecursivePfoMopUpAlgorithm.h.

pandora::StringVector lar_content::RecursivePfoMopUpAlgorithm::m_mopUpAlgorithms
private

Ordered list of mop up algorithms to run.

Definition at line 73 of file RecursivePfoMopUpAlgorithm.h.

pandora::StringVector lar_content::RecursivePfoMopUpAlgorithm::m_pfoListNames
private

The list of pfo list names.

Definition at line 72 of file RecursivePfoMopUpAlgorithm.h.


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