Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
LArShowerOverlapResult.cc
Go to the documentation of this file.
1
9#include "Objects/CaloHit.h"
10
12
14
15using namespace pandora;
16
17namespace lar_content
18{
19
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
31ShowerOverlapResult::ShowerOverlapResult(const unsigned int nMatchedSamplingPoints, const unsigned int nSamplingPoints, const XOverlap &xOverlap) :
32 m_isInitialized(true),
33 m_nMatchedSamplingPoints(nMatchedSamplingPoints),
34 m_nSamplingPoints(nSamplingPoints),
35 m_matchedFraction(0.f),
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
47 m_isInitialized(rhs.m_isInitialized),
48 m_nMatchedSamplingPoints(rhs.m_nMatchedSamplingPoints),
49 m_nSamplingPoints(rhs.m_nSamplingPoints),
50 m_matchedFraction(rhs.m_matchedFraction),
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
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())
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
Header file for the calo hit class.
Header file for the lar shower overlap result class.
Header file defining relevant internal typedefs, sort and string conversion functions.
bool operator>(const ShowerOverlapResult &rhs) const
Track overlap result greater than operator.
float m_matchedFraction
The fraction of sampling points resulting in a match.
bool operator<(const ShowerOverlapResult &rhs) const
Track overlap result less than operator.
bool m_isInitialized
Whether the track overlap result has been initialized.
ShowerOverlapResult & operator=(const ShowerOverlapResult &rhs)
Track overlap result assigment operator.
const XOverlap & GetXOverlap() const
Get the x overlap object.
unsigned int m_nSamplingPoints
The number of sampling points.
XOverlap m_xOverlap
The x overlap object.
unsigned int m_nMatchedSamplingPoints
The number of matched sampling points.
bool IsInitialized() const
Whether the track overlap result has been initialized.
XOverlap class.
Definition LArXOverlap.h:18
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.
StatusCodeException class.