49 this->GetClusterLists(m_inputClusterListNames, clustersU, clustersV, clustersW);
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);
57 this->CalculateShowerClusterList(clustersU, showerClusterListU);
58 this->CalculateShowerClusterList(clustersV, showerClusterListV);
59 this->CalculateShowerClusterList(clustersW, showerClusterListW);
72 EventFeatureInfo eventFeatureInfo(this->CalculateEventFeatures(clustersU, clustersV, clustersW, vertexVector));
75 this->AddEventFeaturesToVector(eventFeatureInfo, eventFeatureList);
78 for (
const Vertex *
const pVertex : vertexVector)
80 this->PopulateVertexFeatureInfoMap(
81 beamConstants, clusterListMap, slidingFitDataListMap, showerClusterListMap, kdTreeMap, pVertex, vertexFeatureInfoMap);
86 for (
const Vertex *
const pVertex : vertexVector)
87 PopulateInitialScoreList(vertexFeatureInfoMap, pVertex, initialScoreList);
90 this->GetBestRegionVertices(initialScoreList, bestRegionVertices);
92 if (m_trainingSetMode)
93 this->ProduceTrainingSets(vertexVector, bestRegionVertices, vertexFeatureInfoMap, eventFeatureList, kdTreeMap);
95 if ((!m_trainingSetMode || m_allowClassifyDuringTraining) && !bestRegionVertices.empty())
98 const Vertex *
const pBestRegionVertex(
99 this->CompareVertices(bestRegionVertices, vertexFeatureInfoMap, eventFeatureList, kdTreeMap, m_mvaRegion, m_useRPhiFeatureForRegion));
103 for (
const Vertex *
const pVertex : vertexVector)
105 if (pVertex == pBestRegionVertex)
108 if ((pBestRegionVertex->
GetPosition() - pVertex->GetPosition()).GetMagnitude() < m_regionRadius)
109 regionalVertices.push_back(pVertex);
112 this->CalculateRPhiScores(regionalVertices, vertexFeatureInfoMap, kdTreeMap);
114 if (!regionalVertices.empty())
117 const Vertex *
const pBestVertex(
118 this->CompareVertices(regionalVertices, vertexFeatureInfoMap, eventFeatureList, kdTreeMap, m_mvaVertex,
true));
119 this->PopulateFinalVertexScoreList(vertexFeatureInfoMap, pBestVertex, vertexVector, vertexScoreList);
130 const Vertex *pBestVertex(vertexVector.front());
134 this->AddVertexFeaturesToVector(chosenVertexFeatureInfo, chosenFeatureList, useRPhi);
136 for (
const Vertex *
const pVertex : vertexVector)
138 if (pVertex == pBestVertex)
143 this->AddVertexFeaturesToVector(vertexFeatureInfo, featureList, useRPhi);
145 if (!m_legacyVariables)
148 float separation(0.f), axisHits(0.f);
149 this->GetSharedFeatures(pVertex, pBestVertex, kdTreeMap, separation, axisHits);
151 this->AddSharedFeaturesToVector(sharedFeatureInfo, sharedFeatureList);
155 pBestVertex = pVertex;
156 chosenFeatureList = featureList;
163 pBestVertex = pVertex;
164 chosenFeatureList = featureList;
189 if ((!m_trainingSetMode || m_allowClassifyDuringTraining))
191 if (m_mvaFileName.empty() || m_regionMvaName.empty() || m_vertexMvaName.empty())
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;
199 m_mvaRegion.Initialize(fullMvaFileName, m_regionMvaName);
200 m_mvaVertex.Initialize(fullMvaFileName, m_vertexMvaName);
203 return STATUS_CODE_SUCCESS;
Header file for the lar monte carlo particle helper helper class.
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...
MvaTypes::MvaFeatureVector MvaFeatureVector
static MvaFeatureVector ConcatenateFeatureLists()
Recursively concatenate vectors of features (terminating method)
static bool Classify(const MvaInterface &classifier, TCONTAINER &&featureContainer)
Use the trained classifier to predict the boolean class of an example.
void GetVertexScoreList(const pandora::VertexVector &vertexVector, const BeamConstants &beamConstants, HitKDTree2D &kdTreeU, HitKDTree2D &kdTreeV, HitKDTree2D &kdTreeW, VertexScoreList &vertexScoreList) const
Get the vertex score list.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
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.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
std::map< const pandora::Vertex *const, VertexFeatureInfo > VertexFeatureInfoMap
std::map< pandora::HitType, const SlidingFitDataList > SlidingFitDataListMap
Map of sliding fit data lists for passing to tools.
std::map< pandora::HitType, const pandora::ClusterList & > ClusterListMap
Map array of cluster lists for passing to tools.
std::map< pandora::HitType, const std::reference_wrapper< HitKDTree2D > > KDTreeMap
Map array of hit kd trees for passing to tools.
std::map< pandora::HitType, const ShowerClusterList > ShowerClusterListMap
Map of shower cluster lists for passing to tools.