LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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  return (m_matchedFraction < rhs.m_matchedFraction);
84 }
85 
86 //------------------------------------------------------------------------------------------------------------------------------------------
87 
89 {
90  if (this == &rhs)
91  return false;
92 
93  return !(*this < rhs);
94 }
95 
96 //------------------------------------------------------------------------------------------------------------------------------------------
97 
99 {
100  if (this == &rhs)
101  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
102 
107 
108  if (rhs.IsInitialized())
109  {
110  m_xOverlap = rhs.GetXOverlap();
111  }
112  else
113  {
114  m_xOverlap = XOverlap(0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f);
115  }
116 
117  return *this;
118 }
119 
120 } // namespace lar_content
bool IsInitialized() const
Whether the track overlap result has been initialized.
ShowerOverlapResult()
Default constructor.
const XOverlap & GetXOverlap() const
Get the x overlap object.
bool operator<(const ShowerOverlapResult &rhs) const
Track overlap result less than operator.
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.
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.