LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
TwoViewClearTracksTool.cc
Go to the documentation of this file.
1 
9 #include "Pandora/AlgorithmHeaders.h"
10 
12 
13 #include <limits>
14 
15 using namespace pandora;
16 
17 namespace lar_content
18 {
19 
20 TwoViewClearTracksTool::TwoViewClearTracksTool() :
21  m_minXOverlapFraction(0.1f),
22  m_minMatchingScore(0.95f),
23  m_minLocallyMatchedFraction(0.3f)
24 {
25 }
26 
27 //------------------------------------------------------------------------------------------------------------------------------------------
28 
30 {
31  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
32  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
33 
34  bool particlesMade(false);
35 
36  MatrixType::ElementList elementList;
37  overlapMatrix.GetUnambiguousElements(true, elementList);
38  this->CreateThreeDParticles(pAlgorithm, elementList, particlesMade);
39 
40  return particlesMade;
41 }
42 
43 //------------------------------------------------------------------------------------------------------------------------------------------
44 
46  TwoViewTransverseTracksAlgorithm *const pAlgorithm, const MatrixType::ElementList &elementList, bool &particlesMade) const
47 {
48  ProtoParticleVector protoParticleVector;
49 
50  for (MatrixType::ElementList::const_iterator iter = elementList.begin(), iterEnd = elementList.end(); iter != iterEnd; ++iter)
51  {
52  if (iter->GetOverlapResult().GetTwoViewXOverlap().GetXOverlapFraction0() - m_minXOverlapFraction < -1.f * std::numeric_limits<float>::epsilon())
53  continue;
54  if (iter->GetOverlapResult().GetTwoViewXOverlap().GetXOverlapFraction1() - m_minXOverlapFraction < -1.f * std::numeric_limits<float>::epsilon())
55  continue;
56 
57  if (iter->GetOverlapResult().GetMatchingScore() - m_minMatchingScore < std::numeric_limits<float>::epsilon())
58  continue;
59 
60  if (iter->GetOverlapResult().GetLocallyMatchedFraction() - m_minLocallyMatchedFraction < std::numeric_limits<float>::epsilon())
61  continue;
62 
63  ProtoParticle protoParticle;
64  protoParticle.m_clusterList.push_back(iter->GetCluster1());
65  protoParticle.m_clusterList.push_back(iter->GetCluster2());
66  protoParticleVector.push_back(protoParticle);
67  }
68 
69  particlesMade |= pAlgorithm->CreateThreeDParticles(protoParticleVector);
70 }
71 
72 //------------------------------------------------------------------------------------------------------------------------------------------
73 
74 StatusCode TwoViewClearTracksTool::ReadSettings(const TiXmlHandle xmlHandle)
75 {
76  PANDORA_RETURN_RESULT_IF_AND_IF(
77  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinMatchingScore", m_minMatchingScore));
78 
79  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
80  XmlHelper::ReadValue(xmlHandle, "MinLocallyMatchedFraction", m_minLocallyMatchedFraction));
81 
82  PANDORA_RETURN_RESULT_IF_AND_IF(
83  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinXOverlapFraction", m_minXOverlapFraction));
84 
85  return STATUS_CODE_SUCCESS;
86 }
87 
88 } // namespace lar_content
std::vector< ProtoParticle > ProtoParticleVector
float m_minMatchingScore
The min global matching score for particle creation.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
TFile f
Definition: plotHisto.C:6
float m_minXOverlapFraction
The min x overlap fraction value for particle creation.
bool Run(TwoViewTransverseTracksAlgorithm *const pAlgorithm, MatrixType &overlapMatrix)
Run the algorithm tool.
float m_minLocallyMatchedFraction
The min locally matched fraction for particle creation.
pandora::ClusterList m_clusterList
List of 2D clusters in a 3D proto particle.
void GetUnambiguousElements(const bool ignoreUnavailable, ElementList &elementList) const
Get unambiguous elements.
void CreateThreeDParticles(TwoViewTransverseTracksAlgorithm *const pAlgorithm, const MatrixType::ElementList &elementList, bool &particlesMade) const
Create three dimensional particles for a given tensor element list.
Header file for the two view clear tracks tool class.
virtual bool CreateThreeDParticles(const ProtoParticleVector &protoParticleVector)
Create particles using findings from recent algorithm processing.