All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | List of all members
lar_content::EnergyDepositionAsymmetryFeatureTool Class Reference

EnergyDepositionAsymmetryFeatureTool class. More...

#include <EnergyDepositionAsymmetryFeatureTool.h>

Inheritance diagram for lar_content::EnergyDepositionAsymmetryFeatureTool:
lar_content::GlobalAsymmetryFeatureTool lar_content::AsymmetryFeatureBaseTool lar_content::MvaFeatureTool< Ts >

Public Member Functions

 EnergyDepositionAsymmetryFeatureTool ()
 Default constructor. More...
 
- Public Member Functions inherited from lar_content::GlobalAsymmetryFeatureTool
 GlobalAsymmetryFeatureTool ()
 Default constructor. More...
 
- Public Member Functions inherited from lar_content::AsymmetryFeatureBaseTool
 AsymmetryFeatureBaseTool ()
 Default constructor. More...
 
void Run (LArMvaHelper::MvaFeatureVector &featureVector, const VertexSelectionBaseAlgorithm *const pAlgorithm, const pandora::Vertex *const pVertex, const VertexSelectionBaseAlgorithm::SlidingFitDataListMap &slidingFitDataListMap, const VertexSelectionBaseAlgorithm::ClusterListMap &, const VertexSelectionBaseAlgorithm::KDTreeMap &, const VertexSelectionBaseAlgorithm::ShowerClusterListMap &showerClusterListMap, const float, float &)
 Run the tool. More...
 
- Public Member Functions inherited from lar_content::MvaFeatureTool< Ts >
 MvaFeatureTool ()=default
 Default constructor. More...
 
virtual void Run (MvaTypes::MvaFeatureVector &featureVector, Ts...args)=0
 Run the algorithm tool. More...
 
virtual void Run (MvaTypes::MvaFeatureMap &featureMap, pandora::StringVector &featureOrder, const std::string &featureToolName, Ts...args)
 

Private Member Functions

pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle) override
 
float CalculateAsymmetry (const bool useEnergyMetrics, const pandora::CartesianVector &vertexPosition2D, const pandora::ClusterVector &clusterVector, const pandora::CartesianVector &localWeightedDirectionSum) const override
 Calculate the energy deposition asymmetry feature. More...
 

Additional Inherited Members

- Public Types inherited from lar_content::MvaFeatureTool< Ts >
typedef std::vector
< MvaFeatureTool< Ts...> * > 
FeatureToolVector
 
typedef std::map< std::string,
MvaFeatureTool< Ts...> * > 
FeatureToolMap
 
- Protected Member Functions inherited from lar_content::GlobalAsymmetryFeatureTool
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle) override
 
- Protected Member Functions inherited from lar_content::AsymmetryFeatureBaseTool
pandora::StatusCode ReadSettings (const pandora::TiXmlHandle xmlHandle)
 
void IncrementAsymmetryParameters (const float weight, const pandora::CartesianVector &clusterDirection, pandora::CartesianVector &localWeightedDirectionSum) const
 Increment the asymmetry parameters. More...
 
- Protected Attributes inherited from lar_content::AsymmetryFeatureBaseTool
float m_maxAsymmetryDistance
 The max distance between cluster (any hit) and vertex to calculate asymmetry score. More...
 

Detailed Description

EnergyDepositionAsymmetryFeatureTool class.

Definition at line 19 of file EnergyDepositionAsymmetryFeatureTool.h.

Constructor & Destructor Documentation

lar_content::EnergyDepositionAsymmetryFeatureTool::EnergyDepositionAsymmetryFeatureTool ( )

Default constructor.

Definition at line 19 of file EnergyDepositionAsymmetryFeatureTool.cc.

20 {
21 }

Member Function Documentation

float lar_content::EnergyDepositionAsymmetryFeatureTool::CalculateAsymmetry ( const bool  useEnergyMetrics,
const pandora::CartesianVector &  vertexPosition2D,
const pandora::ClusterVector &  clusterVector,
const pandora::CartesianVector &  localWeightedDirectionSum 
) const
overrideprivatevirtual

Calculate the energy deposition asymmetry feature.

Parameters
useEnergyMetricswhether to use energy-based metrics instead of hit-counting-based metrics
vertexPosition2Dthe vertex position in this view
slidingFitDataListthe list of sliding fit data objects
localWeightedDirectionSumthe local event axis
Returns
the energy deposition asymmetry feature

Reimplemented from lar_content::AsymmetryFeatureBaseTool.

Definition at line 25 of file EnergyDepositionAsymmetryFeatureTool.cc.

27 {
28  // Project every hit onto local event axis direction and record side of the projected vtx position on which it falls
29  float beforeVtxEnergy(0.f), afterVtxEnergy(0.f);
30  unsigned int beforeVtxHits(0), afterVtxHits(0);
31 
32  const CartesianVector localWeightedDirection(localWeightedDirectionSum.GetUnitVector());
33  const float evtProjectedVtxPos(vertexPosition2D.GetDotProduct(localWeightedDirection));
34 
35  float minBeforeProjectedPos(std::numeric_limits<float>::max());
36  float maxBeforeProjectedPos(-std::numeric_limits<float>::max());
37 
38  float minAfterProjectedPos(std::numeric_limits<float>::max());
39  float maxAfterProjectedPos(-std::numeric_limits<float>::max());
40 
41  for (const Cluster *const pCluster : clusterVector)
42  {
43  CaloHitList caloHitList;
44  pCluster->GetOrderedCaloHitList().FillCaloHitList(caloHitList);
45 
46  CaloHitVector caloHitVector(caloHitList.begin(), caloHitList.end());
47  std::sort(caloHitVector.begin(), caloHitVector.end(), LArClusterHelper::SortHitsByPosition);
48 
49  for (const CaloHit *const pCaloHit : caloHitVector)
50  {
51  if (pCaloHit->GetPositionVector().GetDotProduct(localWeightedDirection) < evtProjectedVtxPos)
52  {
53  minBeforeProjectedPos = std::min(minBeforeProjectedPos, pCaloHit->GetPositionVector().GetDotProduct(localWeightedDirection));
54  maxBeforeProjectedPos = std::max(maxBeforeProjectedPos, pCaloHit->GetPositionVector().GetDotProduct(localWeightedDirection));
55 
56  beforeVtxEnergy += pCaloHit->GetElectromagneticEnergy();
57  ++beforeVtxHits;
58  }
59 
60  else
61  {
62  minAfterProjectedPos = std::min(minAfterProjectedPos, pCaloHit->GetPositionVector().GetDotProduct(localWeightedDirection));
63  maxAfterProjectedPos = std::max(maxAfterProjectedPos, pCaloHit->GetPositionVector().GetDotProduct(localWeightedDirection));
64 
65  afterVtxEnergy += pCaloHit->GetElectromagneticEnergy();
66  ++afterVtxHits;
67  }
68  }
69  }
70 
71  // Use energy metrics if possible, otherwise fall back on hit counting.
72  const unsigned int totalHits(beforeVtxHits + afterVtxHits);
73 
74  const float beforeLength(std::fabs(maxBeforeProjectedPos - minBeforeProjectedPos));
75  const float afterLength(std::fabs(maxAfterProjectedPos - minAfterProjectedPos));
76 
77  const float beforeVtxEnergyDeposition(beforeLength < std::numeric_limits<float>::epsilon() ? 0 : beforeVtxEnergy / beforeLength);
78 
79  const float afterVtxEnergyDeposition(afterLength < std::numeric_limits<float>::epsilon() ? 0 : afterVtxEnergy / afterLength);
80 
81  const float totalEnergyDeposition(beforeVtxEnergyDeposition + afterVtxEnergyDeposition);
82 
83  if (useEnergyMetrics && totalEnergyDeposition > std::numeric_limits<float>::epsilon())
84  return std::fabs((afterVtxEnergyDeposition - beforeVtxEnergyDeposition)) / totalEnergyDeposition;
85 
86  if (0 == totalHits)
87  throw StatusCodeException(STATUS_CODE_FAILURE);
88 
89  const float beforeVtxHitDeposition(beforeLength < std::numeric_limits<float>::epsilon() ? 0 : beforeVtxHits / beforeLength);
90 
91  const float afterVtxHitDeposition(afterLength < std::numeric_limits<float>::epsilon() ? 0 : afterVtxHits / afterLength);
92 
93  const float totalHitDeposition(beforeVtxHitDeposition + afterVtxHitDeposition);
94 
95  if (totalHitDeposition > std::numeric_limits<float>::epsilon())
96  return std::fabs((afterVtxHitDeposition - beforeVtxHitDeposition)) / totalHitDeposition;
97 
98  return 0.f;
99 }
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)
StatusCode lar_content::EnergyDepositionAsymmetryFeatureTool::ReadSettings ( const pandora::TiXmlHandle  xmlHandle)
overrideprivate

Definition at line 103 of file EnergyDepositionAsymmetryFeatureTool.cc.

104 {
106 }
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle) override

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