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

TwoViewSimpleTracksTool class. More...

#include "TwoViewSimpleTracksTool.h"

Inheritance diagram for lar_content::TwoViewSimpleTracksTool:
lar_content::TransverseMatrixTool

Public Types

typedef TwoViewTransverseTracksAlgorithm::MatchingType::MatrixType MatrixType
 
typedef std::vector< MatrixType::ElementList::const_iteratorIteratorList
 

Public Member Functions

 TwoViewSimpleTracksTool ()
 Default constructor. More...
 
bool Run (TwoViewTransverseTracksAlgorithm *const pAlgorithm, MatrixType &overlapMatrix)
 Run the algorithm tool. More...
 

Private Member Functions

void FindBestTrack (const MatrixType &overlapMatrix, ProtoParticleVector &protoParticleVector) const
 Find best track match as a simple way to (try to) resolve ambiguities in the matrix. More...
 
bool PassesElementCuts (MatrixType::ElementList::const_reverse_iterator eIter) const
 Whether a provided (iterator to a) matrix element passes the selection cuts for particle creation. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

float m_minMatchedFraction
 The min matched sampling point fraction for particle creation. More...
 
float m_minMatchingScore
 The min global matching score for particle creation. More...
 
unsigned int m_minMatchedSamplingPoints
 The min number of matched sampling points for particle creation. More...
 
float m_minXOverlapFraction
 The min x overlap fraction (in each view) for particle creation. More...
 

Detailed Description

TwoViewSimpleTracksTool class.

Definition at line 19 of file TwoViewSimpleTracksTool.h.

Member Typedef Documentation

Constructor & Destructor Documentation

lar_content::TwoViewSimpleTracksTool::TwoViewSimpleTracksTool ( )

Default constructor.

Definition at line 18 of file TwoViewSimpleTracksTool.cc.

18  :
23 {
24 }
float m_minMatchingScore
The min global matching score for particle creation.
unsigned int m_minMatchedSamplingPoints
The min number of matched sampling points for particle creation.
TFile f
Definition: plotHisto.C:6
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
float m_minXOverlapFraction
The min x overlap fraction (in each view) for particle creation.

Member Function Documentation

void lar_content::TwoViewSimpleTracksTool::FindBestTrack ( const MatrixType overlapMatrix,
ProtoParticleVector protoParticleVector 
) const
private

Find best track match as a simple way to (try to) resolve ambiguities in the matrix.

Parameters
overlapMatrixthe overlap matrix
protoParticleVectorto receive the list of proto particles

Definition at line 41 of file TwoViewSimpleTracksTool.cc.

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

Referenced by Run().

42 {
43  ClusterVector sortedKeyClusters;
44  overlapMatrix.GetSortedKeyClusters(sortedKeyClusters);
45 
46  for (const Cluster *const pKeyCluster : sortedKeyClusters)
47  {
48  if (!pKeyCluster->IsAvailable())
49  continue;
50 
51  unsigned int n0(0), n1(0);
52  MatrixType::ElementList elementList;
53  overlapMatrix.GetConnectedElements(pKeyCluster, true, elementList, n0, n1);
54 
55  if (elementList.empty())
56  continue;
57 
58  for (MatrixType::ElementList::const_reverse_iterator iIter = elementList.rbegin(); iIter != elementList.rend(); ++iIter)
59  {
60  if (this->PassesElementCuts(iIter))
61  {
62  if ((nullptr == iIter->GetCluster1()) || (nullptr == iIter->GetCluster2()))
63  continue;
64 
65  ProtoParticle protoParticle;
66  protoParticle.m_clusterList.push_back(iIter->GetCluster1());
67  protoParticle.m_clusterList.push_back(iIter->GetCluster2());
68  protoParticleVector.push_back(protoParticle);
69 
70  return;
71  }
72  }
73  }
74 }
bool PassesElementCuts(MatrixType::ElementList::const_reverse_iterator eIter) const
Whether a provided (iterator to a) matrix element passes the selection cuts for particle creation...
std::vector< art::Ptr< recob::Cluster > > ClusterVector
bool lar_content::TwoViewSimpleTracksTool::PassesElementCuts ( MatrixType::ElementList::const_reverse_iterator  eIter) const
private

Whether a provided (iterator to a) matrix element passes the selection cuts for particle creation.

Parameters
eIterthe iterator to the matrix element

Definition at line 78 of file TwoViewSimpleTracksTool.cc.

References m_minMatchedFraction, m_minMatchedSamplingPoints, m_minMatchingScore, and m_minXOverlapFraction.

Referenced by FindBestTrack().

79 {
80  if (!eIter->GetOverlapResult().IsInitialized())
81  return false;
82 
83  if (eIter->GetOverlapResult().GetLocallyMatchedFraction() < m_minMatchedFraction)
84  return false;
85 
86  if (eIter->GetOverlapResult().GetMatchingScore() < m_minMatchingScore)
87  return false;
88 
89  if (eIter->GetOverlapResult().GetNMatchedReUpsampledSamplingPoints() < m_minMatchedSamplingPoints)
90  return false;
91 
92  const TwoViewXOverlap &xOverlap(eIter->GetOverlapResult().GetTwoViewXOverlap());
93 
94  if (!((xOverlap.GetXOverlapFraction0() > m_minXOverlapFraction) && (xOverlap.GetXOverlapFraction1() > m_minXOverlapFraction)))
95  {
96  return false;
97  }
98 
99  return true;
100 }
float m_minMatchingScore
The min global matching score for particle creation.
unsigned int m_minMatchedSamplingPoints
The min number of matched sampling points for particle creation.
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
float m_minXOverlapFraction
The min x overlap fraction (in each view) for particle creation.
StatusCode lar_content::TwoViewSimpleTracksTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 104 of file TwoViewSimpleTracksTool.cc.

References m_minMatchedFraction, m_minMatchedSamplingPoints, m_minMatchingScore, and m_minXOverlapFraction.

105 {
106  PANDORA_RETURN_RESULT_IF_AND_IF(
107  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinMatchedFraction", m_minMatchedFraction));
108 
109  PANDORA_RETURN_RESULT_IF_AND_IF(
110  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinMatchingScore", m_minMatchingScore));
111 
112  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
113  XmlHelper::ReadValue(xmlHandle, "MinMatchedSamplingPoints", m_minMatchedSamplingPoints));
114 
115  PANDORA_RETURN_RESULT_IF_AND_IF(
116  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinXOverlapFraction", m_minXOverlapFraction));
117 
118  return STATUS_CODE_SUCCESS;
119 }
float m_minMatchingScore
The min global matching score for particle creation.
unsigned int m_minMatchedSamplingPoints
The min number of matched sampling points for particle creation.
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
float m_minXOverlapFraction
The min x overlap fraction (in each view) for particle creation.
bool lar_content::TwoViewSimpleTracksTool::Run ( TwoViewTransverseTracksAlgorithm *const  pAlgorithm,
MatrixType overlapMatrix 
)
virtual

Run the algorithm tool.

Parameters
pAlgorithmaddress of the calling algorithm
overlapMatrixthe overlap matrix
Returns
whether changes have been made by the tool

Implements lar_content::TransverseMatrixTool.

Definition at line 28 of file TwoViewSimpleTracksTool.cc.

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

29 {
30  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
31  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
32 
33  ProtoParticleVector protoParticleVector;
34  this->FindBestTrack(overlapMatrix, protoParticleVector);
35 
36  return pAlgorithm->CreateThreeDParticles(protoParticleVector);
37 }
std::vector< ProtoParticle > ProtoParticleVector
void FindBestTrack(const MatrixType &overlapMatrix, ProtoParticleVector &protoParticleVector) const
Find best track match as a simple way to (try to) resolve ambiguities in the matrix.

Member Data Documentation

float lar_content::TwoViewSimpleTracksTool::m_minMatchedFraction
private

The min matched sampling point fraction for particle creation.

Definition at line 47 of file TwoViewSimpleTracksTool.h.

Referenced by PassesElementCuts(), and ReadSettings().

unsigned int lar_content::TwoViewSimpleTracksTool::m_minMatchedSamplingPoints
private

The min number of matched sampling points for particle creation.

Definition at line 49 of file TwoViewSimpleTracksTool.h.

Referenced by PassesElementCuts(), and ReadSettings().

float lar_content::TwoViewSimpleTracksTool::m_minMatchingScore
private

The min global matching score for particle creation.

Definition at line 48 of file TwoViewSimpleTracksTool.h.

Referenced by PassesElementCuts(), and ReadSettings().

float lar_content::TwoViewSimpleTracksTool::m_minXOverlapFraction
private

The min x overlap fraction (in each view) for particle creation.

Definition at line 50 of file TwoViewSimpleTracksTool.h.

Referenced by PassesElementCuts(), and ReadSettings().


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