LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::LongTracksTool Class Reference

LongTracksTool class. More...

#include "LongTracksTool.h"

Inheritance diagram for lar_content::LongTracksTool:
lar_content::TransverseTensorTool

Public Types

typedef ThreeDTransverseTracksAlgorithm::TensorType TensorType
 
typedef std::vector< TensorType::ElementList::const_iteratorIteratorList
 

Public Member Functions

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

Static Public Member Functions

static bool HasLongDirectConnections (IteratorList::const_iterator iIter, const IteratorList &iteratorList)
 Whether a long element shares clusters with any other long elements. More...
 
static bool IsLongerThanDirectConnections (IteratorList::const_iterator iIter, const TensorType::ElementList &elementList, const unsigned int minMatchedSamplingPointRatio, const pandora::ClusterSet &usedClusters)
 Whether a long element is significantly longer that other elements with which it shares a cluster. More...
 

Private Member Functions

pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
void FindLongTracks (const TensorType &overlapTensor, ProtoParticleVector &protoParticleVector) const
 Find long tracks, hidden by simple ambiguities in the tensor. More...
 
void SelectLongElements (const TensorType::ElementList &elementList, const pandora::ClusterSet &usedClusters, IteratorList &iteratorList) const
 Select a list of long track-like elements from a set of connected tensor elements. More...
 

Private Attributes

float m_minMatchedFraction
 The min matched sampling point fraction 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...
 
unsigned int m_minMatchedSamplingPointRatio
 The min ratio between 1st and 2nd highest msps for simple ambiguity resolution. More...
 

Detailed Description

LongTracksTool class.

Definition at line 19 of file LongTracksTool.h.

Member Typedef Documentation

Constructor & Destructor Documentation

lar_content::LongTracksTool::LongTracksTool ( )

Default constructor.

Definition at line 18 of file LongTracksTool.cc.

18  :
23 {
24 }
unsigned int m_minMatchedSamplingPoints
The min number of matched sampling points for particle creation.
unsigned int m_minMatchedSamplingPointRatio
The min ratio between 1st and 2nd highest msps for simple ambiguity resolution.
float m_minXOverlapFraction
The min x overlap fraction (in each view) for particle creation.
TFile f
Definition: plotHisto.C:6
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.

Member Function Documentation

void lar_content::LongTracksTool::FindLongTracks ( const TensorType overlapTensor,
ProtoParticleVector protoParticleVector 
) const
private

Find long tracks, hidden by simple ambiguities in the tensor.

Parameters
overlapTensorthe overlap tensor
protoParticleVectorto receive the list of proto particles

Definition at line 83 of file LongTracksTool.cc.

References lar_content::OverlapTensor< T >::GetConnectedElements(), lar_content::OverlapTensor< T >::GetSortedKeyClusters(), HasLongDirectConnections(), IsLongerThanDirectConnections(), lar_content::ProtoParticle::m_clusterListU, lar_content::ProtoParticle::m_clusterListV, lar_content::ProtoParticle::m_clusterListW, m_minMatchedSamplingPointRatio, and SelectLongElements().

Referenced by Run().

84 {
85  ClusterSet usedClusters;
86  ClusterVector sortedKeyClusters;
87  overlapTensor.GetSortedKeyClusters(sortedKeyClusters);
88 
89  for (const Cluster *const pKeyCluster : sortedKeyClusters)
90  {
91  if (!pKeyCluster->IsAvailable())
92  continue;
93 
94  unsigned int nU(0), nV(0), nW(0);
95  TensorType::ElementList elementList;
96  overlapTensor.GetConnectedElements(pKeyCluster, true, elementList, nU, nV, nW);
97 
98  IteratorList iteratorList;
99  this->SelectLongElements(elementList, usedClusters, iteratorList);
100 
101  // Check that elements are not directly connected and are significantly longer than any other directly connected elements
102  for (IteratorList::const_iterator iIter = iteratorList.begin(), iIterEnd = iteratorList.end(); iIter != iIterEnd; ++iIter)
103  {
104  if (LongTracksTool::HasLongDirectConnections(iIter, iteratorList))
105  continue;
106 
108  continue;
109 
110  ProtoParticle protoParticle;
111  protoParticle.m_clusterListU.push_back((*iIter)->GetClusterU());
112  protoParticle.m_clusterListV.push_back((*iIter)->GetClusterV());
113  protoParticle.m_clusterListW.push_back((*iIter)->GetClusterW());
114  protoParticleVector.push_back(protoParticle);
115 
116  usedClusters.insert((*iIter)->GetClusterU());
117  usedClusters.insert((*iIter)->GetClusterV());
118  usedClusters.insert((*iIter)->GetClusterW());
119  }
120  }
121 }
std::vector< TensorType::ElementList::const_iterator > IteratorList
static bool IsLongerThanDirectConnections(IteratorList::const_iterator iIter, const TensorType::ElementList &elementList, const unsigned int minMatchedSamplingPointRatio, const pandora::ClusterSet &usedClusters)
Whether a long element is significantly longer that other elements with which it shares a cluster...
unsigned int m_minMatchedSamplingPointRatio
The min ratio between 1st and 2nd highest msps for simple ambiguity resolution.
intermediate_table::const_iterator const_iterator
void SelectLongElements(const TensorType::ElementList &elementList, const pandora::ClusterSet &usedClusters, IteratorList &iteratorList) const
Select a list of long track-like elements from a set of connected tensor elements.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
static bool HasLongDirectConnections(IteratorList::const_iterator iIter, const IteratorList &iteratorList)
Whether a long element shares clusters with any other long elements.
bool lar_content::LongTracksTool::HasLongDirectConnections ( IteratorList::const_iterator  iIter,
const IteratorList iteratorList 
)
static

Whether a long element shares clusters with any other long elements.

Parameters
iIterspecifies the long element under consideration
iteratorListlist of iterators to other long elements
Returns
boolean

Definition at line 28 of file LongTracksTool.cc.

Referenced by FindLongTracks(), lar_content::TracksCrossingGapsTool::FindTracks(), lar_content::TrackSplittingTool::FindTracks(), and lar_content::MissingTrackSegmentTool::FindTracks().

29 {
30  for (IteratorList::const_iterator iIter2 = iteratorList.begin(), iIter2End = iteratorList.end(); iIter2 != iIter2End; ++iIter2)
31  {
32  if (iIter == iIter2)
33  continue;
34 
35  if (((*iIter)->GetClusterU() == (*iIter2)->GetClusterU()) || ((*iIter)->GetClusterV() == (*iIter2)->GetClusterV()) || ((*iIter)->GetClusterW() == (*iIter2)->GetClusterW()) )
36  return true;
37  }
38 
39  return false;
40 }
intermediate_table::const_iterator const_iterator
bool lar_content::LongTracksTool::IsLongerThanDirectConnections ( IteratorList::const_iterator  iIter,
const TensorType::ElementList elementList,
const unsigned int  minMatchedSamplingPointRatio,
const pandora::ClusterSet &  usedClusters 
)
static

Whether a long element is significantly longer that other elements with which it shares a cluster.

Parameters
iIterspecifies the long element under consideration
elementListthe full list of connected tensor elements
minMatchedSamplingPointRatiothe min ratio between 1st and 2nd highest msps for simple ambiguity resolution
usedClustersthe list of clusters already marked as to be added to a pfo

Definition at line 44 of file LongTracksTool.cc.

Referenced by FindLongTracks(), lar_content::TracksCrossingGapsTool::FindTracks(), lar_content::TrackSplittingTool::FindTracks(), and lar_content::MissingTrackSegmentTool::FindTracks().

46 {
47  const unsigned int nMatchedSamplingPoints((*iIter)->GetOverlapResult().GetNMatchedSamplingPoints());
48 
49  for (TensorType::ElementList::const_iterator eIter = elementList.begin(); eIter != elementList.end(); ++eIter)
50  {
51  if ((*iIter) == eIter)
52  continue;
53 
54  if (usedClusters.count(eIter->GetClusterU()) || usedClusters.count(eIter->GetClusterV()) || usedClusters.count(eIter->GetClusterW()))
55  continue;
56 
57  if (((*iIter)->GetClusterU() != eIter->GetClusterU()) && ((*iIter)->GetClusterV() != eIter->GetClusterV()) && ((*iIter)->GetClusterW() != eIter->GetClusterW()))
58  continue;
59 
60  if (nMatchedSamplingPoints < minMatchedSamplingPointRatio * eIter->GetOverlapResult().GetNMatchedSamplingPoints())
61  return false;
62  }
63 
64  return true;
65 }
intermediate_table::const_iterator const_iterator
StatusCode lar_content::LongTracksTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 152 of file LongTracksTool.cc.

References m_minMatchedFraction, m_minMatchedSamplingPointRatio, m_minMatchedSamplingPoints, and m_minXOverlapFraction.

153 {
154  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
155  "MinMatchedFraction", m_minMatchedFraction));
156 
157  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
158  "MinMatchedSamplingPoints", m_minMatchedSamplingPoints));
159 
160  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
161  "MinXOverlapFraction", m_minXOverlapFraction));
162 
163  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
164  "MinMatchedSamplingPointRatio", m_minMatchedSamplingPointRatio));
165 
166  return STATUS_CODE_SUCCESS;
167 }
unsigned int m_minMatchedSamplingPoints
The min number of matched sampling points for particle creation.
unsigned int m_minMatchedSamplingPointRatio
The min ratio between 1st and 2nd highest msps for simple ambiguity resolution.
float m_minXOverlapFraction
The min x overlap fraction (in each view) for particle creation.
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.
bool lar_content::LongTracksTool::Run ( ThreeDTransverseTracksAlgorithm *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::TransverseTensorTool.

Definition at line 69 of file LongTracksTool.cc.

References lar_content::ThreeDBaseAlgorithm< T >::CreateThreeDParticles(), and FindLongTracks().

70 {
71  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
72  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
73 
74  ProtoParticleVector protoParticleVector;
75  this->FindLongTracks(overlapTensor, protoParticleVector);
76 
77  const bool particlesMade(pAlgorithm->CreateThreeDParticles(protoParticleVector));
78  return particlesMade;
79 }
std::vector< ProtoParticle > ProtoParticleVector
void FindLongTracks(const TensorType &overlapTensor, ProtoParticleVector &protoParticleVector) const
Find long tracks, hidden by simple ambiguities in the tensor.
void lar_content::LongTracksTool::SelectLongElements ( const TensorType::ElementList elementList,
const pandora::ClusterSet &  usedClusters,
IteratorList iteratorList 
) const
private

Select a list of long track-like elements from a set of connected tensor elements.

Parameters
elementListthe full list of connected tensor elements
usedClustersthe list of clusters already marked as to be added to a pfo
iteratorListto receive a list of iterators to long track-like elements

Definition at line 125 of file LongTracksTool.cc.

References m_minMatchedFraction, m_minMatchedSamplingPoints, and m_minXOverlapFraction.

Referenced by FindLongTracks().

127 {
128  for (TensorType::ElementList::const_iterator eIter = elementList.begin(); eIter != elementList.end(); ++eIter)
129  {
130  if (usedClusters.count(eIter->GetClusterU()) || usedClusters.count(eIter->GetClusterV()) || usedClusters.count(eIter->GetClusterW()))
131  continue;
132 
133  if (eIter->GetOverlapResult().GetMatchedFraction() < m_minMatchedFraction)
134  continue;
135 
136  if (eIter->GetOverlapResult().GetNMatchedSamplingPoints() < m_minMatchedSamplingPoints)
137  continue;
138 
139  const XOverlap &xOverlap(eIter->GetOverlapResult().GetXOverlap());
140 
141  if ((xOverlap.GetXSpanU() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanU() > m_minXOverlapFraction) &&
142  (xOverlap.GetXSpanV() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanV() > m_minXOverlapFraction) &&
143  (xOverlap.GetXSpanW() > std::numeric_limits<float>::epsilon()) && (xOverlap.GetXOverlapSpan() / xOverlap.GetXSpanW() > m_minXOverlapFraction))
144  {
145  iteratorList.push_back(eIter);
146  }
147  }
148 }
unsigned int m_minMatchedSamplingPoints
The min number of matched sampling points for particle creation.
float m_minXOverlapFraction
The min x overlap fraction (in each view) for particle creation.
intermediate_table::const_iterator const_iterator
float m_minMatchedFraction
The min matched sampling point fraction for particle creation.

Member Data Documentation

float lar_content::LongTracksTool::m_minMatchedFraction
private

The min matched sampling point fraction for particle creation.

Definition at line 71 of file LongTracksTool.h.

Referenced by ReadSettings(), and SelectLongElements().

unsigned int lar_content::LongTracksTool::m_minMatchedSamplingPointRatio
private

The min ratio between 1st and 2nd highest msps for simple ambiguity resolution.

Definition at line 74 of file LongTracksTool.h.

Referenced by FindLongTracks(), and ReadSettings().

unsigned int lar_content::LongTracksTool::m_minMatchedSamplingPoints
private

The min number of matched sampling points for particle creation.

Definition at line 72 of file LongTracksTool.h.

Referenced by ReadSettings(), and SelectLongElements().

float lar_content::LongTracksTool::m_minXOverlapFraction
private

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

Definition at line 73 of file LongTracksTool.h.

Referenced by ReadSettings(), and SelectLongElements().


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