LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
lar_content::LArEventTopology Class Reference

LArEventTopology class. More...

#include "LArEventTopology.h"

Classes

class  Particle
 

Public Member Functions

 LArEventTopology (const pandora::CaloHitList &caloHitList2D)
 Constructor. More...
 
virtual ~LArEventTopology ()
 Destructor. More...
 
void ConstructVisibleHierarchy ()
 Construct a particle hierarchy based on the key topological features in an event. More...
 
void GetVertices (pandora::CartesianPointVector &vertices) const
 Extract the clear topological vertices from the event. More...
 
void PruneHierarchy ()
 Fold or remove particles that aren't substantive parts of the hierarchy. More...
 
void Print () const
 Print the visible hierarchy. More...
 

Private Types

typedef std::map< const pandora::MCParticle *, pandora::CaloHitList > MCHitMap
 

Private Member Functions

void ConstructVisibleHierarchy (Particle *pParticle, const pandora::MCParticle *const pRootMC)
 Construct a particle hierarhcy based on the key topological features in an event. More...
 

Private Attributes

MCHitMap m_mcHitMap
 
const pandora::MCParticle * m_pRoot
 
Particlem_pParticle
 

Detailed Description

LArEventTopology class.

Definition at line 21 of file LArEventTopology.h.

Member Typedef Documentation

typedef std::map<const pandora::MCParticle *, pandora::CaloHitList> lar_content::LArEventTopology::MCHitMap
private

Definition at line 24 of file LArEventTopology.h.

Constructor & Destructor Documentation

lar_content::LArEventTopology::LArEventTopology ( const pandora::CaloHitList &  caloHitList2D)

Constructor.

Parameters
caloHitList2DThe collection of all hits across all views

Definition at line 23 of file LArEventTopology.cc.

References lar_content::LArMCParticleHelper::IsNeutrino(), m_mcHitMap, m_pParticle, and m_pRoot.

23  :
24  m_pRoot{nullptr},
25  m_pParticle{nullptr}
26 {
27  for (const CaloHit *const pCaloHit : caloHitList2D)
28  {
29  try
30  {
31  const MCParticle *pMCParticle{MCParticleHelper::GetMainMCParticle(pCaloHit)};
32  m_mcHitMap[pMCParticle].emplace_back(pCaloHit);
34  {
35  const MCParticle *pRoot{pMCParticle};
36  while (!pRoot->GetParentList().empty())
37  pRoot = pRoot->GetParentList().front();
38  m_pRoot = pRoot;
39  }
40  }
41  catch (const StatusCodeException &)
42  {
43  }
44  }
45 }
const pandora::MCParticle * m_pRoot
static bool IsNeutrino(const pandora::MCParticle *const pMCParticle)
Whether a mc particle is a neutrino or antineutrino.
lar_content::LArEventTopology::~LArEventTopology ( )
virtual

Destructor.

Definition at line 49 of file LArEventTopology.cc.

References m_pParticle.

50 {
51  delete m_pParticle;
52 }

Member Function Documentation

void lar_content::LArEventTopology::ConstructVisibleHierarchy ( )

Construct a particle hierarchy based on the key topological features in an event.

Definition at line 56 of file LArEventTopology.cc.

References m_pParticle, and m_pRoot.

Referenced by lar_content::VertexMonitoringAlgorithm::AssessSecondaryVertices(), lar_dl_content::DlSecondaryVertexingAlgorithm::PrepareTrainingSample(), Print(), and lar_content::CheatingSecondaryVertexAlgorithm::Run().

57 {
58  m_pParticle = new Particle(m_pRoot);
60 }
void ConstructVisibleHierarchy()
Construct a particle hierarchy based on the key topological features in an event. ...
const pandora::MCParticle * m_pRoot
void lar_content::LArEventTopology::ConstructVisibleHierarchy ( Particle pParticle,
const pandora::MCParticle *const  pRootMC 
)
private

Construct a particle hierarhcy based on the key topological features in an event.

Parameters
pParticleThe parent particle relative to which the hierarchy should be constructed
pRootMCThe underlying MC particle associated with the parent particle
void lar_content::LArEventTopology::GetVertices ( pandora::CartesianPointVector &  vertices) const

Extract the clear topological vertices from the event.

Definition at line 64 of file LArEventTopology.cc.

References lar_content::LArEventTopology::Particle::GetVertices(), and m_pParticle.

Referenced by lar_content::VertexMonitoringAlgorithm::AssessSecondaryVertices(), lar_dl_content::DlSecondaryVertexingAlgorithm::PrepareTrainingSample(), and lar_content::CheatingSecondaryVertexAlgorithm::Run().

65 {
66  m_pParticle->GetVertices(vertices);
67 
68  CartesianPointVector forRemoval;
69  for (auto iter1 = vertices.begin(); iter1 != vertices.end(); ++iter1)
70  {
71  const CartesianVector &vertex1{*iter1};
72  if (std::find(forRemoval.begin(), forRemoval.end(), vertex1) != forRemoval.end())
73  continue;
74  for (auto iter2 = std::next(iter1); iter2 != vertices.end(); ++iter2)
75  {
76  const CartesianVector &vertex2{*iter2};
77  if (std::find(forRemoval.begin(), forRemoval.end(), vertex2) != forRemoval.end())
78  continue;
79  if (vertex1.GetDistanceSquared(vertex2) < 1)
80  forRemoval.emplace_back(vertex2);
81  }
82  }
83 
84  for (auto iter = vertices.begin(); iter != vertices.end();)
85  {
86  if (std::find(forRemoval.begin(), forRemoval.end(), *iter) != forRemoval.end())
87  iter = vertices.erase(iter);
88  else
89  ++iter;
90  }
91 }
void GetVertices(pandora::CartesianPointVector &vertices) const
Extract the clear topological vertices from the event.
void lar_content::LArEventTopology::Print ( ) const

Print the visible hierarchy.

Definition at line 95 of file LArEventTopology.cc.

References lar_content::LArEventTopology::Particle::AddChild(), ConstructVisibleHierarchy(), m_mcHitMap, m_pParticle, m_pRoot, lar_content::LArEventTopology::Particle::Print(), and util::to_string().

96 {
97  std::string str{"Neutrino hierarchy: " + std::to_string(m_pRoot->GetParticleId()) + " E: " + std::to_string(m_pRoot->GetEnergy()) +
98  " GeV\n" + m_pParticle->Print(m_mcHitMap, " ")};
99  std::cout << str << std::endl;
100 }
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
const pandora::MCParticle * m_pRoot
const std::string Print(const MCHitMap &mcHitMap, const std::string &indent) const
Print the visible hierarchy.
void lar_content::LArEventTopology::PruneHierarchy ( )

Fold or remove particles that aren't substantive parts of the hierarchy.

Definition at line 123 of file LArEventTopology.cc.

References m_mcHitMap, m_pParticle, lar_content::LArEventTopology::Particle::Parse(), lar_content::LArEventTopology::Particle::Particle(), and lar_content::LArEventTopology::Particle::Prune().

Referenced by lar_dl_content::DlSecondaryVertexingAlgorithm::PrepareTrainingSample(), and lar_content::CheatingSecondaryVertexAlgorithm::Run().

124 {
126  m_pParticle->Prune();
127 }
void Parse(const MCHitMap &mcHitMap)
Assess this child particle and its descendents to see if it is topologically significant either indep...
void Prune()
Prune particles from the hierarchy if they are not deemed topologically significant.

Member Data Documentation

MCHitMap lar_content::LArEventTopology::m_mcHitMap
private

Definition at line 131 of file LArEventTopology.h.

Referenced by LArEventTopology(), Print(), and PruneHierarchy().

Particle* lar_content::LArEventTopology::m_pParticle
private
const pandora::MCParticle* lar_content::LArEventTopology::m_pRoot
private

Definition at line 132 of file LArEventTopology.h.

Referenced by ConstructVisibleHierarchy(), LArEventTopology(), and Print().


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