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

MopUpRemnantsTool class. More...

#include "MopUpRemnantsTool.h"

Inheritance diagram for lar_content::MopUpRemnantsTool:
lar_content::RemnantTensorTool

Public Types

typedef ThreeViewRemnantsAlgorithm::MatchingType::TensorType TensorType
 
typedef std::vector< TensorType::ElementList::const_iteratorIteratorList
 

Public Member Functions

 MopUpRemnantsTool ()
 Default constructor. More...
 
bool Run (ThreeViewRemnantsAlgorithm *const pAlgorithm, TensorType &overlapTensor)
 Run the algorithm tool. More...
 

Private Member Functions

pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
void FindBestShowers (const TensorType &overlapTensor, ProtoParticleVector &protoParticleVector) const
 Identify candidate particles. More...
 
void GetUsedClusters (const TensorType::ElementList &elementList, pandora::ClusterSet &usedClusters) const
 Copy used clusters into cluster list. More...
 
void SelectBestElement (const TensorType::ElementList &elementList, const pandora::ClusterSet &usedClusters, TensorType::ElementList::const_iterator &bestIter) const
 Select the best triplet of clusters. More...
 

Detailed Description

MopUpRemnantsTool class.

Definition at line 19 of file MopUpRemnantsTool.h.

Member Typedef Documentation

Constructor & Destructor Documentation

lar_content::MopUpRemnantsTool::MopUpRemnantsTool ( )

Default constructor.

Definition at line 18 of file MopUpRemnantsTool.cc.

19 {
20 }

Member Function Documentation

void lar_content::MopUpRemnantsTool::FindBestShowers ( const TensorType overlapTensor,
ProtoParticleVector protoParticleVector 
) const
private

Identify candidate particles.

Parameters
overlapTensorthe input overlap tensor
protoParticleVectorthe output vector of candidate particles
clusterMergeMapthe output map of clusters to be merged

Definition at line 38 of file MopUpRemnantsTool.cc.

References lar_content::OverlapTensor< T >::GetConnectedElements(), lar_content::OverlapTensor< T >::GetSortedKeyClusters(), and lar_content::ProtoParticle::m_clusterList.

39 {
40  ClusterSet usedClusters;
41  ClusterVector sortedKeyClusters;
42  overlapTensor.GetSortedKeyClusters(sortedKeyClusters);
43 
44  for (const Cluster *const pKeyCluster : sortedKeyClusters)
45  {
46  if (!pKeyCluster->IsAvailable())
47  continue;
48 
49  TensorType::ElementList connectedElements;
50  overlapTensor.GetConnectedElements(pKeyCluster, true, connectedElements);
51 
52  TensorType::ElementList::const_iterator eIter = connectedElements.end();
53  this->SelectBestElement(connectedElements, usedClusters, eIter);
54  this->GetUsedClusters(connectedElements, usedClusters);
55 
56  if (connectedElements.end() == eIter)
57  continue;
58 
59  ProtoParticle protoParticle;
60  protoParticle.m_clusterList.push_back(eIter->GetClusterU());
61  protoParticle.m_clusterList.push_back(eIter->GetClusterV());
62  protoParticle.m_clusterList.push_back(eIter->GetClusterW());
63  protoParticleVector.push_back(protoParticle);
64  }
65 }
void GetUsedClusters(const TensorType::ElementList &elementList, pandora::ClusterSet &usedClusters) const
Copy used clusters into cluster list.
intermediate_table::const_iterator const_iterator
std::vector< Element > ElementList
void SelectBestElement(const TensorType::ElementList &elementList, const pandora::ClusterSet &usedClusters, TensorType::ElementList::const_iterator &bestIter) const
Select the best triplet of clusters.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
void lar_content::MopUpRemnantsTool::GetUsedClusters ( const TensorType::ElementList elementList,
pandora::ClusterSet &  usedClusters 
) const
private

Copy used clusters into cluster list.

Parameters
elementListthe input list of elements
usedClustersto receive the list of used clusters

Definition at line 69 of file MopUpRemnantsTool.cc.

70 {
71  for (TensorType::ElementList::const_iterator eIter = elementList.begin(); eIter != elementList.end(); ++eIter)
72  {
73  usedClusters.insert(eIter->GetClusterU());
74  usedClusters.insert(eIter->GetClusterV());
75  usedClusters.insert(eIter->GetClusterW());
76  }
77 }
intermediate_table::const_iterator const_iterator
StatusCode lar_content::MopUpRemnantsTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 107 of file MopUpRemnantsTool.cc.

108 {
109  return STATUS_CODE_SUCCESS;
110 }
bool lar_content::MopUpRemnantsTool::Run ( ThreeViewRemnantsAlgorithm *const  pAlgorithm,
TensorType overlapTensor 
)
virtual

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::RemnantTensorTool.

Definition at line 24 of file MopUpRemnantsTool.cc.

References lar_content::MatchingBaseAlgorithm::CreateThreeDParticles().

25 {
26  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
27  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
28 
29  ProtoParticleVector protoParticleVector;
30  this->FindBestShowers(overlapTensor, protoParticleVector);
31 
32  const bool particlesMade(pAlgorithm->CreateThreeDParticles(protoParticleVector));
33  return particlesMade;
34 }
std::vector< ProtoParticle > ProtoParticleVector
void FindBestShowers(const TensorType &overlapTensor, ProtoParticleVector &protoParticleVector) const
Identify candidate particles.
void lar_content::MopUpRemnantsTool::SelectBestElement ( const TensorType::ElementList elementList,
const pandora::ClusterSet &  usedClusters,
TensorType::ElementList::const_iterator bestIter 
) const
private

Select the best triplet of clusters.

Parameters
elementListthe input list of elements
usedClustersthe list of cluster analysed so far
bestIteriterator to the best element in the list

Definition at line 81 of file MopUpRemnantsTool.cc.

References f.

83 {
84  float bestFigureOfMerit(0.f);
85 
86  for (TensorType::ElementList::const_iterator eIter = elementList.begin(); eIter != elementList.end(); ++eIter)
87  {
88  const Cluster *const pClusterU = eIter->GetClusterU();
89  const Cluster *const pClusterV = eIter->GetClusterV();
90  const Cluster *const pClusterW = eIter->GetClusterW();
91 
92  if (usedClusters.count(pClusterU) || usedClusters.count(pClusterV) || usedClusters.count(pClusterW))
93  continue;
94 
95  const float figureOfMerit(pClusterU->GetHadronicEnergy() + pClusterV->GetHadronicEnergy() + pClusterW->GetHadronicEnergy());
96 
97  if (figureOfMerit > bestFigureOfMerit)
98  {
99  bestFigureOfMerit = figureOfMerit;
100  bestIter = eIter;
101  }
102  }
103 }
intermediate_table::const_iterator const_iterator
TFile f
Definition: plotHisto.C:6

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