Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
MissingTrackTool.cc
Go to the documentation of this file.
1
11
12using namespace pandora;
13
14namespace lar_content
15{
16
18 m_minMatchedSamplingPoints(15),
19 m_minMatchedFraction(0.95f),
20 m_maxReducedChiSquared(0.707f),
21 m_minXOverlapFraction(0.75f)
22{
23}
24
25//------------------------------------------------------------------------------------------------------------------------------------------
26
28{
30 std::cout << "----> Running Algorithm Tool: " << this->GetInstanceName() << ", " << this->GetType() << std::endl;
31
32 ProtoParticleVector protoParticleVector;
33 this->FindMissingTracks(overlapTensor, protoParticleVector);
34
35 const bool particlesMade(pAlgorithm->CreateThreeDParticles(protoParticleVector));
36 return particlesMade;
37}
38
39//------------------------------------------------------------------------------------------------------------------------------------------
40
41void MissingTrackTool::FindMissingTracks(const TensorType &overlapTensor, ProtoParticleVector &protoParticleVector) const
42{
43 ClusterSet usedClusters;
44 ClusterVector sortedKeyClusters;
45 overlapTensor.GetSortedKeyClusters(sortedKeyClusters);
46
47 for (const Cluster *const pKeyCluster : sortedKeyClusters)
48 {
49 unsigned int nU(0), nV(0), nW(0);
50 TensorType::ElementList elementList;
51 overlapTensor.GetConnectedElements(pKeyCluster, false, elementList, nU, nV, nW);
52
53 for (TensorType::ElementList::const_iterator eIter = elementList.begin(); eIter != elementList.end(); ++eIter)
54 {
55 const bool includeU(eIter->GetClusterU()->IsAvailable() && !usedClusters.count(eIter->GetClusterU()));
56 const bool includeV(eIter->GetClusterV()->IsAvailable() && !usedClusters.count(eIter->GetClusterV()));
57 const bool includeW(eIter->GetClusterW()->IsAvailable() && !usedClusters.count(eIter->GetClusterW()));
58
59 unsigned int nAvailable(0);
60 if (includeU)
61 ++nAvailable;
62 if (includeV)
63 ++nAvailable;
64 if (includeW)
65 ++nAvailable;
66
67 if (2 != nAvailable)
68 continue;
69
70 const TransverseOverlapResult &overlapResult(eIter->GetOverlapResult());
71
73 continue;
74
75 if (overlapResult.GetMatchedFraction() < m_minMatchedFraction)
76 continue;
77
78 if (overlapResult.GetReducedChi2() > m_maxReducedChiSquared)
79 continue;
80
81 if ((overlapResult.GetXOverlap().GetXSpanU() < std::numeric_limits<float>::epsilon()) ||
82 (overlapResult.GetXOverlap().GetXSpanV() < std::numeric_limits<float>::epsilon()) ||
83 (overlapResult.GetXOverlap().GetXSpanW() < std::numeric_limits<float>::epsilon()))
84 {
85 continue;
86 }
87
88 const float xOverlapSpan(overlapResult.GetXOverlap().GetXOverlapSpan());
89
90 if (includeU && (xOverlapSpan / overlapResult.GetXOverlap().GetXSpanU() < m_minXOverlapFraction))
91 continue;
92
93 if (includeV && (xOverlapSpan / overlapResult.GetXOverlap().GetXSpanV() < m_minXOverlapFraction))
94 continue;
95
96 if (includeW && (xOverlapSpan / overlapResult.GetXOverlap().GetXSpanW() < m_minXOverlapFraction))
97 continue;
98
99 ProtoParticle protoParticle;
100 if (includeU)
101 protoParticle.m_clusterList.push_back(eIter->GetClusterU());
102 if (includeV)
103 protoParticle.m_clusterList.push_back(eIter->GetClusterV());
104 if (includeW)
105 protoParticle.m_clusterList.push_back(eIter->GetClusterW());
106
107 protoParticleVector.push_back(protoParticle);
108 usedClusters.insert(eIter->GetClusterU());
109 usedClusters.insert(eIter->GetClusterV());
110 usedClusters.insert(eIter->GetClusterW());
111 }
112 }
113}
114
115//------------------------------------------------------------------------------------------------------------------------------------------
116
118{
119 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
120 XmlHelper::ReadValue(xmlHandle, "MinMatchedSamplingPoints", m_minMatchedSamplingPoints));
121
123 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinMatchedFraction", m_minMatchedFraction));
124
126 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxReducedChiSquared", m_maxReducedChiSquared));
127
129 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinXOverlapFraction", m_minXOverlapFraction));
130
131 return STATUS_CODE_SUCCESS;
132}
133
134} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the missing track tool class.
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
Definition StatusCodes.h:31
static const pandora::PandoraSettings * GetSettings(const pandora::Algorithm &algorithm)
Get the pandora settings instance.
virtual bool CreateThreeDParticles(const ProtoParticleVector &protoParticleVector)
Create particles using findings from recent algorithm processing.
MissingTrackTool()
Default constructor.
float m_maxReducedChiSquared
The max reduced chi squared value for the unavailable tensor element.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
float m_minXOverlapFraction
The min x overlap fraction for the two available clusters in the tensor element.
void FindMissingTracks(const TensorType &overlapTensor, ProtoParticleVector &protoParticleVector) const
Find missing tracks, due to merging of multiple particle deposits into single hits during hit creatio...
float m_minMatchedFraction
The min matched sampling point fraction for the unavailable tensor element.
bool Run(ThreeViewTransverseTracksAlgorithm *const pAlgorithm, TensorType &overlapTensor)
Run the algorithm tool.
unsigned int m_minMatchedSamplingPoints
The min number of matched sampling points for the unavailable tensor element.
unsigned int GetNMatchedSamplingPoints() const
Get the number of matched sampling points.
float GetReducedChi2() const
Get the chi2 per samping point value.
float GetMatchedFraction() const
Get the fraction of sampling points resulting in a match.
const XOverlap & GetXOverlap() const
Get the x overlap object.
ThreeViewTransverseTracksAlgorithm::MatchingType::TensorType TensorType
float GetXSpanV() const
Get the x span in the v view.
float GetXOverlapSpan() const
Get the x overlap span.
float GetXSpanW() const
Get the x span in the w view.
float GetXSpanU() const
Get the x span in the u view.
Cluster class.
Definition Cluster.h:31
bool ShouldDisplayAlgorithmInfo() const
Whether to display algorithm information during processing.
const std::string & GetType() const
Get the type.
Definition Process.h:102
const std::string & GetInstanceName() const
Get the instance name.
Definition Process.h:109
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
Definition XmlHelper.h:136
std::vector< ProtoParticle > ProtoParticleVector
pandora::ClusterList m_clusterList
List of 2D clusters in a 3D proto particle.
std::vector< const Cluster * > ClusterVector
std::unordered_set< const Cluster * > ClusterSet
StatusCode
The StatusCode enum.