All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
lar_content::CosmicRayShowerMatchingAlgorithm Class Reference

CosmicRayShowerMatchingAlgorithm class. More...

#include <CosmicRayShowerMatchingAlgorithm.h>

Inheritance diagram for lar_content::CosmicRayShowerMatchingAlgorithm:
lar_content::CosmicRayBaseMatchingAlgorithm

Public Member Functions

 CosmicRayShowerMatchingAlgorithm ()
 Default constructor. More...
 

Private Member Functions

void SelectCleanClusters (const pandora::ClusterVector &inputVector, pandora::ClusterVector &outputVector) const
 Select a set of clusters judged to be clean. More...
 
bool MatchClusters (const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2) const
 Match a pair of clusters from two views. More...
 
bool CheckMatchedClusters3D (const pandora::Cluster *const pCluster1, const pandora::Cluster *const pCluster2, const pandora::Cluster *const pCluster3) const
 Check that three clusters have a consistent 3D position. More...
 
void SetPfoParameters (const Particle &particle, PandoraContentApi::ParticleFlowObject::Parameters &pfoParameters) const
 Calculate Pfo properties from proto particle. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

float m_minCaloHitsPerCluster
 minimum size of clusters for this algorithm More...
 
float m_minXOverlap
 requirement on minimum X overlap for associated clusters More...
 
float m_minXOverlapFraction
 requirement on minimum X overlap fraction for associated clusters More...
 
float m_pseudoChi2Cut
 The selection cut on the matched chi2. More...
 

Additional Inherited Members

- Protected Types inherited from lar_content::CosmicRayBaseMatchingAlgorithm
typedef std::vector< ParticleParticleList
 
typedef std::unordered_map
< const pandora::Cluster
*, pandora::ClusterList > 
ClusterAssociationMap
 
typedef std::set< unsigned int > UIntSet
 
- Protected Member Functions inherited from lar_content::CosmicRayBaseMatchingAlgorithm
pandora::StatusCode Run ()
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Detailed Description

CosmicRayShowerMatchingAlgorithm class.

Definition at line 19 of file CosmicRayShowerMatchingAlgorithm.h.

Constructor & Destructor Documentation

lar_content::CosmicRayShowerMatchingAlgorithm::CosmicRayShowerMatchingAlgorithm ( )

Default constructor.

Definition at line 21 of file CosmicRayShowerMatchingAlgorithm.cc.

21  :
23  m_minXOverlap(1.f),
25  m_pseudoChi2Cut(5.f)
26 {
27 }
float m_pseudoChi2Cut
The selection cut on the matched chi2.
float m_minXOverlap
requirement on minimum X overlap for associated clusters
float m_minCaloHitsPerCluster
minimum size of clusters for this algorithm
float m_minXOverlapFraction
requirement on minimum X overlap fraction for associated clusters

Member Function Documentation

bool lar_content::CosmicRayShowerMatchingAlgorithm::CheckMatchedClusters3D ( const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2,
const pandora::Cluster *const  pCluster3 
) const
privatevirtual

Check that three clusters have a consistent 3D position.

Parameters
pCluster1the cluster from the first view
pCluster2the cluster from the second view
pCluster3the cluster from the third view
Returns
boolean

Implements lar_content::CosmicRayBaseMatchingAlgorithm.

Definition at line 64 of file CosmicRayShowerMatchingAlgorithm.cc.

66 {
67  // Check that three clusters have a consistent 3D position
68  const HitType hitType1(LArClusterHelper::GetClusterHitType(pCluster1));
69  const HitType hitType2(LArClusterHelper::GetClusterHitType(pCluster2));
70  const HitType hitType3(LArClusterHelper::GetClusterHitType(pCluster3));
71 
72  if (hitType1 == hitType2 || hitType2 == hitType3 || hitType3 == hitType1)
73  throw StatusCodeException(STATUS_CODE_FAILURE);
74 
75  // Requirements on X matching
76  float xMin1(0.f), xMin2(0.f), xMin3(0.f), xMax1(0.f), xMax2(0.f), xMax3(0.f);
77  pCluster1->GetClusterSpanX(xMin1, xMax1);
78  pCluster2->GetClusterSpanX(xMin2, xMax2);
79  pCluster3->GetClusterSpanX(xMin3, xMax3);
80 
81  const float xMin(std::max(xMin1, std::max(xMin2, xMin3)));
82  const float xMax(std::min(xMax1, std::min(xMax2, xMax3)));
83  const float xOverlap(xMax - xMin);
84 
85  if (xOverlap < std::numeric_limits<float>::epsilon())
86  return false;
87 
88  float p1(std::numeric_limits<float>::max()), p2(std::numeric_limits<float>::max()), p3(std::numeric_limits<float>::max());
89 
90  if ((STATUS_CODE_SUCCESS != LArClusterHelper::GetAverageZ(pCluster1, xMin, xMax, p1)) ||
91  (STATUS_CODE_SUCCESS != LArClusterHelper::GetAverageZ(pCluster2, xMin, xMax, p2)) ||
92  (STATUS_CODE_SUCCESS != LArClusterHelper::GetAverageZ(pCluster3, xMin, xMax, p3)))
93  {
94  return false;
95  }
96 
97  const float q3(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), hitType1, hitType2, p1, p2));
98  const float q1(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), hitType2, hitType3, p2, p3));
99  const float q2(LArGeometryHelper::MergeTwoPositions(this->GetPandora(), hitType3, hitType1, p3, p1));
100 
101  const float pseudoChi2(((q1 - p1) * (q1 - p1) + (q2 - p2) * (q2 - p2) + (q3 - p3) * (q3 - p3)) / 3.f);
102 
103  if (pseudoChi2 > m_pseudoChi2Cut)
104  return false;
105 
106  return true;
107 }
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
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.
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_pseudoChi2Cut
The selection cut on the matched chi2.
physics associatedGroupsWithLeft p1
bool lar_content::CosmicRayShowerMatchingAlgorithm::MatchClusters ( const pandora::Cluster *const  pCluster1,
const pandora::Cluster *const  pCluster2 
) const
privatevirtual

Match a pair of clusters from two views.

Parameters
pCluster1the first cluster
pCluster2the second cluster
Returns
boolean

Implements lar_content::CosmicRayBaseMatchingAlgorithm.

Definition at line 44 of file CosmicRayShowerMatchingAlgorithm.cc.

45 {
46  float xMin1(0.f), xMax1(0.f), xMin2(0.f), xMax2(0.f);
47  pCluster1->GetClusterSpanX(xMin1, xMax1);
48  pCluster2->GetClusterSpanX(xMin2, xMax2);
49 
50  const float xOverlap(std::min(xMax1, xMax2) - std::max(xMin1, xMin2));
51  const float xSpan(std::max(xMax1, xMax2) - std::min(xMin1, xMin2));
52 
53  if (xSpan < std::numeric_limits<float>::epsilon())
54  return false;
55 
56  if (xOverlap > m_minXOverlap && xOverlap / xSpan > m_minXOverlapFraction)
57  return true;
58 
59  return false;
60 }
float m_minXOverlap
requirement on minimum X overlap for associated clusters
float m_minXOverlapFraction
requirement on minimum X overlap fraction for associated clusters
StatusCode lar_content::CosmicRayShowerMatchingAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 132 of file CosmicRayShowerMatchingAlgorithm.cc.

133 {
134  PANDORA_RETURN_RESULT_IF_AND_IF(
135  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinCaloHitsPerCluster", m_minCaloHitsPerCluster));
136 
137  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinXOverlap", m_minXOverlap));
138 
139  PANDORA_RETURN_RESULT_IF_AND_IF(
140  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinXOverlapFraction", m_minXOverlapFraction));
141 
142  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "PseudoChi2Cut", m_pseudoChi2Cut));
143 
145 }
float m_pseudoChi2Cut
The selection cut on the matched chi2.
float m_minXOverlap
requirement on minimum X overlap for associated clusters
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float m_minCaloHitsPerCluster
minimum size of clusters for this algorithm
float m_minXOverlapFraction
requirement on minimum X overlap fraction for associated clusters
void lar_content::CosmicRayShowerMatchingAlgorithm::SelectCleanClusters ( const pandora::ClusterVector &  inputVector,
pandora::ClusterVector &  outputVector 
) const
privatevirtual

Select a set of clusters judged to be clean.

Parameters
inputVectorthe input vector of all available clusters
outputVectorthe output vector of clean clusters

Implements lar_content::CosmicRayBaseMatchingAlgorithm.

Definition at line 31 of file CosmicRayShowerMatchingAlgorithm.cc.

32 {
33  for (const Cluster *const pCluster : inputVector)
34  {
35  if (pCluster->GetNCaloHits() < m_minCaloHitsPerCluster)
36  continue;
37 
38  outputVector.push_back(pCluster);
39  }
40 }
float m_minCaloHitsPerCluster
minimum size of clusters for this algorithm
void lar_content::CosmicRayShowerMatchingAlgorithm::SetPfoParameters ( const Particle protoParticle,
PandoraContentApi::ParticleFlowObject::Parameters pfoParameters 
) const
privatevirtual

Calculate Pfo properties from proto particle.

Parameters
protoParticlethe input proto particle
pfoParametersthe output pfo parameters

Implements lar_content::CosmicRayBaseMatchingAlgorithm.

Definition at line 111 of file CosmicRayShowerMatchingAlgorithm.cc.

112 {
113  ClusterList clusterList;
114  if (particle.m_pClusterU)
115  clusterList.push_back(particle.m_pClusterU);
116  if (particle.m_pClusterV)
117  clusterList.push_back(particle.m_pClusterV);
118  if (particle.m_pClusterW)
119  clusterList.push_back(particle.m_pClusterW);
120 
121  // TODO Correct these placeholder parameters
122  pfoParameters.m_particleId = E_MINUS; // SHOWER
123  pfoParameters.m_charge = PdgTable::GetParticleCharge(pfoParameters.m_particleId.Get());
124  pfoParameters.m_mass = PdgTable::GetParticleMass(pfoParameters.m_particleId.Get());
125  pfoParameters.m_energy = 0.f;
126  pfoParameters.m_momentum = CartesianVector(0.f, 0.f, 0.f);
127  pfoParameters.m_clusterList = clusterList;
128 }

Member Data Documentation

float lar_content::CosmicRayShowerMatchingAlgorithm::m_minCaloHitsPerCluster
private

minimum size of clusters for this algorithm

Definition at line 36 of file CosmicRayShowerMatchingAlgorithm.h.

float lar_content::CosmicRayShowerMatchingAlgorithm::m_minXOverlap
private

requirement on minimum X overlap for associated clusters

Definition at line 37 of file CosmicRayShowerMatchingAlgorithm.h.

float lar_content::CosmicRayShowerMatchingAlgorithm::m_minXOverlapFraction
private

requirement on minimum X overlap fraction for associated clusters

Definition at line 38 of file CosmicRayShowerMatchingAlgorithm.h.

float lar_content::CosmicRayShowerMatchingAlgorithm::m_pseudoChi2Cut
private

The selection cut on the matched chi2.

Definition at line 39 of file CosmicRayShowerMatchingAlgorithm.h.


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