TwoViewClearTracksTool.cc
Go to the documentation of this file.
1 /**
2  * @file larpandoracontent/LArThreeDReco/LArTwoViewMatching/TwoViewClearTracksTool.cc
3  *
4  * @brief Implementation of the two view clear tracks tool class.
5  *
6  * $Log: $
7  */
8 
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() : m_minXOverlapFraction(0.1f), m_minMatchingScore(0.95f), m_minLocallyMatchedFraction(0.3f)
21 {
22 }
23 
24 //------------------------------------------------------------------------------------------------------------------------------------------
25 
27 {
28  if (PandoraContentApi::GetSettings(*pAlgorithm)->ShouldDisplayAlgorithmInfo())
29  std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
30 
31  bool particlesMade(false);
32 
33  MatrixType::ElementList elementList;
34  overlapMatrix.GetUnambiguousElements(true, elementList);
35  this->CreateThreeDParticles(pAlgorithm, elementList, particlesMade);
36 
37  return particlesMade;
38 }
39 
40 //------------------------------------------------------------------------------------------------------------------------------------------
41 
43  TwoViewTransverseTracksAlgorithm *const pAlgorithm, const MatrixType::ElementList &elementList, bool &particlesMade) const
44 {
45  ProtoParticleVector protoParticleVector;
46 
47  for (MatrixType::ElementList::const_iterator iter = elementList.begin(), iterEnd = elementList.end(); iter != iterEnd; ++iter)
48  {
49  if (iter->GetOverlapResult().GetTwoViewXOverlap().GetXOverlapFraction0() - m_minXOverlapFraction < -1.f * std::numeric_limits<float>::epsilon())
50  continue;
51  if (iter->GetOverlapResult().GetTwoViewXOverlap().GetXOverlapFraction1() - m_minXOverlapFraction < -1.f * std::numeric_limits<float>::epsilon())
52  continue;
53 
54  if (iter->GetOverlapResult().GetMatchingScore() - m_minMatchingScore < std::numeric_limits<float>::epsilon())
55  continue;
56 
57  if (iter->GetOverlapResult().GetLocallyMatchedFraction() - m_minLocallyMatchedFraction < std::numeric_limits<float>::epsilon())
58  continue;
59 
60  ProtoParticle protoParticle;
61  protoParticle.m_clusterList.push_back(iter->GetCluster1());
62  protoParticle.m_clusterList.push_back(iter->GetCluster2());
63  protoParticleVector.push_back(protoParticle);
64  }
65 
66  particlesMade |= pAlgorithm->CreateThreeDParticles(protoParticleVector);
67 }
68 
69 //------------------------------------------------------------------------------------------------------------------------------------------
70 
71 StatusCode TwoViewClearTracksTool::ReadSettings(const TiXmlHandle xmlHandle)
72 {
73  PANDORA_RETURN_RESULT_IF_AND_IF(
74  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinMatchingScore", m_minMatchingScore));
75 
76  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
77  XmlHelper::ReadValue(xmlHandle, "MinLocallyMatchedFraction", m_minLocallyMatchedFraction));
78 
79  PANDORA_RETURN_RESULT_IF_AND_IF(
80  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinXOverlapFraction", m_minXOverlapFraction));
81 
82  return STATUS_CODE_SUCCESS;
83 }
84 
85 } // 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)
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.
QTextStream & endl(QTextStream &s)