LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar_content::MvaVertexSelectionAlgorithm< T > Class Template Reference

MvaVertexSelectionAlgorithm class. More...

#include "MvaVertexSelectionAlgorithm.h"

Inheritance diagram for lar_content::MvaVertexSelectionAlgorithm< T >:
lar_content::TrainedVertexSelectionAlgorithm lar_content::VertexSelectionBaseAlgorithm

Public Types

typedef std::map< const pandora::Vertex *const, VertexFeatureInfoVertexFeatureInfoMap
 
typedef std::vector< VertexScoreVertexScoreList
 
typedef std::vector< SlidingFitDataSlidingFitDataList
 
typedef std::vector< ShowerClusterShowerClusterList
 
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

 MvaVertexSelectionAlgorithm ()
 Default constructor. More...
 

Protected Types

typedef std::pair< pandora::CartesianVector, pandora::CartesianVector > ClusterEndPoints
 
typedef std::map< const pandora::Cluster *const, ClusterEndPointsClusterEndPointsMap
 
typedef std::vector< LArMvaHelper::MvaFeatureVectorFeatureListVector
 
typedef std::vector< pandora::VertexVector > VectorOfVertexVectors
 
typedef KDTreeLinkerAlgo< const pandora::CaloHit *, 2 > HitKDTree2D
 
typedef KDTreeNodeInfoT< const pandora::CaloHit *, 2 > HitKDNode2D
 
typedef std::vector< HitKDNode2DHitKDNode2DList
 
typedef std::unordered_map< const pandora::CaloHit *, const pandora::Cluster * > HitToClusterMap
 

Protected Member Functions

pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
void CalculateShowerClusterList (const pandora::ClusterList &inputClusterList, ShowerClusterList &showerClusterList) const
 Calculate the shower cluster map for a cluster list. More...
 
void GetShowerLikeClusterEndPoints (const pandora::ClusterList &clusterList, pandora::ClusterList &showerLikeClusters, ClusterEndPointsMap &clusterEndPointsMap) const
 Add the endpoints of any shower-like clusters to the map. More...
 
void PopulateKdTree (const pandora::ClusterList &clusterList, HitKDTree2D &kdTree, HitToClusterMap &hitToClusterMap) const
 Populate kd tree with information about hits in a provided list of clusters. More...
 
bool AddClusterToShower (const ClusterEndPointsMap &clusterEndPointsMap, pandora::ClusterList &availableShowerLikeClusters, const pandora::Cluster *const pCluster, pandora::ClusterList &showerCluster) const
 Try to add an available cluster to a given shower cluster, using shower clustering approximation. More...
 
bool AddClusterToShower (HitKDTree2D &kdTree, const HitToClusterMap &hitToClusterMap, pandora::ClusterList &availableShowerLikeClusters, const pandora::Cluster *const pCluster, pandora::ClusterList &showerCluster) const
 Try to add an available cluster to a given shower cluster, using cluster hit positions cached in kd tree. More...
 
EventFeatureInfo CalculateEventFeatures (const pandora::ClusterList &clusterListU, const pandora::ClusterList &clusterListV, const pandora::ClusterList &clusterListW, const pandora::VertexVector &vertexVector) const
 Calculate the event parameters. More...
 
void IncrementShoweryParameters (const pandora::ClusterList &clusterList, unsigned int &nShoweryHits, unsigned int &nHits, float &eventEnergy) const
 Increment the showery hit parameters for a cluster list. More...
 
bool IsClusterShowerLike (const pandora::Cluster *const pCluster) const
 Find whether a cluster is shower-like. More...
 
void GetLegacyEventShapeFeatures (const pandora::ClusterList &clusterList, float &eventVolume, float &longitudinality) const
 Get the event shape features. More...
 
void GetEventShapeFeatures (const ClusterListMap &clusterListMap, float &eventArea, float &longitudinality) const
 Get the event shape features. More...
 
void Get2DSpan (const pandora::ClusterList &clusterList, float &xSpan, float &zSpan) const
 Get the coordinate span in one view. More...
 
void UpdateSpanCoordinate (const float minPositionCoord, const float maxPositionCoord, pandora::InputFloat &minCoord, pandora::InputFloat &maxCoord) const
 Update the min/max coordinate spans. More...
 
float GetCoordinateSpan (const pandora::InputFloat &minCoord, const pandora::InputFloat &maxCoord) const
 Get the coordinate span. More...
 
void AddEventFeaturesToVector (const EventFeatureInfo &eventFeatureInfo, LArMvaHelper::MvaFeatureVector &featureVector) const
 Add the event features to a vector in the correct order. More...
 
void PopulateVertexFeatureInfoMap (const BeamConstants &beamConstants, const ClusterListMap &clusterListMap, const SlidingFitDataListMap &slidingFitDataListMap, const ShowerClusterListMap &showerClusterListMap, const KDTreeMap &kdTreeMap, const pandora::Vertex *const pVertex, VertexFeatureInfoMap &vertexFeatureInfoMap) const
 Populate the vertex feature info map for a given vertex. More...
 
void PopulateInitialScoreList (VertexFeatureInfoMap &vertexFeatureInfoMap, const pandora::Vertex *const pVertex, VertexScoreList &initialScoreList) const
 Populate the initial vertex score list for a given vertex. More...
 
void GetBestRegionVertices (VertexScoreList &initialScoreList, pandora::VertexVector &bestRegionVertices) const
 Get the list of top-N separated vertices. More...
 
void ProduceTrainingSets (const pandora::VertexVector &vertexVector, const pandora::VertexVector &bestRegionVertices, VertexFeatureInfoMap &vertexFeatureInfoMap, const LArMvaHelper::MvaFeatureVector &eventFeatureList, const KDTreeMap &kdTreeMap) const
 Produce the region and vertex training sets. More...
 
void CalculateRPhiScores (pandora::VertexVector &vertexVector, VertexFeatureInfoMap &vertexFeatureInfoMap, const KDTreeMap &kdTreeMap) const
 Calculate the r/phi scores for the vertices in a vector, possibly erasing those that fail the fast score test. More...
 
std::string GetInteractionType () const
 Get the interaction type string. More...
 
const pandora::Vertex * ProduceTrainingExamples (const pandora::VertexVector &vertexVector, const VertexFeatureInfoMap &vertexFeatureInfoMap, std::bernoulli_distribution &coinFlip, std::mt19937 &generator, const std::string &interactionType, const std::string &trainingOutputFile, const LArMvaHelper::MvaFeatureVector &eventFeatureList, const KDTreeMap &kdTreeMap, const float maxRadius, const bool useRPhi) const
 Produce a set of training examples for a binary classifier. More...
 
void GetBestVertex (const pandora::VertexVector &vertexVector, const pandora::Vertex *&pBestVertex, float &bestVertexDr) const
 Use the MC information to get the best vertex from a list. More...
 
void GetSharedFeatures (const pandora::Vertex *const pVertex1, const pandora::Vertex *const pVertex2, const KDTreeMap &kdTreeMap, float &separation, float &axisHits) const
 Calculates the shared features of a pair of vertex candidates. More...
 
void IncrementSharedAxisValues (const pandora::CartesianVector pos1, const pandora::CartesianVector pos2, HitKDTree2D &kdTree, float &axisHits) const
 Increments the axis hits information for one view. More...
 
bool IsHitInBox (const pandora::CartesianVector &hitPos, const pandora::CartesianVector &point1, const pandora::CartesianVector &point2, const pandora::CartesianVector &point3, const pandora::CartesianVector &point4) const
 Determines whether a hit lies within the box defined by four other positions. More...
 
void AddVertexFeaturesToVector (const VertexFeatureInfo &vertexFeatureInfo, LArMvaHelper::MvaFeatureVector &featureVector, const bool useRPhi) const
 Add the vertex features to a vector in the correct order. More...
 
void AddSharedFeaturesToVector (const VertexSharedFeatureInfo &vertexSharedFeatureInfo, LArMvaHelper::MvaFeatureVector &featureVector) const
 Add the shared features to a vector in the correct order. More...
 
void PopulateFinalVertexScoreList (const VertexFeatureInfoMap &vertexFeatureInfoMap, const pandora::Vertex *const pFavouriteVertex, const pandora::VertexVector &vertexVector, VertexScoreList &finalVertexScoreList) const
 Populate the final vertex score list using the r/phi score to find the best vertex in the vicinity. More...
 
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...
 

Protected Attributes

VertexFeatureTool::FeatureToolVector m_featureToolVector
 The feature tool vector. More...
 
bool m_trainingSetMode
 Whether to train. More...
 
bool m_allowClassifyDuringTraining
 Whether classification is allowed during training. More...
 
float m_mcVertexXCorrection
 The correction to the x-coordinate of the MC vertex position. More...
 
std::string m_trainingOutputFileRegion
 The training output file for the region mva. More...
 
std::string m_trainingOutputFileVertex
 The training output file for the vertex mva. More...
 
std::string m_mcParticleListName
 The MC particle list for creating training examples. More...
 
std::string m_caloHitListName
 The 2D CaloHit list name. 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_minShowerSpineLength
 The minimum length at which all are considered to be tracks. More...
 
float m_beamDeweightingConstant
 The beam deweighting constant for the initial region score list. More...
 
float m_localAsymmetryConstant
 The local asymmetry constant for the initial region score list. More...
 
float m_globalAsymmetryConstant
 The global asymmetry constant for the initial region score list. More...
 
float m_showerAsymmetryConstant
 The shower asymmetry constant for the initial region score list. More...
 
float m_energyKickConstant
 The energy kick constant for the initial region score list. More...
 
float m_showerClusteringDistance
 The shower clustering distance. More...
 
unsigned int m_minShowerClusterHits
 The minimum number of shower cluster hits. More...
 
bool m_useShowerClusteringApproximation
 Whether to use the shower clustering distance approximation. More...
 
float m_regionRadius
 The radius for a vertex region. More...
 
float m_rPhiFineTuningRadius
 The maximum distance the r/phi tune can move a vertex. More...
 
float m_maxTrueVertexRadius
 The maximum distance at which a vertex candidate can be considered the 'true' vertex. More...
 
bool m_useRPhiFeatureForRegion
 Whether to use the r/phi feature for the region vertex. More...
 
bool m_dropFailedRPhiFastScoreCandidates
 Whether to drop candidates that fail the r/phi fast score test. More...
 
bool m_testBeamMode
 Test beam mode. More...
 
bool m_legacyEventShapes
 Whether to use the old event shapes calculation. More...
 
bool m_legacyVariables
 Whether to only use the old variables. 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. More...
 
const pandora::Vertex * CompareVertices (const pandora::VertexVector &vertexVector, const VertexFeatureInfoMap &vertexFeatureInfoMap, const LArMvaHelper::MvaFeatureVector &eventFeatureList, const KDTreeMap &kdTreeMap, const T &t, const bool useRPhi) const
 Used a binary classifier to compare a set of vertices and pick the best one. More...
 

Private Attributes

std::string m_filePathEnvironmentVariable
 The environment variable providing a list of paths to mva files. More...
 
std::string m_mvaFileName
 The mva file name. More...
 
std::string m_regionMvaName
 The name of the region mva to find. More...
 
std::string m_vertexMvaName
 The name of the vertex mva to find. More...
 
m_mvaRegion
 The region mva. More...
 
m_mvaVertex
 The vertex mva. More...
 

Detailed Description

template<typename T>
class lar_content::MvaVertexSelectionAlgorithm< T >

MvaVertexSelectionAlgorithm class.

Definition at line 37 of file MvaVertexSelectionAlgorithm.h.

Member Typedef Documentation

typedef std::pair<pandora::CartesianVector, pandora::CartesianVector> lar_content::TrainedVertexSelectionAlgorithm::ClusterEndPoints
protectedinherited

Definition at line 131 of file TrainedVertexSelectionAlgorithm.h.

typedef std::map<const pandora::Cluster *const, ClusterEndPoints> lar_content::TrainedVertexSelectionAlgorithm::ClusterEndPointsMap
protectedinherited

Definition at line 132 of file TrainedVertexSelectionAlgorithm.h.

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::TrainedVertexSelectionAlgorithm::HitKDNode2D
protectedinherited

Definition at line 168 of file TrainedVertexSelectionAlgorithm.h.

Definition at line 169 of file TrainedVertexSelectionAlgorithm.h.

typedef KDTreeLinkerAlgo<const pandora::CaloHit *, 2> lar_content::TrainedVertexSelectionAlgorithm::HitKDTree2D
protectedinherited

Definition at line 167 of file TrainedVertexSelectionAlgorithm.h.

typedef std::unordered_map<const pandora::CaloHit *, const pandora::Cluster *> lar_content::TrainedVertexSelectionAlgorithm::HitToClusterMap
protectedinherited

Definition at line 171 of file TrainedVertexSelectionAlgorithm.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 std::vector<pandora::VertexVector> lar_content::TrainedVertexSelectionAlgorithm::VectorOfVertexVectors
protectedinherited

Definition at line 134 of file TrainedVertexSelectionAlgorithm.h.

typedef std::map<const pandora::Vertex *const, VertexFeatureInfo> lar_content::TrainedVertexSelectionAlgorithm::VertexFeatureInfoMap
inherited

Definition at line 70 of file TrainedVertexSelectionAlgorithm.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

Default constructor.

Definition at line 36 of file MvaVertexSelectionAlgorithm.cc.

36  :
38  m_filePathEnvironmentVariable("FW_SEARCH_PATH")
39 {
40 }
std::string m_filePathEnvironmentVariable
The environment variable providing a list of paths to mva files.

Member Function Documentation

bool lar_content::TrainedVertexSelectionAlgorithm::AddClusterToShower ( const ClusterEndPointsMap clusterEndPointsMap,
pandora::ClusterList &  availableShowerLikeClusters,
const pandora::Cluster *const  pCluster,
pandora::ClusterList &  showerCluster 
) const
protectedinherited

Try to add an available cluster to a given shower cluster, using shower clustering approximation.

Parameters
clusterEndPointsMapthe map of shower-like cluster endpoints
availableShowerLikeClustersthe list of shower-like clusters still available
pClusterthe cluster in the shower cluster from which to consider distances
showerClusterthe shower cluster
Returns
boolean

Referenced by lar_content::TrainedVertexSelectionAlgorithm::CalculateShowerClusterList(), and lar_content::TrainedVertexSelectionAlgorithm::PopulateKdTree().

bool lar_content::TrainedVertexSelectionAlgorithm::AddClusterToShower ( HitKDTree2D kdTree,
const HitToClusterMap hitToClusterMap,
pandora::ClusterList &  availableShowerLikeClusters,
const pandora::Cluster *const  pCluster,
pandora::ClusterList &  showerCluster 
) const
protectedinherited

Try to add an available cluster to a given shower cluster, using cluster hit positions cached in kd tree.

Parameters
kdTreethe kd tree, used purely for efficiency in events with large hit multiplicity
hitToClusterMapthe hit to cluster map, used to interpret kd tree findings
availableShowerLikeClustersthe list of shower-like clusters still available
pClusterthe cluster in the shower cluster from which to consider distances
showerClusterthe shower cluster
Returns
boolean
void lar_content::TrainedVertexSelectionAlgorithm::AddEventFeaturesToVector ( const EventFeatureInfo eventFeatureInfo,
LArMvaHelper::MvaFeatureVector featureVector 
) const
protectedinherited

Add the event features to a vector in the correct order.

Parameters
eventFeatureInfothe event feature info
featureVectorthe vector of doubles to append

Definition at line 412 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::VertexSelectionBaseAlgorithm::IsBeamModeOn(), lar_content::TrainedVertexSelectionAlgorithm::EventFeatureInfo::m_eventArea, lar_content::TrainedVertexSelectionAlgorithm::EventFeatureInfo::m_eventEnergy, lar_content::TrainedVertexSelectionAlgorithm::EventFeatureInfo::m_eventShoweryness, lar_content::TrainedVertexSelectionAlgorithm::EventFeatureInfo::m_longitudinality, lar_content::TrainedVertexSelectionAlgorithm::EventFeatureInfo::m_nCandidates, lar_content::TrainedVertexSelectionAlgorithm::EventFeatureInfo::m_nClusters, and lar_content::TrainedVertexSelectionAlgorithm::EventFeatureInfo::m_nHits.

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

413 {
414  featureVector.push_back(static_cast<double>(eventFeatureInfo.m_eventShoweryness));
415  featureVector.push_back(static_cast<double>(eventFeatureInfo.m_eventEnergy));
416  featureVector.push_back(static_cast<double>(eventFeatureInfo.m_eventArea));
417  featureVector.push_back(static_cast<double>(eventFeatureInfo.m_longitudinality));
418  if (this->IsBeamModeOn())
419  {
420  featureVector.push_back(static_cast<double>(eventFeatureInfo.m_nHits));
421  featureVector.push_back(static_cast<double>(eventFeatureInfo.m_nClusters));
422  featureVector.push_back(static_cast<double>(eventFeatureInfo.m_nCandidates));
423  }
424 }
bool IsBeamModeOn() const
Whether algorithm is running in beam mode, assuming neutrinos travel in positive z-direction.
void lar_content::TrainedVertexSelectionAlgorithm::AddSharedFeaturesToVector ( const VertexSharedFeatureInfo vertexSharedFeatureInfo,
LArMvaHelper::MvaFeatureVector featureVector 
) const
protectedinherited

Add the shared features to a vector in the correct order.

Parameters
vertexSharedFeatureInfothe shared vertex feature info
featureVectorthe vector of floats to append

Definition at line 829 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::TrainedVertexSelectionAlgorithm::VertexSharedFeatureInfo::m_axisHits, and lar_content::TrainedVertexSelectionAlgorithm::VertexSharedFeatureInfo::m_separation.

Referenced by lar_content::MvaVertexSelectionAlgorithm< T >::CompareVertices(), and lar_content::TrainedVertexSelectionAlgorithm::ProduceTrainingExamples().

831 {
832  featureVector.push_back(static_cast<double>(vertexSharedFeatureInfo.m_separation));
833  featureVector.push_back(static_cast<double>(vertexSharedFeatureInfo.m_axisHits));
834 }
void lar_content::TrainedVertexSelectionAlgorithm::AddVertexFeaturesToVector ( const VertexFeatureInfo vertexFeatureInfo,
LArMvaHelper::MvaFeatureVector featureVector,
const bool  useRPhi 
) const
protectedinherited

Add the vertex features to a vector in the correct order.

Parameters
vertexFeatureInfothe vertex feature info
featureVectorthe vector of floats to append
useRPhiwhether to include the r/phi feature

Definition at line 807 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::VertexSelectionBaseAlgorithm::IsBeamModeOn(), lar_content::TrainedVertexSelectionAlgorithm::VertexFeatureInfo::m_beamDeweighting, lar_content::TrainedVertexSelectionAlgorithm::VertexFeatureInfo::m_dEdxAsymmetry, lar_content::TrainedVertexSelectionAlgorithm::VertexFeatureInfo::m_energyKick, lar_content::TrainedVertexSelectionAlgorithm::VertexFeatureInfo::m_globalAsymmetry, lar_content::TrainedVertexSelectionAlgorithm::m_legacyVariables, lar_content::TrainedVertexSelectionAlgorithm::VertexFeatureInfo::m_localAsymmetry, lar_content::TrainedVertexSelectionAlgorithm::VertexFeatureInfo::m_rPhiFeature, lar_content::TrainedVertexSelectionAlgorithm::VertexFeatureInfo::m_showerAsymmetry, and lar_content::TrainedVertexSelectionAlgorithm::VertexFeatureInfo::m_vertexEnergy.

Referenced by lar_content::MvaVertexSelectionAlgorithm< T >::CompareVertices(), and lar_content::TrainedVertexSelectionAlgorithm::ProduceTrainingExamples().

809 {
810  if (this->IsBeamModeOn())
811  featureVector.push_back(static_cast<double>(vertexFeatureInfo.m_beamDeweighting));
812  featureVector.push_back(static_cast<double>(vertexFeatureInfo.m_energyKick));
813  featureVector.push_back(static_cast<double>(vertexFeatureInfo.m_globalAsymmetry));
814  featureVector.push_back(static_cast<double>(vertexFeatureInfo.m_localAsymmetry));
815  featureVector.push_back(static_cast<double>(vertexFeatureInfo.m_showerAsymmetry));
816 
817  if (!m_legacyVariables)
818  {
819  featureVector.push_back(static_cast<double>(vertexFeatureInfo.m_dEdxAsymmetry));
820  featureVector.push_back(static_cast<double>(vertexFeatureInfo.m_vertexEnergy));
821  }
822 
823  if (useRPhi)
824  featureVector.push_back(static_cast<double>(vertexFeatureInfo.m_rPhiFeature));
825 }
bool IsBeamModeOn() const
Whether algorithm is running in beam mode, assuming neutrinos travel in positive z-direction.
bool m_legacyVariables
Whether to only use the old variables.
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 lar_content::EnergyKickVertexSelectionAlgorithm::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
TrainedVertexSelectionAlgorithm::EventFeatureInfo lar_content::TrainedVertexSelectionAlgorithm::CalculateEventFeatures ( const pandora::ClusterList &  clusterListU,
const pandora::ClusterList &  clusterListV,
const pandora::ClusterList &  clusterListW,
const pandora::VertexVector &  vertexVector 
) const
protectedinherited

Calculate the event parameters.

Parameters
clusterListUthe U-view cluster list
clusterListVthe V-view cluster list
clusterListWthe W-view cluster list
vertexVectorthe vector of vertex candidates
Returns
the EventFeatureInfo object

Definition at line 240 of file TrainedVertexSelectionAlgorithm.cc.

References f, lar_content::TrainedVertexSelectionAlgorithm::GetEventShapeFeatures(), lar_content::TrainedVertexSelectionAlgorithm::GetLegacyEventShapeFeatures(), lar_content::TrainedVertexSelectionAlgorithm::IncrementShoweryParameters(), and lar_content::TrainedVertexSelectionAlgorithm::m_legacyEventShapes.

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

242 {
243  float eventEnergy(0.f);
244  unsigned int nShoweryHits(0), nHits(0);
245 
246  this->IncrementShoweryParameters(clusterListU, nShoweryHits, nHits, eventEnergy);
247  this->IncrementShoweryParameters(clusterListV, nShoweryHits, nHits, eventEnergy);
248  this->IncrementShoweryParameters(clusterListW, nShoweryHits, nHits, eventEnergy);
249 
250  const unsigned int nClusters(clusterListU.size() + clusterListV.size() + clusterListW.size());
251  const float eventShoweryness((nHits > 0) ? static_cast<float>(nShoweryHits) / static_cast<float>(nHits) : 0.f);
252 
253  ClusterList allClusters(clusterListU);
254  allClusters.insert(allClusters.end(), clusterListV.begin(), clusterListV.end());
255  allClusters.insert(allClusters.end(), clusterListW.begin(), clusterListW.end());
256 
257  const ClusterListMap clusterListMap{{TPC_VIEW_U, clusterListU}, {TPC_VIEW_V, clusterListV}, {TPC_VIEW_W, clusterListW}};
258 
259  float eventArea(0.f), longitudinality(0.f);
261  this->GetLegacyEventShapeFeatures(allClusters, eventArea, longitudinality);
262  else
263  this->GetEventShapeFeatures(clusterListMap, eventArea, longitudinality);
264 
265  return EventFeatureInfo(eventShoweryness, eventEnergy, eventArea, longitudinality, nHits, nClusters, vertexVector.size());
266 }
void GetLegacyEventShapeFeatures(const pandora::ClusterList &clusterList, float &eventVolume, float &longitudinality) const
Get the event shape features.
bool m_legacyEventShapes
Whether to use the old event shapes calculation.
TFile f
Definition: plotHisto.C:6
std::map< pandora::HitType, const pandora::ClusterList & > ClusterListMap
Map array of cluster lists for passing to tools.
void IncrementShoweryParameters(const pandora::ClusterList &clusterList, unsigned int &nShoweryHits, unsigned int &nHits, float &eventEnergy) const
Increment the showery hit parameters for a cluster list.
void GetEventShapeFeatures(const ClusterListMap &clusterListMap, float &eventArea, float &longitudinality) const
Get the event shape features.
void lar_content::TrainedVertexSelectionAlgorithm::CalculateRPhiScores ( pandora::VertexVector &  vertexVector,
VertexFeatureInfoMap vertexFeatureInfoMap,
const KDTreeMap kdTreeMap 
) const
protectedinherited

Calculate the r/phi scores for the vertices in a vector, possibly erasing those that fail the fast score test.

Parameters
vertexVectorthe vector of vertices
vertexFeatureInfoMapthe vertex feature info map
kdTreeMapthe kd tree map

Definition at line 571 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::TrainedVertexSelectionAlgorithm::VertexFeatureInfo::m_beamDeweighting, lar_content::TrainedVertexSelectionAlgorithm::m_dropFailedRPhiFastScoreCandidates, lar_content::TrainedVertexSelectionAlgorithm::m_featureToolVector, and lar_content::TrainedVertexSelectionAlgorithm::VertexFeatureInfo::m_rPhiFeature.

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

573 {
574  float bestFastScore(-std::numeric_limits<float>::max());
575 
576  for (auto iter = vertexVector.begin(); iter != vertexVector.end(); /* no increment */)
577  {
578  VertexFeatureInfo &vertexFeatureInfo = vertexFeatureInfoMap.at(*iter);
579  vertexFeatureInfo.m_rPhiFeature = static_cast<float>(LArMvaHelper::CalculateFeaturesOfType<RPhiFeatureTool>(m_featureToolVector, this,
580  *iter, SlidingFitDataListMap(), ClusterListMap(), kdTreeMap, ShowerClusterListMap(), vertexFeatureInfo.m_beamDeweighting, bestFastScore)
581  .at(0)
582  .Get());
583 
584  if (m_dropFailedRPhiFastScoreCandidates && (vertexFeatureInfo.m_rPhiFeature <= std::numeric_limits<float>::epsilon()))
585  iter = vertexVector.erase(iter);
586 
587  else
588  ++iter;
589  }
590 }
VertexFeatureTool::FeatureToolVector m_featureToolVector
The feature tool vector.
std::map< pandora::HitType, const ShowerClusterList > ShowerClusterListMap
Map of shower cluster lists for passing to tools.
std::map< pandora::HitType, const pandora::ClusterList & > ClusterListMap
Map array of cluster lists for passing to tools.
bool m_dropFailedRPhiFastScoreCandidates
Whether to drop candidates that fail the r/phi fast score test.
std::map< pandora::HitType, const SlidingFitDataList > SlidingFitDataListMap
Map of sliding fit data lists for passing to tools.
void lar_content::TrainedVertexSelectionAlgorithm::CalculateShowerClusterList ( const pandora::ClusterList &  inputClusterList,
ShowerClusterList showerClusterList 
) const
protectedinherited

Calculate the shower cluster map for a cluster list.

Parameters
inputClusterListthe input cluster list
showerClusterListthe shower cluster list to populate

Definition at line 65 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::TrainedVertexSelectionAlgorithm::AddClusterToShower(), lar_content::TrainedVertexSelectionAlgorithm::GetShowerLikeClusterEndPoints(), lar_content::LArGeometryHelper::GetWireZPitch(), lar_content::TrainedVertexSelectionAlgorithm::m_minClusterCaloHits, lar_content::TrainedVertexSelectionAlgorithm::m_slidingFitWindow, lar_content::TrainedVertexSelectionAlgorithm::m_useShowerClusteringApproximation, and lar_content::TrainedVertexSelectionAlgorithm::PopulateKdTree().

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

66 {
67  ClusterEndPointsMap clusterEndPointsMap;
68  ClusterList showerLikeClusters;
69  this->GetShowerLikeClusterEndPoints(inputClusterList, showerLikeClusters, clusterEndPointsMap);
70 
71  const float slidingFitPitch(LArGeometryHelper::GetWireZPitch(this->GetPandora()));
72  ClusterList availableShowerLikeClusters(showerLikeClusters.begin(), showerLikeClusters.end());
73 
74  HitKDTree2D kdTree;
75  HitToClusterMap hitToClusterMap;
76 
78  this->PopulateKdTree(availableShowerLikeClusters, kdTree, hitToClusterMap);
79 
80  while (!availableShowerLikeClusters.empty())
81  {
82  ClusterList showerCluster;
83  showerCluster.push_back(availableShowerLikeClusters.back());
84  availableShowerLikeClusters.pop_back();
85 
86  bool addedCluster(true);
87  while (addedCluster && !availableShowerLikeClusters.empty())
88  {
89  addedCluster = false;
90  for (const Cluster *const pCluster : showerCluster)
91  {
93  {
94  addedCluster = this->AddClusterToShower(kdTree, hitToClusterMap, availableShowerLikeClusters, pCluster, showerCluster);
95  }
96  else
97  {
98  addedCluster = this->AddClusterToShower(clusterEndPointsMap, availableShowerLikeClusters, pCluster, showerCluster);
99  }
100 
101  if (addedCluster)
102  break;
103  }
104  }
105 
106  unsigned int totHits(0);
107  for (const Cluster *const pCluster : showerCluster)
108  totHits += pCluster->GetNCaloHits();
109 
110  if (totHits < m_minClusterCaloHits)
111  continue;
112 
113  showerClusterList.emplace_back(showerCluster, slidingFitPitch, m_slidingFitWindow);
114  }
115 }
bool m_useShowerClusteringApproximation
Whether to use the shower clustering distance approximation.
std::unordered_map< const pandora::CaloHit *, const pandora::Cluster * > HitToClusterMap
unsigned int m_minClusterCaloHits
The min number of hits parameter in the energy score.
KDTreeLinkerAlgo< const pandora::CaloHit *, 2 > HitKDTree2D
static float GetWireZPitch(const pandora::Pandora &pandora, const float maxWirePitchDiscrepancy=0.01)
Return the wire pitch.
void PopulateKdTree(const pandora::ClusterList &clusterList, HitKDTree2D &kdTree, HitToClusterMap &hitToClusterMap) const
Populate kd tree with information about hits in a provided list of clusters.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
std::map< const pandora::Cluster *const, ClusterEndPoints > ClusterEndPointsMap
bool AddClusterToShower(const ClusterEndPointsMap &clusterEndPointsMap, pandora::ClusterList &availableShowerLikeClusters, const pandora::Cluster *const pCluster, pandora::ClusterList &showerCluster) const
Try to add an available cluster to a given shower cluster, using shower clustering approximation...
void GetShowerLikeClusterEndPoints(const pandora::ClusterList &clusterList, pandora::ClusterList &showerLikeClusters, ClusterEndPointsMap &clusterEndPointsMap) const
Add the endpoints of any shower-like clusters to the map.
template<typename T >
const pandora::Vertex * lar_content::MvaVertexSelectionAlgorithm< T >::CompareVertices ( const pandora::VertexVector &  vertexVector,
const VertexFeatureInfoMap vertexFeatureInfoMap,
const LArMvaHelper::MvaFeatureVector eventFeatureList,
const KDTreeMap kdTreeMap,
const T &  t,
const bool  useRPhi 
) const
private

Used a binary classifier to compare a set of vertices and pick the best one.

Parameters
vertexVectorthe vector of vertices
vertexFeatureInfoMapthe vertex feature info map
eventFeatureListthe event feature list
kdTreeMapthe map of 2D hit kd trees
tthe mva
useRPhiwhether to include the r/phi feature
Returns
address of the best vertex

Definition at line 127 of file MvaVertexSelectionAlgorithm.cc.

References lar_content::TrainedVertexSelectionAlgorithm::AddSharedFeaturesToVector(), lar_content::TrainedVertexSelectionAlgorithm::AddVertexFeaturesToVector(), lar_content::LArMvaHelper::Classify(), lar_content::LArMvaHelper::ConcatenateFeatureLists(), f, lar_content::TrainedVertexSelectionAlgorithm::GetSharedFeatures(), and lar_content::TrainedVertexSelectionAlgorithm::m_legacyVariables.

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

129 {
130  const Vertex *pBestVertex(vertexVector.front());
131  LArMvaHelper::MvaFeatureVector chosenFeatureList;
132 
133  VertexFeatureInfo chosenVertexFeatureInfo(vertexFeatureInfoMap.at(pBestVertex));
134  this->AddVertexFeaturesToVector(chosenVertexFeatureInfo, chosenFeatureList, useRPhi);
135 
136  for (const Vertex *const pVertex : vertexVector)
137  {
138  if (pVertex == pBestVertex)
139  continue;
140 
141  LArMvaHelper::MvaFeatureVector featureList;
142  VertexFeatureInfo vertexFeatureInfo(vertexFeatureInfoMap.at(pVertex));
143  this->AddVertexFeaturesToVector(vertexFeatureInfo, featureList, useRPhi);
144 
145  if (!m_legacyVariables)
146  {
147  LArMvaHelper::MvaFeatureVector sharedFeatureList;
148  float separation(0.f), axisHits(0.f);
149  this->GetSharedFeatures(pVertex, pBestVertex, kdTreeMap, separation, axisHits);
150  VertexSharedFeatureInfo sharedFeatureInfo(separation, axisHits);
151  this->AddSharedFeaturesToVector(sharedFeatureInfo, sharedFeatureList);
152 
153  if (LArMvaHelper::Classify(t, LArMvaHelper::ConcatenateFeatureLists(eventFeatureList, featureList, chosenFeatureList, sharedFeatureList)))
154  {
155  pBestVertex = pVertex;
156  chosenFeatureList = featureList;
157  }
158  }
159  else
160  {
161  if (LArMvaHelper::Classify(t, LArMvaHelper::ConcatenateFeatureLists(eventFeatureList, featureList, chosenFeatureList)))
162  {
163  pBestVertex = pVertex;
164  chosenFeatureList = featureList;
165  }
166  }
167  }
168 
169  return pBestVertex;
170 }
static bool Classify(const MvaInterface &classifier, TCONTAINER &&featureContainer)
Use the trained classifier to predict the boolean class of an example.
Definition: LArMvaHelper.h:331
MvaTypes::MvaFeatureVector MvaFeatureVector
Definition: LArMvaHelper.h:75
void AddVertexFeaturesToVector(const VertexFeatureInfo &vertexFeatureInfo, LArMvaHelper::MvaFeatureVector &featureVector, const bool useRPhi) const
Add the vertex features to a vector in the correct order.
TFile f
Definition: plotHisto.C:6
void AddSharedFeaturesToVector(const VertexSharedFeatureInfo &vertexSharedFeatureInfo, LArMvaHelper::MvaFeatureVector &featureVector) const
Add the shared features to a vector in the correct order.
void GetSharedFeatures(const pandora::Vertex *const pVertex1, const pandora::Vertex *const pVertex2, const KDTreeMap &kdTreeMap, float &separation, float &axisHits) const
Calculates the shared features of a pair of vertex candidates.
bool m_legacyVariables
Whether to only use the old variables.
static MvaFeatureVector ConcatenateFeatureLists()
Recursively concatenate vectors of features (terminating method)
Definition: LArMvaHelper.h:541
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
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::TrainedVertexSelectionAlgorithm::Get2DSpan ( const pandora::ClusterList &  clusterList,
float &  xSpan,
float &  zSpan 
) const
protectedinherited

Get the coordinate span in one view.

Parameters
clusterListthe cluster list in one view
xSpanthe coordinate span in the drift direction
zSpanthe coordinate span in the wire direction

Definition at line 352 of file TrainedVertexSelectionAlgorithm.cc.

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

353 {
354  FloatVector xPositions, zPositions;
355 
356  for (const Cluster *const pCluster : clusterList)
357  {
358  const OrderedCaloHitList &orderedCaloHitList(pCluster->GetOrderedCaloHitList());
359 
360  for (OrderedCaloHitList::const_iterator iter = orderedCaloHitList.begin(), iterEnd = orderedCaloHitList.end(); iter != iterEnd; ++iter)
361  {
362  for (CaloHitList::const_iterator hitIter = iter->second->begin(), hitIterEnd = iter->second->end(); hitIter != hitIterEnd; ++hitIter)
363  {
364  xPositions.push_back((*hitIter)->GetPositionVector().GetX());
365  zPositions.push_back((*hitIter)->GetPositionVector().GetZ());
366  }
367  }
368  }
369 
370  std::sort(xPositions.begin(), xPositions.end());
371  std::sort(zPositions.begin(), zPositions.end());
372 
373  if (xPositions.empty())
374  {
375  xSpan = 0;
376  zSpan = 0;
377  }
378  else
379  {
380  const int low = std::round(0.05 * xPositions.size());
381  const int high = std::round(0.95 * xPositions.size()) - 1;
382 
383  xSpan = xPositions[high] - xPositions[low];
384  zSpan = zPositions[high] - zPositions[low];
385  }
386 }
intermediate_table::const_iterator const_iterator
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 lar_content::EnergyKickVertexSelectionAlgorithm::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::TrainedVertexSelectionAlgorithm::GetBestRegionVertices ( VertexScoreList initialScoreList,
pandora::VertexVector &  bestRegionVertices 
) const
protectedinherited

Get the list of top-N separated vertices.

Parameters
initialScoreListthe initial score list
bestRegionVerticesthe list of best region vertices populate

Definition at line 498 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::TrainedVertexSelectionAlgorithm::m_regionRadius.

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

499 {
500  std::sort(initialScoreList.begin(), initialScoreList.end());
501 
502  for (const VertexScore &vertexScore : initialScoreList)
503  {
504  const Vertex *const pVertex(vertexScore.GetVertex());
505  bool farEnoughAway(true);
506 
507  for (const Vertex *const pRegionVertex : bestRegionVertices)
508  {
509  if (pRegionVertex == pVertex)
510  {
511  farEnoughAway = false;
512  break;
513  }
514 
515  const float distance = (pRegionVertex->GetPosition() - pVertex->GetPosition()).GetMagnitude();
516 
517  if (distance <= m_regionRadius)
518  {
519  farEnoughAway = false;
520  break;
521  }
522  }
523 
524  if (farEnoughAway)
525  bestRegionVertices.push_back(pVertex);
526  }
527 }
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
void lar_content::TrainedVertexSelectionAlgorithm::GetBestVertex ( const pandora::VertexVector &  vertexVector,
const pandora::Vertex *&  pBestVertex,
float &  bestVertexDr 
) const
protectedinherited

Use the MC information to get the best vertex from a list.

Parameters
vertexVectorthe vector of vertices
pBestVertexaddress of the best vertex
bestVertexDrdR of the best vertex

Definition at line 764 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::LArMCParticleHelper::GetTrueNeutrinos(), lar_content::LArMCParticleHelper::GetTrueTestBeamParticles(), lar_content::TrainedVertexSelectionAlgorithm::m_mcParticleListName, lar_content::TrainedVertexSelectionAlgorithm::m_mcVertexXCorrection, and lar_content::TrainedVertexSelectionAlgorithm::m_testBeamMode.

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

765 {
766  // Extract input collections
767  const MCParticleList *pMCParticleList(nullptr);
768  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, m_mcParticleListName, pMCParticleList));
769 
770  // Obtain vector: true targets
771  MCParticleVector mcTargetVector;
772 
773  if (m_testBeamMode)
774  {
775  LArMCParticleHelper::GetTrueTestBeamParticles(pMCParticleList, mcTargetVector);
776  }
777  else
778  {
779  LArMCParticleHelper::GetTrueNeutrinos(pMCParticleList, mcTargetVector);
780  }
781 
782  for (const Vertex *const pVertex : vertexVector)
783  {
784  float mcVertexDr(std::numeric_limits<float>::max());
785  for (const MCParticle *const pMCTarget : mcTargetVector)
786  {
787  const CartesianVector &mcTargetPosition(
788  (m_testBeamMode && std::fabs(pMCTarget->GetParticleId()) == 11) ? pMCTarget->GetVertex() : pMCTarget->GetEndpoint());
789  const CartesianVector mcTargetCorrectedPosition(
790  mcTargetPosition.GetX() + m_mcVertexXCorrection, mcTargetPosition.GetY(), mcTargetPosition.GetZ());
791  const float dr = (mcTargetCorrectedPosition - pVertex->GetPosition()).GetMagnitude();
792 
793  if (dr < mcVertexDr)
794  mcVertexDr = dr;
795  }
796 
797  if (mcVertexDr < bestVertexDr)
798  {
799  bestVertexDr = mcVertexDr;
800  pBestVertex = pVertex;
801  }
802  }
803 }
std::string m_mcParticleListName
The MC particle list for creating training examples.
std::vector< art::Ptr< simb::MCParticle > > MCParticleVector
static void GetTrueNeutrinos(const pandora::MCParticleList *const pMCParticleList, pandora::MCParticleVector &trueNeutrinos)
Get neutrino MC particles from an input MC particle list.
float m_mcVertexXCorrection
The correction to the x-coordinate of the MC vertex position.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
static void GetTrueTestBeamParticles(const pandora::MCParticleList *const pMCParticleList, pandora::MCParticleVector &trueTestBeamParticles)
Get triggered test beam MC particles from an input MC particle list.
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 lar_content::EnergyKickVertexSelectionAlgorithm::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::TrainedVertexSelectionAlgorithm::GetCoordinateSpan ( const pandora::InputFloat &  minCoord,
const pandora::InputFloat &  maxCoord 
) const
inlineprotectedinherited

Get the coordinate span.

Parameters
minCoordthe min coordinate
maxCoordthe max coordinate
Returns
the coordinate span

Definition at line 402 of file TrainedVertexSelectionAlgorithm.cc.

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

403 {
404  if (minCoord.IsInitialized() && maxCoord.IsInitialized())
405  return std::fabs(maxCoord.Get() - minCoord.Get());
406 
407  return 0.f;
408 }
void lar_content::TrainedVertexSelectionAlgorithm::GetEventShapeFeatures ( const ClusterListMap clusterListMap,
float &  eventArea,
float &  longitudinality 
) const
protectedinherited

Get the event shape features.

Parameters
clusterListthe map of cluster lists for each view
eventAreathe event area
longitudinalitythe event longitudinality

Definition at line 332 of file TrainedVertexSelectionAlgorithm.cc.

References f, and lar_content::TrainedVertexSelectionAlgorithm::Get2DSpan().

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

333 {
334  float xSpanU(0.f), zSpanU(0.f), xSpanV(0.f), zSpanV(0.f), xSpanW(0.f), zSpanW(0.f);
335 
336  this->Get2DSpan(clusterListMap.at(TPC_VIEW_U), xSpanU, zSpanU);
337  this->Get2DSpan(clusterListMap.at(TPC_VIEW_V), xSpanV, zSpanV);
338  this->Get2DSpan(clusterListMap.at(TPC_VIEW_W), xSpanW, zSpanW);
339 
340  const float xSpan = (xSpanU + xSpanV + xSpanW) / 3.f;
341  const float zSpan = (zSpanU + zSpanV + zSpanW) / 3.f;
342 
343  if ((xSpan > std::numeric_limits<float>::epsilon()) && (zSpan > std::numeric_limits<float>::epsilon()))
344  {
345  eventArea = xSpan * zSpan;
346  longitudinality = zSpan / (xSpan + zSpan);
347  }
348 }
void Get2DSpan(const pandora::ClusterList &clusterList, float &xSpan, float &zSpan) const
Get the coordinate span in one view.
TFile f
Definition: plotHisto.C:6
std::string lar_content::TrainedVertexSelectionAlgorithm::GetInteractionType ( ) const
protectedinherited

Get the interaction type string.

Returns
the interaction type string

Definition at line 594 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::LArInteractionTypeHelper::GetInteractionType(), lar_content::LArMCParticleHelper::IsBeamNeutrinoFinalState(), lar_content::LArMCParticleHelper::IsTriggeredBeamParticle(), lar_content::TrainedVertexSelectionAlgorithm::m_caloHitListName, lar_content::TrainedVertexSelectionAlgorithm::m_mcParticleListName, lar_content::TrainedVertexSelectionAlgorithm::m_testBeamMode, lar_content::LArMCParticleHelper::SelectReconstructableMCParticles(), lar_content::LArMCParticleHelper::SortByMomentum(), and lar_content::LArInteractionTypeHelper::ToString().

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

595 {
596  // Extract input collections
597  const MCParticleList *pMCParticleList(nullptr);
598  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, m_mcParticleListName, pMCParticleList));
599 
600  const CaloHitList *pCaloHitList(nullptr);
601  PANDORA_THROW_RESULT_IF(STATUS_CODE_SUCCESS, !=, PandoraContentApi::GetList(*this, m_caloHitListName, pCaloHitList));
602 
603  LArMCParticleHelper::MCContributionMap targetMCParticlesToGoodHitsMap;
604 
605  if (m_testBeamMode)
606  {
607  LArMCParticleHelper::SelectReconstructableMCParticles(pMCParticleList, pCaloHitList, LArMCParticleHelper::PrimaryParameters(),
608  LArMCParticleHelper::IsTriggeredBeamParticle, targetMCParticlesToGoodHitsMap);
609  }
610  else
611  {
612  // ATTN Assumes single neutrino is parent of all neutrino-induced mc particles
613  LArMCParticleHelper::SelectReconstructableMCParticles(pMCParticleList, pCaloHitList, LArMCParticleHelper::PrimaryParameters(),
614  LArMCParticleHelper::IsBeamNeutrinoFinalState, targetMCParticlesToGoodHitsMap);
615  }
616 
617  MCParticleList mcPrimaryList;
618  for (const auto &mapEntry : targetMCParticlesToGoodHitsMap)
619  mcPrimaryList.push_back(mapEntry.first);
620  mcPrimaryList.sort(LArMCParticleHelper::SortByMomentum);
621 
623  return LArInteractionTypeHelper::ToString(interactionType);
624 }
std::unordered_map< const pandora::MCParticle *, pandora::CaloHitList > MCContributionMap
static InteractionType GetInteractionType(const pandora::MCParticleList &mcPrimaryList)
Get the interaction type of an event.
static bool SortByMomentum(const pandora::MCParticle *const pLhs, const pandora::MCParticle *const pRhs)
Sort mc particles by their momentum.
static void SelectReconstructableMCParticles(const pandora::MCParticleList *pMCParticleList, const pandora::CaloHitList *pCaloHitList, const PrimaryParameters &parameters, std::function< bool(const pandora::MCParticle *const)> fCriteria, MCContributionMap &selectedMCParticlesToHitsMap)
Select target, reconstructable mc particles that match given criteria.
std::string m_mcParticleListName
The MC particle list for creating training examples.
static std::string ToString(const InteractionType interactionType)
Get a string representation of an interaction type.
static bool IsTriggeredBeamParticle(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary triggered beam MCParticle.
std::string m_caloHitListName
The 2D CaloHit list name.
static bool IsBeamNeutrinoFinalState(const pandora::MCParticle *const pMCParticle)
Returns true if passed a primary neutrino final state MCParticle.
void lar_content::TrainedVertexSelectionAlgorithm::GetLegacyEventShapeFeatures ( const pandora::ClusterList &  clusterList,
float &  eventVolume,
float &  longitudinality 
) const
protectedinherited

Get the event shape features.

Parameters
clusterListthe cluster list
eventVolumethe event volume
longitudinalitythe event longitudinality

Definition at line 292 of file TrainedVertexSelectionAlgorithm.cc.

References f, lar_content::LArClusterHelper::GetClusterBoundingBox(), lar_content::TrainedVertexSelectionAlgorithm::GetCoordinateSpan(), and lar_content::TrainedVertexSelectionAlgorithm::UpdateSpanCoordinate().

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

293 {
294  InputFloat xMin, yMin, zMin, xMax, yMax, zMax;
295 
296  for (const Cluster *const pCluster : clusterList)
297  {
298  CartesianVector minPosition(0.f, 0.f, 0.f), maxPosition(0.f, 0.f, 0.f);
299  LArClusterHelper::GetClusterBoundingBox(pCluster, minPosition, maxPosition);
300 
301  this->UpdateSpanCoordinate(minPosition.GetX(), maxPosition.GetX(), xMin, xMax);
302  this->UpdateSpanCoordinate(minPosition.GetY(), maxPosition.GetY(), yMin, yMax);
303  this->UpdateSpanCoordinate(minPosition.GetZ(), maxPosition.GetZ(), zMin, zMax);
304  }
305 
306  const float xSpan(this->GetCoordinateSpan(xMax, xMin));
307  const float ySpan(this->GetCoordinateSpan(yMax, zMin));
308  const float zSpan(this->GetCoordinateSpan(yMax, zMin));
309 
310  // Calculate the volume and longitudinality of the event (ySpan often 0 - to be investigated).
311  if ((xSpan > std::numeric_limits<float>::epsilon()) && (ySpan > std::numeric_limits<float>::epsilon()))
312  {
313  eventVolume = xSpan * ySpan * zSpan;
314  longitudinality = zSpan / (xSpan + ySpan);
315  }
316 
317  else if (ySpan > std::numeric_limits<float>::epsilon())
318  {
319  eventVolume = ySpan * ySpan * zSpan;
320  longitudinality = zSpan / (ySpan + ySpan);
321  }
322 
323  else if (xSpan > std::numeric_limits<float>::epsilon())
324  {
325  eventVolume = xSpan * xSpan * zSpan;
326  longitudinality = zSpan / (xSpan + xSpan);
327  }
328 }
TFile f
Definition: plotHisto.C:6
static void GetClusterBoundingBox(const pandora::Cluster *const pCluster, pandora::CartesianVector &minimumCoordinate, pandora::CartesianVector &maximumCoordinate)
Get minimum and maximum X, Y and Z positions of the calo hits in a cluster.
void UpdateSpanCoordinate(const float minPositionCoord, const float maxPositionCoord, pandora::InputFloat &minCoord, pandora::InputFloat &maxCoord) const
Update the min/max coordinate spans.
float GetCoordinateSpan(const pandora::InputFloat &minCoord, const pandora::InputFloat &maxCoord) const
Get the coordinate span.
void lar_content::TrainedVertexSelectionAlgorithm::GetSharedFeatures ( const pandora::Vertex *const  pVertex1,
const pandora::Vertex *const  pVertex2,
const KDTreeMap kdTreeMap,
float &  separation,
float &  axisHits 
) const
protectedinherited

Calculates the shared features of a pair of vertex candidates.

Parameters
pVertex1the address of the first vertex
pVertex2the address of the second vertex
kdTreeMapthe map of 2D hit kd trees
separationthe 3D distance between the two vertex candidates
axisHitsthe number of hits between the two candidates normalised to the distance between them

Definition at line 688 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::TrainedVertexSelectionAlgorithm::IncrementSharedAxisValues(), and lar_content::LArGeometryHelper::ProjectPosition().

Referenced by lar_content::MvaVertexSelectionAlgorithm< T >::CompareVertices(), and lar_content::TrainedVertexSelectionAlgorithm::ProduceTrainingExamples().

690 {
691  separation = (pVertex1->GetPosition() - pVertex2->GetPosition()).GetMagnitude();
692 
693  this->IncrementSharedAxisValues(LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex1->GetPosition(), TPC_VIEW_U),
694  LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex2->GetPosition(), TPC_VIEW_U), kdTreeMap.at(TPC_VIEW_U), axisHits);
695 
696  this->IncrementSharedAxisValues(LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex1->GetPosition(), TPC_VIEW_V),
697  LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex2->GetPosition(), TPC_VIEW_V), kdTreeMap.at(TPC_VIEW_V), axisHits);
698 
699  this->IncrementSharedAxisValues(LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex1->GetPosition(), TPC_VIEW_W),
700  LArGeometryHelper::ProjectPosition(this->GetPandora(), pVertex2->GetPosition(), TPC_VIEW_W), kdTreeMap.at(TPC_VIEW_W), axisHits);
701 
702  axisHits = separation > std::numeric_limits<float>::epsilon() ? axisHits / separation : 0.f;
703 }
static pandora::CartesianVector ProjectPosition(const pandora::Pandora &pandora, const pandora::CartesianVector &position3D, const pandora::HitType view)
Project 3D position into a given 2D view.
void IncrementSharedAxisValues(const pandora::CartesianVector pos1, const pandora::CartesianVector pos2, HitKDTree2D &kdTree, float &axisHits) const
Increments the axis hits information for one view.
void lar_content::TrainedVertexSelectionAlgorithm::GetShowerLikeClusterEndPoints ( const pandora::ClusterList &  clusterList,
pandora::ClusterList &  showerLikeClusters,
ClusterEndPointsMap clusterEndPointsMap 
) const
protectedinherited

Add the endpoints of any shower-like clusters to the map.

Parameters
clusterListthe list of clusters
showerLikeClustersthe list of shower-like clusters to populate
clusterEndPointsMapthe map of shower-like cluster endpoints to populate

Definition at line 119 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::TrainedVertexSelectionAlgorithm::IsClusterShowerLike(), lar_content::TrainedVertexSelectionAlgorithm::m_minShowerClusterHits, and lar_content::LArClusterHelper::SortHitsByPosition().

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

121 {
122  for (const Cluster *const pCluster : clusterList)
123  {
124  if (pCluster->GetNCaloHits() < m_minShowerClusterHits)
125  continue;
126 
127  if (this->IsClusterShowerLike(pCluster))
128  showerLikeClusters.push_back(pCluster);
129 
130  CaloHitList clusterCaloHitList;
131  pCluster->GetOrderedCaloHitList().FillCaloHitList(clusterCaloHitList);
132 
133  CaloHitVector clusterCaloHitVector(clusterCaloHitList.begin(), clusterCaloHitList.end());
134  std::sort(clusterCaloHitVector.begin(), clusterCaloHitVector.end(), LArClusterHelper::SortHitsByPosition);
135 
136  if (clusterCaloHitVector.empty())
137  continue;
138 
139  ClusterEndPoints clusterEndPoints(clusterCaloHitVector.front()->GetPositionVector(), clusterCaloHitVector.back()->GetPositionVector());
140  clusterEndPointsMap.emplace(pCluster, clusterEndPoints);
141  }
142 }
bool IsClusterShowerLike(const pandora::Cluster *const pCluster) const
Find whether a cluster is shower-like.
unsigned int m_minShowerClusterHits
The minimum number of shower cluster hits.
std::pair< pandora::CartesianVector, pandora::CartesianVector > ClusterEndPoints
static bool SortHitsByPosition(const pandora::CaloHit *const pLhs, const pandora::CaloHit *const pRhs)
Sort calo hits by their position (use Z, followed by X, followed by Y)
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.
template<typename T >
void lar_content::MvaVertexSelectionAlgorithm< T >::GetVertexScoreList ( const pandora::VertexVector &  vertexVector,
const BeamConstants beamConstants,
HitKDTree2D kdTreeU,
HitKDTree2D kdTreeV,
HitKDTree2D kdTreeW,
VertexScoreList vertexScoreList 
) const
privatevirtual

Get the vertex score list.

Parameters
vertexVectorthe vector of vertices
beamConstantsthe beam constants
kdTreeUthe hit kd tree for the U view
kdTreeVthe hit kd tree for the V view
kdTreeWthe hit kd tree for the W view
vertexScoreListthe vertex score list to fill

Implements lar_content::TrainedVertexSelectionAlgorithm.

Definition at line 45 of file MvaVertexSelectionAlgorithm.cc.

References lar_content::TrainedVertexSelectionAlgorithm::AddEventFeaturesToVector(), lar_content::VertexSelectionBaseAlgorithm::CalculateClusterSlidingFits(), lar_content::TrainedVertexSelectionAlgorithm::CalculateEventFeatures(), lar_content::TrainedVertexSelectionAlgorithm::CalculateRPhiScores(), lar_content::TrainedVertexSelectionAlgorithm::CalculateShowerClusterList(), lar_content::MvaVertexSelectionAlgorithm< T >::CompareVertices(), lar_content::TrainedVertexSelectionAlgorithm::GetBestRegionVertices(), lar_content::VertexSelectionBaseAlgorithm::GetClusterLists(), lar_content::TrainedVertexSelectionAlgorithm::m_allowClassifyDuringTraining, lar_content::TrainedVertexSelectionAlgorithm::m_inputClusterListNames, lar_content::TrainedVertexSelectionAlgorithm::m_minClusterCaloHits, lar_content::MvaVertexSelectionAlgorithm< T >::m_mvaRegion, lar_content::MvaVertexSelectionAlgorithm< T >::m_mvaVertex, lar_content::TrainedVertexSelectionAlgorithm::m_regionRadius, lar_content::TrainedVertexSelectionAlgorithm::m_slidingFitWindow, lar_content::TrainedVertexSelectionAlgorithm::m_trainingSetMode, lar_content::TrainedVertexSelectionAlgorithm::m_useRPhiFeatureForRegion, lar_content::TrainedVertexSelectionAlgorithm::PopulateFinalVertexScoreList(), lar_content::TrainedVertexSelectionAlgorithm::PopulateInitialScoreList(), lar_content::TrainedVertexSelectionAlgorithm::PopulateVertexFeatureInfoMap(), and lar_content::TrainedVertexSelectionAlgorithm::ProduceTrainingSets().

47 {
48  ClusterList clustersU, clustersV, clustersW;
49  this->GetClusterLists(m_inputClusterListNames, clustersU, clustersV, clustersW);
50 
51  SlidingFitDataList slidingFitDataListU, slidingFitDataListV, slidingFitDataListW;
52  this->CalculateClusterSlidingFits(clustersU, m_minClusterCaloHits, m_slidingFitWindow, slidingFitDataListU);
53  this->CalculateClusterSlidingFits(clustersV, m_minClusterCaloHits, m_slidingFitWindow, slidingFitDataListV);
54  this->CalculateClusterSlidingFits(clustersW, m_minClusterCaloHits, m_slidingFitWindow, slidingFitDataListW);
55 
56  ShowerClusterList showerClusterListU, showerClusterListV, showerClusterListW;
57  this->CalculateShowerClusterList(clustersU, showerClusterListU);
58  this->CalculateShowerClusterList(clustersV, showerClusterListV);
59  this->CalculateShowerClusterList(clustersW, showerClusterListW);
60 
61  // Create maps from hit types to objects for passing to feature tools.
62  const ClusterListMap clusterListMap{{TPC_VIEW_U, clustersU}, {TPC_VIEW_V, clustersV}, {TPC_VIEW_W, clustersW}};
63 
64  const SlidingFitDataListMap slidingFitDataListMap{
65  {TPC_VIEW_U, slidingFitDataListU}, {TPC_VIEW_V, slidingFitDataListV}, {TPC_VIEW_W, slidingFitDataListW}};
66 
67  const ShowerClusterListMap showerClusterListMap{{TPC_VIEW_U, showerClusterListU}, {TPC_VIEW_V, showerClusterListV}, {TPC_VIEW_W, showerClusterListW}};
68 
69  const KDTreeMap kdTreeMap{{TPC_VIEW_U, kdTreeU}, {TPC_VIEW_V, kdTreeV}, {TPC_VIEW_W, kdTreeW}};
70 
71  // Calculate the event feature list and the vertex feature map.
72  EventFeatureInfo eventFeatureInfo(this->CalculateEventFeatures(clustersU, clustersV, clustersW, vertexVector));
73 
74  LArMvaHelper::MvaFeatureVector eventFeatureList;
75  this->AddEventFeaturesToVector(eventFeatureInfo, eventFeatureList);
76 
77  VertexFeatureInfoMap vertexFeatureInfoMap;
78  for (const Vertex *const pVertex : vertexVector)
79  {
81  beamConstants, clusterListMap, slidingFitDataListMap, showerClusterListMap, kdTreeMap, pVertex, vertexFeatureInfoMap);
82  }
83 
84  // Use a simple score to get the list of vertices representing good regions.
85  VertexScoreList initialScoreList;
86  for (const Vertex *const pVertex : vertexVector)
87  PopulateInitialScoreList(vertexFeatureInfoMap, pVertex, initialScoreList);
88 
89  VertexVector bestRegionVertices;
90  this->GetBestRegionVertices(initialScoreList, bestRegionVertices);
91 
93  this->ProduceTrainingSets(vertexVector, bestRegionVertices, vertexFeatureInfoMap, eventFeatureList, kdTreeMap);
94 
95  if ((!m_trainingSetMode || m_allowClassifyDuringTraining) && !bestRegionVertices.empty())
96  {
97  // Use mva to choose the region.
98  const Vertex *const pBestRegionVertex(
99  this->CompareVertices(bestRegionVertices, vertexFeatureInfoMap, eventFeatureList, kdTreeMap, m_mvaRegion, m_useRPhiFeatureForRegion));
100 
101  // Get all the vertices in the best region.
102  VertexVector regionalVertices{pBestRegionVertex};
103  for (const Vertex *const pVertex : vertexVector)
104  {
105  if (pVertex == pBestRegionVertex)
106  continue;
107 
108  if ((pBestRegionVertex->GetPosition() - pVertex->GetPosition()).GetMagnitude() < m_regionRadius)
109  regionalVertices.push_back(pVertex);
110  }
111 
112  this->CalculateRPhiScores(regionalVertices, vertexFeatureInfoMap, kdTreeMap);
113 
114  if (!regionalVertices.empty())
115  {
116  // Use mva to choose the vertex and then fine-tune using the RPhi score.
117  const Vertex *const pBestVertex(
118  this->CompareVertices(regionalVertices, vertexFeatureInfoMap, eventFeatureList, kdTreeMap, m_mvaVertex, true));
119  this->PopulateFinalVertexScoreList(vertexFeatureInfoMap, pBestVertex, vertexVector, vertexScoreList);
120  }
121  }
122 }
void AddEventFeaturesToVector(const EventFeatureInfo &eventFeatureInfo, LArMvaHelper::MvaFeatureVector &featureVector) const
Add the event features to a vector in the correct order.
bool m_useRPhiFeatureForRegion
Whether to use the r/phi feature for the region vertex.
void GetBestRegionVertices(VertexScoreList &initialScoreList, pandora::VertexVector &bestRegionVertices) const
Get the list of top-N separated vertices.
MvaTypes::MvaFeatureVector MvaFeatureVector
Definition: LArMvaHelper.h:75
unsigned int m_minClusterCaloHits
The min number of hits parameter in the energy score.
void PopulateInitialScoreList(VertexFeatureInfoMap &vertexFeatureInfoMap, const pandora::Vertex *const pVertex, VertexScoreList &initialScoreList) const
Populate the initial vertex score list for a given vertex.
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.
void PopulateFinalVertexScoreList(const VertexFeatureInfoMap &vertexFeatureInfoMap, const pandora::Vertex *const pFavouriteVertex, const pandora::VertexVector &vertexVector, VertexScoreList &finalVertexScoreList) const
Populate the final vertex score list using the r/phi score to find the best vertex in the vicinity...
const pandora::Vertex * CompareVertices(const pandora::VertexVector &vertexVector, const VertexFeatureInfoMap &vertexFeatureInfoMap, const LArMvaHelper::MvaFeatureVector &eventFeatureList, const KDTreeMap &kdTreeMap, const T &t, const bool useRPhi) const
Used a binary classifier to compare a set of vertices and pick the best one.
void CalculateRPhiScores(pandora::VertexVector &vertexVector, VertexFeatureInfoMap &vertexFeatureInfoMap, const KDTreeMap &kdTreeMap) const
Calculate the r/phi scores for the vertices in a vector, possibly erasing those that fail the fast sc...
void ProduceTrainingSets(const pandora::VertexVector &vertexVector, const pandora::VertexVector &bestRegionVertices, VertexFeatureInfoMap &vertexFeatureInfoMap, const LArMvaHelper::MvaFeatureVector &eventFeatureList, const KDTreeMap &kdTreeMap) const
Produce the region and vertex training sets.
std::map< pandora::HitType, const ShowerClusterList > ShowerClusterListMap
Map of shower cluster lists for passing to tools.
void PopulateVertexFeatureInfoMap(const BeamConstants &beamConstants, const ClusterListMap &clusterListMap, const SlidingFitDataListMap &slidingFitDataListMap, const ShowerClusterListMap &showerClusterListMap, const KDTreeMap &kdTreeMap, const pandora::Vertex *const pVertex, VertexFeatureInfoMap &vertexFeatureInfoMap) const
Populate the vertex feature info map for a given vertex.
EventFeatureInfo CalculateEventFeatures(const pandora::ClusterList &clusterListU, const pandora::ClusterList &clusterListV, const pandora::ClusterList &clusterListW, const pandora::VertexVector &vertexVector) const
Calculate the event parameters.
std::map< pandora::HitType, const pandora::ClusterList & > ClusterListMap
Map array of cluster lists for passing to tools.
bool m_allowClassifyDuringTraining
Whether classification is allowed during training.
void CalculateShowerClusterList(const pandora::ClusterList &inputClusterList, ShowerClusterList &showerClusterList) const
Calculate the shower cluster map for a cluster list.
std::map< pandora::HitType, const SlidingFitDataList > SlidingFitDataListMap
Map of sliding fit data lists for passing to tools.
unsigned int m_slidingFitWindow
The layer window for the sliding linear fits.
std::vector< art::Ptr< recob::Vertex > > VertexVector
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.
pandora::StringVector m_inputClusterListNames
The list of cluster list names.
std::map< const pandora::Vertex *const, VertexFeatureInfo > VertexFeatureInfoMap
void lar_content::TrainedVertexSelectionAlgorithm::IncrementSharedAxisValues ( const pandora::CartesianVector  pos1,
const pandora::CartesianVector  pos2,
HitKDTree2D kdTree,
float &  axisHits 
) const
protectedinherited

Increments the axis hits information for one view.

Parameters
pos12D projected position of the first vertex
pos22D projected position of the second vertex
kdTreethe kd tree of 2D hits
axisHitsthe number of hits between the two candidates

Definition at line 707 of file TrainedVertexSelectionAlgorithm.cc.

References f, lar_content::TrainedVertexSelectionAlgorithm::IsHitInBox(), and lar_content::KDTreeLinkerAlgo< DATA, DIM >::search().

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

709 {
710  if (pos1 == pos2)
711  return;
712 
713  // Define the axis and perpendicular directions
714  const CartesianVector unitAxis = (pos1 - pos2).GetUnitVector();
715  const CartesianVector unitPerp(unitAxis.GetZ(), 0, -unitAxis.GetX());
716 
717  // Define the corners of the search box
718  const CartesianVector point1 = pos1 + unitPerp;
719  const CartesianVector point2 = pos1 - unitPerp;
720  const CartesianVector point3 = pos2 + unitPerp;
721  const CartesianVector point4 = pos2 - unitPerp;
722 
723  // Find the total coordinate span these points cover
724  const float xMin{std::min({point1.GetX(), point2.GetX(), point3.GetX(), point4.GetX()})};
725  const float xMax{std::max({point1.GetX(), point2.GetX(), point3.GetX(), point4.GetX()})};
726  const float zMin{std::min({point1.GetZ(), point2.GetZ(), point3.GetZ(), point4.GetZ()})};
727  const float zMax{std::max({point1.GetZ(), point2.GetZ(), point3.GetZ(), point4.GetZ()})};
728 
729  // Use a kd search to find the hits in the 'wide' area
730  KDTreeBox searchBox(xMin, zMin, xMax, zMax);
731  HitKDNode2DList found;
732  kdTree.search(searchBox, found);
733 
734  // Use IsHitInBox method to check the 'wide' area hits for those in the search box
735  for (auto f : found)
736  {
737  const CartesianVector &hitPos = f.data->GetPositionVector();
738  bool inBox = this->IsHitInBox(hitPos, point1, point2, point3, point4);
739 
740  if (inBox)
741  ++axisHits;
742  }
743 }
bool IsHitInBox(const pandora::CartesianVector &hitPos, const pandora::CartesianVector &point1, const pandora::CartesianVector &point2, const pandora::CartesianVector &point3, const pandora::CartesianVector &point4) const
Determines whether a hit lies within the box defined by four other positions.
TFile f
Definition: plotHisto.C:6
KDTreeBoxT< 2 > KDTreeBox
void lar_content::TrainedVertexSelectionAlgorithm::IncrementShoweryParameters ( const pandora::ClusterList &  clusterList,
unsigned int &  nShoweryHits,
unsigned int &  nHits,
float &  eventEnergy 
) const
protectedinherited

Increment the showery hit parameters for a cluster list.

Parameters
clusterListthe cluster list
nShoweryHitsthe number of showery hits
nHitsthe number of hits
eventEnergythe event energy

Definition at line 270 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::TrainedVertexSelectionAlgorithm::IsClusterShowerLike().

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

272 {
273  for (const Cluster *const pCluster : clusterList)
274  {
275  if (this->IsClusterShowerLike(pCluster))
276  nShoweryHits += pCluster->GetNCaloHits();
277 
278  eventEnergy += pCluster->GetElectromagneticEnergy();
279  nHits += pCluster->GetNCaloHits();
280  }
281 }
bool IsClusterShowerLike(const pandora::Cluster *const pCluster) const
Find whether a cluster is shower-like.
bool lar_content::VertexSelectionBaseAlgorithm::IsBeamModeOn ( ) const
inlineprotectedinherited
bool lar_content::TrainedVertexSelectionAlgorithm::IsClusterShowerLike ( const pandora::Cluster *const  pCluster) const
inlineprotectedinherited

Find whether a cluster is shower-like.

Parameters
pClusterthe cluster
Returns
boolean

Definition at line 285 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::LArClusterHelper::GetLength(), and lar_content::TrainedVertexSelectionAlgorithm::m_minShowerSpineLength.

Referenced by lar_content::TrainedVertexSelectionAlgorithm::GetShowerLikeClusterEndPoints(), and lar_content::TrainedVertexSelectionAlgorithm::IncrementShoweryParameters().

286 {
287  return (pCluster->GetParticleId() == E_MINUS && LArClusterHelper::GetLength(pCluster) < m_minShowerSpineLength);
288 }
static float GetLength(const pandora::Cluster *const pCluster)
Get length of cluster.
float m_minShowerSpineLength
The minimum length at which all are considered to be tracks.
bool lar_content::TrainedVertexSelectionAlgorithm::IsHitInBox ( const pandora::CartesianVector &  hitPos,
const pandora::CartesianVector &  point1,
const pandora::CartesianVector &  point2,
const pandora::CartesianVector &  point3,
const pandora::CartesianVector &  point4 
) const
protectedinherited

Determines whether a hit lies within the box defined by four other positions.

Parameters
hitPosthe hit position
point1the first corner of the box
point2the second corner of the box
point3the third corner of the box
point4the fourth corner of the box
Returns
boolean

Definition at line 747 of file TrainedVertexSelectionAlgorithm.cc.

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

749 {
750  bool b1 = std::signbit(((point2 - point1).GetCrossProduct(point2 - hitPos)).GetY());
751  bool b2 = std::signbit(((point4 - point3).GetCrossProduct(point4 - hitPos)).GetY());
752 
753  if (!(b1 xor b2))
754  return false;
755 
756  bool b3 = std::signbit(((point3 - point1).GetCrossProduct(point3 - hitPos)).GetY());
757  bool b4 = std::signbit(((point4 - point2).GetCrossProduct(point4 - hitPos)).GetY());
758 
759  return (b3 xor b4);
760 }
void lar_content::TrainedVertexSelectionAlgorithm::PopulateFinalVertexScoreList ( const VertexFeatureInfoMap vertexFeatureInfoMap,
const pandora::Vertex *const  pFavouriteVertex,
const pandora::VertexVector &  vertexVector,
VertexScoreList finalVertexScoreList 
) const
protectedinherited

Populate the final vertex score list using the r/phi score to find the best vertex in the vicinity.

Parameters
vertexFeatureInfoMapthe vertex feature info map
pFavouriteVertexaddress of the favourite vertex
vertexVectorthe vector of all vertex candidates
finalVertexScoreListthe final vertex score list to populate

Definition at line 838 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::TrainedVertexSelectionAlgorithm::m_rPhiFineTuningRadius.

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

840 {
841  if (pFavouriteVertex)
842  {
843  const CartesianVector vertexPosition(pFavouriteVertex->GetPosition());
844 
845  for (const Vertex *const pVertex : vertexVector)
846  {
847  if ((pVertex->GetPosition() - vertexPosition).GetMagnitude() < m_rPhiFineTuningRadius)
848  {
849  const float rPhiScore(vertexFeatureInfoMap.at(pVertex).m_rPhiFeature);
850  finalVertexScoreList.emplace_back(pVertex, rPhiScore);
851  }
852  }
853  }
854 }
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
float m_rPhiFineTuningRadius
The maximum distance the r/phi tune can move a vertex.
void lar_content::TrainedVertexSelectionAlgorithm::PopulateInitialScoreList ( VertexFeatureInfoMap vertexFeatureInfoMap,
const pandora::Vertex *const  pVertex,
VertexScoreList initialScoreList 
) const
protectedinherited

Populate the initial vertex score list for a given vertex.

Parameters
vertexFeatureInfoMapthe vertex feature info map
pVertexthe vertex
initialScoreListthe score list to populate

Definition at line 482 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::TrainedVertexSelectionAlgorithm::VertexFeatureInfo::m_beamDeweighting, lar_content::TrainedVertexSelectionAlgorithm::m_beamDeweightingConstant, lar_content::TrainedVertexSelectionAlgorithm::VertexFeatureInfo::m_energyKick, lar_content::TrainedVertexSelectionAlgorithm::m_energyKickConstant, lar_content::TrainedVertexSelectionAlgorithm::VertexFeatureInfo::m_globalAsymmetry, lar_content::TrainedVertexSelectionAlgorithm::m_globalAsymmetryConstant, lar_content::TrainedVertexSelectionAlgorithm::VertexFeatureInfo::m_localAsymmetry, lar_content::TrainedVertexSelectionAlgorithm::m_localAsymmetryConstant, lar_content::TrainedVertexSelectionAlgorithm::VertexFeatureInfo::m_showerAsymmetry, and lar_content::TrainedVertexSelectionAlgorithm::m_showerAsymmetryConstant.

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

484 {
485  VertexFeatureInfo vertexFeatureInfo = vertexFeatureInfoMap.at(pVertex);
486 
487  const float beamDeweightingScore(vertexFeatureInfo.m_beamDeweighting / m_beamDeweightingConstant);
488  const float energyKickScore(-vertexFeatureInfo.m_energyKick / m_energyKickConstant);
489  const float localAsymmetryScore(vertexFeatureInfo.m_localAsymmetry / m_localAsymmetryConstant);
490  const float globalAsymmetryScore(vertexFeatureInfo.m_globalAsymmetry / m_globalAsymmetryConstant);
491  const float showerAsymmetryScore(vertexFeatureInfo.m_showerAsymmetry / m_showerAsymmetryConstant);
492 
493  initialScoreList.emplace_back(pVertex, beamDeweightingScore + energyKickScore + localAsymmetryScore + globalAsymmetryScore + showerAsymmetryScore);
494 }
float m_localAsymmetryConstant
The local asymmetry constant for the initial region score list.
float m_globalAsymmetryConstant
The global asymmetry constant for the initial region score list.
float m_showerAsymmetryConstant
The shower asymmetry constant for the initial region score list.
float m_beamDeweightingConstant
The beam deweighting constant for the initial region score list.
float m_energyKickConstant
The energy kick constant for the initial region score list.
void lar_content::TrainedVertexSelectionAlgorithm::PopulateKdTree ( const pandora::ClusterList &  clusterList,
HitKDTree2D kdTree,
HitToClusterMap hitToClusterMap 
) const
protectedinherited

Populate kd tree with information about hits in a provided list of clusters.

Parameters
clusterListthe list of clusters
kdTreeto receive the populated kd tree
hitToClusterMapto receive the populated hit to cluster map

Definition at line 146 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::TrainedVertexSelectionAlgorithm::AddClusterToShower(), lar_content::KDTreeLinkerAlgo< DATA, DIM >::build(), lar_content::build_2d_kd_search_region(), lar_content::fill_and_bound_2d_kd_tree(), lar_content::TrainedVertexSelectionAlgorithm::m_showerClusteringDistance, and lar_content::KDTreeLinkerAlgo< DATA, DIM >::search().

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

147 {
148  CaloHitList allCaloHits;
149 
150  for (const Cluster *const pCluster : clusterList)
151  {
152  CaloHitList daughterHits;
153  pCluster->GetOrderedCaloHitList().FillCaloHitList(daughterHits);
154  allCaloHits.insert(allCaloHits.end(), daughterHits.begin(), daughterHits.end());
155 
156  for (const CaloHit *const pCaloHit : daughterHits)
157  (void)hitToClusterMap.insert(HitToClusterMap::value_type(pCaloHit, pCluster));
158  }
159 
160  HitKDNode2DList hitKDNode2DList;
161  KDTreeBox hitsBoundingRegion2D(fill_and_bound_2d_kd_tree(allCaloHits, hitKDNode2DList));
162  kdTree.build(hitKDNode2DList, hitsBoundingRegion2D);
163 }
KDTreeBox fill_and_bound_2d_kd_tree(const MANAGED_CONTAINER< const T * > &points, std::vector< KDTreeNodeInfoT< const T *, 2 >> &nodes)
fill_and_bound_2d_kd_tree
KDTreeBoxT< 2 > KDTreeBox
void lar_content::TrainedVertexSelectionAlgorithm::PopulateVertexFeatureInfoMap ( const BeamConstants beamConstants,
const ClusterListMap clusterListMap,
const SlidingFitDataListMap slidingFitDataListMap,
const ShowerClusterListMap showerClusterListMap,
const KDTreeMap kdTreeMap,
const pandora::Vertex *const  pVertex,
VertexFeatureInfoMap vertexFeatureInfoMap 
) const
protectedinherited

Populate the vertex feature info map for a given vertex.

Parameters
beamConstantsthe beam constants
clusterListMapthe cluster list map
slidingFitDataListMapthe sliding fit data list map
showerClusterListMapthe shower cluster list map
kdTreeMapthe kd tree map
pVertexthe vertex
vertexFeatureInfoMapthe map to populate

Definition at line 428 of file TrainedVertexSelectionAlgorithm.cc.

References f, Get, lar_content::VertexSelectionBaseAlgorithm::GetBeamDeweightingScore(), lar_content::VertexSelectionBaseAlgorithm::GetVertexEnergy(), lar_content::VertexSelectionBaseAlgorithm::IsBeamModeOn(), lar_content::TrainedVertexSelectionAlgorithm::m_featureToolVector, and lar_content::TrainedVertexSelectionAlgorithm::m_legacyVariables.

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

431 {
432  float bestFastScore(-std::numeric_limits<float>::max()); // not actually used - artefact of toolizing RPhi score and still using performance trick
433 
434  // ATTN - If beam mode is false GetBeamDeweightingScore will fail, so have a default value that we'll ignore when poplating the feature vector
435  double tempBeamDeweight{0.f};
436  if (this->IsBeamModeOn())
437  tempBeamDeweight = this->GetBeamDeweightingScore(beamConstants, pVertex);
438 
439  const double beamDeweighting(tempBeamDeweight);
440 
441  const double energyKick(LArMvaHelper::CalculateFeaturesOfType<EnergyKickFeatureTool>(m_featureToolVector, this, pVertex,
442  slidingFitDataListMap, clusterListMap, kdTreeMap, showerClusterListMap, beamDeweighting, bestFastScore)
443  .at(0)
444  .Get());
445 
446  const double localAsymmetry(LArMvaHelper::CalculateFeaturesOfType<LocalAsymmetryFeatureTool>(m_featureToolVector, this, pVertex,
447  slidingFitDataListMap, clusterListMap, kdTreeMap, showerClusterListMap, beamDeweighting, bestFastScore)
448  .at(0)
449  .Get());
450 
451  const double globalAsymmetry(LArMvaHelper::CalculateFeaturesOfType<GlobalAsymmetryFeatureTool>(m_featureToolVector, this, pVertex,
452  slidingFitDataListMap, clusterListMap, kdTreeMap, showerClusterListMap, beamDeweighting, bestFastScore)
453  .at(0)
454  .Get());
455 
456  const double showerAsymmetry(LArMvaHelper::CalculateFeaturesOfType<ShowerAsymmetryFeatureTool>(m_featureToolVector, this, pVertex,
457  slidingFitDataListMap, clusterListMap, kdTreeMap, showerClusterListMap, beamDeweighting, bestFastScore)
458  .at(0)
459  .Get());
460 
461  //const double rPhiFeature(LArMvaHelper::CalculateFeaturesOfType<RPhiFeatureTool>(m_featureToolVector, this, pVertex,
462  // slidingFitDataListMap, clusterListMap, kdTreeMap, showerClusterListMap, beamDeweighting, bestFastScore).at(0).Get());
463 
464  double dEdxAsymmetry(0.f), vertexEnergy(0.f);
465 
466  if (!m_legacyVariables)
467  {
468  dEdxAsymmetry = LArMvaHelper::CalculateFeaturesOfType<EnergyDepositionAsymmetryFeatureTool>(m_featureToolVector, this, pVertex,
469  slidingFitDataListMap, clusterListMap, kdTreeMap, showerClusterListMap, beamDeweighting, bestFastScore)
470  .at(0)
471  .Get();
472 
473  vertexEnergy = this->GetVertexEnergy(pVertex, kdTreeMap);
474  }
475 
476  VertexFeatureInfo vertexFeatureInfo(beamDeweighting, 0.f, energyKick, localAsymmetry, globalAsymmetry, showerAsymmetry, dEdxAsymmetry, vertexEnergy);
477  vertexFeatureInfoMap.emplace(pVertex, vertexFeatureInfo);
478 }
VertexFeatureTool::FeatureToolVector m_featureToolVector
The feature tool vector.
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
TFile f
Definition: plotHisto.C:6
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.
bool m_legacyVariables
Whether to only use the old variables.
float GetBeamDeweightingScore(const BeamConstants &beamConstants, const pandora::Vertex *const pVertex) const
Get the beam deweighting score for a vertex.
const pandora::Vertex * lar_content::TrainedVertexSelectionAlgorithm::ProduceTrainingExamples ( const pandora::VertexVector &  vertexVector,
const VertexFeatureInfoMap vertexFeatureInfoMap,
std::bernoulli_distribution &  coinFlip,
std::mt19937 &  generator,
const std::string &  interactionType,
const std::string &  trainingOutputFile,
const LArMvaHelper::MvaFeatureVector eventFeatureList,
const KDTreeMap kdTreeMap,
const float  maxRadius,
const bool  useRPhi 
) const
protectedinherited

Produce a set of training examples for a binary classifier.

Parameters
vertexVectorthe vector of vertices to use
vertexFeatureInfoMapthe vertex feature info map
coinFlipa distribution for producing coin flips
generatorthe random number generator
interactionTypethe interaction type string
trainingOutputFilethe training set output file
eventFeatureListthe event feature list
kdTreeMapthe map of 2D hit kd trees
maxRadiusthe maximum allowed radius for the 'best' vertex
useRPhiwhether to include the r/phi feature
Returns
address of the vertex used as the 'best' vertex in the classifier

Definition at line 628 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::TrainedVertexSelectionAlgorithm::AddSharedFeaturesToVector(), lar_content::TrainedVertexSelectionAlgorithm::AddVertexFeaturesToVector(), lar_content::LArMvaHelper::ConcatenateFeatureLists(), f, lar_content::TrainedVertexSelectionAlgorithm::GetBestVertex(), lar_content::TrainedVertexSelectionAlgorithm::GetSharedFeatures(), lar_content::TrainedVertexSelectionAlgorithm::m_legacyVariables, and lar_content::LArMvaHelper::ProduceTrainingExample().

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

632 {
633  const Vertex *pBestVertex(nullptr);
634  float bestVertexDr(std::numeric_limits<float>::max());
635 
636  LArMvaHelper::MvaFeatureVector bestVertexFeatureList;
637  this->GetBestVertex(vertexVector, pBestVertex, bestVertexDr);
638 
639  VertexFeatureInfo bestVertexFeatureInfo(vertexFeatureInfoMap.at(pBestVertex));
640  this->AddVertexFeaturesToVector(bestVertexFeatureInfo, bestVertexFeatureList, useRPhi);
641 
642  for (const Vertex *const pVertex : vertexVector)
643  {
644  if (pVertex == pBestVertex)
645  continue;
646 
647  LArMvaHelper::MvaFeatureVector featureList;
648  VertexFeatureInfo vertexFeatureInfo(vertexFeatureInfoMap.at(pVertex));
649  this->AddVertexFeaturesToVector(vertexFeatureInfo, featureList, useRPhi);
650 
651  if (!m_legacyVariables)
652  {
653  LArMvaHelper::MvaFeatureVector sharedFeatureList;
654  float separation(0.f), axisHits(0.f);
655  this->GetSharedFeatures(pVertex, pBestVertex, kdTreeMap, separation, axisHits);
656  VertexSharedFeatureInfo sharedFeatureInfo(separation, axisHits);
657  this->AddSharedFeaturesToVector(sharedFeatureInfo, sharedFeatureList);
658 
659  if (pBestVertex && (bestVertexDr < maxRadius))
660  {
661  if (coinFlip(generator))
662  LArMvaHelper::ProduceTrainingExample(trainingOutputFile + "_" + interactionType + ".txt", true,
663  LArMvaHelper::ConcatenateFeatureLists(eventFeatureList, bestVertexFeatureList, featureList, sharedFeatureList));
664  else
665  LArMvaHelper::ProduceTrainingExample(trainingOutputFile + "_" + interactionType + ".txt", false,
666  LArMvaHelper::ConcatenateFeatureLists(eventFeatureList, featureList, bestVertexFeatureList, sharedFeatureList));
667  }
668  }
669  else
670  {
671  if (pBestVertex && (bestVertexDr < maxRadius))
672  {
673  if (coinFlip(generator))
674  LArMvaHelper::ProduceTrainingExample(trainingOutputFile + "_" + interactionType + ".txt", true,
675  LArMvaHelper::ConcatenateFeatureLists(eventFeatureList, bestVertexFeatureList, featureList));
676  else
677  LArMvaHelper::ProduceTrainingExample(trainingOutputFile + "_" + interactionType + ".txt", false,
678  LArMvaHelper::ConcatenateFeatureLists(eventFeatureList, featureList, bestVertexFeatureList));
679  }
680  }
681  }
682 
683  return pBestVertex;
684 }
MvaTypes::MvaFeatureVector MvaFeatureVector
Definition: LArMvaHelper.h:75
static pandora::StatusCode ProduceTrainingExample(const std::string &trainingOutputFile, const bool result, TCONTAINER &&featureContainer)
Produce a training example with the given features and result.
Definition: LArMvaHelper.h:285
void AddVertexFeaturesToVector(const VertexFeatureInfo &vertexFeatureInfo, LArMvaHelper::MvaFeatureVector &featureVector, const bool useRPhi) const
Add the vertex features to a vector in the correct order.
TFile f
Definition: plotHisto.C:6
void AddSharedFeaturesToVector(const VertexSharedFeatureInfo &vertexSharedFeatureInfo, LArMvaHelper::MvaFeatureVector &featureVector) const
Add the shared features to a vector in the correct order.
void GetSharedFeatures(const pandora::Vertex *const pVertex1, const pandora::Vertex *const pVertex2, const KDTreeMap &kdTreeMap, float &separation, float &axisHits) const
Calculates the shared features of a pair of vertex candidates.
bool m_legacyVariables
Whether to only use the old variables.
static MvaFeatureVector ConcatenateFeatureLists()
Recursively concatenate vectors of features (terminating method)
Definition: LArMvaHelper.h:541
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
void GetBestVertex(const pandora::VertexVector &vertexVector, const pandora::Vertex *&pBestVertex, float &bestVertexDr) const
Use the MC information to get the best vertex from a list.
void lar_content::TrainedVertexSelectionAlgorithm::ProduceTrainingSets ( const pandora::VertexVector &  vertexVector,
const pandora::VertexVector &  bestRegionVertices,
VertexFeatureInfoMap vertexFeatureInfoMap,
const LArMvaHelper::MvaFeatureVector eventFeatureList,
const KDTreeMap kdTreeMap 
) const
protectedinherited

Produce the region and vertex training sets.

Parameters
vertexVectorthe vector of all vertices
bestRegionVerticesthe best region vertices
vertexFeatureInfoMapthe vertex feature info map
eventFeatureListthe list of event features
kdTreeMap

Definition at line 531 of file TrainedVertexSelectionAlgorithm.cc.

References lar_content::TrainedVertexSelectionAlgorithm::CalculateRPhiScores(), lar_content::TrainedVertexSelectionAlgorithm::GetInteractionType(), lar_content::TrainedVertexSelectionAlgorithm::m_maxTrueVertexRadius, lar_content::TrainedVertexSelectionAlgorithm::m_regionRadius, lar_content::TrainedVertexSelectionAlgorithm::m_trainingOutputFileRegion, lar_content::TrainedVertexSelectionAlgorithm::m_trainingOutputFileVertex, lar_content::TrainedVertexSelectionAlgorithm::m_useRPhiFeatureForRegion, and lar_content::TrainedVertexSelectionAlgorithm::ProduceTrainingExamples().

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

533 {
534  if (vertexVector.empty())
535  return;
536 
537  // Create a distribution for random coin flips.
538  std::random_device device;
539  std::mt19937 generator(device());
540  std::bernoulli_distribution coinFlip(0.5);
541 
542  const std::string interactionType(this->GetInteractionType());
543 
544  // Produce training examples for the vertices representing regions.
545  const Vertex *const pBestRegionVertex(this->ProduceTrainingExamples(bestRegionVertices, vertexFeatureInfoMap, coinFlip, generator,
546  interactionType, m_trainingOutputFileRegion, eventFeatureList, kdTreeMap, m_regionRadius, m_useRPhiFeatureForRegion));
547 
548  // Get all the vertices in the best region.
549  VertexVector regionalVertices{pBestRegionVertex};
550  for (const Vertex *const pVertex : vertexVector)
551  {
552  if (pVertex == pBestRegionVertex)
553  continue;
554 
555  if ((pBestRegionVertex->GetPosition() - pVertex->GetPosition()).GetMagnitude() < m_regionRadius)
556  regionalVertices.push_back(pVertex);
557  }
558 
559  this->CalculateRPhiScores(regionalVertices, vertexFeatureInfoMap, kdTreeMap);
560 
561  // Produce training examples for the final vertices within the best region.
562  if (!regionalVertices.empty())
563  {
564  this->ProduceTrainingExamples(regionalVertices, vertexFeatureInfoMap, coinFlip, generator, interactionType,
565  m_trainingOutputFileVertex, eventFeatureList, kdTreeMap, m_maxTrueVertexRadius, true);
566  }
567 }
std::string m_trainingOutputFileVertex
The training output file for the vertex mva.
bool m_useRPhiFeatureForRegion
Whether to use the r/phi feature for the region vertex.
const pandora::Vertex * ProduceTrainingExamples(const pandora::VertexVector &vertexVector, const VertexFeatureInfoMap &vertexFeatureInfoMap, std::bernoulli_distribution &coinFlip, std::mt19937 &generator, const std::string &interactionType, const std::string &trainingOutputFile, const LArMvaHelper::MvaFeatureVector &eventFeatureList, const KDTreeMap &kdTreeMap, const float maxRadius, const bool useRPhi) const
Produce a set of training examples for a binary classifier.
void CalculateRPhiScores(pandora::VertexVector &vertexVector, VertexFeatureInfoMap &vertexFeatureInfoMap, const KDTreeMap &kdTreeMap) const
Calculate the r/phi scores for the vertices in a vector, possibly erasing those that fail the fast sc...
float m_maxTrueVertexRadius
The maximum distance at which a vertex candidate can be considered the &#39;true&#39; vertex.
std::string m_trainingOutputFileRegion
The training output file for the region mva.
std::vector< art::Ptr< recob::Vertex > > VertexVector
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
std::string GetInteractionType() const
Get the interaction type string.
template<typename T >
StatusCode lar_content::MvaVertexSelectionAlgorithm< T >::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
protected

Definition at line 175 of file MvaVertexSelectionAlgorithm.cc.

References lar_content::LArFileHelper::FindFileInPath(), lar_content::TrainedVertexSelectionAlgorithm::m_allowClassifyDuringTraining, lar_content::MvaVertexSelectionAlgorithm< T >::m_filePathEnvironmentVariable, lar_content::MvaVertexSelectionAlgorithm< T >::m_mvaFileName, lar_content::MvaVertexSelectionAlgorithm< T >::m_mvaRegion, lar_content::MvaVertexSelectionAlgorithm< T >::m_mvaVertex, lar_content::MvaVertexSelectionAlgorithm< T >::m_regionMvaName, lar_content::TrainedVertexSelectionAlgorithm::m_trainingSetMode, lar_content::MvaVertexSelectionAlgorithm< T >::m_vertexMvaName, and lar_content::TrainedVertexSelectionAlgorithm::ReadSettings().

176 {
177  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=,
178  XmlHelper::ReadValue(xmlHandle, "FilePathEnvironmentVariable", m_filePathEnvironmentVariable));
179 
180  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "MvaFileName", m_mvaFileName));
181 
182  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "RegionMvaName", m_regionMvaName));
183 
184  PANDORA_RETURN_RESULT_IF_AND_IF(STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "VertexMvaName", m_vertexMvaName));
185 
186  // ATTN : Need access to base class member variables at this point, so call read settings prior to end of this function
187  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, TrainedVertexSelectionAlgorithm::ReadSettings(xmlHandle));
188 
190  {
191  if (m_mvaFileName.empty() || m_regionMvaName.empty() || m_vertexMvaName.empty())
192  {
193  std::cout << "MvaVertexSelectionAlgorithm: MvaFileName, RegionMvaName and VertexMvaName must be set if training set mode is"
194  << "off or we allow classification during training" << std::endl;
195  return STATUS_CODE_INVALID_PARAMETER;
196  }
197 
199  m_mvaRegion.Initialize(fullMvaFileName, m_regionMvaName);
200  m_mvaVertex.Initialize(fullMvaFileName, m_vertexMvaName);
201  }
202 
203  return STATUS_CODE_SUCCESS;
204 }
std::string m_filePathEnvironmentVariable
The environment variable providing a list of paths to mva files.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
std::string m_regionMvaName
The name of the region mva to find.
static std::string FindFileInPath(const std::string &unqualifiedFileName, const std::string &environmentVariable, const std::string &delimiter=":")
Find the fully-qualified file name by searching through a list of delimiter-separated paths in a name...
std::string m_vertexMvaName
The name of the vertex mva to find.
bool m_allowClassifyDuringTraining
Whether classification is allowed during training.
void lar_content::TrainedVertexSelectionAlgorithm::UpdateSpanCoordinate ( const float  minPositionCoord,
const float  maxPositionCoord,
pandora::InputFloat &  minCoord,
pandora::InputFloat &  maxCoord 
) const
inlineprotectedinherited

Update the min/max coordinate spans.

Parameters
minPositionCoordthe min position coordinate
maxPositionCoordthe max position coordinate
minCoordthe current min coordinate
maxCoordthe current max coordinate

Definition at line 390 of file TrainedVertexSelectionAlgorithm.cc.

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

392 {
393  if (!minCoord.IsInitialized() || minPositionCoord < minCoord.Get())
394  minCoord = minPositionCoord;
395 
396  if (!maxCoord.IsInitialized() || maxPositionCoord > maxCoord.Get())
397  maxCoord = maxPositionCoord;
398 }
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

bool lar_content::TrainedVertexSelectionAlgorithm::m_allowClassifyDuringTraining
protectedinherited
float lar_content::TrainedVertexSelectionAlgorithm::m_beamDeweightingConstant
protectedinherited

The beam deweighting constant for the initial region score list.

Definition at line 466 of file TrainedVertexSelectionAlgorithm.h.

Referenced by lar_content::TrainedVertexSelectionAlgorithm::PopulateInitialScoreList(), and lar_content::TrainedVertexSelectionAlgorithm::ReadSettings().

std::string lar_content::TrainedVertexSelectionAlgorithm::m_caloHitListName
protectedinherited
bool lar_content::TrainedVertexSelectionAlgorithm::m_dropFailedRPhiFastScoreCandidates
protectedinherited

Whether to drop candidates that fail the r/phi fast score test.

Definition at line 479 of file TrainedVertexSelectionAlgorithm.h.

Referenced by lar_content::TrainedVertexSelectionAlgorithm::CalculateRPhiScores(), and lar_content::TrainedVertexSelectionAlgorithm::ReadSettings().

float lar_content::TrainedVertexSelectionAlgorithm::m_energyKickConstant
protectedinherited

The energy kick constant for the initial region score list.

Definition at line 470 of file TrainedVertexSelectionAlgorithm.h.

Referenced by lar_content::TrainedVertexSelectionAlgorithm::PopulateInitialScoreList(), and lar_content::TrainedVertexSelectionAlgorithm::ReadSettings().

template<typename T >
std::string lar_content::MvaVertexSelectionAlgorithm< T >::m_filePathEnvironmentVariable
private

The environment variable providing a list of paths to mva files.

Definition at line 77 of file MvaVertexSelectionAlgorithm.h.

Referenced by lar_content::MvaVertexSelectionAlgorithm< T >::ReadSettings().

float lar_content::TrainedVertexSelectionAlgorithm::m_globalAsymmetryConstant
protectedinherited

The global asymmetry constant for the initial region score list.

Definition at line 468 of file TrainedVertexSelectionAlgorithm.h.

Referenced by lar_content::TrainedVertexSelectionAlgorithm::PopulateInitialScoreList(), and lar_content::TrainedVertexSelectionAlgorithm::ReadSettings().

pandora::StringVector lar_content::TrainedVertexSelectionAlgorithm::m_inputClusterListNames
protectedinherited
bool lar_content::TrainedVertexSelectionAlgorithm::m_legacyEventShapes
protectedinherited
float lar_content::TrainedVertexSelectionAlgorithm::m_localAsymmetryConstant
protectedinherited

The local asymmetry constant for the initial region score list.

Definition at line 467 of file TrainedVertexSelectionAlgorithm.h.

Referenced by lar_content::TrainedVertexSelectionAlgorithm::PopulateInitialScoreList(), and lar_content::TrainedVertexSelectionAlgorithm::ReadSettings().

float lar_content::TrainedVertexSelectionAlgorithm::m_maxTrueVertexRadius
protectedinherited

The maximum distance at which a vertex candidate can be considered the 'true' vertex.

Definition at line 477 of file TrainedVertexSelectionAlgorithm.h.

Referenced by lar_content::TrainedVertexSelectionAlgorithm::ProduceTrainingSets(), and lar_content::TrainedVertexSelectionAlgorithm::ReadSettings().

std::string lar_content::TrainedVertexSelectionAlgorithm::m_mcParticleListName
protectedinherited
float lar_content::TrainedVertexSelectionAlgorithm::m_mcVertexXCorrection
protectedinherited

The correction to the x-coordinate of the MC vertex position.

Definition at line 455 of file TrainedVertexSelectionAlgorithm.h.

Referenced by lar_content::TrainedVertexSelectionAlgorithm::GetBestVertex(), and lar_content::TrainedVertexSelectionAlgorithm::ReadSettings().

unsigned int lar_content::TrainedVertexSelectionAlgorithm::m_minClusterCaloHits
protectedinherited
unsigned int lar_content::TrainedVertexSelectionAlgorithm::m_minShowerClusterHits
protectedinherited
float lar_content::TrainedVertexSelectionAlgorithm::m_minShowerSpineLength
protectedinherited

The minimum length at which all are considered to be tracks.

Definition at line 464 of file TrainedVertexSelectionAlgorithm.h.

Referenced by lar_content::TrainedVertexSelectionAlgorithm::IsClusterShowerLike(), and lar_content::TrainedVertexSelectionAlgorithm::ReadSettings().

template<typename T >
std::string lar_content::MvaVertexSelectionAlgorithm< T >::m_mvaFileName
private

The mva file name.

Definition at line 78 of file MvaVertexSelectionAlgorithm.h.

Referenced by lar_content::MvaVertexSelectionAlgorithm< T >::ReadSettings().

template<typename T >
std::string lar_content::MvaVertexSelectionAlgorithm< T >::m_regionMvaName
private

The name of the region mva to find.

Definition at line 79 of file MvaVertexSelectionAlgorithm.h.

Referenced by lar_content::MvaVertexSelectionAlgorithm< T >::ReadSettings().

float lar_content::TrainedVertexSelectionAlgorithm::m_rPhiFineTuningRadius
protectedinherited
float lar_content::TrainedVertexSelectionAlgorithm::m_showerAsymmetryConstant
protectedinherited

The shower asymmetry constant for the initial region score list.

Definition at line 469 of file TrainedVertexSelectionAlgorithm.h.

Referenced by lar_content::TrainedVertexSelectionAlgorithm::PopulateInitialScoreList(), and lar_content::TrainedVertexSelectionAlgorithm::ReadSettings().

float lar_content::TrainedVertexSelectionAlgorithm::m_showerClusteringDistance
protectedinherited
unsigned int lar_content::TrainedVertexSelectionAlgorithm::m_slidingFitWindow
protectedinherited
bool lar_content::TrainedVertexSelectionAlgorithm::m_testBeamMode
protectedinherited
std::string lar_content::TrainedVertexSelectionAlgorithm::m_trainingOutputFileRegion
protectedinherited
std::string lar_content::TrainedVertexSelectionAlgorithm::m_trainingOutputFileVertex
protectedinherited
bool lar_content::TrainedVertexSelectionAlgorithm::m_trainingSetMode
protectedinherited
bool lar_content::TrainedVertexSelectionAlgorithm::m_useRPhiFeatureForRegion
protectedinherited
bool lar_content::TrainedVertexSelectionAlgorithm::m_useShowerClusteringApproximation
protectedinherited

Whether to use the shower clustering distance approximation.

Definition at line 474 of file TrainedVertexSelectionAlgorithm.h.

Referenced by lar_content::TrainedVertexSelectionAlgorithm::CalculateShowerClusterList(), and lar_content::TrainedVertexSelectionAlgorithm::ReadSettings().

template<typename T >
std::string lar_content::MvaVertexSelectionAlgorithm< T >::m_vertexMvaName
private

The name of the vertex mva to find.

Definition at line 80 of file MvaVertexSelectionAlgorithm.h.

Referenced by lar_content::MvaVertexSelectionAlgorithm< T >::ReadSettings().


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