Private Member Functions | List of all members
lar_content::CheatingVertexSelectionAlgorithm Class Reference

CheatingVertexSelectionAlgorithm class. More...

#include <CheatingVertexSelectionAlgorithm.h>

Inheritance diagram for lar_content::CheatingVertexSelectionAlgorithm:
lar_content::TrainedVertexSelectionAlgorithm lar_content::VertexSelectionBaseAlgorithm

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...
 
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 

Additional Inherited Members

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

Detailed Description

CheatingVertexSelectionAlgorithm class.

Definition at line 19 of file CheatingVertexSelectionAlgorithm.h.

Member Function Documentation

void lar_content::CheatingVertexSelectionAlgorithm::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 18 of file CheatingVertexSelectionAlgorithm.cc.

20 {
21  const Vertex *pBestVertex(nullptr);
22  float bestVertexDr(std::numeric_limits<float>::max());
23  this->GetBestVertex(vertexVector, pBestVertex, bestVertexDr);
24  if (pBestVertex)
25  vertexScoreList.emplace_back(pBestVertex, 1.0f);
26 }
static int max(int a, int b)
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.
StatusCode lar_content::CheatingVertexSelectionAlgorithm::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
private

Definition at line 30 of file CheatingVertexSelectionAlgorithm.cc.

31 {
32  // ATTN : Need access to base class member variables at this point, so call read settings prior to end of this function
33  PANDORA_RETURN_RESULT_IF(STATUS_CODE_SUCCESS, !=, TrainedVertexSelectionAlgorithm::ReadSettings(xmlHandle));
34 
35  if (m_mcParticleListName.empty())
36  {
37  std::cout << "CheatingVertexSelectionAlgorithm: MCParticleListName required for cheated vertex selection" << std::endl;
38  return STATUS_CODE_INVALID_PARAMETER;
39  }
40 
41  return STATUS_CODE_SUCCESS;
42 }
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
std::string m_mcParticleListName
The MC particle list for creating training examples.
QTextStream & endl(QTextStream &s)

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