LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ShowerAsymmetryFeatureTool.cc
Go to the documentation of this file.
1 
10 #include "Pandora/AlgorithmHeaders.h"
13 
14 using namespace pandora;
15 
16 namespace lar_content
17 {
18 
19 ShowerAsymmetryFeatureTool::ShowerAsymmetryFeatureTool() :
21  m_vertexClusterDistance(4.f)
22 {
23 }
24 
25 //------------------------------------------------------------------------------------------------------------------------------------------
26 
27 float ShowerAsymmetryFeatureTool::GetAsymmetryForView(const CartesianVector &vertexPosition2D,
29 {
30  float showerAsymmetry(1.f);
31 
32  for (const VertexSelectionBaseAlgorithm::ShowerCluster &showerCluster : showerClusterList)
33  {
34  if (this->ShouldUseShowerCluster(vertexPosition2D, showerCluster))
35  {
36  const TwoDSlidingFitResult &showerFit = showerCluster.GetFit();
37 
38  float rL(0.f), rT(0.f);
39  showerFit.GetLocalPosition(vertexPosition2D, rL, rT);
40 
41  CartesianVector showerDirection(0.f, 0.f, 0.f);
42  if (STATUS_CODE_SUCCESS != showerFit.GetGlobalFitDirection(rL, showerDirection))
43  continue;
44 
45  ClusterVector asymmetryClusters;
46  std::copy(showerCluster.GetClusters().begin(), showerCluster.GetClusters().end(), std::back_inserter(asymmetryClusters));
47 
48  showerAsymmetry = this->CalculateAsymmetry(true, vertexPosition2D, asymmetryClusters, showerDirection);
49 
50  break;
51  }
52  }
53 
54  return showerAsymmetry;
55 }
56 
57 //------------------------------------------------------------------------------------------------------------------------------------------
58 
60  const CartesianVector &vertexPosition, const VertexSelectionBaseAlgorithm::ShowerCluster &showerCluster) const
61 {
62  for (const Cluster *const pCluster : showerCluster.GetClusters())
63  {
64  if (LArClusterHelper::GetClosestDistance(vertexPosition, pCluster) < m_vertexClusterDistance)
65  return true;
66  }
67 
68  return false;
69 }
70 
71 //------------------------------------------------------------------------------------------------------------------------------------------
72 //------------------------------------------------------------------------------------------------------------------------------------------
73 
74 StatusCode ShowerAsymmetryFeatureTool::ReadSettings(const TiXmlHandle xmlHandle)
75 {
76  PANDORA_RETURN_RESULT_IF_AND_IF(
77  STATUS_CODE_SUCCESS, STATUS_CODE_NOT_FOUND, !=, XmlHelper::ReadValue(xmlHandle, "VertexClusterDistance", m_vertexClusterDistance));
78 
80 }
81 
82 } // namespace lar_content
virtual float CalculateAsymmetry(const bool useEnergyMetrics, const pandora::CartesianVector &vertexPosition2D, const pandora::ClusterVector &asymmetryClusters, const pandora::CartesianVector &localWeightedDirectionSum) const
Calculate the asymmetry feature.
const pandora::ClusterList & GetClusters() const
Get the cluster list.
TFile f
Definition: plotHisto.C:6
Header file for the geometry helper class.
float m_vertexClusterDistance
The distance around the vertex to look for shower clusters.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle) override
Header file for the cluster helper class.
AsymmetryFeatureBaseTool class.
pandora::StatusCode GetGlobalFitDirection(const float rL, pandora::CartesianVector &direction) const
Get global fit direction for a given longitudinal coordinate.
float GetAsymmetryForView(const pandora::CartesianVector &vertexPosition2D, const VertexSelectionBaseAlgorithm::SlidingFitDataList &, const VertexSelectionBaseAlgorithm::ShowerClusterList &showerClusterList) const override
Get the shower asymmetry feature for a given view.
Header file for the shower asymmetry feature tool class.
std::vector< art::Ptr< recob::Cluster > > ClusterVector
bool ShouldUseShowerCluster(const pandora::CartesianVector &vertexPosition, const VertexSelectionBaseAlgorithm::ShowerCluster &showerCluster) const
Get whether we should use a given shower cluster for asymmetry calculation.
void GetLocalPosition(const pandora::CartesianVector &position, float &rL, float &rT) const
Get local sliding fit coordinates for a given global position.
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
static float GetClosestDistance(const pandora::ClusterList &clusterList1, const pandora::ClusterList &clusterList2)
Get closest distance between clusters in a pair of cluster lists.