1#ifndef SIMCORE_TRACKMAP_H_
2#define SIMCORE_TRACKMAP_H_
5#include <unordered_map>
12#include "SimCore/Event/SimParticle.h"
14#include "SimCore/UserTrackInformation.h"
34 void insert(
const G4Track* track);
40 inline bool contains(
const G4Track* track)
const {
48 bool isDescendant(
int trackID,
int ancestorID,
int maximum_depth)
const;
79 void save(
const G4Track* track);
132 std::unordered_map<int, std::pair<int, bool>>
ancestry_;
Class that provides extra information for Geant4 primary particles.
Defines a map of particle ancestry and particles to be saved.
void clear()
Clear the internal maps.
bool contains(const G4Track *track) const
Check if the passed track has already been inserted into the track map.
std::map< int, ldmx::SimParticle > & getParticleMap()
Get the map of particles to be stored in output event.
std::unordered_map< int, std::pair< int, bool > > ancestry_
ancestry map of particles in event (child -> parent)
bool isSaved(int trackID) const
Return true if the given track ID is saved i.e.
std::unordered_map< int, std::vector< int > > descendents_
descendents map of particles in event (parent -> children)
bool isDescendant(int trackID, int ancestorID, int maximum_depth) const
Check if the track with the given ID is a descendant of the track with the given ancestor ID up to a ...
void save(const G4Track *track)
Add a track to be stored into output map.
std::map< int, ldmx::SimParticle > particle_map_
map of SimParticles that will be stored
bool isInCalorimeterRegion(const G4Track *track) const
Was the input track generated inside the calorimeter region?
void traceAncestry()
Trace the ancestry for the particles that will be stored.
void insert(const G4Track *track)
Add a record in the map for the input track.
int findIncident(int trackID) const
Find a trajectory's nearest parent that is incident on the calorimeter region.