LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ThreeViewShowersAlgorithm.cc
Go to the documentation of this file.
1 
9 #include "Pandora/AlgorithmHeaders.h"
10 
13 
15 
16 using namespace pandora;
17 
18 namespace lar_content
19 {
20 
21 ThreeViewShowersAlgorithm::ThreeViewShowersAlgorithm() :
22  m_nMaxTensorToolRepeats(1000),
23  m_slidingFitWindow(20),
24  m_ignoreUnavailableClusters(true),
25  m_minClusterCaloHits(5),
26  m_minClusterLengthSquared(3.f * 3.f),
27  m_minShowerMatchedFraction(0.2f),
28  m_minShowerMatchedPoints(20),
29  m_visualize(false)
30 {
31 }
32 
33 //------------------------------------------------------------------------------------------------------------------------------------------
34 
36 {
38 
39  if (m_slidingFitResultMap.end() == iter)
40  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
41 
42  return iter->second;
43 }
44 
45 //------------------------------------------------------------------------------------------------------------------------------------------
46 
47 void ThreeViewShowersAlgorithm::UpdateForNewCluster(const Cluster *const pNewCluster)
48 {
49  try
50  {
51  this->AddToSlidingFitCache(pNewCluster);
52  }
53  catch (StatusCodeException &statusCodeException)
54  {
55  if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
56  throw statusCodeException;
57 
58  return;
59  }
60 
62 }
63 
64 //------------------------------------------------------------------------------------------------------------------------------------------
65 
66 void ThreeViewShowersAlgorithm::UpdateUponDeletion(const Cluster *const pDeletedCluster)
67 {
68  this->RemoveFromSlidingFitCache(pDeletedCluster);
69  BaseAlgorithm::UpdateUponDeletion(pDeletedCluster);
70 }
71 
72 //------------------------------------------------------------------------------------------------------------------------------------------
73 
74 void ThreeViewShowersAlgorithm::SelectInputClusters(const ClusterList *const pInputClusterList, ClusterList &selectedClusterList) const
75 {
76  for (ClusterList::const_iterator iter = pInputClusterList->begin(), iterEnd = pInputClusterList->end(); iter != iterEnd; ++iter)
77  {
78  const Cluster *const pCluster = *iter;
79 
80  if (m_ignoreUnavailableClusters && !pCluster->IsAvailable())
81  continue;
82 
83  if (pCluster->GetNCaloHits() < m_minClusterCaloHits)
84  continue;
85 
87  continue;
88 
89  selectedClusterList.push_back(pCluster);
90  }
91  if (m_visualize)
92  {
93  PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &selectedClusterList, "Selected Clusters", RED));
94  PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
95  }
96 }
97 
98 //------------------------------------------------------------------------------------------------------------------------------------------
99 
100 void ThreeViewShowersAlgorithm::PrepareInputClusters(ClusterList &preparedClusterList)
101 {
102  for (ClusterList::iterator iter = preparedClusterList.begin(), iterEnd = preparedClusterList.end(); iter != iterEnd;)
103  {
104  const Cluster *const pCluster(*iter);
105 
106  try
107  {
108  this->AddToSlidingFitCache(pCluster);
109  ++iter;
110  }
111  catch (StatusCodeException &statusCodeException)
112  {
113  preparedClusterList.erase(iter++);
114 
115  if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
116  throw statusCodeException;
117  }
118  }
119  if (m_visualize)
120  {
121  PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &preparedClusterList, "Prepared Clusters", GREEN));
122  PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
123  }
124 }
125 
126 //------------------------------------------------------------------------------------------------------------------------------------------
127 
129 {
130  m_slidingFitResultMap.clear();
131  return BaseAlgorithm::TidyUp();
132 }
133 
134 //------------------------------------------------------------------------------------------------------------------------------------------
135 
136 void ThreeViewShowersAlgorithm::AddToSlidingFitCache(const Cluster *const pCluster)
137 {
138  const float slidingFitPitch(LArGeometryHelper::GetWirePitch(this->GetPandora(), LArClusterHelper::GetClusterHitType(pCluster)));
139  const TwoDSlidingShowerFitResult slidingShowerFitResult(pCluster, m_slidingFitWindow, slidingFitPitch);
140 
141  if (!m_slidingFitResultMap.insert(TwoDSlidingShowerFitResultMap::value_type(pCluster, slidingShowerFitResult)).second)
142  throw StatusCodeException(STATUS_CODE_FAILURE);
143 }
144 
145 //------------------------------------------------------------------------------------------------------------------------------------------
146 
147 void ThreeViewShowersAlgorithm::RemoveFromSlidingFitCache(const Cluster *const pCluster)
148 {
150 
151  if (m_slidingFitResultMap.end() != iter)
152  m_slidingFitResultMap.erase(iter);
153 }
154 
155 //------------------------------------------------------------------------------------------------------------------------------------------
156 
157 void ThreeViewShowersAlgorithm::CalculateOverlapResult(const Cluster *const pClusterU, const Cluster *const pClusterV, const Cluster *const pClusterW)
158 {
159  ShowerOverlapResult overlapResult;
160  PANDORA_THROW_RESULT_IF_AND_IF(
161  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, this->CalculateOverlapResult(pClusterU, pClusterV, pClusterW, overlapResult));
162 
163  if (overlapResult.IsInitialized())
164  this->GetMatchingControl().GetOverlapTensor().SetOverlapResult(pClusterU, pClusterV, pClusterW, overlapResult);
165 }
166 
167 //------------------------------------------------------------------------------------------------------------------------------------------
168 
170  const Cluster *const pClusterU, const Cluster *const pClusterV, const Cluster *const pClusterW, ShowerOverlapResult &overlapResult)
171 {
172  const TwoDSlidingShowerFitResult &fitResultU(this->GetCachedSlidingFitResult(pClusterU));
173  const TwoDSlidingShowerFitResult &fitResultV(this->GetCachedSlidingFitResult(pClusterV));
174  const TwoDSlidingShowerFitResult &fitResultW(this->GetCachedSlidingFitResult(pClusterW));
175 
176  const XSampling xSampling(fitResultU.GetShowerFitResult(), fitResultV.GetShowerFitResult(), fitResultW.GetShowerFitResult());
177 
178  if (xSampling.m_xOverlapSpan < std::numeric_limits<float>::epsilon())
179  return STATUS_CODE_NOT_FOUND;
180 
181  ShowerPositionMapPair positionMapsU, positionMapsV, positionMapsW;
182  this->GetShowerPositionMaps(fitResultU, fitResultV, fitResultW, xSampling, positionMapsU, positionMapsV, positionMapsW);
183 
184  unsigned int nSampledHitsU(0), nMatchedHitsU(0);
185  this->GetBestHitOverlapFraction(pClusterU, xSampling, positionMapsU, nSampledHitsU, nMatchedHitsU);
186 
187  unsigned int nSampledHitsV(0), nMatchedHitsV(0);
188  this->GetBestHitOverlapFraction(pClusterV, xSampling, positionMapsV, nSampledHitsV, nMatchedHitsV);
189 
190  unsigned int nSampledHitsW(0), nMatchedHitsW(0);
191  this->GetBestHitOverlapFraction(pClusterW, xSampling, positionMapsW, nSampledHitsW, nMatchedHitsW);
192 
193  const unsigned int nMatchedHits(nMatchedHitsU + nMatchedHitsV + nMatchedHitsW);
194  const unsigned int nSampledHits(nSampledHitsU + nSampledHitsV + nSampledHitsW);
195 
196  if (0 == nSampledHits)
197  return STATUS_CODE_NOT_FOUND;
198 
199  const XOverlap xOverlapObject(xSampling.m_uMinX, xSampling.m_uMaxX, xSampling.m_vMinX, xSampling.m_vMaxX, xSampling.m_wMinX,
200  xSampling.m_wMaxX, xSampling.m_xOverlapSpan);
201  const ShowerOverlapResult showerOverlapResult(nMatchedHits, nSampledHits, xOverlapObject);
202 
203  if ((showerOverlapResult.GetMatchedFraction() < m_minShowerMatchedFraction) || (showerOverlapResult.GetNMatchedSamplingPoints() < m_minShowerMatchedPoints))
204  return STATUS_CODE_NOT_FOUND;
205 
206  if (m_visualize)
207  {
208  ClusterList clusterList{pClusterU, pClusterV, pClusterW};
209  PANDORA_MONITORING_API(VisualizeClusters(this->GetPandora(), &clusterList, "Overlapping Clusters", BLUE));
210  PANDORA_MONITORING_API(ViewEvent(this->GetPandora()));
211  }
212 
213  overlapResult = showerOverlapResult;
214  return STATUS_CODE_SUCCESS;
215 }
216 
217 //------------------------------------------------------------------------------------------------------------------------------------------
218 
220  const TwoDSlidingShowerFitResult &fitResultV, const TwoDSlidingShowerFitResult &fitResultW, const XSampling &xSampling,
221  ShowerPositionMapPair &positionMapsU, ShowerPositionMapPair &positionMapsV, ShowerPositionMapPair &positionMapsW) const
222 {
223  const unsigned int nPoints(static_cast<unsigned int>(xSampling.m_nPoints));
224 
225  for (unsigned n = 0; n <= nPoints; ++n)
226  {
227  const float x(xSampling.m_minX + (xSampling.m_maxX - xSampling.m_minX) * static_cast<float>(n) / static_cast<float>(nPoints));
228 
229  int xBin(-1);
230  if (STATUS_CODE_SUCCESS != xSampling.GetBin(x, xBin))
231  continue;
232 
233  FloatVector uValues, vValues, wValues;
234  fitResultU.GetShowerEdges(x, true, uValues);
235  fitResultV.GetShowerEdges(x, true, vValues);
236  fitResultW.GetShowerEdges(x, true, wValues);
237 
238  std::sort(uValues.begin(), uValues.end());
239  std::sort(vValues.begin(), vValues.end());
240  std::sort(wValues.begin(), wValues.end());
241 
242  if ((uValues.size() > 1) && (vValues.size() > 1))
243  {
244  const float uMin(uValues.front()), uMax(uValues.back());
245  const float vMin(vValues.front()), vMax(vValues.back());
246  const float uv2wMinMin(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_V, uMin, vMin));
247  const float uv2wMaxMax(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_V, uMax, vMax));
248  const float uv2wMinMax(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_V, uMin, vMax));
249  const float uv2wMaxMin(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_V, uMax, vMin));
250  positionMapsW.first.insert(ShowerPositionMap::value_type(xBin, ShowerExtent(x, uv2wMinMin, uv2wMaxMax)));
251  positionMapsW.second.insert(ShowerPositionMap::value_type(xBin, ShowerExtent(x, uv2wMinMax, uv2wMaxMin)));
252  }
253 
254  if ((uValues.size() > 1) && (wValues.size() > 1))
255  {
256  const float uMin(uValues.front()), uMax(uValues.back());
257  const float wMin(wValues.front()), wMax(wValues.back());
258  const float uw2vMinMin(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_W, uMin, wMin));
259  const float uw2vMaxMax(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_W, uMax, wMax));
260  const float uw2vMinMax(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_W, uMin, wMax));
261  const float uw2vMaxMin(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_W, uMax, wMin));
262  positionMapsV.first.insert(ShowerPositionMap::value_type(xBin, ShowerExtent(x, uw2vMinMin, uw2vMaxMax)));
263  positionMapsV.second.insert(ShowerPositionMap::value_type(xBin, ShowerExtent(x, uw2vMinMax, uw2vMaxMin)));
264  }
265 
266  if ((vValues.size() > 1) && (wValues.size() > 1))
267  {
268  const float vMin(vValues.front()), vMax(vValues.back());
269  const float wMin(wValues.front()), wMax(wValues.back());
270  const float vw2uMinMin(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_V, TPC_VIEW_W, vMin, wMin));
271  const float vw2uMaxMax(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_V, TPC_VIEW_W, vMax, wMax));
272  const float vw2uMinMax(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_V, TPC_VIEW_W, vMin, wMax));
273  const float vw2uMaxMin(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_V, TPC_VIEW_W, vMax, wMin));
274  positionMapsU.first.insert(ShowerPositionMap::value_type(xBin, ShowerExtent(x, vw2uMinMin, vw2uMaxMax)));
275  positionMapsU.second.insert(ShowerPositionMap::value_type(xBin, ShowerExtent(x, vw2uMinMax, vw2uMaxMin)));
276  }
277  }
278 }
279 
280 //------------------------------------------------------------------------------------------------------------------------------------------
281 
282 void ThreeViewShowersAlgorithm::GetBestHitOverlapFraction(const Cluster *const pCluster, const XSampling &xSampling,
283  const ShowerPositionMapPair &positionMaps, unsigned int &nSampledHits, unsigned int &nMatchedHits) const
284 {
285  if ((xSampling.m_maxX - xSampling.m_minX) < std::numeric_limits<float>::epsilon())
286  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
287 
288  nSampledHits = 0;
289  nMatchedHits = 0;
290  unsigned int nMatchedHits1(0), nMatchedHits2(0);
291  const OrderedCaloHitList &orderedCaloHitList(pCluster->GetOrderedCaloHitList());
292 
293  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
294  {
295  for (CaloHitList::const_iterator hIter = iter->second->begin(), hIterEnd = iter->second->end(); hIter != hIterEnd; ++hIter)
296  {
297  const CaloHit *const pCaloHit = *hIter;
298  const float x(pCaloHit->GetPositionVector().GetX());
299  const float z(pCaloHit->GetPositionVector().GetZ());
300 
301  int xBin(-1);
302  if (STATUS_CODE_SUCCESS != xSampling.GetBin(x, xBin))
303  continue;
304 
305  ++nSampledHits;
306 
307  ShowerPositionMap::const_iterator positionIter1 = positionMaps.first.find(xBin);
308  ShowerPositionMap::const_iterator positionIter2 = positionMaps.second.find(xBin);
309 
310  if ((positionMaps.first.end() != positionIter1) && (z > positionIter1->second.GetLowEdgeZ()) && (z < positionIter1->second.GetHighEdgeZ()))
311  ++nMatchedHits1;
312 
313  if ((positionMaps.second.end() != positionIter2) && (z > positionIter2->second.GetLowEdgeZ()) && (z < positionIter2->second.GetHighEdgeZ()))
314  ++nMatchedHits2;
315  }
316  }
317 
318  nMatchedHits = std::max(nMatchedHits1, nMatchedHits2);
319 }
320 
321 //------------------------------------------------------------------------------------------------------------------------------------------
322 
324 {
325  unsigned int repeatCounter(0);
326 
327  for (TensorToolVector::const_iterator iter = m_algorithmToolVector.begin(), iterEnd = m_algorithmToolVector.end(); iter != iterEnd;)
328  {
329  if ((*iter)->Run(this, this->GetMatchingControl().GetOverlapTensor()))
330  {
331  iter = m_algorithmToolVector.begin();
332 
333  if (++repeatCounter > m_nMaxTensorToolRepeats)
334  break;
335  }
336  else
337  {
338  ++iter;
339  }
340  }
341 }
342 
343 //------------------------------------------------------------------------------------------------------------------------------------------
344 //------------------------------------------------------------------------------------------------------------------------------------------
345 
347  const TwoDSlidingFitResult &fitResultU, const TwoDSlidingFitResult &fitResultV, const TwoDSlidingFitResult &fitResultW)
348 {
349  fitResultU.GetMinAndMaxX(m_uMinX, m_uMaxX);
350  fitResultV.GetMinAndMaxX(m_vMinX, m_vMaxX);
351  fitResultW.GetMinAndMaxX(m_wMinX, m_wMaxX);
352  m_minX = std::max(m_uMinX, std::max(m_vMinX, m_wMinX));
353  m_maxX = std::min(m_uMaxX, std::min(m_vMaxX, m_wMaxX));
354  m_xOverlapSpan = (m_maxX - m_minX);
355  m_nPoints = 1.f;
356 
357  if (m_xOverlapSpan > std::numeric_limits<float>::epsilon())
358  {
359  const float nPointsU(
360  std::fabs((m_xOverlapSpan / (m_uMaxX - m_uMinX)) * static_cast<float>(fitResultU.GetMaxLayer() - fitResultU.GetMinLayer())));
361  const float nPointsV(
362  std::fabs((m_xOverlapSpan / (m_vMaxX - m_vMinX)) * static_cast<float>(fitResultV.GetMaxLayer() - fitResultV.GetMinLayer())));
363  const float nPointsW(
364  std::fabs((m_xOverlapSpan / (m_wMaxX - m_wMinX)) * static_cast<float>(fitResultW.GetMaxLayer() - fitResultW.GetMinLayer())));
365  m_nPoints = 1.f + ((nPointsU + nPointsV + nPointsW) / 3.f);
366  }
367 }
368 
369 //------------------------------------------------------------------------------------------------------------------------------------------
370 
371 StatusCode ThreeViewShowersAlgorithm::XSampling::GetBin(const float x, int &xBin) const
372 {
373  if (((x - m_minX) < -std::numeric_limits<float>::epsilon()) || ((x - m_maxX) > +std::numeric_limits<float>::epsilon()))
374  return STATUS_CODE_NOT_FOUND;
375 
376  xBin = static_cast<int>(0.5f + m_nPoints * (x - m_minX) / (m_maxX - m_minX));
377  return STATUS_CODE_SUCCESS;
378 }
379 
380 //------------------------------------------------------------------------------------------------------------------------------------------
381 //------------------------------------------------------------------------------------------------------------------------------------------
382 
383 StatusCode ThreeViewShowersAlgorithm::ReadSettings(const TiXmlHandle xmlHandle)
384 {
385  AlgorithmToolVector algorithmToolVector;
386  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithmToolList(*this, xmlHandle, "ShowerTools", algorithmToolVector));
387 
388  for (AlgorithmToolVector::const_iterator iter = algorithmToolVector.begin(), iterEnd = algorithmToolVector.end(); iter != iterEnd; ++iter)
389  {
390  ShowerTensorTool *const pShowerTensorTool(dynamic_cast<ShowerTensorTool *>(*iter));
391 
392  if (!pShowerTensorTool)
393  return STATUS_CODE_INVALID_PARAMETER;
394 
395  m_algorithmToolVector.push_back(pShowerTensorTool);
396  }
397 
398  PANDORA_RETURN_RESULT_IF_AND_IF(
399  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "NMaxTensorToolRepeats", m_nMaxTensorToolRepeats));
400 
401  PANDORA_RETURN_RESULT_IF_AND_IF(
402  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SlidingFitWindow", m_slidingFitWindow));
403 
404  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
405  XmlHelper::ReadValue(xmlHandle, "IgnoreUnavailableClusters", m_ignoreUnavailableClusters));
406 
407  PANDORA_RETURN_RESULT_IF_AND_IF(
408  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinClusterCaloHits", m_minClusterCaloHits));
409 
410  float minClusterLength = std::sqrt(m_minClusterLengthSquared);
411  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinClusterLength", minClusterLength));
412  m_minClusterLengthSquared = minClusterLength * minClusterLength;
413 
414  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
415  XmlHelper::ReadValue(xmlHandle, "MinShowerMatchedFraction", m_minShowerMatchedFraction));
416 
417  PANDORA_RETURN_RESULT_IF_AND_IF(
418  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinShowerMatchedPoints", m_minShowerMatchedPoints));
419 
420  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "Visualize", m_visualize));
421 
422  return BaseAlgorithm::ReadSettings(xmlHandle);
423 }
424 
425 } // namespace lar_content
Float_t x
Definition: compare.C:6
bool IsInitialized() const
Whether the track overlap result has been initialized.
pandora::StatusCode GetBin(const float x, int &xBin) const
Convert an x position into a sampling bin.
intermediate_table::iterator iterator
TensorToolVector m_algorithmToolVector
The algorithm tool vector.
void GetMinAndMaxX(float &minX, float &maxX) const
Get the minimum and maximum x coordinates associated with the sliding fit.
TensorType & GetOverlapTensor()
Get the overlap tensor.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Double_t z
Definition: plot.C:276
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
const TwoDSlidingFitResult & GetShowerFitResult() const
Get the sliding fit result for the full shower cluster.
XSampling(const TwoDSlidingFitResult &fitResultU, const TwoDSlidingFitResult &fitResultV, const TwoDSlidingFitResult &fitResultW)
Constructor.
intermediate_table::const_iterator const_iterator
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
void RemoveFromSlidingFitCache(const pandora::Cluster *const pCluster)
Remova an existing sliding fit result, for the specified cluster, from the algorithm cache...
float m_minX
The min x value of the common x-overlap range.
TFile f
Definition: plotHisto.C:6
void AddToSlidingFitCache(const pandora::Cluster *const pCluster)
Add a new sliding fit result, for the specified cluster, to the algorithm cache.
Header file for the geometry helper class.
void CalculateOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW)
Calculate cluster overlap result and store in container.
std::pair< ShowerPositionMap, ShowerPositionMap > ShowerPositionMapPair
void SelectInputClusters(const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const
Select a subset of input clusters for processing in this algorithm.
void SetOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW, const OverlapResult &overlapResult)
Set overlap result.
TwoDSlidingShowerFitResultMap m_slidingFitResultMap
The sliding shower fit result map.
int GetMaxLayer() const
Get the maximum occupied layer in the sliding fit.
unsigned int m_minClusterCaloHits
The min number of hits in base cluster selection method.
int GetMinLayer() const
Get the minimum occupied layer in the sliding fit.
unsigned int m_minShowerMatchedPoints
The minimum number of matched shower sampling points to allow shower grouping.
float m_minClusterLengthSquared
The min length (squared) in base cluster selection method.
Header file for the cluster helper class.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void ExamineOverlapContainer()
Examine contents of overlap container, collect together best-matching 2D particles and modify cluster...
void PrepareInputClusters(pandora::ClusterList &preparedClusterList)
Perform any preparatory steps required on the input clusters, e.g. caching expensive fit results...
static float MergeTwoPositions(const pandora::Pandora &pandora, const pandora::HitType view1, const pandora::HitType view2, const float position1, const float position2)
Merge two views (U,V) to give a third view (Z).
unsigned int GetNMatchedSamplingPoints() const
Get the number of matched sampling points.
bool m_visualize
Visualize cluster matching procedure.
static float GetWirePitch(const pandora::Pandora &pandora, const pandora::HitType view, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
void GetShowerPositionMaps(const TwoDSlidingShowerFitResult &fitResultU, const TwoDSlidingShowerFitResult &fitResultV, const TwoDSlidingShowerFitResult &fitResultW, const XSampling &xSampling, ShowerPositionMapPair &positionMapsU, ShowerPositionMapPair &positionMapsV, ShowerPositionMapPair &positionMapsW) const
Get the shower position maps.
void UpdateForNewCluster(const pandora::Cluster *const pNewCluster)
Update to reflect addition of a new cluster to the problem space.
bool m_ignoreUnavailableClusters
Whether to ignore (skip-over) unavailable clusters.
void TidyUp()
Tidy member variables in derived class.
void GetBestHitOverlapFraction(const pandora::Cluster *const pCluster, const XSampling &xSampling, const ShowerPositionMapPair &positionMaps, unsigned int &nSampledHits, unsigned int &nMatchedHits) const
Get the best fraction of hits, in the common x-overlap range, contained within the provided pair of s...
float m_nPoints
The number of sampling points to be used.
float m_minShowerMatchedFraction
The minimum shower matched sampling fraction to allow shower grouping.
float m_maxX
The max x value of the common x-overlap range.
static float GetLengthSquared(const pandora::Cluster *const pCluster)
Get length squared of cluster.
Char_t n[5]
float GetMatchedFraction() const
Get the fraction of sampling points resulting in a match.
second_as<> second
Type of time stored in seconds, in double precision.
Definition: spacetime.h:82
XOverlap class.
Definition: LArXOverlap.h:17
const TwoDSlidingShowerFitResult & GetCachedSlidingFitResult(const pandora::Cluster *const pCluster) const
Get a sliding shower fit result from the algorithm cache.
Header file for the three view showers algorithm class.
void GetShowerEdges(const float x, const bool widenIfAmbiguity, pandora::FloatVector &edgePositions) const
Get the most appropriate shower edges at a given x coordinate.
void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster)
Update to reflect cluster deletion.