LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
VertexSelectionBaseAlgorithm.cc
Go to the documentation of this file.
1 
8 #include "Pandora/AlgorithmHeaders.h"
9 
12 
14 
16 
17 using namespace pandora;
18 
19 namespace lar_content
20 {
21 
22 VertexSelectionBaseAlgorithm::VertexSelectionBaseAlgorithm() :
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 
40 void 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 
65 void 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 
91 void VertexSelectionBaseAlgorithm::GetClusterLists(const StringVector &inputClusterListNames, ClusterList &clusterListU, ClusterList &clusterListV,
92  ClusterList &clusterListW) const
93 {
94  for (const std::string &clusterListName : inputClusterListNames)
95  {
96  const ClusterList *pClusterList(NULL);
97  PANDORA_THROW_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, clusterListName, pClusterList));
98 
99  if (!pClusterList || pClusterList->empty())
100  {
101  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
102  std::cout << "EnergyKickVertexSelectionAlgorithm: unable to find cluster list " << clusterListName << std::endl;
103 
104  continue;
105  }
106 
107  const HitType hitType(LArClusterHelper::GetClusterHitType(*(pClusterList->begin())));
108 
109  if ((TPC_VIEW_U != hitType) && (TPC_VIEW_V != hitType) && (TPC_VIEW_W != hitType))
110  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
111 
112  ClusterList &clusterList((TPC_VIEW_U == hitType) ? clusterListU : (TPC_VIEW_V == hitType) ? clusterListV : clusterListW);
113  clusterList.insert(clusterList.end(), pClusterList->begin(), pClusterList->end());
114  }
115 }
116 
117 //------------------------------------------------------------------------------------------------------------------------------------------
118 
119 void VertexSelectionBaseAlgorithm::CalculateClusterSlidingFits(const ClusterList &inputClusterList, const unsigned int minClusterCaloHits,
120  const unsigned int slidingFitWindow, SlidingFitDataList &slidingFitDataList) const
121 {
122  const float slidingFitPitch(LArGeometryHelper::GetWireZPitch(this->GetPandora()));
123 
124  ClusterVector sortedClusters(inputClusterList.begin(), inputClusterList.end());
125  std::sort(sortedClusters.begin(), sortedClusters.end(), LArClusterHelper::SortByNHits);
126 
127  for (const Cluster * const pCluster : sortedClusters)
128  {
129  if (pCluster->GetNCaloHits() < minClusterCaloHits)
130  continue;
131 
132  // Make sure the window size is such that there are not more layers than hits (following TwoDSlidingLinearFit calculation).
133  const unsigned int newSlidingFitWindow(std::min(static_cast<int>(pCluster->GetNCaloHits()), static_cast<int>(slidingFitPitch * slidingFitWindow)));
134  slidingFitDataList.emplace_back(pCluster, newSlidingFitWindow, slidingFitPitch);
135  }
136 }
137 
138 //------------------------------------------------------------------------------------------------------------------------------------------
139 
141 {
142  const VertexList *pInputVertexList(NULL);
143  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetCurrentList(*this, pInputVertexList));
144 
145  if (!pInputVertexList || pInputVertexList->empty())
146  {
147  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
148  std::cout << "VertexSelectionBaseAlgorithm: unable to find current vertex list " << std::endl;
149 
150  return STATUS_CODE_SUCCESS;
151  }
152 
153  HitKDTree2D kdTreeU, kdTreeV, kdTreeW;
154  this->InitializeKDTrees(kdTreeU, kdTreeV, kdTreeW);
155 
156  VertexVector filteredVertices;
157  this->FilterVertexList(pInputVertexList, kdTreeU, kdTreeV, kdTreeW, filteredVertices);
158 
159  if (filteredVertices.empty())
160  return STATUS_CODE_SUCCESS;
161 
162  BeamConstants beamConstants;
163  this->GetBeamConstants(filteredVertices, beamConstants);
164 
165  VertexScoreList vertexScoreList;
166  this->GetVertexScoreList(filteredVertices, beamConstants, kdTreeU, kdTreeV, kdTreeW, vertexScoreList);
167 
168  VertexList selectedVertexList;
169  this->SelectTopScoreVertices(vertexScoreList, selectedVertexList);
170 
171  if (!selectedVertexList.empty())
172  {
173  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::SaveList(*this, m_outputVertexListName, selectedVertexList));
174 
176  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::ReplaceCurrentList<Vertex>(*this, m_outputVertexListName));
177  }
178 
179  return STATUS_CODE_SUCCESS;
180 }
181 
182 //------------------------------------------------------------------------------------------------------------------------------------------
183 
185 {
186  for (const std::string &caloHitListName : m_inputCaloHitListNames)
187  {
188  const CaloHitList *pCaloHitList = NULL;
189  PANDORA_THROW_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, caloHitListName, pCaloHitList));
190 
191  if (!pCaloHitList || pCaloHitList->empty())
192  {
193  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
194  std::cout << "VertexSelectionBaseAlgorithm: unable to find calo hit list " << caloHitListName << std::endl;
195 
196  continue;
197  }
198 
199  const HitType hitType((*(pCaloHitList->begin()))->GetHitType());
200 
201  if ((TPC_VIEW_U != hitType) && (TPC_VIEW_V != hitType) && (TPC_VIEW_W != hitType))
202  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
203 
204  HitKDTree2D &kdTree((TPC_VIEW_U == hitType) ? kdTreeU : (TPC_VIEW_V == hitType) ? kdTreeV : kdTreeW);
205 
206  if (!kdTree.empty())
207  throw StatusCodeException(STATUS_CODE_FAILURE);
208 
209  HitKDNode2DList hitKDNode2DList;
210  KDTreeBox hitsBoundingRegion2D(fill_and_bound_2d_kd_tree(*pCaloHitList, hitKDNode2DList));
211  kdTree.build(hitKDNode2DList, hitsBoundingRegion2D);
212  }
213 }
214 
215 //------------------------------------------------------------------------------------------------------------------------------------------
216 
217 bool VertexSelectionBaseAlgorithm::IsVertexOnHit(const Vertex *const pVertex, const HitType hitType, HitKDTree2D &kdTree) const
218 {
219  const CartesianVector vertexPosition2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex->GetPosition(), hitType));
221 
222  HitKDNode2DList found;
223  kdTree.search(searchRegionHits, found);
224 
225  return (!found.empty());
226 }
227 
228 //------------------------------------------------------------------------------------------------------------------------------------------
229 
230 bool VertexSelectionBaseAlgorithm::IsVertexInGap(const Vertex *const pVertex, const HitType hitType) const
231 {
232  if (!m_useDetectorGaps)
233  return false;
234 
235  return LArGeometryHelper::IsInGap3D(this->GetPandora(), pVertex->GetPosition(), hitType, m_gapTolerance);
236 }
237 
238 //------------------------------------------------------------------------------------------------------------------------------------------
239 
240 void VertexSelectionBaseAlgorithm::SelectTopScoreVertices(VertexScoreList &vertexScoreList, VertexList &selectedVertexList) const
241 {
242  float bestScore(0.f);
243  std::sort(vertexScoreList.begin(), vertexScoreList.end());
244 
245  for (const VertexScore &vertexScore : vertexScoreList)
246  {
247  if (selectedVertexList.size() >= m_maxTopScoreSelections)
248  break;
249 
250  if (!selectedVertexList.empty() && !this->AcceptVertexLocation(vertexScore.GetVertex(), selectedVertexList))
251  continue;
252 
253  if (!selectedVertexList.empty() && (vertexScore.GetScore() < m_minCandidateScoreFraction * bestScore))
254  continue;
255 
256  selectedVertexList.push_back(vertexScore.GetVertex());
257 
259  return;
260 
261  if (vertexScore.GetScore() > bestScore)
262  bestScore = vertexScore.GetScore();
263  }
264 }
265 
266 //------------------------------------------------------------------------------------------------------------------------------------------
267 
268 bool VertexSelectionBaseAlgorithm::AcceptVertexLocation(const Vertex *const pVertex, const VertexList &selectedVertexList) const
269 {
270  const CartesianVector &position(pVertex->GetPosition());
271  const float minCandidateDisplacementSquared(m_minCandidateDisplacement * m_minCandidateDisplacement);
272 
273  for (const Vertex *const pSelectedVertex : selectedVertexList)
274  {
275  if (pVertex == pSelectedVertex)
276  return false;
277 
278  if ((position - pSelectedVertex->GetPosition()).GetMagnitudeSquared() < minCandidateDisplacementSquared)
279  return false;
280  }
281 
282  return true;
283 }
284 
285 //------------------------------------------------------------------------------------------------------------------------------------------
286 
287 bool VertexSelectionBaseAlgorithm::SortByVertexZPosition(const pandora::Vertex *const pLhs, const pandora::Vertex *const pRhs)
288 {
289  const CartesianVector deltaPosition(pRhs->GetPosition() - pLhs->GetPosition());
290 
291  if (std::fabs(deltaPosition.GetZ()) > std::numeric_limits<float>::epsilon())
292  return (deltaPosition.GetZ() > std::numeric_limits<float>::epsilon());
293 
294  if (std::fabs(deltaPosition.GetX()) > std::numeric_limits<float>::epsilon())
295  return (deltaPosition.GetX() > std::numeric_limits<float>::epsilon());
296 
297  // ATTN No way to distinguish between vertices if still have a tie in y coordinate
298  return (deltaPosition.GetY() > std::numeric_limits<float>::epsilon());
299 }
300 
301 //------------------------------------------------------------------------------------------------------------------------------------------
302 
303 VertexSelectionBaseAlgorithm::SlidingFitData::SlidingFitData(const pandora::Cluster *const pCluster, const int slidingFitWindow,
304  const float slidingFitPitch) :
305  m_minLayerDirection(0.f, 0.f, 0.f),
306  m_maxLayerDirection(0.f, 0.f, 0.f),
307  m_minLayerPosition(0.f, 0.f, 0.f),
308  m_maxLayerPosition(0.f, 0.f, 0.f),
309  m_pCluster(pCluster)
310 {
311  const TwoDSlidingFitResult slidingFitResult(pCluster, slidingFitWindow, slidingFitPitch);
312  m_minLayerDirection = slidingFitResult.GetGlobalMinLayerDirection();
313  m_maxLayerDirection = slidingFitResult.GetGlobalMaxLayerDirection();
314  m_minLayerPosition = slidingFitResult.GetGlobalMinLayerPosition();
315  m_maxLayerPosition = slidingFitResult.GetGlobalMaxLayerPosition();
316 }
317 
318 //------------------------------------------------------------------------------------------------------------------------------------------
319 
320 VertexSelectionBaseAlgorithm::ShowerCluster::ShowerCluster(const pandora::ClusterList &clusterList, const int slidingFitWindow,
321  const float slidingFitPitch) :
322  m_clusterList(clusterList),
323  m_coordinateVector(this->GetClusterListCoordinateVector(clusterList)),
324  m_twoDSlidingFitResult(&m_coordinateVector, slidingFitWindow, slidingFitPitch)
325 {
326 }
327 
328 //------------------------------------------------------------------------------------------------------------------------------------------
329 
330 pandora::CartesianPointVector VertexSelectionBaseAlgorithm::ShowerCluster::GetClusterListCoordinateVector(const pandora::ClusterList &clusterList) const
331 {
332  CartesianPointVector coordinateVector;
333 
334  for (const Cluster * const pCluster : clusterList)
335  {
336  CartesianPointVector clusterCoordinateVector;
337  LArClusterHelper::GetCoordinateVector(pCluster, clusterCoordinateVector);
338 
339  coordinateVector.insert(coordinateVector.end(), std::make_move_iterator(clusterCoordinateVector.begin()),
340  std::make_move_iterator(clusterCoordinateVector.end()));
341  }
342 
343  return coordinateVector;
344 }
345 
346 //------------------------------------------------------------------------------------------------------------------------------------------
347 //------------------------------------------------------------------------------------------------------------------------------------------
348 
349 StatusCode VertexSelectionBaseAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
350 {
351  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadVectorOfValues(xmlHandle,
352  "InputCaloHitListNames", m_inputCaloHitListNames));
353 
354  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadValue(xmlHandle,
355  "OutputVertexListName", m_outputVertexListName));
356 
357  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
358  "ReplaceCurrentVertexList", m_replaceCurrentVertexList));
359 
360  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
361  "BeamMode", m_beamMode));
362 
363  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
364  "NDecayLengthsInZSpan", m_nDecayLengthsInZSpan));
365 
366  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
367  "SelectSingleVertex", m_selectSingleVertex));
368 
369  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
370  "MaxTopScoreSelections", m_maxTopScoreSelections));
371 
372  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
373  "MaxOnHitDisplacement", m_maxOnHitDisplacement));
374 
375  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
376  "MinCandidateDisplacement", m_minCandidateDisplacement));
377 
378  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
379  "MinCandidateScoreFraction", m_minCandidateScoreFraction));
380 
381  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
382  "UseDetectorGaps", m_useDetectorGaps));
383 
384  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
385  "GapTolerance", m_gapTolerance));
386 
387  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
388  "IsEmptyViewAcceptable", m_isEmptyViewAcceptable));
389 
390  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
391  "MinVertexAcceptableViews", m_minVertexAcceptableViews));
392 
393  return STATUS_CODE_SUCCESS;
394 }
395 
396 } // namespace lar_content
float m_minCandidateScoreFraction
Ignore other top-scoring candidates with score less than a fraction of original.
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, then pulse-height.
Header file for the kd tree linker algo template class.
void SetConstants(const float minZCoordinate, const float decayConstant)
Set the beam constants.
pandora::CartesianPointVector GetClusterListCoordinateVector(const pandora::ClusterList &clusterList) const
Get the coordinate vector for a cluster list.
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.
std::string m_outputVertexListName
The name under which to save the output vertex list.
pandora::StringVector m_inputCaloHitListNames
The list of calo hit list names.
void GetClusterLists(const pandora::StringVector &inputClusterListNames, pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW) const
Get the cluster lists.
Class that implements the KDTree partition of 2D space and a closest point search algorithm...
void CalculateClusterSlidingFits(const pandora::ClusterList &inputClusterList, const unsigned int minClusterCaloHits, const unsigned int slidingFitWindow, SlidingFitDataList &slidingFitDataList) const
Calculate the cluster sliding fits.
Box structure used to define 2D field. It&#39;s used in KDTree building step to divide the detector space...
pandora::CartesianVector m_minLayerPosition
The position of the fit at the max layer.
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 pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
pandora::CartesianVector GetGlobalMinLayerDirection() const
Get global direction corresponding to the fit result in minimum fit layer.
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
bool empty()
Whether the tree is empty.
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.
TFile f
Definition: plotHisto.C:6
pandora::CartesianVector m_maxLayerDirection
The direction of the fit at the min 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...
Header file for the geometry helper class.
Int_t max
Definition: plot.C:27
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...
virtual void GetBeamConstants(const pandora::VertexVector &vertexVector, BeamConstants &beamConstants) const
Get the beam score constants for a provided list of candidate vertices.
ShowerCluster(const pandora::ClusterList &clusterList, const int slidingFitWindow, const float slidingFitPitch)
Constructor.
unsigned int m_maxTopScoreSelections
Max number of top-scoring vertex candidate to select for output.
pandora::CartesianVector m_minLayerDirection
The direction of the fit at the min layer.
bool IsVertexInGap(const pandora::Vertex *const pVertex, const pandora::HitType hitType) const
Whether the vertex lies in a registered gap.
Header file for the cluster helper class.
SlidingFitData(const pandora::Cluster *const pCluster, const int slidingFitWindow, const float slidingFitPitch)
Constructor.
Header file for the vertex selection base algorithm class.
pandora::CartesianVector m_maxLayerPosition
The position of the fit at the max layer.
bool m_useDetectorGaps
Whether to account for registered detector gaps in vertex selection.
static bool SortByVertexZPosition(const pandora::Vertex *const pLhs, const pandora::Vertex *const pRhs)
Sort vertices by increasing z position.
pandora::CartesianVector GetGlobalMinLayerPosition() const
Get global position corresponding to the fit result in minimum fit layer.
void InitializeKDTrees(HitKDTree2D &kdTreeU, HitKDTree2D &kdTreeV, HitKDTree2D &kdTreeW) const
Initialize kd trees with details of hits in algorithm-configured cluster lists.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
bool m_beamMode
Whether to run in beam mode, assuming neutrinos travel in positive z-direction.
bool m_isEmptyViewAcceptable
Whether views entirely empty of hits are classed as &#39;acceptable&#39; for candidate filtration.
bool m_selectSingleVertex
Whether to make a final decision and select just one vertex candidate.
Int_t min
Definition: plot.C:26
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...
pandora::CartesianVector GetGlobalMaxLayerDirection() const
Get global direction corresponding to the fit result in maximum fit layer.
static void GetCoordinateVector(const pandora::Cluster *const pCluster, pandora::CartesianPointVector &coordinateVector)
Get vector of hit coordinates from an input cluster.
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.
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
void SelectTopScoreVertices(VertexScoreList &vertexScoreList, pandora::VertexList &selectedVertexList) const
From the top-scoring candidate vertices, select a subset for further investigation.
float m_nDecayLengthsInZSpan
The number of score decay lengths to use over the course of the vertex z-span.
float m_minCandidateDisplacement
Ignore other top-scoring candidates located in close proximity to original.
bool m_replaceCurrentVertexList
Whether to replace the current vertex list with the output list.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
KDTreeBox build_2d_kd_search_region(const pandora::CaloHit *const point, const float x_span, const float z_span)
build_2d_kd_search_region
std::list< Vertex > VertexList
Definition: DCEL.h:178
float m_gapTolerance
The tolerance to use when querying whether a sampling point is in a gap, units cm.
pandora::CartesianVector GetGlobalMaxLayerPosition() const
Get global position corresponding to the fit result in maximum fit layer.
float m_maxOnHitDisplacement
Max hit-vertex displacement for declaring vertex to lie on a hit in each 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.
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".
std::vector< art::Ptr< recob::Vertex > > VertexVector