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

ThreeDRemnantsAlgorithm class. More...

#include "ThreeDRemnantsAlgorithm.h"

Inheritance diagram for lar_content::ThreeDRemnantsAlgorithm:
lar_content::ThreeDBaseAlgorithm< float >

Public Types

typedef OverlapTensor< float > TensorType
 

Public Member Functions

 ThreeDRemnantsAlgorithm ()
 Default constructor. 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 UpdateForNewCluster (const pandora::Cluster *const pNewCluster)
 Update to reflect addition of a new cluster to the problem space. More...
 
virtual void UpdateUponDeletion (const pandora::Cluster *const pDeletedCluster)
 Update to reflect cluster deletion. 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 PreparationStep ()
 Perform any preparatory steps required, e.g. caching expensive fit results for clusters. More...
 
virtual void PerformMainLoop ()
 Main loop over cluster combinations in order to populate the tensor. Responsible for calling CalculateOverlapResult. More...
 
virtual void TidyUp ()
 Tidy member variables in derived class. 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::vector< RemnantTensorTool * > RemnantTensorToolVector
 

Private Member Functions

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...
 
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

RemnantTensorToolVector m_algorithmToolVector
 The algorithm tool list. More...
 
unsigned int m_nMaxTensorToolRepeats
 The maximum number of repeat loops over tensor tools. More...
 
unsigned int m_minClusterCaloHits
 The selection cut on the number of cluster calo hits. More...
 
float m_xOverlapWindow
 The sampling pitch in the x coordinate. More...
 
float m_pseudoChi2Cut
 The selection cut on the matched chi2. More...
 

Detailed Description

ThreeDRemnantsAlgorithm class.

Definition at line 28 of file ThreeDRemnantsAlgorithm.h.

Member Typedef Documentation

typedef OverlapTensor<float > lar_content::ThreeDBaseAlgorithm< float >::TensorType
inherited

Definition at line 45 of file ThreeDBaseAlgorithm.h.

Constructor & Destructor Documentation

lar_content::ThreeDRemnantsAlgorithm::ThreeDRemnantsAlgorithm ( )

Default constructor.

Definition at line 21 of file ThreeDRemnantsAlgorithm.cc.

21  :
25  m_pseudoChi2Cut(10.f)
26 {
27 }
unsigned int m_minClusterCaloHits
The selection cut on the number of cluster calo hits.
float m_pseudoChi2Cut
The selection cut on the matched chi2.
TFile f
Definition: plotHisto.C:6
float m_xOverlapWindow
The sampling pitch in the x coordinate.
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.

Member Function Documentation

void lar_content::ThreeDRemnantsAlgorithm::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< float >.

Definition at line 64 of file ThreeDRemnantsAlgorithm.cc.

References f, lar_content::LArClusterHelper::GetAverageZ(), lar_content::LArClusterHelper::GetClusterSpanX(), lar_content::ThreeDBaseAlgorithm< float >::m_overlapTensor, m_pseudoChi2Cut, m_xOverlapWindow, max, lar_content::LArGeometryHelper::MergeTwoPositions(), min, lar_content::OverlapTensor< T >::SetOverlapResult(), and w.

65 {
66  // Requirements on X matching
67  float xMinU(0.f), xMinV(0.f), xMinW(0.f), xMaxU(0.f), xMaxV(0.f), xMaxW(0.f);
68  LArClusterHelper::GetClusterSpanX(pClusterU, xMinU, xMaxU);
69  LArClusterHelper::GetClusterSpanX(pClusterV, xMinV, xMaxV);
70  LArClusterHelper::GetClusterSpanX(pClusterW, xMinW, xMaxW);
71 
72  const float xMin(std::max(xMinU, std::max(xMinV, xMinW)) - m_xOverlapWindow);
73  const float xMax(std::min(xMaxU, std::min(xMaxV, xMaxW)) + m_xOverlapWindow);
74  const float xOverlap(xMax - xMin);
75 
76  if (xOverlap < std::numeric_limits<float>::epsilon())
77  return;
78 
79  // Requirements on 3D matching
81 
82  if ((STATUS_CODE_SUCCESS != LArClusterHelper::GetAverageZ(pClusterU, xMin, xMax, u)) ||
83  (STATUS_CODE_SUCCESS != LArClusterHelper::GetAverageZ(pClusterV, xMin, xMax, v)) ||
84  (STATUS_CODE_SUCCESS != LArClusterHelper::GetAverageZ(pClusterW, xMin, xMax, w)))
85  {
86  return;
87  }
88 
89  const float uv2w(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_V, u, v));
90  const float vw2u(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_V, TPC_VIEW_W, v, w));
91  const float wu2v(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_W, TPC_VIEW_U, w, u));
92 
93  const float pseudoChi2(((u - vw2u) * (u - vw2u) + (v - wu2v) * (v - wu2v) + (w - uv2w) * (w - uv2w)) / 3.f);
94 
95  if (pseudoChi2 > m_pseudoChi2Cut)
96  return;
97 
98  // ATTN Essentially a boolean result; actual value matters only so as to ensure that overlap results can be sorted
99  const float hackValue(pseudoChi2 + pClusterU->GetElectromagneticEnergy() + pClusterV->GetElectromagneticEnergy() + pClusterW->GetElectromagneticEnergy());
100  m_overlapTensor.SetOverlapResult(pClusterU, pClusterV, pClusterW, hackValue);
101 }
float m_pseudoChi2Cut
The selection cut on the matched chi2.
static pandora::StatusCode GetAverageZ(const pandora::Cluster *const pCluster, const float xmin, const float xmax, float &averageZ)
Get average Z positions of the calo hits in a cluster in range xmin to xmax.
TFile f
Definition: plotHisto.C:6
void SetOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW, const OverlapResult &overlapResult)
Set overlap result.
Int_t max
Definition: plot.C:27
TensorType m_overlapTensor
The overlap tensor.
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).
float m_xOverlapWindow
The sampling pitch in the x coordinate.
Int_t min
Definition: plot.C:26
static void GetClusterSpanX(const pandora::Cluster *const pCluster, float &xmin, float &xmax)
Get minimum and maximum X positions of the calo hits in a cluster.
Float_t w
Definition: plot.C:23
virtual bool lar_content::ThreeDBaseAlgorithm< float >::CreateThreeDParticles ( const ProtoParticleVector protoParticleVector)
virtualinherited

Create particles using findings from recent algorithm processing.

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

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

Implements lar_content::ThreeDBaseAlgorithm< float >.

Definition at line 105 of file ThreeDRemnantsAlgorithm.cc.

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

106 {
107  unsigned int repeatCounter(0);
108 
109  for (RemnantTensorToolVector::const_iterator iter = m_algorithmToolVector.begin(), iterEnd = m_algorithmToolVector.end(); iter != iterEnd; )
110  {
111  if ((*iter)->Run(this, m_overlapTensor))
112  {
113  iter = m_algorithmToolVector.begin();
114 
115  if (++repeatCounter > m_nMaxTensorToolRepeats)
116  break;
117  }
118  else
119  {
120  ++iter;
121  }
122  }
123 }
intermediate_table::const_iterator const_iterator
TensorType m_overlapTensor
The overlap tensor.
RemnantTensorToolVector m_algorithmToolVector
The algorithm tool list.
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
const std::string& lar_content::ThreeDBaseAlgorithm< float >::GetClusterListNameU ( ) const
inherited

Get the name of the u cluster list.

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

Get the name of the v cluster list.

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

Get the name of the w cluster list.

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

Get the input u cluster list.

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

Get the input v cluster list.

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

Get the input w cluster list.

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

Get the selected u cluster list.

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

Get the selected v cluster list.

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

Get the selected w cluster list.

virtual bool lar_content::ThreeDBaseAlgorithm< float >::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< float >::PerformMainLoop ( )
protectedvirtualinherited

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

virtual void lar_content::ThreeDBaseAlgorithm< float >::PreparationStep ( )
protectedvirtualinherited

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

StatusCode lar_content::ThreeDRemnantsAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::ThreeDBaseAlgorithm< float >.

Definition at line 127 of file ThreeDRemnantsAlgorithm.cc.

References m_algorithmToolVector, m_minClusterCaloHits, m_nMaxTensorToolRepeats, m_pseudoChi2Cut, m_xOverlapWindow, and lar_content::ThreeDBaseAlgorithm< T >::ReadSettings().

128 {
129  AlgorithmToolVector algorithmToolVector;
130  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithmToolList(*this, xmlHandle,
131  "TrackTools", algorithmToolVector));
132 
133  for (AlgorithmToolVector::const_iterator iter = algorithmToolVector.begin(), iterEnd = algorithmToolVector.end(); iter != iterEnd; ++iter)
134  {
135  RemnantTensorTool *const pRemnantTensorTool(dynamic_cast<RemnantTensorTool*>(*iter));
136 
137  if (NULL == pRemnantTensorTool)
138  return STATUS_CODE_INVALID_PARAMETER;
139 
140  m_algorithmToolVector.push_back(pRemnantTensorTool);
141  }
142 
143  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
144  "NMaxTensorToolRepeats", m_nMaxTensorToolRepeats));
145 
146  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
147  "MinClusterCaloHits", m_minClusterCaloHits));
148 
149  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
150  "OverlapWindow", m_xOverlapWindow));
151 
152  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle,
153  "PseudoChi2Cut", m_pseudoChi2Cut));
154 
156 }
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
unsigned int m_minClusterCaloHits
The selection cut on the number of cluster calo hits.
float m_pseudoChi2Cut
The selection cut on the matched chi2.
intermediate_table::const_iterator const_iterator
float m_xOverlapWindow
The sampling pitch in the x coordinate.
RemnantTensorToolVector m_algorithmToolVector
The algorithm tool list.
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
virtual void lar_content::ThreeDBaseAlgorithm< float >::RemoveUnavailableTensorElements ( )
virtualinherited

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

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

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

void lar_content::ThreeDRemnantsAlgorithm::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< float >.

Definition at line 31 of file ThreeDRemnantsAlgorithm.cc.

References m_minClusterCaloHits.

32 {
33  for (ClusterList::const_iterator iter = pInputClusterList->begin(), iterEnd = pInputClusterList->end(); iter != iterEnd; ++iter)
34  {
35  const Cluster *const pCluster = *iter;
36 
37  if (!pCluster->IsAvailable())
38  continue;
39 
40  if (pCluster->GetNCaloHits() < m_minClusterCaloHits)
41  continue;
42 
43  selectedClusterList.push_back(pCluster);
44  }
45 }
unsigned int m_minClusterCaloHits
The selection cut on the number of cluster calo hits.
intermediate_table::const_iterator const_iterator
void lar_content::ThreeDRemnantsAlgorithm::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< float >.

Definition at line 49 of file ThreeDRemnantsAlgorithm.cc.

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

50 {
51  // TODO Correct these placeholder parameters
52  pfoParameters.m_particleId = E_MINUS; // Shower
53  pfoParameters.m_charge = PdgTable::GetParticleCharge(pfoParameters.m_particleId.Get());
54  pfoParameters.m_mass = PdgTable::GetParticleMass(pfoParameters.m_particleId.Get());
55  pfoParameters.m_energy = 0.f;
56  pfoParameters.m_momentum = CartesianVector(0.f, 0.f, 0.f);
57  pfoParameters.m_clusterList.insert(pfoParameters.m_clusterList.end(), protoParticle.m_clusterListU.begin(), protoParticle.m_clusterListU.end());
58  pfoParameters.m_clusterList.insert(pfoParameters.m_clusterList.end(), protoParticle.m_clusterListV.begin(), protoParticle.m_clusterListV.end());
59  pfoParameters.m_clusterList.insert(pfoParameters.m_clusterList.end(), protoParticle.m_clusterListW.begin(), protoParticle.m_clusterListW.end());
60 }
TFile f
Definition: plotHisto.C:6
virtual void lar_content::ThreeDBaseAlgorithm< float >::TidyUp ( )
protectedvirtualinherited

Tidy member variables in derived class.

virtual void lar_content::ThreeDBaseAlgorithm< float >::UpdateForNewCluster ( const pandora::Cluster *const  pNewCluster)
virtualinherited

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

Parameters
pNewClusteraddress of the new cluster
virtual void lar_content::ThreeDBaseAlgorithm< float >::UpdateUponDeletion ( const pandora::Cluster *const  pDeletedCluster)
virtualinherited

Update to reflect cluster deletion.

Parameters
pDeletedClusteraddress of the deleted cluster

Member Data Documentation

RemnantTensorToolVector lar_content::ThreeDRemnantsAlgorithm::m_algorithmToolVector
private

The algorithm tool list.

Definition at line 46 of file ThreeDRemnantsAlgorithm.h.

Referenced by ExamineTensor(), and ReadSettings().

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

The selected modified cluster list U.

Definition at line 196 of file ThreeDBaseAlgorithm.h.

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

The selected modified cluster list V.

Definition at line 197 of file ThreeDBaseAlgorithm.h.

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

The selected modified cluster list W.

Definition at line 198 of file ThreeDBaseAlgorithm.h.

unsigned int lar_content::ThreeDRemnantsAlgorithm::m_minClusterCaloHits
private

The selection cut on the number of cluster calo hits.

Definition at line 49 of file ThreeDRemnantsAlgorithm.h.

Referenced by ReadSettings(), and SelectInputClusters().

unsigned int lar_content::ThreeDRemnantsAlgorithm::m_nMaxTensorToolRepeats
private

The maximum number of repeat loops over tensor tools.

Definition at line 48 of file ThreeDRemnantsAlgorithm.h.

Referenced by ExamineTensor(), and ReadSettings().

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

The overlap tensor.

Definition at line 200 of file ThreeDBaseAlgorithm.h.

Referenced by CalculateOverlapResult(), and ExamineTensor().

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

Address of the input cluster list U.

Definition at line 192 of file ThreeDBaseAlgorithm.h.

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

Address of the input cluster list V.

Definition at line 193 of file ThreeDBaseAlgorithm.h.

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

Address of the input cluster list W.

Definition at line 194 of file ThreeDBaseAlgorithm.h.

float lar_content::ThreeDRemnantsAlgorithm::m_pseudoChi2Cut
private

The selection cut on the matched chi2.

Definition at line 51 of file ThreeDRemnantsAlgorithm.h.

Referenced by CalculateOverlapResult(), and ReadSettings().

float lar_content::ThreeDRemnantsAlgorithm::m_xOverlapWindow
private

The sampling pitch in the x coordinate.

Definition at line 50 of file ThreeDRemnantsAlgorithm.h.

Referenced by CalculateOverlapResult(), and ReadSettings().


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