LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
LArTrackOverlapResult.cc
Go to the documentation of this file.
1 
9 #include "Objects/CaloHit.h"
10 
11 #include "Pandora/PandoraInternal.h"
12 
14 
15 using namespace pandora;
16 
17 namespace lar_content
18 {
19 
20 TrackOverlapResult::TrackOverlapResult() :
21  m_isInitialized(false),
22  m_nMatchedSamplingPoints(0),
23  m_nSamplingPoints(0),
24  m_matchedFraction(0.f),
25  m_chi2(0.f),
26  m_reducedChi2(0.f)
27 {
28 }
29 
30 //------------------------------------------------------------------------------------------------------------------------------------------
31 
32 TrackOverlapResult::TrackOverlapResult(const unsigned int nMatchedSamplingPoints, const unsigned int nSamplingPoints, const float chi2) :
33  m_isInitialized(true),
34  m_nMatchedSamplingPoints(nMatchedSamplingPoints),
35  m_nSamplingPoints(nSamplingPoints),
37  m_chi2(chi2),
38  m_reducedChi2(0.f)
39 {
41  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
42 
43  m_matchedFraction = static_cast<float>(m_nMatchedSamplingPoints) / static_cast<float>(m_nSamplingPoints);
44  m_reducedChi2 = m_chi2 / static_cast<float>(m_nSamplingPoints);
45 }
46 
47 //------------------------------------------------------------------------------------------------------------------------------------------
48 
54  m_chi2(rhs.m_chi2),
56 {
57 }
58 
59 //------------------------------------------------------------------------------------------------------------------------------------------
60 
62 {
63 }
64 
65 //------------------------------------------------------------------------------------------------------------------------------------------
66 
68 {
69  if (this == &rhs)
70  return false;
71 
72  if (!m_isInitialized && !rhs.IsInitialized())
73  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
74 
75  if (!m_isInitialized)
76  return true;
77 
78  if (!rhs.IsInitialized())
79  return false;
80 
83 
84  if (std::fabs(m_reducedChi2 - rhs.m_reducedChi2) > std::numeric_limits<float>::epsilon())
85  return (m_reducedChi2 > rhs.m_reducedChi2);
86 
87  return (m_matchedFraction < rhs.m_matchedFraction);
88 }
89 
90 //------------------------------------------------------------------------------------------------------------------------------------------
91 
93 {
94  if (this == &rhs)
95  return false;
96 
97  return !(*this < rhs);
98 }
99 
100 //------------------------------------------------------------------------------------------------------------------------------------------
101 
103 {
104  if (this == &rhs)
105  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
106 
111  m_chi2 = rhs.m_chi2;
113 
114  return *this;
115 }
116 
117 //------------------------------------------------------------------------------------------------------------------------------------------
118 //------------------------------------------------------------------------------------------------------------------------------------------
119 
122  m_xOverlap(XOverlap(0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f))
123 {
124 }
125 
126 //------------------------------------------------------------------------------------------------------------------------------------------
127 
129  const unsigned int nMatchedSamplingPoints, const unsigned int nSamplingPoints, const float chi2, const XOverlap &xOverlap) :
130  TrackOverlapResult(nMatchedSamplingPoints, nSamplingPoints, chi2),
131  m_xOverlap(xOverlap)
132 {
133 }
134 
135 //------------------------------------------------------------------------------------------------------------------------------------------
136 
138  TrackOverlapResult(rhs),
139  m_xOverlap(rhs.IsInitialized() ? rhs.GetXOverlap() : XOverlap(0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f))
140 {
141 }
142 
143 //------------------------------------------------------------------------------------------------------------------------------------------
144 
146 {
147 }
148 
149 //------------------------------------------------------------------------------------------------------------------------------------------
150 
152 {
154 
155  if (rhs.IsInitialized())
156  {
157  m_xOverlap = rhs.GetXOverlap();
158  }
159  else
160  {
161  m_xOverlap = XOverlap(0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f);
162  }
163 
164  return *this;
165 }
166 
167 //------------------------------------------------------------------------------------------------------------------------------------------
168 //------------------------------------------------------------------------------------------------------------------------------------------
169 
171 {
172  if (!lhs.IsInitialized() && !rhs.IsInitialized())
173  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
174 
175  if (!lhs.IsInitialized())
176  return rhs;
177 
178  if (!rhs.IsInitialized())
179  return lhs;
180 
182  lhs.GetNSamplingPoints() + rhs.GetNSamplingPoints(), lhs.GetChi2() + rhs.GetChi2(), lhs.GetXOverlap() + rhs.GetXOverlap());
183 }
184 
185 //------------------------------------------------------------------------------------------------------------------------------------------
186 //------------------------------------------------------------------------------------------------------------------------------------------
187 
190  m_innerChi2(0.f),
191  m_outerChi2(0.f)
192 {
193 }
194 //------------------------------------------------------------------------------------------------------------------------------------------
195 
196 LongitudinalOverlapResult::LongitudinalOverlapResult(const TrackOverlapResult trackOverlapResult, const float innerChi2, const float outerChi2) :
197  TrackOverlapResult(trackOverlapResult),
198  m_innerChi2(innerChi2),
199  m_outerChi2(outerChi2)
200 {
201 }
202 
203 //------------------------------------------------------------------------------------------------------------------------------------------
204 
205 LongitudinalOverlapResult::LongitudinalOverlapResult(const unsigned int nMatchedSamplingPoints, const unsigned int nSamplingPoints,
206  const float chi2, const float innerChi2, const float outerChi2) :
207  TrackOverlapResult(nMatchedSamplingPoints, nSamplingPoints, chi2),
208  m_innerChi2(innerChi2),
209  m_outerChi2(outerChi2)
210 {
211 }
212 
213 //------------------------------------------------------------------------------------------------------------------------------------------
214 
216  TrackOverlapResult(rhs),
217  m_innerChi2(rhs.IsInitialized() ? rhs.GetInnerChi2() : 0.f),
218  m_outerChi2(rhs.IsInitialized() ? rhs.GetOuterChi2() : 0.f)
219 {
220 }
221 
222 //------------------------------------------------------------------------------------------------------------------------------------------
223 
225 {
226 }
227 
228 //------------------------------------------------------------------------------------------------------------------------------------------
229 
231 {
233  m_innerChi2 = rhs.GetInnerChi2();
234  m_outerChi2 = rhs.GetOuterChi2();
235 
236  return *this;
237 }
238 
239 //------------------------------------------------------------------------------------------------------------------------------------------
240 //------------------------------------------------------------------------------------------------------------------------------------------
241 
244  m_caloHitList(),
245  m_clusterList()
246 {
247 }
248 //------------------------------------------------------------------------------------------------------------------------------------------
249 
251  const TrackOverlapResult trackOverlapResult, const pandora::CaloHitList &caloHitList, const pandora::ClusterList &clusterList) :
252  TrackOverlapResult(trackOverlapResult),
253  m_caloHitList(caloHitList),
254  m_clusterList(clusterList)
255 {
256 }
257 
258 //------------------------------------------------------------------------------------------------------------------------------------------
259 
260 FragmentOverlapResult::FragmentOverlapResult(const unsigned int nMatchedSamplingPoints, const unsigned int nSamplingPoints,
261  const float chi2, const pandora::CaloHitList &caloHitList, const pandora::ClusterList &clusterList) :
262  TrackOverlapResult(nMatchedSamplingPoints, nSamplingPoints, chi2),
263  m_caloHitList(caloHitList),
264  m_clusterList(clusterList)
265 {
266 }
267 
268 //------------------------------------------------------------------------------------------------------------------------------------------
269 
271  TrackOverlapResult(rhs),
272  m_caloHitList(rhs.IsInitialized() ? rhs.GetFragmentCaloHitList() : CaloHitList()),
273  m_clusterList(rhs.IsInitialized() ? rhs.GetFragmentClusterList() : ClusterList())
274 {
275 }
276 
277 //------------------------------------------------------------------------------------------------------------------------------------------
278 
280 {
281 }
282 
283 //------------------------------------------------------------------------------------------------------------------------------------------
284 
286 {
290 
291  return *this;
292 }
293 
294 //------------------------------------------------------------------------------------------------------------------------------------------
295 
297 {
298  if (m_caloHitList.empty())
299  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
300 
301  return (*(m_caloHitList.begin()))->GetHitType();
302 }
303 
304 //------------------------------------------------------------------------------------------------------------------------------------------
305 //------------------------------------------------------------------------------------------------------------------------------------------
306 
309  m_commonMuonPfoList(PfoList())
310 {
311 }
312 
313 //------------------------------------------------------------------------------------------------------------------------------------------
314 
315 DeltaRayOverlapResult::DeltaRayOverlapResult(const unsigned int nMatchedSamplingPoints, const unsigned int nSamplingPoints,
316  const float chi2, const XOverlap &xOverlap, const PfoList &commonMuonPfoList) :
317  TransverseOverlapResult(nMatchedSamplingPoints, nSamplingPoints, chi2, xOverlap),
318  m_commonMuonPfoList(commonMuonPfoList)
319 {
320 }
321 
322 //------------------------------------------------------------------------------------------------------------------------------------------
323 
327 {
328 }
329 
330 //------------------------------------------------------------------------------------------------------------------------------------------
331 
333 {
334 }
335 
336 //------------------------------------------------------------------------------------------------------------------------------------------
337 
339 {
341 
343 
344  return *this;
345 }
346 
347 //------------------------------------------------------------------------------------------------------------------------------------------
348 //------------------------------------------------------------------------------------------------------------------------------------------
349 
350 } // namespace lar_content
LongitudinalOverlapResult class.
pandora::ClusterList m_clusterList
The list of fragment-associated clusters.
float m_chi2
The absolute chi2 value.
FragmentOverlapResult class.
unsigned int GetNMatchedSamplingPoints() const
Get the number of matched sampling points.
bool IsInitialized() const
Whether the track overlap result has been initialized.
virtual ~TrackOverlapResult()
Destructor.
FragmentOverlapResult & operator=(const FragmentOverlapResult &rhs)
Fragments overlap result assigment operator.
TrackOverlapResult()
Default constructor.
unsigned int m_nMatchedSamplingPoints
The number of matched sampling points.
bool m_isInitialized
Whether the track overlap result has been initialized.
float m_outerChi2
The outer chi squared.
float m_innerChi2
The inner chi squared.
bool operator<(const TrackOverlapResult &rhs) const
Track overlap result less than operator.
const XOverlap & GetXOverlap() const
Get the x overlap object.
TransverseOverlapResult operator+(const TransverseOverlapResult &lhs, const TransverseOverlapResult &rhs)
Transverse overlap result + operator.
TFile f
Definition: plotHisto.C:6
pandora::HitType GetFragmentHitType() const
Get the fragment hit type.
const pandora::CaloHitList & GetFragmentCaloHitList() const
Get the list of fragment-associated hits.
unsigned int GetNSamplingPoints() const
Get the number of sampling points.
const pandora::PfoList & GetCommonMuonPfoList() const
Get the common muon pfo list.
DeltaRayOverlapResult class.
TransverseOverlapResult class.
TrackOverlapResult class.
LongitudinalOverlapResult & operator=(const LongitudinalOverlapResult &rhs)
Track overlap result assigment operator.
TrackOverlapResult & operator=(const TrackOverlapResult &rhs)
Track overlap result assigment operator.
Header file for the lar track overlap result class.
HitType
Definition: HitType.h:12
bool operator>(const TrackOverlapResult &rhs) const
Track overlap result greater than operator.
float m_reducedChi2
The chi2 per samping point value.
pandora::PfoList m_commonMuonPfoList
The list of cosmic ray pfos that, in each view, lie close to the clusters of the tensor element...
unsigned int m_nSamplingPoints
The number of sampling points.
float m_matchedFraction
The fraction of sampling points resulting in a match.
TransverseOverlapResult & operator=(const TransverseOverlapResult &rhs)
Track overlap result assigment operator.
XOverlap class.
Definition: LArXOverlap.h:17
const pandora::ClusterList & GetFragmentClusterList() const
Get the list of fragment-associated clusters.
float GetChi2() const
Get the absolute chi2 value.
DeltaRayOverlapResult & operator=(const DeltaRayOverlapResult &rhs)
Track overlap result assigment operator.
pandora::CaloHitList m_caloHitList
The list of fragment-associated hits.
XOverlap m_xOverlap
The x overlap object.