LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
sim::ParticleAncestryMap Class Reference

#include "ParticleAncestryMap.h"

Public Member Functions

 ParticleAncestryMap ()
 
 ParticleAncestryMap (const std::map< int, std::set< int >> &particleMap)
 
void SetMap (const std::map< int, std::set< int >> &map)
 
std::map< int, std::set< int > > const & GetMap () const
 
bool HasDroppedDescendants (const int trackid) const
 
std::set< int > const & GetAllDroppedDescendants (const int trackid) const
 
int GetAncestor (const int trackid) const
 
bool Exists (const int trackid) const
 

Private Attributes

std::map< int, std::set< int > > fParticleMap
 

Detailed Description

Definition at line 20 of file ParticleAncestryMap.h.

Constructor & Destructor Documentation

sim::ParticleAncestryMap::ParticleAncestryMap ( )
inline

Definition at line 26 of file ParticleAncestryMap.h.

26 {}
sim::ParticleAncestryMap::ParticleAncestryMap ( const std::map< int, std::set< int >> &  particleMap)
inline

Definition at line 29 of file ParticleAncestryMap.h.

References Exists(), GetAllDroppedDescendants(), GetAncestor(), GetMap(), HasDroppedDescendants(), and SetMap().

29  : fParticleMap(particleMap)
30  {}
std::map< int, std::set< int > > fParticleMap

Member Function Documentation

bool ParticleAncestryMap::Exists ( const int  trackid) const

Definition at line 39 of file ParticleAncestryMap.cxx.

Referenced by ParticleAncestryMap().

40  {
41  return trackid != -std::numeric_limits<int>::max();
42  }
std::set< int > const & ParticleAncestryMap::GetAllDroppedDescendants ( const int  trackid) const

Definition at line 25 of file ParticleAncestryMap.cxx.

References fParticleMap.

Referenced by ParticleAncestryMap().

26  {
27  return fParticleMap.at(trackid);
28  }
std::map< int, std::set< int > > fParticleMap
int ParticleAncestryMap::GetAncestor ( const int  trackid) const

Definition at line 30 of file ParticleAncestryMap.cxx.

References fParticleMap.

Referenced by ParticleAncestryMap().

31  {
32  for (auto const& [ancestor, descendants] : fParticleMap) {
33  if (descendants.count(trackid) != 0) return ancestor;
34  }
35 
36  return -std::numeric_limits<int>::max();
37  }
std::map< int, std::set< int > > fParticleMap
std::map< int, std::set< int > > const & ParticleAncestryMap::GetMap ( ) const

Definition at line 15 of file ParticleAncestryMap.cxx.

References fParticleMap.

Referenced by larg4::CheckMCParticle::analyze(), sim::MergeSimSourcesUtility::offsetParticleAncestryMapTrackID(), and ParticleAncestryMap().

16  {
17  return fParticleMap;
18  }
std::map< int, std::set< int > > fParticleMap
bool ParticleAncestryMap::HasDroppedDescendants ( const int  trackid) const

Definition at line 20 of file ParticleAncestryMap.cxx.

References fParticleMap.

Referenced by ParticleAncestryMap().

21  {
22  return fParticleMap.count(trackid) != 0;
23  }
std::map< int, std::set< int > > fParticleMap
void ParticleAncestryMap::SetMap ( const std::map< int, std::set< int >> &  map)

Definition at line 10 of file ParticleAncestryMap.cxx.

References fParticleMap.

Referenced by ParticleAncestryMap().

11  {
12  fParticleMap = map;
13  }
std::map< int, std::set< int > > fParticleMap

Member Data Documentation

std::map<int, std::set<int> > sim::ParticleAncestryMap::fParticleMap
private

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