Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
lar_content::ThreeViewRemnantsAlgorithm Class Reference

ThreeViewRemnantsAlgorithm class. More...

#include <ThreeViewRemnantsAlgorithm.h>

Inheritance diagram for lar_content::ThreeViewRemnantsAlgorithm:
lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< float > > lar_content::MatchingBaseAlgorithm

Public Types

typedef NViewMatchingAlgorithm< ThreeViewMatchingControl< float > > BaseAlgorithm
 
- Public Types inherited from lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< float > >
typedef ThreeViewMatchingControl< float > MatchingType
 

Public Member Functions

 ThreeViewRemnantsAlgorithm ()
 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...
 
- Public Member Functions inherited from lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< float > >
 NViewMatchingAlgorithm ()
 Default constructor. More...
 
virtual ~NViewMatchingAlgorithm ()
 Destructor. 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...
 
const std::stringGetClusterListName (const pandora::HitType hitType) const
 Get the cluster list name corresponding to a specified hit type. More...
 
const pandora::ClusterList & GetInputClusterList (const pandora::HitType hitType) const
 Get the input cluster list corresponding to a specified hit type. More...
 
const pandora::ClusterList & GetSelectedClusterList (const pandora::HitType hitType) const
 Get the selected cluster list corresponding to a specified hit type. More...
 
- Public Member Functions inherited from lar_content::MatchingBaseAlgorithm
 MatchingBaseAlgorithm ()
 Default constructor. More...
 
virtual ~MatchingBaseAlgorithm ()
 Destructor. More...
 
virtual void PrepareInputClusters (pandora::ClusterList &preparedClusterList)
 Perform any preparatory steps required on the input clusters, e.g. caching expensive fit results. More...
 
virtual bool MakeClusterMerges (const ClusterMergeMap &clusterMergeMap)
 Merge clusters together. More...
 
virtual bool CreateThreeDParticles (const ProtoParticleVector &protoParticleVector)
 Create particles using findings from recent algorithm processing. More...
 
virtual void SetPfoParameters (const ProtoParticle &protoParticle, PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
 Set Pfo properties. More...
 
virtual void SetPfoParticleId (PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
 Set pfo particle id. 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 container. More...
 
void ExamineOverlapContainer ()
 Examine contents of overlap container, 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...
 

Additional Inherited Members

- Protected Member Functions inherited from lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< float > >
MatchingTypeGetMatchingControl ()
 Get the matching control. More...
 
virtual void SelectAllInputClusters ()
 Select a subset of input clusters for processing in this algorithm. More...
 
virtual void PrepareAllInputClusters ()
 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 overlap container. Responsible for calling CalculateOverlapResult. More...
 
virtual void TidyUp ()
 Tidy member variables in derived class. More...
 
- Protected Attributes inherited from lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< float > >
MatchingType m_matchingControl
 The matching control. More...
 

Detailed Description

ThreeViewRemnantsAlgorithm class.

Definition at line 27 of file ThreeViewRemnantsAlgorithm.h.

Member Typedef Documentation

Definition at line 30 of file ThreeViewRemnantsAlgorithm.h.

Definition at line 45 of file ThreeViewRemnantsAlgorithm.h.

Constructor & Destructor Documentation

lar_content::ThreeViewRemnantsAlgorithm::ThreeViewRemnantsAlgorithm ( )

Default constructor.

Definition at line 21 of file ThreeViewRemnantsAlgorithm.cc.

21  :
25  m_pseudoChi2Cut(10.f)
26 {
27 }
float m_pseudoChi2Cut
The selection cut on the matched chi2.
unsigned int m_minClusterCaloHits
The selection cut on the number of cluster calo hits.
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::ThreeViewRemnantsAlgorithm::CalculateOverlapResult ( const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2,
const pandora::Cluster *const  pCluster3 
)
privatevirtual

Calculate cluster overlap result and store in container.

Parameters
pCluster1address of cluster1
pCluster2address of cluster2
pCluster3address of cluster3

Implements lar_content::MatchingBaseAlgorithm.

Definition at line 49 of file ThreeViewRemnantsAlgorithm.cc.

50 {
51  // Requirements on X matching
52  float xMinU(0.f), xMinV(0.f), xMinW(0.f), xMaxU(0.f), xMaxV(0.f), xMaxW(0.f);
53  pClusterU->GetClusterSpanX(xMinU, xMaxU);
54  pClusterV->GetClusterSpanX(xMinV, xMaxV);
55  pClusterW->GetClusterSpanX(xMinW, xMaxW);
56 
57  const float xMin(std::max(xMinU, std::max(xMinV, xMinW)) - m_xOverlapWindow);
58  const float xMax(std::min(xMaxU, std::min(xMaxV, xMaxW)) + m_xOverlapWindow);
59  const float xOverlap(xMax - xMin);
60 
61  if (xOverlap < std::numeric_limits<float>::epsilon())
62  return;
63 
64  // Requirements on 3D matching
66 
67  if ((STATUS_CODE_SUCCESS != LArClusterHelper::GetAverageZ(pClusterU, xMin, xMax, u)) ||
68  (STATUS_CODE_SUCCESS != LArClusterHelper::GetAverageZ(pClusterV, xMin, xMax, v)) ||
69  (STATUS_CODE_SUCCESS != LArClusterHelper::GetAverageZ(pClusterW, xMin, xMax, w)))
70  {
71  return;
72  }
73 
74  const float uv2w(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_U, TPC_VIEW_V, u, v));
75  const float vw2u(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_V, TPC_VIEW_W, v, w));
76  const float wu2v(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), TPC_VIEW_W, TPC_VIEW_U, w, u));
77 
78  const float pseudoChi2(((u - vw2u) * (u - vw2u) + (v - wu2v) * (v - wu2v) + (w - uv2w) * (w - uv2w)) / 3.f);
79 
80  if (pseudoChi2 > m_pseudoChi2Cut)
81  return;
82 
83  // ATTN Essentially a boolean result; actual value matters only so as to ensure that overlap results can be sorted
84  const float hackValue(
85  pseudoChi2 + pClusterU->GetElectromagneticEnergy() + pClusterV->GetElectromagneticEnergy() + pClusterW->GetElectromagneticEnergy());
86  this->GetMatchingControl().GetOverlapTensor().SetOverlapResult(pClusterU, pClusterV, pClusterW, hackValue);
87 }
float m_pseudoChi2Cut
The selection cut on the matched chi2.
TensorType & GetOverlapTensor()
Get the overlap tensor.
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.
void SetOverlapResult(const pandora::Cluster *const pClusterU, const pandora::Cluster *const pClusterV, const pandora::Cluster *const pClusterW, const OverlapResult &overlapResult)
Set overlap result.
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).
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
float m_xOverlapWindow
The sampling pitch in the x coordinate.
void lar_content::ThreeViewRemnantsAlgorithm::ExamineOverlapContainer ( )
privatevirtual

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

Implements lar_content::MatchingBaseAlgorithm.

Definition at line 91 of file ThreeViewRemnantsAlgorithm.cc.

92 {
93  unsigned int repeatCounter(0);
94 
95  for (RemnantTensorToolVector::const_iterator iter = m_algorithmToolVector.begin(), iterEnd = m_algorithmToolVector.end(); iter != iterEnd;)
96  {
97  if ((*iter)->Run(this, this->GetMatchingControl().GetOverlapTensor()))
98  {
99  iter = m_algorithmToolVector.begin();
100 
101  if (++repeatCounter > m_nMaxTensorToolRepeats)
102  break;
103  }
104  else
105  {
106  ++iter;
107  }
108  }
109 }
intermediate_table::const_iterator const_iterator
RemnantTensorToolVector m_algorithmToolVector
The algorithm tool list.
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
StatusCode lar_content::ThreeViewRemnantsAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
privatevirtual

Reimplemented from lar_content::NViewMatchingAlgorithm< ThreeViewMatchingControl< float > >.

Definition at line 113 of file ThreeViewRemnantsAlgorithm.cc.

114 {
115  AlgorithmToolVector algorithmToolVector;
116  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithmToolList(*this, xmlHandle, "TrackTools", algorithmToolVector));
117 
118  for (AlgorithmToolVector::const_iterator iter = algorithmToolVector.begin(), iterEnd = algorithmToolVector.end(); iter != iterEnd; ++iter)
119  {
120  RemnantTensorTool *const pRemnantTensorTool(dynamic_cast<RemnantTensorTool *>(*iter));
121 
122  if (!pRemnantTensorTool)
123  return STATUS_CODE_INVALID_PARAMETER;
124 
125  m_algorithmToolVector.push_back(pRemnantTensorTool);
126  }
127 
128  PANDORA_RETURN_RESULT_IF_AND_IF(
129  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "NMaxTensorToolRepeats", m_nMaxTensorToolRepeats));
130 
131  PANDORA_RETURN_RESULT_IF_AND_IF(
132  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinClusterCaloHits", m_minClusterCaloHits));
133 
134  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "OverlapWindow", m_xOverlapWindow));
135 
136  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "PseudoChi2Cut", m_pseudoChi2Cut));
137 
138  return BaseAlgorithm::ReadSettings(xmlHandle);
139 }
float m_pseudoChi2Cut
The selection cut on the matched chi2.
intermediate_table::const_iterator const_iterator
RemnantTensorToolVector m_algorithmToolVector
The algorithm tool list.
virtual pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
unsigned int m_minClusterCaloHits
The selection cut on the number of cluster calo hits.
float m_xOverlapWindow
The sampling pitch in the x coordinate.
unsigned int m_nMaxTensorToolRepeats
The maximum number of repeat loops over tensor tools.
void lar_content::ThreeViewRemnantsAlgorithm::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

Reimplemented from lar_content::MatchingBaseAlgorithm.

Definition at line 31 of file ThreeViewRemnantsAlgorithm.cc.

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 }
intermediate_table::const_iterator const_iterator
unsigned int m_minClusterCaloHits
The selection cut on the number of cluster calo hits.

Member Data Documentation

RemnantTensorToolVector lar_content::ThreeViewRemnantsAlgorithm::m_algorithmToolVector
private

The algorithm tool list.

Definition at line 46 of file ThreeViewRemnantsAlgorithm.h.

unsigned int lar_content::ThreeViewRemnantsAlgorithm::m_minClusterCaloHits
private

The selection cut on the number of cluster calo hits.

Definition at line 49 of file ThreeViewRemnantsAlgorithm.h.

unsigned int lar_content::ThreeViewRemnantsAlgorithm::m_nMaxTensorToolRepeats
private

The maximum number of repeat loops over tensor tools.

Definition at line 48 of file ThreeViewRemnantsAlgorithm.h.

float lar_content::ThreeViewRemnantsAlgorithm::m_pseudoChi2Cut
private

The selection cut on the matched chi2.

Definition at line 51 of file ThreeViewRemnantsAlgorithm.h.

float lar_content::ThreeViewRemnantsAlgorithm::m_xOverlapWindow
private

The sampling pitch in the x coordinate.

Definition at line 50 of file ThreeViewRemnantsAlgorithm.h.


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