LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
lar_content::ThreeDShowersAlgorithm Class Reference

ThreeDShowersAlgorithm class. More...

#include "ThreeDShowersAlgorithm.h"

Inheritance diagram for lar_content::ThreeDShowersAlgorithm:
lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >

Classes

class  XSampling
 XSampling class. More...
 

Public Types

typedef OverlapTensor< ShowerOverlapResultTensorType
 

Public Member Functions

 ThreeDShowersAlgorithm ()
 Default constructor. More...
 
const TwoDSlidingShowerFitResultGetCachedSlidingFitResult (const pandora::Cluster *const pCluster) const
 Get a sliding shower fit result from the algorithm cache. More...
 
void UpdateForNewCluster (const pandora::Cluster *const pNewCluster)
 Update to reflect addition of a new cluster to the problem space. More...
 
void UpdateUponDeletion (const pandora::Cluster *const pDeletedCluster)
 Update to reflect cluster deletion. More...
 
void SelectInputClusters (const pandora::ClusterList *const pInputClusterList, pandora::ClusterList &selectedClusterList) const
 Select a subset of input clusters for processing in this algorithm. More...
 
void SetPfoParameters (const ProtoParticle &protoParticle, PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
 Calculate Pfo properties from proto particle. More...
 
virtual bool CreateThreeDParticles (const ProtoParticleVector &protoParticleVector)
 Create particles using findings from recent algorithm processing. More...
 
virtual bool MakeClusterMerges (const ClusterMergeMap &clusterMergeMap)
 Merge clusters together. More...
 
virtual void RemoveUnavailableTensorElements ()
 Update tensor to remove all elements that have been added to pfos and so are unavailable. More...
 
const pandora::ClusterList & GetInputClusterListU () const
 Get the input u cluster list. More...
 
const pandora::ClusterList & GetInputClusterListV () const
 Get the input v cluster list. More...
 
const pandora::ClusterList & GetInputClusterListW () const
 Get the input w cluster list. More...
 
const pandora::ClusterList & GetSelectedClusterListU () const
 Get the selected u cluster list. More...
 
const pandora::ClusterList & GetSelectedClusterListV () const
 Get the selected v cluster list. More...
 
const pandora::ClusterList & GetSelectedClusterListW () const
 Get the selected w cluster list. More...
 
const std::string & GetClusterListNameU () const
 Get the name of the u cluster list. More...
 
const std::string & GetClusterListNameV () const
 Get the name of the v cluster list. More...
 
const std::string & GetClusterListNameW () const
 Get the name of the w cluster list. More...
 

Protected Member Functions

virtual void SelectAllInputClusters ()
 Select a subset of input clusters for processing in this algorithm. More...
 
virtual void PerformMainLoop ()
 Main loop over cluster combinations in order to populate the tensor. Responsible for calling CalculateOverlapResult. More...
 

Protected Attributes

const pandora::ClusterList * m_pInputClusterListU
 Address of the input cluster list U. More...
 
const pandora::ClusterList * m_pInputClusterListV
 Address of the input cluster list V. More...
 
const pandora::ClusterList * m_pInputClusterListW
 Address of the input cluster list W. More...
 
pandora::ClusterList m_clusterListU
 The selected modified cluster list U. More...
 
pandora::ClusterList m_clusterListV
 The selected modified cluster list V. More...
 
pandora::ClusterList m_clusterListW
 The selected modified cluster list W. More...
 
TensorType m_overlapTensor
 The overlap tensor. More...
 

Private Types

typedef std::pair< ShowerPositionMap, ShowerPositionMapShowerPositionMapPair
 
typedef std::vector< ShowerTensorTool * > TensorToolVector
 

Private Member Functions

void PreparationStep ()
 Perform any preparatory steps required, e.g. caching expensive fit results for clusters. More...
 
void PreparationStep (pandora::ClusterList &clusterList)
 Preparation step for a specific cluster list. More...
 
void TidyUp ()
 Tidy member variables in derived class. More...
 
void AddToSlidingFitCache (const pandora::Cluster *const pCluster)
 Add a new sliding fit result, for the specified cluster, to the algorithm cache. More...
 
void RemoveFromSlidingFitCache (const pandora::Cluster *const pCluster)
 Remova an existing sliding fit result, for the specified cluster, from the algorithm cache. More...
 
void CalculateOverlapResult (const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW)
 Calculate cluster overlap result and store in tensor. More...
 
pandora::StatusCode CalculateOverlapResult (const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW, ShowerOverlapResult &overlapResult)
 Calculate the overlap result for given group of clusters. More...
 
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. More...
 
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 shower boundaries. More...
 
void ExamineTensor ()
 Examine contents of tensor, collect together best-matching 2D particles and modify clusters as required. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

TensorToolVector m_algorithmToolVector
 The algorithm tool vector. More...
 
unsigned int m_nMaxTensorToolRepeats
 The maximum number of repeat loops over tensor tools. More...
 
unsigned int m_slidingFitWindow
 The layer window for the sliding linear fits. More...
 
TwoDSlidingShowerFitResultMap m_slidingFitResultMap
 The sliding shower fit result map. More...
 
bool m_ignoreUnavailableClusters
 Whether to ignore (skip-over) unavailable clusters. More...
 
unsigned int m_minClusterCaloHits
 The min number of hits in base cluster selection method. More...
 
float m_minClusterLengthSquared
 The min length (squared) in base cluster selection method. More...
 
float m_minShowerMatchedFraction
 The minimum shower matched sampling fraction to allow shower grouping. More...
 
unsigned int m_minShowerMatchedPoints
 The minimum number of matched shower sampling points to allow shower grouping. More...
 

Detailed Description

ThreeDShowersAlgorithm class.

Definition at line 28 of file ThreeDShowersAlgorithm.h.

Member Typedef Documentation

Constructor & Destructor Documentation

lar_content::ThreeDShowersAlgorithm::ThreeDShowersAlgorithm ( )

Default constructor.

Definition at line 21 of file ThreeDShowersAlgorithm.cc.

21  :
29 {
30 }
bool m_ignoreUnavailableClusters
Whether to ignore (skip-over) unavailable clusters.
TFile f
Definition: plotHisto.C:6
float m_minClusterLengthSquared
The min length (squared) in base cluster selection method.
unsigned int m_minShowerMatchedPoints
The minimum number of matched shower sampling points to allow shower grouping.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
unsigned int m_minClusterCaloHits
The min number of hits in base cluster selection method.
float m_minShowerMatchedFraction
The minimum shower matched sampling fraction to allow shower grouping.

Member Function Documentation

void lar_content::ThreeDShowersAlgorithm::AddToSlidingFitCache ( const pandora::Cluster *const  pCluster)
private

Add a new sliding fit result, for the specified cluster, to the algorithm cache.

Parameters
pClusteraddress of the relevant cluster

Definition at line 149 of file ThreeDShowersAlgorithm.cc.

References lar_content::LArGeometryHelper::GetWireZPitch(), m_slidingFitResultMap, and m_slidingFitWindow.

Referenced by PreparationStep(), and UpdateForNewCluster().

150 {
151  const float slidingFitPitch(LArGeometryHelper::GetWireZPitch(this->GetPandora()));
152  const TwoDSlidingShowerFitResult slidingShowerFitResult(pCluster, m_slidingFitWindow, slidingFitPitch);
153 
154  if (!m_slidingFitResultMap.insert(TwoDSlidingShowerFitResultMap::value_type(pCluster, slidingShowerFitResult)).second)
155  throw StatusCodeException(STATUS_CODE_FAILURE);
156 }
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
TwoDSlidingShowerFitResultMap m_slidingFitResultMap
The sliding shower fit result map.
void lar_content::ThreeDShowersAlgorithm::CalculateOverlapResult ( const pandora::Cluster *const  pClusterU,
const pandora::Cluster *const  pClusterV,
const pandora::Cluster *const  pClusterW 
)
privatevirtual

Calculate cluster overlap result and store in tensor.

Parameters
pClusterUaddress of U view cluster
pClusterVaddress of V view cluster
pClusterWaddress of W view cluster

Implements lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >.

Referenced by RemoveFromSlidingFitCache().

pandora::StatusCode lar_content::ThreeDShowersAlgorithm::CalculateOverlapResult ( const pandora::Cluster *const  pClusterU,
const pandora::Cluster *const  pClusterV,
const pandora::Cluster *const  pClusterW,
ShowerOverlapResult overlapResult 
)
private

Calculate the overlap result for given group of clusters.

Parameters
pClusterUthe cluster from the U view
pClusterVthe cluster from the V view
pClusterWthe cluster from the W view
overlapResultto receive the overlap result
virtual bool lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::CreateThreeDParticles ( const ProtoParticleVector protoParticleVector)
virtualinherited

Create particles using findings from recent algorithm processing.

Parameters
protoParticleVectorthe proto particle vector
whetherparticles were created
void lar_content::ThreeDShowersAlgorithm::ExamineTensor ( )
privatevirtual

Examine contents of tensor, collect together best-matching 2D particles and modify clusters as required.

Implements lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >.

Definition at line 325 of file ThreeDShowersAlgorithm.cc.

References m_algorithmToolVector, m_nMaxTensorToolRepeats, and lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::m_overlapTensor.

326 {
327  unsigned int repeatCounter(0);
328 
329  for (TensorToolVector::const_iterator iter = m_algorithmToolVector.begin(), iterEnd = m_algorithmToolVector.end(); iter != iterEnd; )
330  {
331  if ((*iter)->Run(this, m_overlapTensor))
332  {
333  iter = m_algorithmToolVector.begin();
334 
335  if (++repeatCounter > m_nMaxTensorToolRepeats)
336  break;
337  }
338  else
339  {
340  ++iter;
341  }
342  }
343 }
intermediate_table::const_iterator const_iterator
TensorToolVector m_algorithmToolVector
The algorithm tool vector.
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
void lar_content::ThreeDShowersAlgorithm::GetBestHitOverlapFraction ( const pandora::Cluster *const  pCluster,
const XSampling xSampling,
const ShowerPositionMapPair positionMaps,
unsigned int &  nSampledHits,
unsigned int &  nMatchedHits 
) const
private

Get the best fraction of hits, in the common x-overlap range, contained within the provided pair of shower boundaries.

Parameters
pClusterthe address of the candidate cluster
xSamplingthe x sampling details
positionMapsthe shower edge position maps
nSampledHitsto receive the number of hits in the common x-overlap range
nMatchedHitsto receive the number of sampled hits contained within the shower edges

Definition at line 285 of file ThreeDShowersAlgorithm.cc.

References lar_content::ThreeDShowersAlgorithm::XSampling::GetBin(), lar_content::ThreeDShowersAlgorithm::XSampling::m_maxX, lar_content::ThreeDShowersAlgorithm::XSampling::m_minX, max, x, and z.

Referenced by RemoveFromSlidingFitCache().

287 {
288  if ((xSampling.m_maxX - xSampling.m_minX) < std::numeric_limits<float>::epsilon())
289  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
290 
291  nSampledHits = 0; nMatchedHits = 0;
292  unsigned int nMatchedHits1(0), nMatchedHits2(0);
293  const OrderedCaloHitList &orderedCaloHitList(pCluster->GetOrderedCaloHitList());
294 
295  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
296  {
297  for (CaloHitList::const_iterator hIter = iter->second->begin(), hIterEnd = iter->second->end(); hIter != hIterEnd; ++hIter)
298  {
299  const CaloHit *const pCaloHit = *hIter;
300  const float x(pCaloHit->GetPositionVector().GetX());
301  const float z(pCaloHit->GetPositionVector().GetZ());
302 
303  int xBin(-1);
304  if (STATUS_CODE_SUCCESS != xSampling.GetBin(x, xBin))
305  continue;
306 
307  ++nSampledHits;
308 
309  ShowerPositionMap::const_iterator positionIter1 = positionMaps.first.find(xBin);
310  ShowerPositionMap::const_iterator positionIter2 = positionMaps.second.find(xBin);
311 
312  if ((positionMaps.first.end() != positionIter1) && (z > positionIter1->second.GetLowEdgeZ()) && (z < positionIter1->second.GetHighEdgeZ()))
313  ++nMatchedHits1;
314 
315  if ((positionMaps.second.end() != positionIter2) && (z > positionIter2->second.GetLowEdgeZ()) && (z < positionIter2->second.GetHighEdgeZ()))
316  ++nMatchedHits2;
317  }
318  }
319 
320  nMatchedHits = std::max(nMatchedHits1, nMatchedHits2);
321 }
Float_t x
Definition: compare.C:6
Double_t z
Definition: plot.C:279
Int_t max
Definition: plot.C:27
intermediate_table::const_iterator const_iterator
const TwoDSlidingShowerFitResult & lar_content::ThreeDShowersAlgorithm::GetCachedSlidingFitResult ( const pandora::Cluster *const  pCluster) const

Get a sliding shower fit result from the algorithm cache.

Parameters
pClusteraddress of the relevant cluster

Definition at line 34 of file ThreeDShowersAlgorithm.cc.

References m_slidingFitResultMap.

Referenced by lar_content::SplitShowersTool::CheckClusterVertexRelations(), lar_content::SplitShowersTool::GetSplitXDetails(), RemoveFromSlidingFitCache(), and lar_content::SplitShowersTool::SpecifyClusterMerges().

35 {
37 
38  if (m_slidingFitResultMap.end() == iter)
39  throw StatusCodeException(STATUS_CODE_NOT_FOUND);
40 
41  return iter->second;
42 }
intermediate_table::const_iterator const_iterator
TwoDSlidingShowerFitResultMap m_slidingFitResultMap
The sliding shower fit result map.
const std::string& lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::GetClusterListNameU ( ) const
inherited

Get the name of the u cluster list.

const std::string& lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::GetClusterListNameV ( ) const
inherited

Get the name of the v cluster list.

const std::string& lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::GetClusterListNameW ( ) const
inherited

Get the name of the w cluster list.

const pandora::ClusterList& lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::GetInputClusterListU ( ) const
inherited

Get the input u cluster list.

const pandora::ClusterList& lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::GetInputClusterListV ( ) const
inherited

Get the input v cluster list.

const pandora::ClusterList& lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::GetInputClusterListW ( ) const
inherited

Get the input w cluster list.

const pandora::ClusterList& lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::GetSelectedClusterListU ( ) const
inherited

Get the selected u cluster list.

const pandora::ClusterList& lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::GetSelectedClusterListV ( ) const
inherited

Get the selected v cluster list.

const pandora::ClusterList& lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::GetSelectedClusterListW ( ) const
inherited

Get the selected w cluster list.

void lar_content::ThreeDShowersAlgorithm::GetShowerPositionMaps ( const TwoDSlidingShowerFitResult fitResultU,
const TwoDSlidingShowerFitResult fitResultV,
const TwoDSlidingShowerFitResult fitResultW,
const XSampling xSampling,
ShowerPositionMapPair positionMapsU,
ShowerPositionMapPair positionMapsV,
ShowerPositionMapPair positionMapsW 
) const
private

Get the shower position maps.

Parameters
fitResultUthe sliding shower fit result for the u view
fitResultVthe sliding shower fit result for the v view
fitResultWthe sliding shower fit result for the w view
xSamplingthe x sampling details
positionMapsUto receive the shower position maps for the u view
positionMapsVto receive the shower position maps for the v view
positionMapsWto receive the shower position maps for the w view

Definition at line 222 of file ThreeDShowersAlgorithm.cc.

References lar_content::ThreeDShowersAlgorithm::XSampling::GetBin(), lar_content::TwoDSlidingShowerFitResult::GetShowerEdges(), lar_content::ThreeDShowersAlgorithm::XSampling::m_maxX, lar_content::ThreeDShowersAlgorithm::XSampling::m_minX, lar_content::ThreeDShowersAlgorithm::XSampling::m_nPoints, lar_content::LArGeometryHelper::MergeTwoPositions(), n, and x.

Referenced by RemoveFromSlidingFitCache().

225 {
226  const unsigned int nPoints(static_cast<unsigned int>(xSampling.m_nPoints));
227 
228  for (unsigned n = 0; n <= nPoints; ++n)
229  {
230  const float x(xSampling.m_minX + (xSampling.m_maxX - xSampling.m_minX) * static_cast<float>(n) / static_cast<float>(nPoints));
231 
232  int xBin(-1);
233  if (STATUS_CODE_SUCCESS != xSampling.GetBin(x, xBin))
234  continue;
235 
236  FloatVector uValues, vValues, wValues;
237  fitResultU.GetShowerEdges(x, true, uValues);
238  fitResultV.GetShowerEdges(x, true, vValues);
239  fitResultW.GetShowerEdges(x, true, wValues);
240 
241  std::sort(uValues.begin(), uValues.end());
242  std::sort(vValues.begin(), vValues.end());
243  std::sort(wValues.begin(), wValues.end());
244 
245  if ((uValues.size() > 1) && (vValues.size() > 1))
246  {
247  const float uMin(uValues.front()), uMax(uValues.back());
248  const float vMin(vValues.front()), vMax(vValues.back());
249  const float uv2wMinMin(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_V, uMin, vMin));
250  const float uv2wMaxMax(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_V, uMax, vMax));
251  const float uv2wMinMax(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_V, uMin, vMax));
252  const float uv2wMaxMin(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_V, uMax, vMin));
253  positionMapsW.first.insert(ShowerPositionMap::value_type(xBin, ShowerExtent(x, uv2wMinMin, uv2wMaxMax)));
254  positionMapsW.second.insert(ShowerPositionMap::value_type(xBin, ShowerExtent(x, uv2wMinMax, uv2wMaxMin)));
255  }
256 
257  if ((uValues.size() > 1) && (wValues.size() > 1))
258  {
259  const float uMin(uValues.front()), uMax(uValues.back());
260  const float wMin(wValues.front()), wMax(wValues.back());
261  const float uw2vMinMin(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_W, uMin, wMin));
262  const float uw2vMaxMax(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_W, uMax, wMax));
263  const float uw2vMinMax(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_W, uMin, wMax));
264  const float uw2vMaxMin(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_W, uMax, wMin));
265  positionMapsV.first.insert(ShowerPositionMap::value_type(xBin, ShowerExtent(x, uw2vMinMin, uw2vMaxMax)));
266  positionMapsV.second.insert(ShowerPositionMap::value_type(xBin, ShowerExtent(x, uw2vMinMax, uw2vMaxMin)));
267  }
268 
269  if ((vValues.size() > 1) && (wValues.size() > 1))
270  {
271  const float vMin(vValues.front()), vMax(vValues.back());
272  const float wMin(wValues.front()), wMax(wValues.back());
273  const float vw2uMinMin(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_V, TPC_VIEW_W, vMin, wMin));
274  const float vw2uMaxMax(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_V, TPC_VIEW_W, vMax, wMax));
275  const float vw2uMinMax(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_V, TPC_VIEW_W, vMin, wMax));
276  const float vw2uMaxMin(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_V, TPC_VIEW_W, vMax, wMin));
277  positionMapsU.first.insert(ShowerPositionMap::value_type(xBin, ShowerExtent(x, vw2uMinMin, vw2uMaxMax)));
278  positionMapsU.second.insert(ShowerPositionMap::value_type(xBin, ShowerExtent(x, vw2uMinMax, vw2uMaxMin)));
279  }
280  }
281 }
Float_t x
Definition: compare.C:6
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).
Char_t n[5]
virtual bool lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::MakeClusterMerges ( const ClusterMergeMap clusterMergeMap)
virtualinherited

Merge clusters together.

Parameters
clusterMergeMapthe cluster merge map
Returns
whether changes to the tensor have been made
virtual void lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::PerformMainLoop ( )
protectedvirtualinherited

Main loop over cluster combinations in order to populate the tensor. Responsible for calling CalculateOverlapResult.

void lar_content::ThreeDShowersAlgorithm::PreparationStep ( )
privatevirtual

Perform any preparatory steps required, e.g. caching expensive fit results for clusters.

Reimplemented from lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >.

Definition at line 109 of file ThreeDShowersAlgorithm.cc.

References AddToSlidingFitCache(), lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::m_clusterListU, lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::m_clusterListV, and lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::m_clusterListW.

110 {
111  this->PreparationStep(this->m_clusterListU);
112  this->PreparationStep(this->m_clusterListV);
113  this->PreparationStep(this->m_clusterListW);
114 }
pandora::ClusterList m_clusterListW
The selected modified cluster list W.
void PreparationStep()
Perform any preparatory steps required, e.g. caching expensive fit results for clusters.
pandora::ClusterList m_clusterListV
The selected modified cluster list V.
pandora::ClusterList m_clusterListU
The selected modified cluster list U.
void lar_content::ThreeDShowersAlgorithm::PreparationStep ( pandora::ClusterList &  clusterList)
private

Preparation step for a specific cluster list.

Parameters
clusterListthe cluster list
StatusCode lar_content::ThreeDShowersAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >.

Definition at line 382 of file ThreeDShowersAlgorithm.cc.

References m_algorithmToolVector, m_ignoreUnavailableClusters, m_minClusterCaloHits, m_minClusterLengthSquared, m_minShowerMatchedFraction, m_minShowerMatchedPoints, m_nMaxTensorToolRepeats, m_slidingFitWindow, and lar_content::ThreeDBaseAlgorithm< T >::ReadSettings().

383 {
384  AlgorithmToolVector algorithmToolVector;
385  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithmToolList(*this, xmlHandle,
386  "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 (NULL == pShowerTensorTool)
393  return STATUS_CODE_INVALID_PARAMETER;
394 
395  m_algorithmToolVector.push_back(pShowerTensorTool);
396  }
397 
398  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
399  "NMaxTensorToolRepeats", m_nMaxTensorToolRepeats));
400 
401  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
402  "SlidingFitWindow", m_slidingFitWindow));
403 
404  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
405  "IgnoreUnavailableClusters", m_ignoreUnavailableClusters));
406 
407  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
408  "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,
412  "MinClusterLength", minClusterLength));
413  m_minClusterLengthSquared = minClusterLength * minClusterLength;
414 
415  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
416  "MinShowerMatchedFraction", m_minShowerMatchedFraction));
417 
418  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
419  "MinShowerMatchedPoints", m_minShowerMatchedPoints));
420 
422 }
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
bool m_ignoreUnavailableClusters
Whether to ignore (skip-over) unavailable clusters.
float m_minClusterLengthSquared
The min length (squared) in base cluster selection method.
intermediate_table::const_iterator const_iterator
unsigned int m_minShowerMatchedPoints
The minimum number of matched shower sampling points to allow shower grouping.
TensorToolVector m_algorithmToolVector
The algorithm tool vector.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
unsigned int m_minClusterCaloHits
The min number of hits in base cluster selection method.
float m_minShowerMatchedFraction
The minimum shower matched sampling fraction to allow shower grouping.
void lar_content::ThreeDShowersAlgorithm::RemoveFromSlidingFitCache ( const pandora::Cluster *const  pCluster)
private
virtual void lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::RemoveUnavailableTensorElements ( )
virtualinherited

Update tensor to remove all elements that have been added to pfos and so are unavailable.

virtual void lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::SelectAllInputClusters ( )
protectedvirtualinherited

Select a subset of input clusters for processing in this algorithm.

void lar_content::ThreeDShowersAlgorithm::SelectInputClusters ( const pandora::ClusterList *const  pInputClusterList,
pandora::ClusterList &  selectedClusterList 
) const
virtual

Select a subset of input clusters for processing in this algorithm.

Parameters
pInputClusterListaddress of an input cluster list
selectedClusterListto receive the selected cluster list

Implements lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >.

Definition at line 73 of file ThreeDShowersAlgorithm.cc.

References lar_content::LArClusterHelper::GetLengthSquared(), m_ignoreUnavailableClusters, m_minClusterCaloHits, and m_minClusterLengthSquared.

74 {
75  for (ClusterList::const_iterator iter = pInputClusterList->begin(), iterEnd = pInputClusterList->end(); iter != iterEnd; ++iter)
76  {
77  const Cluster *const pCluster = *iter;
78 
79  if (m_ignoreUnavailableClusters && !pCluster->IsAvailable())
80  continue;
81 
82  if (pCluster->GetNCaloHits() < m_minClusterCaloHits)
83  continue;
84 
86  continue;
87 
88  selectedClusterList.push_back(pCluster);
89  }
90 }
bool m_ignoreUnavailableClusters
Whether to ignore (skip-over) unavailable clusters.
float m_minClusterLengthSquared
The min length (squared) in base cluster selection method.
intermediate_table::const_iterator const_iterator
static float GetLengthSquared(const pandora::Cluster *const pCluster)
Get length squared of cluster.
unsigned int m_minClusterCaloHits
The min number of hits in base cluster selection method.
void lar_content::ThreeDShowersAlgorithm::SetPfoParameters ( const ProtoParticle protoParticle,
PandoraContentApi::ParticleFlowObject::Parameters &  pfoParameters 
) const
virtual

Calculate Pfo properties from proto particle.

Parameters
protoParticlethe input proto particle
pfoParametersthe output pfo parameters

Implements lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >.

Definition at line 94 of file ThreeDShowersAlgorithm.cc.

References f, lar_content::ProtoParticle::m_clusterListU, lar_content::ProtoParticle::m_clusterListV, and lar_content::ProtoParticle::m_clusterListW.

95 {
96  // TODO Correct these placeholder parameters
97  pfoParameters.m_particleId = E_MINUS; // Shower
98  pfoParameters.m_charge = PdgTable::GetParticleCharge(pfoParameters.m_particleId.Get());
99  pfoParameters.m_mass = PdgTable::GetParticleMass(pfoParameters.m_particleId.Get());
100  pfoParameters.m_energy = 0.f;
101  pfoParameters.m_momentum = CartesianVector(0.f, 0.f, 0.f);
102  pfoParameters.m_clusterList.insert(pfoParameters.m_clusterList.end(), protoParticle.m_clusterListU.begin(), protoParticle.m_clusterListU.end());
103  pfoParameters.m_clusterList.insert(pfoParameters.m_clusterList.end(), protoParticle.m_clusterListV.begin(), protoParticle.m_clusterListV.end());
104  pfoParameters.m_clusterList.insert(pfoParameters.m_clusterList.end(), protoParticle.m_clusterListW.begin(), protoParticle.m_clusterListW.end());
105 }
TFile f
Definition: plotHisto.C:6
void lar_content::ThreeDShowersAlgorithm::TidyUp ( )
privatevirtual

Tidy member variables in derived class.

Reimplemented from lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >.

Definition at line 141 of file ThreeDShowersAlgorithm.cc.

References m_slidingFitResultMap, and lar_content::ThreeDBaseAlgorithm< T >::TidyUp().

142 {
143  m_slidingFitResultMap.clear();
145 }
virtual void TidyUp()
Tidy member variables in derived class.
TwoDSlidingShowerFitResultMap m_slidingFitResultMap
The sliding shower fit result map.
void lar_content::ThreeDShowersAlgorithm::UpdateForNewCluster ( const pandora::Cluster *const  pNewCluster)
virtual

Update to reflect addition of a new cluster to the problem space.

Parameters
pNewClusteraddress of the new cluster

Reimplemented from lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >.

Definition at line 46 of file ThreeDShowersAlgorithm.cc.

References AddToSlidingFitCache(), and lar_content::ThreeDBaseAlgorithm< T >::UpdateForNewCluster().

47 {
48  try
49  {
50  this->AddToSlidingFitCache(pNewCluster);
51  }
52  catch (StatusCodeException &statusCodeException)
53  {
54  if (STATUS_CODE_FAILURE == statusCodeException.GetStatusCode())
55  throw statusCodeException;
56 
57  return;
58  }
59 
61 }
virtual void UpdateForNewCluster(const pandora::Cluster *const pNewCluster)
Update to reflect addition of a new cluster to the problem space.
void AddToSlidingFitCache(const pandora::Cluster *const pCluster)
Add a new sliding fit result, for the specified cluster, to the algorithm cache.
void lar_content::ThreeDShowersAlgorithm::UpdateUponDeletion ( const pandora::Cluster *const  pDeletedCluster)
virtual

Update to reflect cluster deletion.

Parameters
pDeletedClusteraddress of the deleted cluster

Reimplemented from lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >.

Definition at line 65 of file ThreeDShowersAlgorithm.cc.

References RemoveFromSlidingFitCache(), and lar_content::ThreeDBaseAlgorithm< T >::UpdateUponDeletion().

66 {
67  this->RemoveFromSlidingFitCache(pDeletedCluster);
69 }
virtual void UpdateUponDeletion(const pandora::Cluster *const pDeletedCluster)
Update to reflect cluster deletion.
void RemoveFromSlidingFitCache(const pandora::Cluster *const pCluster)
Remova an existing sliding fit result, for the specified cluster, from the algorithm cache...

Member Data Documentation

TensorToolVector lar_content::ThreeDShowersAlgorithm::m_algorithmToolVector
private

The algorithm tool vector.

Definition at line 156 of file ThreeDShowersAlgorithm.h.

Referenced by ExamineTensor(), and ReadSettings().

pandora::ClusterList lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::m_clusterListU
protectedinherited

The selected modified cluster list U.

Definition at line 196 of file ThreeDBaseAlgorithm.h.

Referenced by PreparationStep().

pandora::ClusterList lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::m_clusterListV
protectedinherited

The selected modified cluster list V.

Definition at line 197 of file ThreeDBaseAlgorithm.h.

Referenced by PreparationStep().

pandora::ClusterList lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::m_clusterListW
protectedinherited

The selected modified cluster list W.

Definition at line 198 of file ThreeDBaseAlgorithm.h.

Referenced by PreparationStep().

bool lar_content::ThreeDShowersAlgorithm::m_ignoreUnavailableClusters
private

Whether to ignore (skip-over) unavailable clusters.

Definition at line 162 of file ThreeDShowersAlgorithm.h.

Referenced by ReadSettings(), and SelectInputClusters().

unsigned int lar_content::ThreeDShowersAlgorithm::m_minClusterCaloHits
private

The min number of hits in base cluster selection method.

Definition at line 163 of file ThreeDShowersAlgorithm.h.

Referenced by ReadSettings(), and SelectInputClusters().

float lar_content::ThreeDShowersAlgorithm::m_minClusterLengthSquared
private

The min length (squared) in base cluster selection method.

Definition at line 164 of file ThreeDShowersAlgorithm.h.

Referenced by ReadSettings(), and SelectInputClusters().

float lar_content::ThreeDShowersAlgorithm::m_minShowerMatchedFraction
private

The minimum shower matched sampling fraction to allow shower grouping.

Definition at line 166 of file ThreeDShowersAlgorithm.h.

Referenced by ReadSettings(), and RemoveFromSlidingFitCache().

unsigned int lar_content::ThreeDShowersAlgorithm::m_minShowerMatchedPoints
private

The minimum number of matched shower sampling points to allow shower grouping.

Definition at line 167 of file ThreeDShowersAlgorithm.h.

Referenced by ReadSettings(), and RemoveFromSlidingFitCache().

unsigned int lar_content::ThreeDShowersAlgorithm::m_nMaxTensorToolRepeats
private

The maximum number of repeat loops over tensor tools.

Definition at line 157 of file ThreeDShowersAlgorithm.h.

Referenced by ExamineTensor(), and ReadSettings().

TensorType lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::m_overlapTensor
protectedinherited

The overlap tensor.

Definition at line 200 of file ThreeDBaseAlgorithm.h.

Referenced by ExamineTensor(), and RemoveFromSlidingFitCache().

const pandora::ClusterList* lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::m_pInputClusterListU
protectedinherited

Address of the input cluster list U.

Definition at line 192 of file ThreeDBaseAlgorithm.h.

const pandora::ClusterList* lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::m_pInputClusterListV
protectedinherited

Address of the input cluster list V.

Definition at line 193 of file ThreeDBaseAlgorithm.h.

const pandora::ClusterList* lar_content::ThreeDBaseAlgorithm< ShowerOverlapResult >::m_pInputClusterListW
protectedinherited

Address of the input cluster list W.

Definition at line 194 of file ThreeDBaseAlgorithm.h.

TwoDSlidingShowerFitResultMap lar_content::ThreeDShowersAlgorithm::m_slidingFitResultMap
private

The sliding shower fit result map.

Definition at line 160 of file ThreeDShowersAlgorithm.h.

Referenced by AddToSlidingFitCache(), GetCachedSlidingFitResult(), RemoveFromSlidingFitCache(), and TidyUp().

unsigned int lar_content::ThreeDShowersAlgorithm::m_slidingFitWindow
private

The layer window for the sliding linear fits.

Definition at line 159 of file ThreeDShowersAlgorithm.h.

Referenced by AddToSlidingFitCache(), and ReadSettings().


The documentation for this class was generated from the following files: