LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
LArShowerOverlapResult.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 ShowerOverlapResult::ShowerOverlapResult() :
21  m_isInitialized(false),
22  m_nMatchedSamplingPoints(0),
23  m_nSamplingPoints(0),
24  m_matchedFraction(0.f),
25  m_xOverlap(XOverlap(0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f))
26 {
27 }
28 
29 //------------------------------------------------------------------------------------------------------------------------------------------
30 
31 ShowerOverlapResult::ShowerOverlapResult(const unsigned int nMatchedSamplingPoints, const unsigned int nSamplingPoints, const XOverlap &xOverlap) :
32  m_isInitialized(true),
33  m_nMatchedSamplingPoints(nMatchedSamplingPoints),
34  m_nSamplingPoints(nSamplingPoints),
36  m_xOverlap(xOverlap)
37 {
39  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
40 
41  m_matchedFraction = static_cast<float>(m_nMatchedSamplingPoints) / static_cast<float>(m_nSamplingPoints);
42 }
43 
44 //------------------------------------------------------------------------------------------------------------------------------------------
45 
51  m_xOverlap(rhs.IsInitialized() ? rhs.GetXOverlap() : XOverlap(0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f))
52 {
53 }
54 
55 //------------------------------------------------------------------------------------------------------------------------------------------
56 
58 {
59 }
60 
61 //------------------------------------------------------------------------------------------------------------------------------------------
62 
64 {
65  if (this == &rhs)
66  return false;
67 
68  if (!m_isInitialized && !rhs.IsInitialized())
69  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
70 
71  if (!m_isInitialized)
72  return true;
73 
74  if (!rhs.IsInitialized())
75  return false;
76 
79 
80  if (std::fabs(m_xOverlap.GetXOverlapSpan() - rhs.m_xOverlap.GetXOverlapSpan()) > std::numeric_limits<float>::epsilon())
82 
83  if (std::fabs(m_matchedFraction - rhs.m_matchedFraction) > std::numeric_limits<float>::epsilon())
84  return (m_matchedFraction < rhs.m_matchedFraction);
85 
86  if (std::fabs(m_xOverlap.GetXSpanW() - rhs.m_xOverlap.GetXSpanW()) > std::numeric_limits<float>::epsilon())
87  return (m_xOverlap.GetXSpanW() < rhs.m_xOverlap.GetXSpanW());
88 
89  if (std::fabs(m_xOverlap.GetXSpanU() - rhs.m_xOverlap.GetXSpanU()) > std::numeric_limits<float>::epsilon())
90  return (m_xOverlap.GetXSpanU() < rhs.m_xOverlap.GetXSpanU());
91 
92  return (m_xOverlap.GetXSpanV() < rhs.m_xOverlap.GetXSpanV());
93 }
94 
95 //------------------------------------------------------------------------------------------------------------------------------------------
96 
98 {
99  if (this == &rhs)
100  return false;
101 
102  return !(*this < rhs);
103 }
104 
105 //------------------------------------------------------------------------------------------------------------------------------------------
106 
108 {
109  if (this == &rhs)
110  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
111 
116 
117  if (rhs.IsInitialized())
118  {
119  m_xOverlap = rhs.GetXOverlap();
120  }
121  else
122  {
123  m_xOverlap = XOverlap(0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f);
124  }
125 
126  return *this;
127 }
128 
129 } // namespace lar_content
bool IsInitialized() const
Whether the track overlap result has been initialized.
float GetXSpanV() const
Get the x span in the v view.
Definition: LArXOverlap.h:186
ShowerOverlapResult()
Default constructor.
const XOverlap & GetXOverlap() const
Get the x overlap object.
bool operator<(const ShowerOverlapResult &rhs) const
Track overlap result less than operator.
float GetXSpanW() const
Get the x span in the w view.
Definition: LArXOverlap.h:193
unsigned int m_nSamplingPoints
The number of sampling points.
TFile f
Definition: plotHisto.C:6
bool operator>(const ShowerOverlapResult &rhs) const
Track overlap result greater than operator.
float m_matchedFraction
The fraction of sampling points resulting in a match.
float GetXOverlapSpan() const
Get the x overlap span.
Definition: LArXOverlap.h:200
Header file for the lar shower overlap result class.
bool m_isInitialized
Whether the track overlap result has been initialized.
float GetXSpanU() const
Get the x span in the u view.
Definition: LArXOverlap.h:179
ShowerOverlapResult & operator=(const ShowerOverlapResult &rhs)
Track overlap result assigment operator.
XOverlap class.
Definition: LArXOverlap.h:17
unsigned int m_nMatchedSamplingPoints
The number of matched sampling points.
XOverlap m_xOverlap
The x overlap object.