LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
VertexBasedPfoMopUpAlgorithm.h
Go to the documentation of this file.
1 
8 #ifndef LAR_VERTEX_BASED_PFO_MOP_UP_ALGORITHM_H
9 #define LAR_VERTEX_BASED_PFO_MOP_UP_ALGORITHM_H 1
10 
12 
13 #include <unordered_map>
14 
15 namespace lar_content
16 {
17 
22 {
23 public:
28 
29 protected:
34  {
35  public:
40 
49  ClusterAssociation(const pandora::Cluster *const pVertexCluster, const pandora::Cluster *const pDaughterCluster,
50  const float boundedFraction, const bool isConsistentDirection);
51 
57  const pandora::Cluster *GetVertexCluster() const;
58 
64  const pandora::Cluster *GetDaughterCluster() const;
65 
71  float GetBoundedFraction() const;
72 
78  bool IsConsistentDirection() const;
79 
80  private:
81  const pandora::Cluster *m_pVertexCluster;
82  const pandora::Cluster *m_pDaughterCluster;
85  };
86 
91  {
92  public:
102  PfoAssociation(const pandora::Pfo *const pVertexPfo, const pandora::Pfo *const pDaughterPfo, const ClusterAssociation &clusterAssociationU,
103  const ClusterAssociation &clusterAssociationV, const ClusterAssociation &clusterAssociationW);
104 
110  const pandora::Pfo *GetVertexPfo() const;
111 
117  const pandora::Pfo *GetDaughterPfo() const;
118 
124  float GetMeanBoundedFraction() const;
125 
131  float GetMaxBoundedFraction() const;
132 
138  float GetMinBoundedFraction() const;
139 
145  unsigned int GetNConsistentDirections() const;
146 
152  const ClusterAssociation &GetClusterAssociationU() const;
153 
159  const ClusterAssociation &GetClusterAssociationV() const;
160 
166  const ClusterAssociation &GetClusterAssociationW() const;
167 
175  bool operator<(const PfoAssociation &rhs) const;
176 
177  private:
178  const pandora::Pfo *m_pVertexPfo;
179  const pandora::Pfo *m_pDaughterPfo;
180 
184  };
185 
186  typedef std::vector<PfoAssociation> PfoAssociationList;
187 
192  {
193  public:
202  ConeParameters(const pandora::Cluster *const pCluster, const pandora::CartesianVector &vertexPosition2D,
203  const float coneAngleCentile, const float maxConeCosHalfAngle);
204 
213  float GetBoundedFraction(const pandora::Cluster *const pDaughterCluster, const float coneLengthMultiplier) const;
214 
215  private:
221  pandora::CartesianVector GetDirectionEstimate() const;
222 
228  float GetSignedConeLength() const;
229 
237  float GetCosHalfAngleEstimate(const float coneAngleCentile) const;
238 
239  const pandora::Cluster *m_pCluster;
240  pandora::CartesianVector m_apex;
241  pandora::CartesianVector m_direction;
242  float m_coneLength;
244  };
245 
246  pandora::StatusCode Run();
247 
256  virtual bool IsVertexAssociated(const pandora::CartesianVector &vertex2D, const LArPointingCluster &pointingCluster) const;
257 
258  typedef std::map<pandora::HitType, ClusterAssociation> HitTypeToAssociationMap;
259 
269  virtual PfoAssociation GetPfoAssociation(const pandora::Pfo *const pVertexPfo, const pandora::Pfo *const pDaughterPfo,
270  HitTypeToAssociationMap &hitTypeToAssociationMap) const;
271 
279  void GetInputPfos(const pandora::Vertex *const pVertex, pandora::PfoList &vertexPfos, pandora::PfoList &nonVertexPfos) const;
280 
289  bool IsVertexAssociated(const pandora::Pfo *const pPfo, const pandora::Vertex *const pVertex) const;
290 
299  void GetPfoAssociations(const pandora::Vertex *const pVertex, const pandora::PfoList &vertexPfos, const pandora::PfoList &nonVertexPfos,
300  PfoAssociationList &pfoAssociationList) const;
301 
312  const pandora::Vertex *const pVertex, const pandora::Pfo *const pVertexPfo, const pandora::Pfo *const pDaughterPfo) const;
313 
323  ClusterAssociation GetClusterAssociation(const pandora::Vertex *const pVertex, const pandora::Cluster *const pVertexCluster,
324  const pandora::Cluster *const pDaughterCluster) const;
325 
333  bool ProcessPfoAssociations(const PfoAssociationList &pfoAssociationList) const;
334 
340  void MergePfos(const PfoAssociation &pfoAssociation) const;
341 
342  pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle);
343 
344  typedef std::set<pandora::HitType> HitTypeSet;
345  typedef std::map<pandora::HitType, const pandora::Cluster *> HitTypeToClusterMap;
346 
347  std::string m_trackPfoListName;
348  std::string m_showerPfoListName;
349 
353 
357 
360 
364 
367 };
368 
369 //------------------------------------------------------------------------------------------------------------------------------------------
370 
372 {
373  return m_pVertexCluster;
374 }
375 
376 //------------------------------------------------------------------------------------------------------------------------------------------
377 
379 {
380  return m_pDaughterCluster;
381 }
382 
383 //------------------------------------------------------------------------------------------------------------------------------------------
384 
386 {
387  return m_boundedFraction;
388 }
389 
390 //------------------------------------------------------------------------------------------------------------------------------------------
391 
393 {
395 }
396 
397 //------------------------------------------------------------------------------------------------------------------------------------------
398 //------------------------------------------------------------------------------------------------------------------------------------------
399 
401 {
402  return m_pVertexPfo;
403 }
404 
405 //------------------------------------------------------------------------------------------------------------------------------------------
406 
408 {
409  return m_pDaughterPfo;
410 }
411 
412 //------------------------------------------------------------------------------------------------------------------------------------------
413 
415 {
416  return m_clusterAssociationU;
417 }
418 
419 //------------------------------------------------------------------------------------------------------------------------------------------
420 
422 {
423  return m_clusterAssociationV;
424 }
425 
426 //------------------------------------------------------------------------------------------------------------------------------------------
427 
429 {
430  return m_clusterAssociationW;
431 }
432 
433 } // namespace lar_content
434 
435 #endif // #ifndef LAR_VERTEX_BASED_PFO_MOP_UP_ALGORITHM_H
pandora::StatusCode ReadSettings(const pandora::TiXmlHandle xmlHandle)
void GetPfoAssociations(const pandora::Vertex *const pVertex, const pandora::PfoList &vertexPfos, const pandora::PfoList &nonVertexPfos, PfoAssociationList &pfoAssociationList) const
Get the list of associations between vertex-associated pfos and non-vertex-associated pfos...
unsigned int m_minVertexAssociatedHitTypes
The min number of vertex associated hit types for a vertex associated pfo.
float m_maxConeLengthMultiplier
Consider hits as bound if inside cone, with projected distance less than N times cone length...
ClusterAssociation GetClusterAssociation(const pandora::Vertex *const pVertex, const pandora::Cluster *const pVertexCluster, const pandora::Cluster *const pDaughterCluster) const
Get cluster association details between a vertex-associated cluster and a non-vertex associated daugh...
bool IsConsistentDirection() const
Whether the vertex and daughter clusters have consistent directions.
const pandora::Cluster * m_pDaughterCluster
The address of the daughter cluster.
constexpr bool operator<(CryostatID const &a, CryostatID const &b)
Order cryostats with increasing ID.
Definition: geo_types.h:692
float m_coneAngleCentile
Cluster cone angle is defined using specified centile of distribution of hit half angles...
unsigned int m_minConsistentDirections
The minimum number of consistent cluster directions to allow a pfo merge.
const pandora::Cluster * GetVertexCluster() const
Get the address of the vertex cluster.
void MergePfos(const PfoAssociation &pfoAssociation) const
Merge the vertex and daughter pfos (deleting daughter pfo, merging clusters, etc.) described in the s...
LArPointingCluster class.
bool m_isConsistentDirection
Whether the vertex and daughter clusters have consistent directions.
float m_maxVertexTransverseDistance
Vertex association check: max transverse distance cut.
float m_minVertexLongitudinalDistance
Vertex association check: min longitudinal distance cut.
float m_maxBoundedFractionCut
Cut on association info (max bounded fraction) for determining pfo merges.
bool ProcessPfoAssociations(const PfoAssociationList &pfoAssociationList) const
Process the list of pfo associations, merging the best-matching pfo.
float GetBoundedFraction() const
Get the fraction of daughter hits bounded by the cone defined by the vertex cluster.
const pandora::Cluster * GetDaughterCluster() const
Get the address of the daughter cluster.
std::map< pandora::HitType, ClusterAssociation > HitTypeToAssociationMap
float m_directionApexShift
Direction determination, look for vertex inside triangle with apex shifted along the cluster length...
float m_meanBoundedFractionCut
Cut on association info (mean bounded fraction) for determining pfo merges.
virtual PfoAssociation GetPfoAssociation(const pandora::Pfo *const pVertexPfo, const pandora::Pfo *const pDaughterPfo, HitTypeToAssociationMap &hitTypeToAssociationMap) const
Get pfo association details between a vertex-associated pfo and a non-vertex associated daughter cand...
PfoMopUpBaseAlgorithm class.
float m_boundedFraction
The fraction of daughter hits bounded by the cone defined by the vertex cluster.
const ClusterAssociation & GetClusterAssociationW() const
Get the cluster association in the w view.
const pandora::Pfo * m_pDaughterPfo
The address of the non-vertex-associated candidate daughter pfo.
float m_directionTanAngle
Direction determination, look for vertex inside triangle with apex shifted along the cluster length...
ClusterAssociation m_clusterAssociationV
The cluster association in the v view.
void GetInputPfos(const pandora::Vertex *const pVertex, pandora::PfoList &vertexPfos, pandora::PfoList &nonVertexPfos) const
Get the list of input pfos and divide them into vertex-associated and non-vertex-associated lists...
virtual bool IsVertexAssociated(const pandora::CartesianVector &vertex2D, const LArPointingCluster &pointingCluster) const
Whether a specified pfo is associated with a specified vertex.
unsigned int m_minConsistentDirectionsTrack
The minimum number of consistent cluster directions to allow a merge involving a track pfo...
ClusterAssociation m_clusterAssociationW
The cluster association in the w view.
float m_maxConeCosHalfAngle
Maximum value for cosine of cone half angle.
const pandora::Pfo * GetDaughterPfo() const
Get the address of the non-vertex-associated candidate daughter pfo.
ClusterAssociation m_clusterAssociationU
The cluster association in the u view.
Header file for the pfo mop up algorithm base class.
const ClusterAssociation & GetClusterAssociationU() const
Get the cluster association in the u view.
std::string m_trackPfoListName
The input track pfo list name.
const pandora::Pfo * GetVertexPfo() const
Get the address of the vertex-associated pfo.
boost::graph_traits< ModuleGraph >::vertex_descriptor Vertex
Definition: ModuleGraph.h:25
const ClusterAssociation & GetClusterAssociationV() const
Get the cluster association in the v view.
const pandora::Cluster * m_pVertexCluster
The address of the vertex cluster.
const pandora::Pfo * m_pVertexPfo
The address of the vertex-associated pfo.
std::map< pandora::HitType, const pandora::Cluster * > HitTypeToClusterMap
std::string m_showerPfoListName
The input shower pfo list name.
float m_minBoundedFractionCut
Cut on association info (min bounded fraction) for determining pfo merges.