LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
LArTrackTwoViewOverlapResult.cc
Go to the documentation of this file.
1 
10 #include "Objects/Cluster.h"
11 
12 using namespace pandora;
13 
14 namespace lar_content
15 {
16 
17 TwoViewDeltaRayOverlapResult::TwoViewDeltaRayOverlapResult() :
18  m_isInitialized(false),
19  m_xOverlap(TwoViewXOverlap(0.f, 0.f, 0.f, 0.f)),
20  m_commonMuonPfoList(),
21  m_pBestMatchedCluster(nullptr),
22  m_matchedClusterList(),
23  m_reducedChiSquared(std::numeric_limits<float>::max())
24 {
25 }
26 
27 //------------------------------------------------------------------------------------------------------------------------------------------
28 
29 TwoViewDeltaRayOverlapResult::TwoViewDeltaRayOverlapResult(const TwoViewXOverlap &xOverlap, const PfoList &commonMuonPfoList,
30  const Cluster *const pBestMatchedCluster, const ClusterList &matchedClusterList, const float reducedChiSquared) :
31  m_isInitialized(true),
32  m_xOverlap(xOverlap),
33  m_commonMuonPfoList(commonMuonPfoList),
34  m_pBestMatchedCluster(pBestMatchedCluster),
35  m_matchedClusterList(matchedClusterList),
36  m_reducedChiSquared(reducedChiSquared)
37 {
38 }
39 
40 //------------------------------------------------------------------------------------------------------------------------------------------
41 
44  m_xOverlap(rhs.GetXOverlap()),
49 {
50 }
51 
52 //------------------------------------------------------------------------------------------------------------------------------------------
53 
55 {
56 }
57 
58 //------------------------------------------------------------------------------------------------------------------------------------------
59 
61 {
62  unsigned int highestNHits(0);
63  const Cluster *pBestMatchedCluster(nullptr);
64 
65  for (const Cluster *const pMatchedCluster : m_matchedClusterList)
66  {
67  if (!pMatchedCluster->IsAvailable())
68  continue;
69 
70  if (pMatchedCluster->GetNCaloHits() > highestNHits)
71  {
72  highestNHits = pMatchedCluster->GetNCaloHits();
73  pBestMatchedCluster = pMatchedCluster;
74  }
75  }
76 
77  return pBestMatchedCluster;
78 }
79 
80 //------------------------------------------------------------------------------------------------------------------------------------------
81 
83 {
85  m_xOverlap = rhs.GetXOverlap();
90 
91  return *this;
92 }
93 
94 //------------------------------------------------------------------------------------------------------------------------------------------
95 
97 {
98  if (this == &rhs)
99  return false;
100 
101  if (!m_isInitialized && !rhs.m_isInitialized)
102  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
103 
104  if (!m_isInitialized)
105  return true;
106 
107  if (!rhs.m_isInitialized)
108  return false;
109 
111 }
112 
113 //------------------------------------------------------------------------------------------------------------------------------------------
114 //------------------------------------------------------------------------------------------------------------------------------------------
115 
117  m_isInitialized(false),
118  m_matchingScore(0)
119 {
120 }
121 
122 //------------------------------------------------------------------------------------------------------------------------------------------
123 
125  m_isInitialized(true),
126  m_matchingScore(matchingScore)
127 {
128 }
129 
130 //------------------------------------------------------------------------------------------------------------------------------------------
131 
135 {
136 }
137 
138 //------------------------------------------------------------------------------------------------------------------------------------------
139 
141 {
142 }
143 
144 //------------------------------------------------------------------------------------------------------------------------------------------
145 
147 {
148  if (this == &rhs)
149  return false;
150 
151  if (!m_isInitialized && !rhs.m_isInitialized)
152  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
153 
154  if (!m_isInitialized)
155  return true;
156 
157  if (!rhs.m_isInitialized)
158  return false;
159 
160  return (m_matchingScore < rhs.m_matchingScore);
161 }
162 
163 //------------------------------------------------------------------------------------------------------------------------------------------
164 
166 {
167  if (this == &rhs)
168  return false;
169 
170  return !(*this < rhs);
171 }
172 
173 //------------------------------------------------------------------------------------------------------------------------------------------
174 
176 {
177  if (this == &rhs)
178  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
179 
182 
183  return *this;
184 }
185 
186 //------------------------------------------------------------------------------------------------------------------------------------------
187 //------------------------------------------------------------------------------------------------------------------------------------------
188 
191  m_downsamplingFactor(0.f),
192  m_nSamplingPoints(0),
193  m_nMatchedSamplingPoints(0),
194  m_correlationCoefficient(0.f),
195  m_twoViewXOverlap(TwoViewXOverlap(0.f, 0.f, 0.f, 0.f))
196 {
197 }
198 
199 //------------------------------------------------------------------------------------------------------------------------------------------
200 
201 TwoViewTransverseOverlapResult::TwoViewTransverseOverlapResult(const float matchingScore, const float downsamplingFactor, const unsigned int nSamplingPoints,
202  const unsigned int nMatchedSamplingPoints, const float correlationCoefficient, const TwoViewXOverlap &twoViewXOverlap) :
203  TrackTwoViewOverlapResult(matchingScore),
204  m_downsamplingFactor(downsamplingFactor),
205  m_nSamplingPoints(nSamplingPoints),
206  m_nMatchedSamplingPoints(nMatchedSamplingPoints),
207  m_correlationCoefficient(correlationCoefficient),
208  m_twoViewXOverlap(twoViewXOverlap)
209 {
210 }
211 
212 //------------------------------------------------------------------------------------------------------------------------------------------
213 
221 {
222 }
223 
224 //------------------------------------------------------------------------------------------------------------------------------------------
225 
227 {
228 }
229 
230 //------------------------------------------------------------------------------------------------------------------------------------------
231 
233 {
234  if (this == &rhs)
235  return false;
236 
237  if (!m_isInitialized && !rhs.m_isInitialized)
238  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
239 
240  if (!m_isInitialized)
241  return true;
242 
243  if (!rhs.m_isInitialized)
244  return false;
245 
246  if (std::fabs(m_matchingScore - rhs.m_matchingScore) > std::numeric_limits<float>::epsilon())
247  return (m_matchingScore < rhs.m_matchingScore);
248 
249  if (std::fabs(m_correlationCoefficient - rhs.m_correlationCoefficient) > std::numeric_limits<float>::epsilon())
251 
254 
256  return (m_nSamplingPoints < rhs.m_nSamplingPoints);
257 
258  if (std::fabs(this->GetLocallyMatchedFraction() - rhs.GetLocallyMatchedFraction()) > std::numeric_limits<float>::epsilon())
259  return (this->GetLocallyMatchedFraction() < rhs.GetLocallyMatchedFraction());
260 
261  if (std::fabs(m_twoViewXOverlap.GetTwoViewXOverlapSpan() - rhs.m_twoViewXOverlap.GetTwoViewXOverlapSpan()) > std::numeric_limits<float>::epsilon())
263 
264  if (std::fabs(m_twoViewXOverlap.GetXSpan0() - rhs.m_twoViewXOverlap.GetXSpan0()) > std::numeric_limits<float>::epsilon())
266 
268 }
269 
270 //------------------------------------------------------------------------------------------------------------------------------------------
271 
273 {
275 
276  if (rhs.m_isInitialized)
277  {
285  }
286  else
287  {
288  m_isInitialized = false;
289  m_matchingScore = 0.f;
290  m_downsamplingFactor = 0.f;
291  m_nSamplingPoints = 0;
294  m_twoViewXOverlap = TwoViewXOverlap(0.f, 0.f, 0.f, 0.f);
295  }
296 
297  return *this;
298 }
299 
300 } // namespace lar_content
TwoViewTransverseOverlapResult & operator=(const TwoViewTransverseOverlapResult &rhs)
Track overlap result assigment operator.
TrackTwoViewOverlapResult & operator=(const TrackTwoViewOverlapResult &rhs)
Track overlap result assigment operator.
float GetReducedChiSquared() const
Get the reduced chi squared value.
pandora::ClusterList m_matchedClusterList
The list of clusters that lie on the projected hits.
bool m_isInitialized
Whether the track overlap result has been initialized.
float m_reducedChiSquared
The reduced chi squared of the best matched cluster.
STL namespace.
bool operator<(const TwoViewTransverseOverlapResult &rhs) const
Track two view overlap result less than operator.
float GetLocallyMatchedFraction() const
Get the locally matched fraction.
pandora::PfoList m_commonMuonPfoList
The list of muon pfos whose clusters lie close to delta ray clusters in all views.
TFile f
Definition: plotHisto.C:6
const pandora::Cluster * GetBestMatchedAvailableCluster() const
Get the best matched available cluster.
float GetXSpan0() const
Get the x span in the view 0.
bool operator>(const TrackTwoViewOverlapResult &rhs) const
Track two view overlap result greater than operator.
TwoViewXOverlap m_xOverlap
The x overlap object.
float GetXSpan1() const
Get the x span in the view 1.
const pandora::Cluster * GetBestMatchedCluster() const
Get the best matched cluster.
float m_correlationCoefficient
The correlation coefficient.
bool operator<(const TwoViewDeltaRayOverlapResult &rhs) const
Track two view overlap result less than operator.
float m_matchingScore
The compatability score for the two objects associated with the overlap result.
TwoViewDeltaRayOverlapResult & operator=(const TwoViewDeltaRayOverlapResult &rhs)
Track overlap result assigment operator.
const pandora::Cluster * m_pBestMatchedCluster
The largest cluster that lies on the projected hits.
float GetTwoViewXOverlapSpan() const
Get the x overlap span.
TwoViewXOverlap class.
unsigned int m_nSamplingPoints
The number of sampling points.
const pandora::ClusterList & GetMatchedClusterList() const
Get the matched cluster list.
bool operator<(const TrackTwoViewOverlapResult &rhs) const
Track two view overlap result less than operator.
Header file for the lar track two view overlap result class.
TwoViewXOverlap m_twoViewXOverlap
The two view x overlap object.
const pandora::PfoList & GetCommonMuonPfoList() const
Get the common muon pfo list.
bool m_isInitialized
Whether the two view delta ray overlap result has been initialized.
unsigned int m_nMatchedSamplingPoints
The number of matched sampling points.
const TwoViewXOverlap & GetXOverlap() const
Get the x overlap object.