Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
LArTrackOverlapResult.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_chi2(0.f),
26 m_reducedChi2(0.f)
27{
28}
29
30//------------------------------------------------------------------------------------------------------------------------------------------
31
32TrackOverlapResult::TrackOverlapResult(const unsigned int nMatchedSamplingPoints, const unsigned int nSamplingPoints, const float chi2) :
33 m_isInitialized(true),
34 m_nMatchedSamplingPoints(nMatchedSamplingPoints),
35 m_nSamplingPoints(nSamplingPoints),
36 m_matchedFraction(0.f),
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
50 m_isInitialized(rhs.m_isInitialized),
51 m_nMatchedSamplingPoints(rhs.m_nMatchedSamplingPoints),
52 m_nSamplingPoints(rhs.m_nSamplingPoints),
53 m_matchedFraction(rhs.m_matchedFraction),
54 m_chi2(rhs.m_chi2),
55 m_reducedChi2(rhs.m_reducedChi2)
56{
57}
58
59//------------------------------------------------------------------------------------------------------------------------------------------
60
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
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
120TransverseOverlapResult::TransverseOverlapResult() : TrackOverlapResult(), m_xOverlap(XOverlap(0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f))
121{
122}
123
124//------------------------------------------------------------------------------------------------------------------------------------------
125
127 const unsigned int nMatchedSamplingPoints, const unsigned int nSamplingPoints, const float chi2, const XOverlap &xOverlap) :
128 TrackOverlapResult(nMatchedSamplingPoints, nSamplingPoints, chi2),
129 m_xOverlap(xOverlap)
130{
131}
132
133//------------------------------------------------------------------------------------------------------------------------------------------
134
137 m_xOverlap(rhs.IsInitialized() ? rhs.GetXOverlap() : XOverlap(0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f))
138{
139}
140
141//------------------------------------------------------------------------------------------------------------------------------------------
142
146
147//------------------------------------------------------------------------------------------------------------------------------------------
148
150{
152
153 if (rhs.IsInitialized())
154 {
155 m_xOverlap = rhs.GetXOverlap();
156 }
157 else
158 {
159 m_xOverlap = XOverlap(0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f);
160 }
161
162 return *this;
163}
164
165//------------------------------------------------------------------------------------------------------------------------------------------
166//------------------------------------------------------------------------------------------------------------------------------------------
167
169{
170 if (!lhs.IsInitialized() && !rhs.IsInitialized())
171 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
172
173 if (!lhs.IsInitialized())
174 return rhs;
175
176 if (!rhs.IsInitialized())
177 return lhs;
178
180 lhs.GetNSamplingPoints() + rhs.GetNSamplingPoints(), lhs.GetChi2() + rhs.GetChi2(), lhs.GetXOverlap() + rhs.GetXOverlap());
181}
182
183//------------------------------------------------------------------------------------------------------------------------------------------
184//------------------------------------------------------------------------------------------------------------------------------------------
185
187{
188}
189//------------------------------------------------------------------------------------------------------------------------------------------
190
191LongitudinalOverlapResult::LongitudinalOverlapResult(const TrackOverlapResult trackOverlapResult, const float innerChi2, const float outerChi2) :
192 TrackOverlapResult(trackOverlapResult),
193 m_innerChi2(innerChi2),
194 m_outerChi2(outerChi2)
195{
196}
197
198//------------------------------------------------------------------------------------------------------------------------------------------
199
200LongitudinalOverlapResult::LongitudinalOverlapResult(const unsigned int nMatchedSamplingPoints, const unsigned int nSamplingPoints,
201 const float chi2, const float innerChi2, const float outerChi2) :
202 TrackOverlapResult(nMatchedSamplingPoints, nSamplingPoints, chi2),
203 m_innerChi2(innerChi2),
204 m_outerChi2(outerChi2)
205{
206}
207
208//------------------------------------------------------------------------------------------------------------------------------------------
209
212 m_innerChi2(rhs.IsInitialized() ? rhs.GetInnerChi2() : 0.f),
213 m_outerChi2(rhs.IsInitialized() ? rhs.GetOuterChi2() : 0.f)
214{
215}
216
217//------------------------------------------------------------------------------------------------------------------------------------------
218
222
223//------------------------------------------------------------------------------------------------------------------------------------------
224
233
234//------------------------------------------------------------------------------------------------------------------------------------------
235//------------------------------------------------------------------------------------------------------------------------------------------
236
238{
239}
240//------------------------------------------------------------------------------------------------------------------------------------------
241
243 const TrackOverlapResult trackOverlapResult, const pandora::CaloHitList &caloHitList, const pandora::ClusterList &clusterList) :
244 TrackOverlapResult(trackOverlapResult),
245 m_caloHitList(caloHitList),
246 m_clusterList(clusterList)
247{
248}
249
250//------------------------------------------------------------------------------------------------------------------------------------------
251
252FragmentOverlapResult::FragmentOverlapResult(const unsigned int nMatchedSamplingPoints, const unsigned int nSamplingPoints,
253 const float chi2, const pandora::CaloHitList &caloHitList, const pandora::ClusterList &clusterList) :
254 TrackOverlapResult(nMatchedSamplingPoints, nSamplingPoints, chi2),
255 m_caloHitList(caloHitList),
256 m_clusterList(clusterList)
257{
258}
259
260//------------------------------------------------------------------------------------------------------------------------------------------
261
264 m_caloHitList(rhs.IsInitialized() ? rhs.GetFragmentCaloHitList() : CaloHitList()),
265 m_clusterList(rhs.IsInitialized() ? rhs.GetFragmentClusterList() : ClusterList())
266{
267}
268
269//------------------------------------------------------------------------------------------------------------------------------------------
270
274
275//------------------------------------------------------------------------------------------------------------------------------------------
276
285
286//------------------------------------------------------------------------------------------------------------------------------------------
287
289{
290 if (m_caloHitList.empty())
291 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
292
293 return (*(m_caloHitList.begin()))->GetHitType();
294}
295
296//------------------------------------------------------------------------------------------------------------------------------------------
297//------------------------------------------------------------------------------------------------------------------------------------------
298
302
303//------------------------------------------------------------------------------------------------------------------------------------------
304
305DeltaRayOverlapResult::DeltaRayOverlapResult(const unsigned int nMatchedSamplingPoints, const unsigned int nSamplingPoints,
306 const float chi2, const XOverlap &xOverlap, const PfoList &commonMuonPfoList) :
307 TransverseOverlapResult(nMatchedSamplingPoints, nSamplingPoints, chi2, xOverlap),
308 m_commonMuonPfoList(commonMuonPfoList)
309{
310}
311
312//------------------------------------------------------------------------------------------------------------------------------------------
313
316 m_commonMuonPfoList(rhs.GetCommonMuonPfoList())
317{
318}
319
320//------------------------------------------------------------------------------------------------------------------------------------------
321
325
326//------------------------------------------------------------------------------------------------------------------------------------------
327
336
337//------------------------------------------------------------------------------------------------------------------------------------------
338//------------------------------------------------------------------------------------------------------------------------------------------
339
340} // namespace lar_content
Header file for the calo hit class.
Header file for the lar track overlap result class.
Header file defining relevant internal typedefs, sort and string conversion functions.
pandora::PfoList m_commonMuonPfoList
The list of cosmic ray pfos that, in each view, lie close to the clusters of the tensor element.
DeltaRayOverlapResult & operator=(const DeltaRayOverlapResult &rhs)
Track overlap result assigment operator.
const pandora::PfoList & GetCommonMuonPfoList() const
Get the common muon pfo list.
pandora::CaloHitList m_caloHitList
The list of fragment-associated hits.
pandora::ClusterList m_clusterList
The list of fragment-associated clusters.
const pandora::CaloHitList & GetFragmentCaloHitList() const
Get the list of fragment-associated hits.
pandora::HitType GetFragmentHitType() const
Get the fragment hit type.
FragmentOverlapResult & operator=(const FragmentOverlapResult &rhs)
Fragments overlap result assigment operator.
const pandora::ClusterList & GetFragmentClusterList() const
Get the list of fragment-associated clusters.
LongitudinalOverlapResult & operator=(const LongitudinalOverlapResult &rhs)
Track overlap result assigment operator.
float m_matchedFraction
The fraction of sampling points resulting in a match.
bool operator>(const TrackOverlapResult &rhs) const
Track overlap result greater than operator.
unsigned int GetNSamplingPoints() const
Get the number of sampling points.
float m_chi2
The absolute chi2 value.
bool IsInitialized() const
Whether the track overlap result has been initialized.
unsigned int GetNMatchedSamplingPoints() const
Get the number of matched sampling points.
float m_reducedChi2
The chi2 per samping point value.
TrackOverlapResult & operator=(const TrackOverlapResult &rhs)
Track overlap result assigment operator.
unsigned int m_nMatchedSamplingPoints
The number of matched sampling points.
float GetChi2() const
Get the absolute chi2 value.
bool m_isInitialized
Whether the track overlap result has been initialized.
unsigned int m_nSamplingPoints
The number of sampling points.
bool operator<(const TrackOverlapResult &rhs) const
Track overlap result less than operator.
XOverlap m_xOverlap
The x overlap object.
const XOverlap & GetXOverlap() const
Get the x overlap object.
TransverseOverlapResult & operator=(const TransverseOverlapResult &rhs)
Track overlap result assigment operator.
XOverlap class.
Definition LArXOverlap.h:18
StatusCodeException class.
TransverseOverlapResult operator+(const TransverseOverlapResult &lhs, const TransverseOverlapResult &rhs)
Transverse overlap result + operator.
HitType
Calorimeter hit type enum.
MANAGED_CONTAINER< const Cluster * > ClusterList
MANAGED_CONTAINER< const CaloHit * > CaloHitList
MANAGED_CONTAINER< const ParticleFlowObject * > PfoList