Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
VertexSelectionBaseAlgorithm.cc
Go to the documentation of this file.
1
9
12
14
16
17using namespace pandora;
18
19namespace lar_content
20{
21
23 m_replaceCurrentVertexList(true),
24 m_beamMode(true),
25 m_nDecayLengthsInZSpan(2.f),
26 m_selectSingleVertex(true),
27 m_maxTopScoreSelections(3),
28 m_maxOnHitDisplacement(1.f),
29 m_minCandidateDisplacement(2.f),
30 m_minCandidateScoreFraction(0.5f),
31 m_useDetectorGaps(true),
32 m_gapTolerance(0.f),
33 m_isEmptyViewAcceptable(true),
34 m_minVertexAcceptableViews(3)
35{
36}
37
38//------------------------------------------------------------------------------------------------------------------------------------------
39
40void VertexSelectionBaseAlgorithm::FilterVertexList(const VertexList *const pInputVertexList, HitKDTree2D &kdTreeU, HitKDTree2D &kdTreeV,
41 HitKDTree2D &kdTreeW, VertexVector &filteredVertices) const
42{
43 for (const Vertex *const pVertex : *pInputVertexList)
44 {
45 unsigned int nAcceptableViews(0);
46
47 if ((m_isEmptyViewAcceptable && kdTreeU.empty()) || this->IsVertexOnHit(pVertex, TPC_VIEW_U, kdTreeU) || this->IsVertexInGap(pVertex, TPC_VIEW_U))
48 ++nAcceptableViews;
49
50 if ((m_isEmptyViewAcceptable && kdTreeV.empty()) || this->IsVertexOnHit(pVertex, TPC_VIEW_V, kdTreeV) || this->IsVertexInGap(pVertex, TPC_VIEW_V))
51 ++nAcceptableViews;
52
53 if ((m_isEmptyViewAcceptable && kdTreeW.empty()) || this->IsVertexOnHit(pVertex, TPC_VIEW_W, kdTreeW) || this->IsVertexInGap(pVertex, TPC_VIEW_W))
54 ++nAcceptableViews;
55
56 if (nAcceptableViews >= m_minVertexAcceptableViews)
57 filteredVertices.push_back(pVertex);
58 }
59
60 std::sort(filteredVertices.begin(), filteredVertices.end(), SortByVertexZPosition);
61}
62
63//------------------------------------------------------------------------------------------------------------------------------------------
64
65void VertexSelectionBaseAlgorithm::GetBeamConstants(const VertexVector &vertexVector, BeamConstants &beamConstants) const
66{
67 if (!m_beamMode)
68 return;
69
70 if (vertexVector.empty())
71 throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
72
73 float minZCoordinate(std::numeric_limits<float>::max()), maxZCoordinate(-std::numeric_limits<float>::max());
74
75 for (const Vertex *const pVertex : vertexVector)
76 {
77 if (pVertex->GetPosition().GetZ() < minZCoordinate)
78 minZCoordinate = pVertex->GetPosition().GetZ();
79
80 if (pVertex->GetPosition().GetZ() > maxZCoordinate)
81 maxZCoordinate = pVertex->GetPosition().GetZ();
82 }
83
84 const float zSpan(maxZCoordinate - minZCoordinate);
85 const float decayConstant((zSpan < std::numeric_limits<float>::epsilon()) ? 0.f : (m_nDecayLengthsInZSpan / zSpan));
86 beamConstants.SetConstants(minZCoordinate, decayConstant);
87}
88
89//------------------------------------------------------------------------------------------------------------------------------------------
90
92 const StringVector &inputClusterListNames, ClusterList &clusterListU, ClusterList &clusterListV, ClusterList &clusterListW) const
93{
94 for (const std::string &clusterListName : inputClusterListNames)
95 {
96 const ClusterList *pClusterList(NULL);
98 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, clusterListName, pClusterList));
99
100 if (!pClusterList || pClusterList->empty())
101 {
103 std::cout << "EnergyKickVertexSelectionAlgorithm: unable to find cluster list " << clusterListName << std::endl;
104
105 continue;
106 }
107
108 const HitType hitType(LArClusterHelper::GetClusterHitType(*(pClusterList->begin())));
109
110 if ((TPC_VIEW_U != hitType) && (TPC_VIEW_V != hitType) && (TPC_VIEW_W != hitType))
111 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
112
113 ClusterList &clusterList((TPC_VIEW_U == hitType) ? clusterListU : (TPC_VIEW_V == hitType) ? clusterListV : clusterListW);
114 clusterList.insert(clusterList.end(), pClusterList->begin(), pClusterList->end());
115 }
116}
117
118//------------------------------------------------------------------------------------------------------------------------------------------
119
120void VertexSelectionBaseAlgorithm::CalculateClusterSlidingFits(const ClusterList &inputClusterList, const unsigned int minClusterCaloHits,
121 const unsigned int slidingFitWindow, SlidingFitDataList &slidingFitDataList) const
122{
123 const float slidingFitPitch(LArGeometryHelper::GetWireZPitch(this->GetPandora()));
124
125 ClusterVector sortedClusters(inputClusterList.begin(), inputClusterList.end());
126 std::sort(sortedClusters.begin(), sortedClusters.end(), LArClusterHelper::SortByNHits);
127
128 for (const Cluster *const pCluster : sortedClusters)
129 {
130 if (pCluster->GetNCaloHits() < minClusterCaloHits)
131 continue;
132
133 // Make sure the window size is such that there are not more layers than hits (following TwoDSlidingLinearFit calculation).
134 const unsigned int newSlidingFitWindow(
135 std::min(static_cast<int>(pCluster->GetNCaloHits()), static_cast<int>(slidingFitPitch * slidingFitWindow)));
136 slidingFitDataList.emplace_back(pCluster, newSlidingFitWindow, slidingFitPitch);
137 }
138}
139
140//------------------------------------------------------------------------------------------------------------------------------------------
141
143{
144 const VertexList *pInputVertexList(NULL);
145 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*this, pInputVertexList));
146
147 if (!pInputVertexList || pInputVertexList->empty())
148 {
150 std::cout << "VertexSelectionBaseAlgorithm: unable to find current vertex list " << std::endl;
151
152 return STATUS_CODE_SUCCESS;
153 }
154
155 HitKDTree2D kdTreeU, kdTreeV, kdTreeW;
156 this->InitializeKDTrees(kdTreeU, kdTreeV, kdTreeW);
157
158 VertexVector filteredVertices;
159 this->FilterVertexList(pInputVertexList, kdTreeU, kdTreeV, kdTreeW, filteredVertices);
160
161 if (filteredVertices.empty())
162 return STATUS_CODE_SUCCESS;
163
164 BeamConstants beamConstants;
165 this->GetBeamConstants(filteredVertices, beamConstants);
166
167 VertexScoreList vertexScoreList;
168 this->GetVertexScoreList(filteredVertices, beamConstants, kdTreeU, kdTreeV, kdTreeW, vertexScoreList);
169
170 VertexList selectedVertexList;
171 this->SelectTopScoreVertices(vertexScoreList, selectedVertexList);
172
173 if (!selectedVertexList.empty())
174 {
175 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, m_outputVertexListName, selectedVertexList));
176
179 }
180
181 return STATUS_CODE_SUCCESS;
182}
183
184//------------------------------------------------------------------------------------------------------------------------------------------
185
187{
188 for (const std::string &caloHitListName : m_inputCaloHitListNames)
189 {
190 const CaloHitList *pCaloHitList = NULL;
192 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, caloHitListName, pCaloHitList));
193
194 if (!pCaloHitList || pCaloHitList->empty())
195 {
197 std::cout << "VertexSelectionBaseAlgorithm: unable to find calo hit list " << caloHitListName << std::endl;
198
199 continue;
200 }
201
202 const HitType hitType((*(pCaloHitList->begin()))->GetHitType());
203
204 if ((TPC_VIEW_U != hitType) && (TPC_VIEW_V != hitType) && (TPC_VIEW_W != hitType))
205 throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
206
207 HitKDTree2D &kdTree((TPC_VIEW_U == hitType) ? kdTreeU : (TPC_VIEW_V == hitType) ? kdTreeV : kdTreeW);
208
209 if (!kdTree.empty())
210 throw StatusCodeException(STATUS_CODE_FAILURE);
211
212 HitKDNode2DList hitKDNode2DList;
213 KDTreeBox hitsBoundingRegion2D(fill_and_bound_2d_kd_tree(*pCaloHitList, hitKDNode2DList));
214 kdTree.build(hitKDNode2DList, hitsBoundingRegion2D);
215 }
216}
217
218//------------------------------------------------------------------------------------------------------------------------------------------
219
220bool VertexSelectionBaseAlgorithm::IsVertexOnHit(const Vertex *const pVertex, const HitType hitType, HitKDTree2D &kdTree) const
221{
222 const CartesianVector vertexPosition2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex->GetPosition(), hitType));
224
225 HitKDNode2DList found;
226 kdTree.search(searchRegionHits, found);
227
228 return (!found.empty());
229}
230
231//------------------------------------------------------------------------------------------------------------------------------------------
232
233bool VertexSelectionBaseAlgorithm::IsVertexInGap(const Vertex *const pVertex, const HitType hitType) const
234{
236 return false;
237
238 return LArGeometryHelper::IsInGap3D(this->GetPandora(), pVertex->GetPosition(), hitType, m_gapTolerance);
239}
240
241//------------------------------------------------------------------------------------------------------------------------------------------
242
243float VertexSelectionBaseAlgorithm::GetVertexEnergy(const Vertex *const pVertex, const KDTreeMap &kdTreeMap) const
244{
245 float totalEnergy(0.f);
246
247 if (!this->IsVertexInGap(pVertex, TPC_VIEW_U))
248 totalEnergy += this->VertexHitEnergy(pVertex, TPC_VIEW_U, kdTreeMap.at(TPC_VIEW_U));
249
250 if (!this->IsVertexInGap(pVertex, TPC_VIEW_V))
251 totalEnergy += this->VertexHitEnergy(pVertex, TPC_VIEW_V, kdTreeMap.at(TPC_VIEW_V));
252
253 if (!this->IsVertexInGap(pVertex, TPC_VIEW_W))
254 totalEnergy += this->VertexHitEnergy(pVertex, TPC_VIEW_W, kdTreeMap.at(TPC_VIEW_W));
255
256 return totalEnergy;
257}
258
259//------------------------------------------------------------------------------------------------------------------------------------------
260
261float VertexSelectionBaseAlgorithm::VertexHitEnergy(const Vertex *const pVertex, const HitType hitType, HitKDTree2D &kdTree) const
262{
263 const CartesianVector vertexPosition2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex->GetPosition(), hitType));
265
266 HitKDNode2DList foundHits;
267 kdTree.search(searchRegionHits, foundHits);
268
269 float dr(std::numeric_limits<float>::max());
270 float energy(0);
271
272 for (auto hit : foundHits)
273 {
274 const float diff = (vertexPosition2D - hit.data->GetPositionVector()).GetMagnitude();
275 if (diff < dr)
276 {
277 dr = diff;
278 energy = hit.data->GetElectromagneticEnergy();
279 }
280 }
281 return energy;
282}
283
284//------------------------------------------------------------------------------------------------------------------------------------------
285
287{
288 float bestScore(0.f);
289 std::sort(vertexScoreList.begin(), vertexScoreList.end());
290
291 for (const VertexScore &vertexScore : vertexScoreList)
292 {
293 if (selectedVertexList.size() >= m_maxTopScoreSelections)
294 break;
295
296 if (!selectedVertexList.empty() && !this->AcceptVertexLocation(vertexScore.GetVertex(), selectedVertexList))
297 continue;
298
299 if (!selectedVertexList.empty() && (vertexScore.GetScore() < m_minCandidateScoreFraction * bestScore))
300 continue;
301
302 selectedVertexList.push_back(vertexScore.GetVertex());
303
305 return;
306
307 if (vertexScore.GetScore() > bestScore)
308 bestScore = vertexScore.GetScore();
309 }
310}
311
312//------------------------------------------------------------------------------------------------------------------------------------------
313
314bool VertexSelectionBaseAlgorithm::AcceptVertexLocation(const Vertex *const pVertex, const VertexList &selectedVertexList) const
315{
316 const CartesianVector &position(pVertex->GetPosition());
317 const float minCandidateDisplacementSquared(m_minCandidateDisplacement * m_minCandidateDisplacement);
318
319 for (const Vertex *const pSelectedVertex : selectedVertexList)
320 {
321 if (pVertex == pSelectedVertex)
322 return false;
323
324 if ((position - pSelectedVertex->GetPosition()).GetMagnitudeSquared() < minCandidateDisplacementSquared)
325 return false;
326 }
327
328 return true;
329}
330
331//------------------------------------------------------------------------------------------------------------------------------------------
332
334{
335 const CartesianVector deltaPosition(pRhs->GetPosition() - pLhs->GetPosition());
336
337 if (std::fabs(deltaPosition.GetZ()) > std::numeric_limits<float>::epsilon())
338 return (deltaPosition.GetZ() > std::numeric_limits<float>::epsilon());
339
340 if (std::fabs(deltaPosition.GetX()) > std::numeric_limits<float>::epsilon())
341 return (deltaPosition.GetX() > std::numeric_limits<float>::epsilon());
342
343 // ATTN No way to distinguish between vertices if still have a tie in y coordinate
344 return (deltaPosition.GetY() > std::numeric_limits<float>::epsilon());
345}
346
347//------------------------------------------------------------------------------------------------------------------------------------------
348
349VertexSelectionBaseAlgorithm::SlidingFitData::SlidingFitData(const pandora::Cluster *const pCluster, const int slidingFitWindow, const float slidingFitPitch) :
350 m_minLayerDirection(0.f, 0.f, 0.f),
351 m_maxLayerDirection(0.f, 0.f, 0.f),
352 m_minLayerPosition(0.f, 0.f, 0.f),
353 m_maxLayerPosition(0.f, 0.f, 0.f),
354 m_pCluster(pCluster)
355{
356 const TwoDSlidingFitResult slidingFitResult(pCluster, slidingFitWindow, slidingFitPitch);
361}
362
363//------------------------------------------------------------------------------------------------------------------------------------------
364
365VertexSelectionBaseAlgorithm::ShowerCluster::ShowerCluster(const pandora::ClusterList &clusterList, const int slidingFitWindow, const float slidingFitPitch) :
366 m_clusterList(clusterList),
367 m_coordinateVector(this->GetClusterListCoordinateVector(clusterList)),
368 m_twoDSlidingFitResult(&m_coordinateVector, slidingFitWindow, slidingFitPitch)
369{
370}
371
372//------------------------------------------------------------------------------------------------------------------------------------------
373
375{
376 CartesianPointVector coordinateVector;
377
378 for (const Cluster *const pCluster : clusterList)
379 {
380 CartesianPointVector clusterCoordinateVector;
381 LArClusterHelper::GetCoordinateVector(pCluster, clusterCoordinateVector);
382
383 coordinateVector.insert(coordinateVector.end(), std::make_move_iterator(clusterCoordinateVector.begin()),
384 std::make_move_iterator(clusterCoordinateVector.end()));
385 }
386
387 return coordinateVector;
388}
389
390//------------------------------------------------------------------------------------------------------------------------------------------
391//------------------------------------------------------------------------------------------------------------------------------------------
392
394{
395 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "InputCaloHitListNames", m_inputCaloHitListNames));
396
397 PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle, "OutputVertexListName", m_outputVertexListName));
398
399 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
400 XmlHelper::ReadValue(xmlHandle, "ReplaceCurrentVertexList", m_replaceCurrentVertexList));
401
402 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "BeamMode", m_beamMode));
403
405 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "NDecayLengthsInZSpan", m_nDecayLengthsInZSpan));
406
408 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SelectSingleVertex", m_selectSingleVertex));
409
411 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxTopScoreSelections", m_maxTopScoreSelections));
412
414 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MaxOnHitDisplacement", m_maxOnHitDisplacement));
415
416 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
417 XmlHelper::ReadValue(xmlHandle, "MinCandidateDisplacement", m_minCandidateDisplacement));
418
419 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
420 XmlHelper::ReadValue(xmlHandle, "MinCandidateScoreFraction", m_minCandidateScoreFraction));
421
422 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "UseDetectorGaps", m_useDetectorGaps));
423
424 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "GapTolerance", m_gapTolerance));
425
427 STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "IsEmptyViewAcceptable", m_isEmptyViewAcceptable));
428
429 PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
430 XmlHelper::ReadValue(xmlHandle, "MinVertexAcceptableViews", m_minVertexAcceptableViews));
431
432 return STATUS_CODE_SUCCESS;
433}
434
435} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the kd tree linker algo template class.
Header file for the cluster helper class.
Header file for the geometry helper class.
#define PANDORA_THROW_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
Definition StatusCodes.h:55
#define PANDORA_RETURN_RESULT_IF_AND_IF(StatusCode1, StatusCode2, Operator, Command)
Definition StatusCodes.h:31
#define PANDORA_RETURN_RESULT_IF(StatusCode1, Operator, Command)
Definition StatusCodes.h:19
Header file for the vertex selection base algorithm class.
static pandora::StatusCode SaveList(const pandora::Algorithm &algorithm, const T &t, const std::string &newListName)
Save a provided input object list under a new name.
static pandora::StatusCode ReplaceCurrentList(const pandora::Algorithm &algorithm, const std::string &newListName)
Replace the current list with a pre-saved list; use this new list as a permanent replacement for the ...
static pandora::StatusCode GetCurrentList(const pandora::Algorithm &algorithm, const T *&pT)
Get the current list.
static pandora::StatusCode GetList(const pandora::Algorithm &algorithm, const std::string &listName, const T *&pT)
Get a named list.
static const pandora::PandoraSettings * GetSettings(const pandora::Algorithm &algorithm)
Get the pandora settings instance.
Box structure used to define 2D field. It's used in KDTree building step to divide the detector space...
void build(std::vector< KDTreeNodeInfoT< DATA, DIM > > &eltList, const KDTreeBoxT< DIM > &region)
Build the KD tree from the "eltList" in the space define by "region".
void search(const KDTreeBoxT< DIM > &searchBox, std::vector< KDTreeNodeInfoT< DATA, DIM > > &resRecHitList)
Search in the KDTree for all points that would be contained in the given searchbox The founded points...
bool empty()
Whether the tree is empty.
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
static void GetCoordinateVector(const pandora::Cluster *const pCluster, pandora::CartesianPointVector &coordinateVector)
Get vector of hit coordinates from an input cluster.
static bool SortByNHits(const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
Sort clusters by number of hits, then layer span, then inner layer, then position,...
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
static bool IsInGap3D(const pandora::Pandora &pandora, const pandora::CartesianVector &testPoint3D, const pandora::HitType hitType, const float gapTolerance=0.f)
Whether a 3D test point lies in a registered gap with the associated hit type.
pandora::CartesianVector GetGlobalMinLayerPosition() const
Get global position corresponding to the fit result in minimum fit layer.
pandora::CartesianVector GetGlobalMinLayerDirection() const
Get global direction corresponding to the fit result in minimum fit layer.
pandora::CartesianVector GetGlobalMaxLayerPosition() const
Get global position corresponding to the fit result in maximum fit layer.
pandora::CartesianVector GetGlobalMaxLayerDirection() const
Get global direction corresponding to the fit result in maximum fit layer.
void SetConstants(const float minZCoordinate, const float decayConstant)
Set the beam constants.
ShowerCluster(const pandora::ClusterList &clusterList, const int slidingFitWindow, const float slidingFitPitch)
Constructor.
pandora::CartesianPointVector GetClusterListCoordinateVector(const pandora::ClusterList &clusterList) const
Get the coordinate vector for a cluster list.
pandora::CartesianVector m_minLayerDirection
The direction of the fit at the min layer.
pandora::CartesianVector m_maxLayerDirection
The direction of the fit at the min layer.
pandora::CartesianVector m_maxLayerPosition
The position of the fit at the max layer.
SlidingFitData(const pandora::Cluster *const pCluster, const int slidingFitWindow, const float slidingFitPitch)
Constructor.
pandora::CartesianVector m_minLayerPosition
The position of the fit at the max layer.
bool AcceptVertexLocation(const pandora::Vertex *const pVertex, const pandora::VertexList &selectedVertexList) const
Whether to accept a candidate vertex, based on its spatial position in relation to other selected can...
std::string m_outputVertexListName
The name under which to save the output vertex list.
std::map< pandora::HitType, const std::reference_wrapper< HitKDTree2D > > KDTreeMap
Map array of hit kd trees for passing to tools.
float m_nDecayLengthsInZSpan
The number of score decay lengths to use over the course of the vertex z-span.
void InitializeKDTrees(HitKDTree2D &kdTreeU, HitKDTree2D &kdTreeV, HitKDTree2D &kdTreeW) const
Initialize kd trees with details of hits in algorithm-configured cluster lists.
void GetClusterLists(const pandora::StringVector &inputClusterListNames, pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW) const
Get the cluster lists.
float m_maxOnHitDisplacement
Max hit-vertex displacement for declaring vertex to lie on a hit in each view.
pandora::StringVector m_inputCaloHitListNames
The list of calo hit list names.
void CalculateClusterSlidingFits(const pandora::ClusterList &inputClusterList, const unsigned int minClusterCaloHits, const unsigned int slidingFitWindow, SlidingFitDataList &slidingFitDataList) const
Calculate the cluster sliding fits.
unsigned int m_minVertexAcceptableViews
The minimum number of views in which a candidate must sit on/near a hit or in a gap (or view can be e...
bool m_replaceCurrentVertexList
Whether to replace the current vertex list with the output list.
bool IsVertexOnHit(const pandora::Vertex *const pVertex, const pandora::HitType hitType, HitKDTree2D &kdTree) const
Whether the vertex lies on a hit in the specified view.
float m_minCandidateScoreFraction
Ignore other top-scoring candidates with score less than a fraction of original.
static bool SortByVertexZPosition(const pandora::Vertex *const pLhs, const pandora::Vertex *const pRhs)
Sort vertices by increasing z position.
bool m_useDetectorGaps
Whether to account for registered detector gaps in vertex selection.
float m_gapTolerance
The tolerance to use when querying whether a sampling point is in a gap, units cm.
void SelectTopScoreVertices(VertexScoreList &vertexScoreList, pandora::VertexList &selectedVertexList) const
From the top-scoring candidate vertices, select a subset for further investigation.
float GetVertexEnergy(const pandora::Vertex *const pVertex, const KDTreeMap &kdTreeMap) const
Calculate the energy of a vertex candidate by summing values from all three planes.
bool m_selectSingleVertex
Whether to make a final decision and select just one vertex candidate.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
float m_minCandidateDisplacement
Ignore other top-scoring candidates located in close proximity to original.
bool m_beamMode
Whether to run in beam mode, assuming neutrinos travel in positive z-direction.
virtual void GetVertexScoreList(const pandora::VertexVector &vertexVector, const BeamConstants &beamConstants, HitKDTree2D &kdTreeU, HitKDTree2D &kdTreeV, HitKDTree2D &kdTreeW, VertexScoreList &vertexScoreList) const =0
Get the vertex score list for a provided list of candidate vertices.
pandora::StatusCode Run()
Run the algorithm.
bool IsVertexInGap(const pandora::Vertex *const pVertex, const pandora::HitType hitType) const
Whether the vertex lies in a registered gap.
bool m_isEmptyViewAcceptable
Whether views entirely empty of hits are classed as 'acceptable' for candidate filtration.
virtual void FilterVertexList(const pandora::VertexList *const pInputVertexList, HitKDTree2D &kdTreeU, HitKDTree2D &kdTreeV, HitKDTree2D &kdTreeW, pandora::VertexVector &filteredVertices) const
Filter the input list of vertices to obtain a reduced number of vertex candidates.
virtual void GetBeamConstants(const pandora::VertexVector &vertexVector, BeamConstants &beamConstants) const
Get the beam score constants for a provided list of candidate vertices.
unsigned int m_maxTopScoreSelections
Max number of top-scoring vertex candidate to select for output.
float VertexHitEnergy(const pandora::Vertex *const pVertex, const pandora::HitType hitType, HitKDTree2D &kdTree) const
Finds the energy of the nearest hit to the vertex candidate in this view.
CartesianVector class.
float GetX() const
Get the cartesian x coordinate.
float GetZ() const
Get the cartesian z coordinate.
float GetY() const
Get the cartesian y coordinate.
Cluster class.
Definition Cluster.h:31
bool ShouldDisplayAlgorithmInfo() const
Whether to display algorithm information during processing.
const Pandora & GetPandora() const
Get the associated pandora instance.
Definition Process.h:116
StatusCodeException class.
Vertex class.
Definition Vertex.h:26
const CartesianVector & GetPosition() const
Get the vertex position.
Definition Vertex.h:103
static StatusCode ReadVectorOfValues(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, std::vector< T > &vector)
Read a vector of values from a (space separated) list in an xml element.
Definition XmlHelper.h:229
static StatusCode ReadValue(const TiXmlHandle &xmlHandle, const std::string &xmlElementName, T &t)
Read a value from an xml element.
Definition XmlHelper.h:136
KDTreeBox fill_and_bound_2d_kd_tree(const MANAGED_CONTAINER< const T * > &points, std::vector< KDTreeNodeInfoT< const T *, 2 > > &nodes)
fill_and_bound_2d_kd_tree
KDTreeBox build_2d_kd_search_region(const pandora::CaloHit *const point, const float x_span, const float z_span)
build_2d_kd_search_region
HitType
Calorimeter hit type enum.
std::vector< const Cluster * > ClusterVector
MANAGED_CONTAINER< const Cluster * > ClusterList
std::vector< std::string > StringVector
std::vector< CartesianVector > CartesianPointVector
MANAGED_CONTAINER< const CaloHit * > CaloHitList
MANAGED_CONTAINER< const Vertex * > VertexList
StatusCode
The StatusCode enum.
std::vector< const Vertex * > VertexVector