LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::EnergyKickVertexSelectionAlgorithm Class Reference

EnergyKickVertexSelectionAlgorithm class. More...

#include "EnergyKickVertexSelectionAlgorithm.h"

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

Public Types

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

Public Member Functions

 EnergyKickVertexSelectionAlgorithm ()
 Default constructor. More...
 

Protected Member Functions

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

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

Detailed Description

Member Typedef Documentation

typedef std::map<pandora::HitType, const pandora::ClusterList &> lar_content::VertexSelectionBaseAlgorithm::ClusterListMap
inherited

Map array of cluster lists for passing to tools.

Definition at line 227 of file VertexSelectionBaseAlgorithm.h.

typedef KDTreeNodeInfoT<const pandora::CaloHit *, 2> lar_content::VertexSelectionBaseAlgorithm::HitKDNode2D
inherited

Definition at line 223 of file VertexSelectionBaseAlgorithm.h.

typedef KDTreeLinkerAlgo<const pandora::CaloHit *, 2> lar_content::VertexSelectionBaseAlgorithm::HitKDTree2D
inherited

Definition at line 225 of file VertexSelectionBaseAlgorithm.h.

typedef std::map<pandora::HitType, const std::reference_wrapper<HitKDTree2D> > lar_content::VertexSelectionBaseAlgorithm::KDTreeMap
inherited

Map array of hit kd trees for passing to tools.

Definition at line 230 of file VertexSelectionBaseAlgorithm.h.

typedef std::map<pandora::HitType, const ShowerClusterList> lar_content::VertexSelectionBaseAlgorithm::ShowerClusterListMap
inherited

Map of shower cluster lists for passing to tools.

Definition at line 229 of file VertexSelectionBaseAlgorithm.h.

typedef std::map<pandora::HitType, const SlidingFitDataList> lar_content::VertexSelectionBaseAlgorithm::SlidingFitDataListMap
inherited

Map of sliding fit data lists for passing to tools.

Definition at line 228 of file VertexSelectionBaseAlgorithm.h.

typedef MvaFeatureTool<const VertexSelectionBaseAlgorithm *const, const pandora::Vertex *const, const SlidingFitDataListMap &, const ClusterListMap &, const KDTreeMap &, const ShowerClusterListMap &, const float, float &> lar_content::VertexSelectionBaseAlgorithm::VertexFeatureTool
inherited

The base type for the vertex feature tools.

Definition at line 234 of file VertexSelectionBaseAlgorithm.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.
TFile f
Definition: plotHisto.C:6
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::VertexSelectionBaseAlgorithm::CalculateClusterSlidingFits ( const pandora::ClusterList &  inputClusterList,
const unsigned int  minClusterCaloHits,
const unsigned int  slidingFitWindow,
SlidingFitDataList slidingFitDataList 
) const
protectedinherited

Calculate the cluster sliding fits.

Parameters
inputClusterListthe input cluster list
minClusterCaloHitsthe minimum number of cluster calo hits
slidingFitWindowthe sliding fit window
slidingFitDataListthe list of sliding fits to fill

Definition at line 120 of file VertexSelectionBaseAlgorithm.cc.

References lar_content::LArGeometryHelper::GetWireZPitch(), and lar_content::LArClusterHelper::SortByNHits().

Referenced by GetVertexScoreList(), and lar_content::MvaVertexSelectionAlgorithm< T >::GetVertexScoreList().

122 {
123  const float slidingFitPitch(LArGeometryHelper::GetWireZPitch(this->GetPandora()));
124 
125  ClusterVector sortedClusters(inputClusterList.begin(), inputClusterList.end());
126  std::sort(sortedClusters.begin(), sortedClusters.end(), LArClusterHelper::SortByNHits);
127 
128  for (const Cluster *const pCluster : sortedClusters)
129  {
130  if (pCluster->GetNCaloHits() < minClusterCaloHits)
131  continue;
132 
133  // Make sure the window size is such that there are not more layers than hits (following TwoDSlidingLinearFit calculation).
134  const unsigned int newSlidingFitWindow(
135  std::min(static_cast<int>(pCluster->GetNCaloHits()), static_cast<int>(slidingFitPitch * slidingFitWindow)));
136  slidingFitDataList.emplace_back(pCluster, newSlidingFitWindow, slidingFitPitch);
137  }
138 }
static bool SortByNHits(const pandora::Cluster *const pLhs, const pandora::Cluster *const pRhs)
Sort clusters by number of hits, then layer span, then inner layer, then position, then pulse-height.
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
void lar_content::VertexSelectionBaseAlgorithm::FilterVertexList ( const pandora::VertexList *const  pInputVertexList,
HitKDTree2D kdTreeU,
HitKDTree2D kdTreeV,
HitKDTree2D kdTreeW,
pandora::VertexVector &  filteredVertices 
) const
protectedvirtualinherited

Filter the input list of vertices to obtain a reduced number of vertex candidates.

Parameters
pInputVertexListthe address of the input vertex list
kdTreeUthe kd tree for u hits
kdTreeVthe kd tree for v hits
kdTreeWthe kd tree for w hits
filteredVerticesto receive the filtered vertex list

Definition at line 40 of file VertexSelectionBaseAlgorithm.cc.

References lar_content::KDTreeLinkerAlgo< DATA, DIM >::empty(), lar_content::VertexSelectionBaseAlgorithm::IsVertexInGap(), lar_content::VertexSelectionBaseAlgorithm::IsVertexOnHit(), lar_content::VertexSelectionBaseAlgorithm::m_isEmptyViewAcceptable, lar_content::VertexSelectionBaseAlgorithm::m_minVertexAcceptableViews, and lar_content::VertexSelectionBaseAlgorithm::SortByVertexZPosition().

Referenced by lar_content::VertexSelectionBaseAlgorithm::Run().

42 {
43  for (const Vertex *const pVertex : *pInputVertexList)
44  {
45  unsigned int nAcceptableViews(0);
46 
47  if ((m_isEmptyViewAcceptable && kdTreeU.empty()) || this->IsVertexOnHit(pVertex, TPC_VIEW_U, kdTreeU) || this->IsVertexInGap(pVertex, TPC_VIEW_U))
48  ++nAcceptableViews;
49 
50  if ((m_isEmptyViewAcceptable && kdTreeV.empty()) || this->IsVertexOnHit(pVertex, TPC_VIEW_V, kdTreeV) || this->IsVertexInGap(pVertex, TPC_VIEW_V))
51  ++nAcceptableViews;
52 
53  if ((m_isEmptyViewAcceptable && kdTreeW.empty()) || this->IsVertexOnHit(pVertex, TPC_VIEW_W, kdTreeW) || this->IsVertexInGap(pVertex, TPC_VIEW_W))
54  ++nAcceptableViews;
55 
56  if (nAcceptableViews >= m_minVertexAcceptableViews)
57  filteredVertices.push_back(pVertex);
58  }
59 
60  std::sort(filteredVertices.begin(), filteredVertices.end(), SortByVertexZPosition);
61 }
bool IsVertexOnHit(const pandora::Vertex *const pVertex, const pandora::HitType hitType, HitKDTree2D &kdTree) const
Whether the vertex lies on a hit in the specified view.
bool IsVertexInGap(const pandora::Vertex *const pVertex, const pandora::HitType hitType) const
Whether the vertex lies in a registered gap.
static bool SortByVertexZPosition(const pandora::Vertex *const pLhs, const pandora::Vertex *const pRhs)
Sort vertices by increasing z position.
bool m_isEmptyViewAcceptable
Whether views entirely empty of hits are classed as &#39;acceptable&#39; for candidate filtration.
unsigned int m_minVertexAcceptableViews
The minimum number of views in which a candidate must sit on/near a hit or in a gap (or view can be e...
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
void lar_content::VertexSelectionBaseAlgorithm::GetBeamConstants ( const pandora::VertexVector &  vertexVector,
BeamConstants beamConstants 
) const
protectedvirtualinherited

Get the beam score constants for a provided list of candidate vertices.

Parameters
vertexVectorthe vertex vector
beamConstantsto receive the beam constants

Definition at line 65 of file VertexSelectionBaseAlgorithm.cc.

References f, lar_content::VertexSelectionBaseAlgorithm::m_beamMode, lar_content::VertexSelectionBaseAlgorithm::m_nDecayLengthsInZSpan, and lar_content::VertexSelectionBaseAlgorithm::BeamConstants::SetConstants().

Referenced by lar_content::VertexSelectionBaseAlgorithm::Run().

66 {
67  if (!m_beamMode)
68  return;
69 
70  if (vertexVector.empty())
71  throw StatusCodeException(STATUS_CODE_NOT_INITIALIZED);
72 
73  float minZCoordinate(std::numeric_limits<float>::max()), maxZCoordinate(-std::numeric_limits<float>::max());
74 
75  for (const Vertex *const pVertex : vertexVector)
76  {
77  if (pVertex->GetPosition().GetZ() < minZCoordinate)
78  minZCoordinate = pVertex->GetPosition().GetZ();
79 
80  if (pVertex->GetPosition().GetZ() > maxZCoordinate)
81  maxZCoordinate = pVertex->GetPosition().GetZ();
82  }
83 
84  const float zSpan(maxZCoordinate - minZCoordinate);
85  const float decayConstant((zSpan < std::numeric_limits<float>::epsilon()) ? 0.f : (m_nDecayLengthsInZSpan / zSpan));
86  beamConstants.SetConstants(minZCoordinate, decayConstant);
87 }
TFile f
Definition: plotHisto.C:6
bool m_beamMode
Whether to run in beam mode, assuming neutrinos travel in positive z-direction.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
float m_nDecayLengthsInZSpan
The number of score decay lengths to use over the course of the vertex z-span.
float lar_content::VertexSelectionBaseAlgorithm::GetBeamDeweightingScore ( const BeamConstants beamConstants,
const pandora::Vertex *const  pVertex 
) const
inlineprotectedinherited

Get the beam deweighting score for a vertex.

Parameters
beamConstantsthe beam constants
pVertexaddress of the vertex
Returns
the score

Definition at line 419 of file VertexSelectionBaseAlgorithm.h.

References lar_content::VertexSelectionBaseAlgorithm::BeamConstants::GetDecayConstant(), and lar_content::VertexSelectionBaseAlgorithm::BeamConstants::GetMinZCoordinate().

Referenced by GetVertexScoreList(), and lar_content::TrainedVertexSelectionAlgorithm::PopulateVertexFeatureInfoMap().

420 {
421  const float vertexMinZ(std::max(pVertex->GetPosition().GetZ(), beamConstants.GetMinZCoordinate()));
422  return (beamConstants.GetMinZCoordinate() - vertexMinZ) * beamConstants.GetDecayConstant();
423 }
void lar_content::VertexSelectionBaseAlgorithm::GetClusterLists ( const pandora::StringVector &  inputClusterListNames,
pandora::ClusterList &  clusterListU,
pandora::ClusterList &  clusterListV,
pandora::ClusterList &  clusterListW 
) const
protectedinherited

Get the cluster lists.

Parameters
inputClusterListNamesthe input cluster list names
clusterListUthe U-view cluster list to populate
clusterListVthe V-view cluster list to populate
clusterListWthe W-view cluster list to populate

Definition at line 91 of file VertexSelectionBaseAlgorithm.cc.

References lar_content::LArClusterHelper::GetClusterHitType().

Referenced by GetVertexScoreList(), and lar_content::MvaVertexSelectionAlgorithm< T >::GetVertexScoreList().

93 {
94  for (const std::string &clusterListName : inputClusterListNames)
95  {
96  const ClusterList *pClusterList(NULL);
97  PANDORA_THROW_RESULT_IF_AND_IF(
98  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_INITIALIZED, !=, PandoraContentApi::GetList(*this, clusterListName, pClusterList));
99 
100  if (!pClusterList || pClusterList->empty())
101  {
102  if (PandoraContentApi::GetSettings(*this)->ShouldDisplayAlgorithmInfo())
103  std::cout << "EnergyKickVertexSelectionAlgorithm: unable to find cluster list " << clusterListName << std::endl;
104 
105  continue;
106  }
107 
108  const HitType hitType(LArClusterHelper::GetClusterHitType(*(pClusterList->begin())));
109 
110  if ((TPC_VIEW_U != hitType) && (TPC_VIEW_V != hitType) && (TPC_VIEW_W != hitType))
111  throw StatusCodeException(STATUS_CODE_INVALID_PARAMETER);
112 
113  ClusterList &clusterList((TPC_VIEW_U == hitType) ? clusterListU : (TPC_VIEW_V == hitType) ? clusterListV : clusterListW);
114  clusterList.insert(clusterList.end(), pClusterList->begin(), pClusterList->end());
115  }
116 }
static pandora::HitType GetClusterHitType(const pandora::Cluster *const pCluster)
Get the hit type associated with a two dimensional cluster.
HitType
Definition: HitType.h:12
float lar_content::VertexSelectionBaseAlgorithm::GetVertexEnergy ( const pandora::Vertex *const  pVertex,
const KDTreeMap kdTreeMap 
) const
protectedinherited

Calculate the energy of a vertex candidate by summing values from all three planes.

Parameters
pVertexthe address of the vertex
kdTreeMapthe map of 2D hit kd trees
Returns
the summed vertex energy

Definition at line 243 of file VertexSelectionBaseAlgorithm.cc.

References f, lar_content::VertexSelectionBaseAlgorithm::IsVertexInGap(), and lar_content::VertexSelectionBaseAlgorithm::VertexHitEnergy().

Referenced by lar_content::TrainedVertexSelectionAlgorithm::PopulateVertexFeatureInfoMap().

244 {
245  float totalEnergy(0.f);
246 
247  if (!this->IsVertexInGap(pVertex, TPC_VIEW_U))
248  totalEnergy += this->VertexHitEnergy(pVertex, TPC_VIEW_U, kdTreeMap.at(TPC_VIEW_U));
249 
250  if (!this->IsVertexInGap(pVertex, TPC_VIEW_V))
251  totalEnergy += this->VertexHitEnergy(pVertex, TPC_VIEW_V, kdTreeMap.at(TPC_VIEW_V));
252 
253  if (!this->IsVertexInGap(pVertex, TPC_VIEW_W))
254  totalEnergy += this->VertexHitEnergy(pVertex, TPC_VIEW_W, kdTreeMap.at(TPC_VIEW_W));
255 
256  return totalEnergy;
257 }
TFile f
Definition: plotHisto.C:6
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.
bool IsVertexInGap(const pandora::Vertex *const pVertex, const pandora::HitType hitType) const
Whether the vertex lies in a registered gap.
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.

References lar_content::VertexSelectionBaseAlgorithm::CalculateClusterSlidingFits(), f, Get, lar_content::VertexSelectionBaseAlgorithm::GetBeamDeweightingScore(), lar_content::VertexSelectionBaseAlgorithm::GetClusterLists(), lar_content::VertexSelectionBaseAlgorithm::IsBeamModeOn(), m_asymmetryConstant, m_epsilon, m_featureToolVector, m_inputClusterListNames, m_minClusterCaloHits, and m_slidingFitWindow.

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.
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
TFile f
Definition: plotHisto.C:6
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.
bool lar_content::VertexSelectionBaseAlgorithm::IsBeamModeOn ( ) const
inlineprotectedinherited

Whether algorithm is running in beam mode, assuming neutrinos travel in positive z-direction.

Returns
boolean

Definition at line 427 of file VertexSelectionBaseAlgorithm.h.

References lar_content::VertexSelectionBaseAlgorithm::m_beamMode.

Referenced by lar_content::TrainedVertexSelectionAlgorithm::AddEventFeaturesToVector(), lar_content::TrainedVertexSelectionAlgorithm::AddVertexFeaturesToVector(), GetVertexScoreList(), and lar_content::TrainedVertexSelectionAlgorithm::PopulateVertexFeatureInfoMap().

428 {
429  return m_beamMode;
430 }
bool m_beamMode
Whether to run in beam mode, assuming neutrinos travel in positive z-direction.
StatusCode lar_content::EnergyKickVertexSelectionAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 72 of file EnergyKickVertexSelectionAlgorithm.cc.

References lar_content::LArMvaHelper::AddFeatureToolToVector(), m_asymmetryConstant, m_epsilon, m_featureToolVector, m_inputClusterListNames, m_minClusterCaloHits, m_slidingFitWindow, and lar_content::VertexSelectionBaseAlgorithm::ReadSettings().

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 "
96  << m_asymmetryConstant << std::endl;
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:451
float m_asymmetryConstant
The asymmetry constant parameter in the energy score.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
float lar_content::VertexSelectionBaseAlgorithm::VertexHitEnergy ( const pandora::Vertex *const  pVertex,
const pandora::HitType  hitType,
HitKDTree2D kdTree 
) const
protectedinherited

Finds the energy of the nearest hit to the vertex candidate in this view.

Parameters
pVertexthe address of the vertex
hitTypethe relevant hit type
kdTreethe kd tree of 2D hits
Returns
the energy of the nearest hit

Definition at line 261 of file VertexSelectionBaseAlgorithm.cc.

References lar_content::build_2d_kd_search_region(), energy, lar_content::VertexSelectionBaseAlgorithm::m_maxOnHitDisplacement, lar_content::LArGeometryHelper::ProjectPosition(), and lar_content::KDTreeLinkerAlgo< DATA, DIM >::search().

Referenced by lar_content::VertexSelectionBaseAlgorithm::GetVertexEnergy().

262 {
263  const CartesianVector vertexPosition2D(LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex->GetPosition(), hitType));
265 
266  HitKDNode2DList foundHits;
267  kdTree.search(searchRegionHits, foundHits);
268 
269  float dr(std::numeric_limits<float>::max());
270  float energy(0);
271 
272  for (auto hit : foundHits)
273  {
274  const float diff = (vertexPosition2D - hit.data->GetPositionVector()).GetMagnitude();
275  if (diff < dr)
276  {
277  dr = diff;
278  energy = hit.data->GetElectromagneticEnergy();
279  }
280  }
281  return energy;
282 }
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
double energy
Definition: plottest35.C:25
Detector simulation of raw signals on wires.
KDTreeBox build_2d_kd_search_region(const pandora::CaloHit *const point, const float x_span, const float z_span)
build_2d_kd_search_region
KDTreeBoxT< 2 > KDTreeBox
float m_maxOnHitDisplacement
Max hit-vertex displacement for declaring vertex to lie on a hit in each view.

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.

Referenced by GetVertexScoreList(), and ReadSettings().

float lar_content::EnergyKickVertexSelectionAlgorithm::m_epsilon
private

The epsilon parameter in the energy score.

Definition at line 38 of file EnergyKickVertexSelectionAlgorithm.h.

Referenced by GetVertexScoreList(), and ReadSettings().

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

The feature tool map.

Definition at line 33 of file EnergyKickVertexSelectionAlgorithm.h.

Referenced by GetVertexScoreList(), and ReadSettings().

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

The list of cluster list names.

Definition at line 35 of file EnergyKickVertexSelectionAlgorithm.h.

Referenced by GetVertexScoreList(), and ReadSettings().

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.

Referenced by GetVertexScoreList(), and ReadSettings().

unsigned int lar_content::EnergyKickVertexSelectionAlgorithm::m_slidingFitWindow
private

The layer window for the sliding linear fits.

Definition at line 37 of file EnergyKickVertexSelectionAlgorithm.h.

Referenced by GetVertexScoreList(), and ReadSettings().


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