Pandora
Pandora source code navigator
Loading...
Searching...
No Matches
GlobalAsymmetryFeatureTool.cc
Go to the documentation of this file.
1
13
14using namespace pandora;
15
16namespace lar_content
17{
18
22
23//------------------------------------------------------------------------------------------------------------------------------------------
24
27{
28 bool useEnergy(true);
29 CartesianVector energyWeightedDirectionSum(0.f, 0.f, 0.f), hitWeightedDirectionSum(0.f, 0.f, 0.f);
30 ClusterVector asymmetryClusters;
31
32 for (const VertexSelectionBaseAlgorithm::SlidingFitData &slidingFitData : slidingFitDataList)
33 {
34 const Cluster *const pCluster(slidingFitData.GetCluster());
35
36 asymmetryClusters.push_back(pCluster);
37
38 if (pCluster->GetElectromagneticEnergy() < std::numeric_limits<float>::epsilon())
39 useEnergy = false;
40
41 const CartesianVector vertexToMinLayer(slidingFitData.GetMinLayerPosition() - vertexPosition2D);
42 const CartesianVector vertexToMaxLayer(slidingFitData.GetMaxLayerPosition() - vertexPosition2D);
43
44 const bool minLayerClosest(vertexToMinLayer.GetMagnitudeSquared() < vertexToMaxLayer.GetMagnitudeSquared());
45 const CartesianVector &clusterDirection((minLayerClosest) ? slidingFitData.GetMinLayerDirection() : slidingFitData.GetMaxLayerDirection());
46
47 if ((LArClusterHelper::GetClosestDistance(vertexPosition2D, pCluster) < m_maxAsymmetryDistance))
48 {
49 this->IncrementAsymmetryParameters(pCluster->GetElectromagneticEnergy(), clusterDirection, energyWeightedDirectionSum);
50 this->IncrementAsymmetryParameters(static_cast<float>(pCluster->GetNCaloHits()), clusterDirection, hitWeightedDirectionSum);
51 }
52 }
53
54 const CartesianVector &localWeightedDirectionSum(useEnergy ? energyWeightedDirectionSum : hitWeightedDirectionSum);
55
56 if (localWeightedDirectionSum.GetMagnitudeSquared() < std::numeric_limits<float>::epsilon())
57 return 0.f;
58
59 return this->CalculateAsymmetry(useEnergy, vertexPosition2D, asymmetryClusters, localWeightedDirectionSum);
60}
61
66
67} // namespace lar_content
Grouping of header files for many classes of use in particle flow algorithms.
Header file for the global asymmetry feature tool class.
Header file for the cluster helper class.
Header file for the geometry helper class.
void IncrementAsymmetryParameters(const float weight, const pandora::CartesianVector &clusterDirection, pandora::CartesianVector &localWeightedDirectionSum) const
Increment the asymmetry parameters.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
Read the algorithm settings.
float m_maxAsymmetryDistance
The max distance between cluster (any hit) and vertex to calculate asymmetry score.
virtual float CalculateAsymmetry(const bool useEnergyMetrics, const pandora::CartesianVector &vertexPosition2D, const pandora::ClusterVector &asymmetryClusters, const pandora::CartesianVector &localWeightedDirectionSum) const
Calculate the asymmetry feature.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle) override
Read the algorithm settings.
float GetAsymmetryForView(const pandora::CartesianVector &vertexPosition2D, const VertexSelectionBaseAlgorithm::SlidingFitDataList &slidingFitDataList, const VertexSelectionBaseAlgorithm::ShowerClusterList &) const override
Get the global asymmetry feature for a given view.
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.
CartesianVector class.
float GetMagnitudeSquared() const
Get the magnitude squared.
Cluster class.
Definition Cluster.h:31
unsigned int GetNCaloHits() const
Get the number of calo hits in the cluster.
Definition Cluster.h:484
float GetElectromagneticEnergy() const
Get the sum of electromagnetic energy measures of all constituent calo hits, units GeV.
Definition Cluster.h:519
std::vector< const Cluster * > ClusterVector
StatusCode
The StatusCode enum.