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

MatchedEndPointsTool class. More...

#include "MatchedEndPointsTool.h"

Inheritance diagram for lar_content::MatchedEndPointsTool:
lar_content::LongitudinalTensorTool

Public Types

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

Public Member Functions

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

Private Member Functions

pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
void FindMatchedTracks (const TensorType &overlapTensor, ProtoParticleVector &protoParticleVector) const
 Find matched tracks, hidden by ambiguities in the tensor. More...
 

Static Private Member Functions

static bool SortByChiSquared (const TensorType::Element &lhs, const TensorType::Element &rhs)
 Sort tensor elements by chi-squared. More...
 

Private Attributes

float m_minMatchedFraction
 The min matched sampling point fraction for particle creation. More...
 
float m_maxEndPointChi2
 The max chi2 of matched vertex and end points for particle creation. More...
 

Detailed Description

MatchedEndPointsTool class.

Definition at line 19 of file MatchedEndPointsTool.h.

Member Typedef Documentation

Constructor & Destructor Documentation

lar_content::MatchedEndPointsTool::MatchedEndPointsTool ( )

Default constructor.

Definition at line 18 of file MatchedEndPointsTool.cc.

18  :
21 {
22 }
TFile f
Definition: plotHisto.C:6
float m_maxEndPointChi2
The max chi2 of matched vertex and end points for particle creation.
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.

Member Function Documentation

void lar_content::MatchedEndPointsTool::FindMatchedTracks ( const TensorType overlapTensor,
ProtoParticleVector protoParticleVector 
) const
private

Find matched tracks, hidden by ambiguities in the tensor.

Parameters
overlapTensorthe overlap tensor
protoParticleVectorto receive the list of proto particles

Definition at line 40 of file MatchedEndPointsTool.cc.

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

Referenced by Run().

41 {
42  ClusterSet usedClusters;
43  ClusterVector sortedKeyClusters;
44  overlapTensor.GetSortedKeyClusters(sortedKeyClusters);
45 
46  for (const Cluster *const pKeyCluster : sortedKeyClusters)
47  {
48  if (!pKeyCluster->IsAvailable())
49  continue;
50 
51  unsigned int nU(0), nV(0), nW(0);
52  TensorType::ElementList elementList;
53  overlapTensor.GetConnectedElements(pKeyCluster, true, elementList, nU, nV, nW);
54 
55  if (nU * nV * nW == 0)
56  continue;
57 
58  std::sort(elementList.begin(), elementList.end(), MatchedEndPointsTool::SortByChiSquared);
59 
60  for (TensorType::ElementList::const_iterator iter = elementList.begin(); iter != elementList.end(); ++iter)
61  {
62  if (usedClusters.count(iter->GetClusterU()) || usedClusters.count(iter->GetClusterV()) || usedClusters.count(iter->GetClusterW()))
63  continue;
64 
65  if (iter->GetOverlapResult().GetMatchedFraction() < m_minMatchedFraction)
66  continue;
67 
68  if (std::max(iter->GetOverlapResult().GetInnerChi2(), iter->GetOverlapResult().GetOuterChi2()) > m_maxEndPointChi2)
69  continue;
70 
71  ProtoParticle protoParticle;
72  protoParticle.m_clusterList.push_back(iter->GetClusterU());
73  protoParticle.m_clusterList.push_back(iter->GetClusterV());
74  protoParticle.m_clusterList.push_back(iter->GetClusterW());
75  protoParticleVector.push_back(protoParticle);
76 
77  usedClusters.insert(iter->GetClusterU());
78  usedClusters.insert(iter->GetClusterV());
79  usedClusters.insert(iter->GetClusterW());
80  }
81  }
82 }
intermediate_table::const_iterator const_iterator
float m_maxEndPointChi2
The max chi2 of matched vertex and end points for particle creation.
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
static bool SortByChiSquared(const TensorType::Element &lhs, const TensorType::Element &rhs)
Sort tensor elements by chi-squared.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
StatusCode lar_content::MatchedEndPointsTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 94 of file MatchedEndPointsTool.cc.

References m_maxEndPointChi2, and m_minMatchedFraction.

95 {
96  PANDORA_RETURN_RESULT_IF_AND_IF(
97  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinMatchedFraction", m_minMatchedFraction));
98 
99  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxEndPointChi2", m_maxEndPointChi2));
100 
101  return STATUS_CODE_SUCCESS;
102 }
float m_maxEndPointChi2
The max chi2 of matched vertex and end points for particle creation.
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
bool lar_content::MatchedEndPointsTool::Run ( ThreeViewLongitudinalTracksAlgorithm *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::LongitudinalTensorTool.

Definition at line 26 of file MatchedEndPointsTool.cc.

References lar_content::MatchingBaseAlgorithm::CreateThreeDParticles(), and FindMatchedTracks().

27 {
28  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
29  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
30 
31  ProtoParticleVector protoParticleVector;
32  this->FindMatchedTracks(overlapTensor, protoParticleVector);
33 
34  const bool particlesMade(pAlgorithm->CreateThreeDParticles(protoParticleVector));
35  return particlesMade;
36 }
std::vector< ProtoParticle > ProtoParticleVector
void FindMatchedTracks(const TensorType &overlapTensor, ProtoParticleVector &protoParticleVector) const
Find matched tracks, hidden by ambiguities in the tensor.
bool lar_content::MatchedEndPointsTool::SortByChiSquared ( const TensorType::Element &  lhs,
const TensorType::Element &  rhs 
)
staticprivate

Sort tensor elements by chi-squared.

Parameters
lhsthe first tensor element
rhsthe second tensor element
Returns
boolean

Definition at line 86 of file MatchedEndPointsTool.cc.

Referenced by FindMatchedTracks().

87 {
88  return (lhs.GetOverlapResult().GetInnerChi2() + lhs.GetOverlapResult().GetOuterChi2() <
89  rhs.GetOverlapResult().GetInnerChi2() + rhs.GetOverlapResult().GetOuterChi2());
90 }

Member Data Documentation

float lar_content::MatchedEndPointsTool::m_maxEndPointChi2
private

The max chi2 of matched vertex and end points for particle creation.

Definition at line 51 of file MatchedEndPointsTool.h.

Referenced by FindMatchedTracks(), and ReadSettings().

float lar_content::MatchedEndPointsTool::m_minMatchedFraction
private

The min matched sampling point fraction for particle creation.

Definition at line 50 of file MatchedEndPointsTool.h.

Referenced by FindMatchedTracks(), and ReadSettings().


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