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

EnergyKickVertexSelectionAlgorithm class. More...

#include <EnergyKickVertexSelectionAlgorithm.h>

Inheritance diagram for lar_content::EnergyKickVertexSelectionAlgorithm:
lar_content::VertexSelectionBaseAlgorithm

Public Member Functions

 EnergyKickVertexSelectionAlgorithm ()
 Default constructor. More...
 
- Public Member Functions inherited from lar_content::VertexSelectionBaseAlgorithm
 VertexSelectionBaseAlgorithm ()
 Default constructor. More...
 

Private Member Functions

void GetVertexScoreList (const pandora::VertexVector &vertexVector, const BeamConstants &beamConstants, HitKDTree2D &kdTreeU, HitKDTree2D &kdTreeV, HitKDTree2D &kdTreeW, VertexScoreList &vertexScoreList) const
 Get the vertex score list for a provided list of candidate vertices. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Private Attributes

VertexFeatureTool::FeatureToolVector m_featureToolVector
 The feature tool map. More...
 
pandora::StringVector m_inputClusterListNames
 The list of cluster list names. More...
 
unsigned int m_minClusterCaloHits
 The min number of hits parameter in the energy score. More...
 
unsigned int m_slidingFitWindow
 The layer window for the sliding linear fits. More...
 
float m_epsilon
 The epsilon parameter in the energy score. More...
 
float m_asymmetryConstant
 The asymmetry constant parameter in the energy score. More...
 

Additional Inherited Members

- Public Types inherited from lar_content::VertexSelectionBaseAlgorithm
typedef std::vector< VertexScoreVertexScoreList
 
typedef std::vector< SlidingFitDataSlidingFitDataList
 
typedef std::vector< ShowerClusterShowerClusterList
 
typedef KDTreeNodeInfoT< const pandora::CaloHit *, 2 > HitKDNode2D
 
typedef std::vector< HitKDNode2DHitKDNode2DList
 
typedef KDTreeLinkerAlgo< const pandora::CaloHit *, 2 > HitKDTree2D
 
typedef std::map< pandora::HitType, const pandora::ClusterList & > ClusterListMap
 Map array of cluster lists for passing to tools. More...
 
typedef std::map< pandora::HitType, const SlidingFitDataListSlidingFitDataListMap
 Map of sliding fit data lists for passing to tools. More...
 
typedef std::map< pandora::HitType, const ShowerClusterListShowerClusterListMap
 Map of shower cluster lists for passing to tools. More...
 
typedef std::map< pandora::HitType, const std::reference_wrapper< HitKDTree2D > > KDTreeMap
 Map array of hit kd trees for passing to tools. More...
 
typedef MvaFeatureTool< const VertexSelectionBaseAlgorithm *const, const pandora::Vertex *const, const SlidingFitDataListMap &, const ClusterListMap &, const KDTreeMap &, const ShowerClusterListMap &, const float, float & > VertexFeatureTool
 The base type for the vertex feature tools. More...
 
- Protected Member Functions inherited from lar_content::VertexSelectionBaseAlgorithm
virtual void FilterVertexList (const pandora::VertexList *const pInputVertexList, HitKDTree2D &kdTreeU, HitKDTree2D &kdTreeV, HitKDTree2D &kdTreeW, pandora::VertexVector &filteredVertices) const
 Filter the input list of vertices to obtain a reduced number of vertex candidates. More...
 
virtual void GetBeamConstants (const pandora::VertexVector &vertexVector, BeamConstants &beamConstants) const
 Get the beam score constants for a provided list of candidate vertices. More...
 
void GetClusterLists (const pandora::StringVector &inputClusterListNames, pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW) const
 Get the cluster lists. More...
 
void CalculateClusterSlidingFits (const pandora::ClusterList &inputClusterList, const unsigned int minClusterCaloHits, const unsigned int slidingFitWindow, SlidingFitDataList &slidingFitDataList) const
 Calculate the cluster sliding fits. More...
 
float GetBeamDeweightingScore (const BeamConstants &beamConstants, const pandora::Vertex *const pVertex) const
 Get the beam deweighting score for a vertex. More...
 
bool IsBeamModeOn () const
 Whether algorithm is running in beam mode, assuming neutrinos travel in positive z-direction. More...
 
float GetVertexEnergy (const pandora::Vertex *const pVertex, const KDTreeMap &kdTreeMap) const
 Calculate the energy of a vertex candidate by summing values from all three planes. More...
 
float VertexHitEnergy (const pandora::Vertex *const pVertex, const pandora::HitType hitType, HitKDTree2D &kdTree) const
 Finds the energy of the nearest hit to the vertex candidate in this view. More...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Detailed Description

EnergyKickVertexSelectionAlgorithm class.

Definition at line 19 of file EnergyKickVertexSelectionAlgorithm.h.

Constructor & Destructor Documentation

lar_content::EnergyKickVertexSelectionAlgorithm::EnergyKickVertexSelectionAlgorithm ( )

Default constructor.

Definition at line 22 of file EnergyKickVertexSelectionAlgorithm.cc.

22  :
24  m_slidingFitWindow(100),
25  m_epsilon(0.06),
27 {
28 }
unsigned int m_minClusterCaloHits
The min number of hits parameter in the energy score.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
float m_epsilon
The epsilon parameter in the energy score.
float m_asymmetryConstant
The asymmetry constant parameter in the energy score.

Member Function Documentation

void lar_content::EnergyKickVertexSelectionAlgorithm::GetVertexScoreList ( const pandora::VertexVector &  vertexVector,
const BeamConstants beamConstants,
HitKDTree2D kdTreeU,
HitKDTree2D kdTreeV,
HitKDTree2D kdTreeW,
VertexScoreList vertexScoreList 
) const
privatevirtual

Get the vertex score list for a provided list of candidate vertices.

Parameters
vertexVectorthe vertex vector
beamConstantsthe beam constants
kdTreeUthe kd tree for u hits
kdTreeVthe kd tree for v hits
kdTreeWthe kd tree for w hits
vertexScoreListto receive the vertex score list

Implements lar_content::VertexSelectionBaseAlgorithm.

Definition at line 32 of file EnergyKickVertexSelectionAlgorithm.cc.

34 {
35  ClusterList clustersU, clustersV, clustersW;
36  this->GetClusterLists(m_inputClusterListNames, clustersU, clustersV, clustersW);
37 
38  SlidingFitDataList slidingFitDataListU, slidingFitDataListV, slidingFitDataListW;
39  this->CalculateClusterSlidingFits(clustersU, m_minClusterCaloHits, m_slidingFitWindow, slidingFitDataListU);
40  this->CalculateClusterSlidingFits(clustersV, m_minClusterCaloHits, m_slidingFitWindow, slidingFitDataListV);
41  this->CalculateClusterSlidingFits(clustersW, m_minClusterCaloHits, m_slidingFitWindow, slidingFitDataListW);
42 
43  // Create maps from hit types to objects for passing to feature tools
44  const SlidingFitDataListMap slidingFitDataListMap{
45  {TPC_VIEW_U, slidingFitDataListU}, {TPC_VIEW_V, slidingFitDataListV}, {TPC_VIEW_W, slidingFitDataListW}};
46 
47  float bestFastScore(0.f); // not actually used - artefact of toolizing RPhi score and still using performance trick
48  for (const Vertex *const pVertex : vertexVector)
49  {
50  const float beamDeweightingScore(this->IsBeamModeOn() ? this->GetBeamDeweightingScore(beamConstants, pVertex) : 0.f);
51 
52  const float energyKick(LArMvaHelper::CalculateFeaturesOfType<EnergyKickFeatureTool>(m_featureToolVector, this, pVertex,
53  slidingFitDataListMap, ClusterListMap(), KDTreeMap(), ShowerClusterListMap(), beamDeweightingScore, bestFastScore)
54  .at(0)
55  .Get());
56 
57  const float energyAsymmetry(LArMvaHelper::CalculateFeaturesOfType<LocalAsymmetryFeatureTool>(m_featureToolVector, this, pVertex,
58  slidingFitDataListMap, ClusterListMap(), KDTreeMap(), ShowerClusterListMap(), beamDeweightingScore, bestFastScore)
59  .at(0)
60  .Get());
61 
62  const float energyKickScore(-energyKick / m_epsilon);
63  const float energyAsymmetryScore(energyAsymmetry / m_asymmetryConstant);
64 
65  vertexScoreList.push_back(VertexScore(pVertex, beamDeweightingScore + energyKickScore + energyAsymmetryScore));
66  }
67 }
pandora::StringVector m_inputClusterListNames
The list of cluster list names.
void GetClusterLists(const pandora::StringVector &inputClusterListNames, pandora::ClusterList &clusterListU, pandora::ClusterList &clusterListV, pandora::ClusterList &clusterListW) const
Get the cluster lists.
void CalculateClusterSlidingFits(const pandora::ClusterList &inputClusterList, const unsigned int minClusterCaloHits, const unsigned int slidingFitWindow, SlidingFitDataList &slidingFitDataList) const
Calculate the cluster sliding fits.
unsigned int m_minClusterCaloHits
The min number of hits parameter in the energy score.
bool IsBeamModeOn() const
Whether algorithm is running in beam mode, assuming neutrinos travel in positive z-direction.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
std::map< pandora::HitType, const ShowerClusterList > ShowerClusterListMap
Map of shower cluster lists for passing to tools.
float m_epsilon
The epsilon parameter in the energy score.
VertexFeatureTool::FeatureToolVector m_featureToolVector
The feature tool map.
std::map< pandora::HitType, const pandora::ClusterList & > ClusterListMap
Map array of cluster lists for passing to tools.
float m_asymmetryConstant
The asymmetry constant parameter in the energy score.
std::map< pandora::HitType, const SlidingFitDataList > SlidingFitDataListMap
Map of sliding fit data lists for passing to tools.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
std::map< pandora::HitType, const std::reference_wrapper< HitKDTree2D > > KDTreeMap
Map array of hit kd trees for passing to tools.
float GetBeamDeweightingScore(const BeamConstants &beamConstants, const pandora::Vertex *const pVertex) const
Get the beam deweighting score for a vertex.
StatusCode lar_content::EnergyKickVertexSelectionAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 72 of file EnergyKickVertexSelectionAlgorithm.cc.

73 {
74  AlgorithmToolVector algorithmToolVector;
75  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ProcessAlgorithmToolList(*this, xmlHandle, "FeatureTools", algorithmToolVector));
76 
77  for (AlgorithmTool *const pAlgorithmTool : algorithmToolVector)
78  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, LArMvaHelper::AddFeatureToolToVector(pAlgorithmTool, m_featureToolVector));
79 
80  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, XmlHelper::ReadVectorOfValues(xmlHandle, "InputClusterListNames", m_inputClusterListNames));
81 
82  PANDORA_RETURN_RESULT_IF_AND_IF(
83  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MinClusterCaloHits", m_minClusterCaloHits));
84 
85  PANDORA_RETURN_RESULT_IF_AND_IF(
86  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "SlidingFitWindow", m_slidingFitWindow));
87 
88  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "Epsilon", m_epsilon));
89 
90  PANDORA_RETURN_RESULT_IF_AND_IF(
91  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "AsymmetryConstant", m_asymmetryConstant));
92 
93  if ((m_epsilon < std::numeric_limits<float>::epsilon()) || (m_asymmetryConstant < std::numeric_limits<float>::epsilon()))
94  {
95  std::cout << "EnergyKickVertexSelection: Invalid parameter(s), Epsilon " << m_epsilon << ", AsymmetryConstant "
97  return STATUS_CODE_INVALID_PARAMETER;
98  }
99 
101 }
pandora::StringVector m_inputClusterListNames
The list of cluster list names.
unsigned int m_minClusterCaloHits
The min number of hits parameter in the energy score.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
float m_epsilon
The epsilon parameter in the energy score.
VertexFeatureTool::FeatureToolVector m_featureToolVector
The feature tool map.
static pandora::StatusCode AddFeatureToolToVector(pandora::AlgorithmTool *const pFeatureTool, MvaFeatureToolVector< Ts... > &featureToolVector)
Add a feature tool to a vector of feature tools.
Definition: LArMvaHelper.h:274
float m_asymmetryConstant
The asymmetry constant parameter in the energy score.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
QTextStream & endl(QTextStream &s)

Member Data Documentation

float lar_content::EnergyKickVertexSelectionAlgorithm::m_asymmetryConstant
private

The asymmetry constant parameter in the energy score.

Definition at line 39 of file EnergyKickVertexSelectionAlgorithm.h.

float lar_content::EnergyKickVertexSelectionAlgorithm::m_epsilon
private

The epsilon parameter in the energy score.

Definition at line 38 of file EnergyKickVertexSelectionAlgorithm.h.

VertexFeatureTool::FeatureToolVector lar_content::EnergyKickVertexSelectionAlgorithm::m_featureToolVector
private

The feature tool map.

Definition at line 33 of file EnergyKickVertexSelectionAlgorithm.h.

pandora::StringVector lar_content::EnergyKickVertexSelectionAlgorithm::m_inputClusterListNames
private

The list of cluster list names.

Definition at line 35 of file EnergyKickVertexSelectionAlgorithm.h.

unsigned int lar_content::EnergyKickVertexSelectionAlgorithm::m_minClusterCaloHits
private

The min number of hits parameter in the energy score.

Definition at line 36 of file EnergyKickVertexSelectionAlgorithm.h.

unsigned int lar_content::EnergyKickVertexSelectionAlgorithm::m_slidingFitWindow
private

The layer window for the sliding linear fits.

Definition at line 37 of file EnergyKickVertexSelectionAlgorithm.h.


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