LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
#include "ParticleListAction.h"
Classes | |
struct | ParticleInfo_t |
Public Types | |
using | GeneratedParticleIndex_t = simb::GeneratedParticleIndex_t |
Public Member Functions | |
ParticleListAction (double energyCut, bool storeTrajectories=false, bool keepEMShowerDaughters=false, bool keepMCParticleList=true, bool storeDroppedMCParticles=false) | |
virtual void | BeginOfEventAction (const G4Event *) |
G4UserEventAction interfaces. More... | |
virtual void | EndOfEventAction (const G4Event *) |
virtual void | PreTrackingAction (const G4Track *) |
G4UserTrackingAction interfaces. More... | |
virtual void | PostTrackingAction (const G4Track *) |
virtual void | SteppingAction (const G4Step *) |
G4UserSteppingAction interface. More... | |
void | ParticleFilter (std::unique_ptr< util::PositionInVolumeFilter > &&filter) |
Grabs a particle filter. More... | |
void | ResetTrackIDOffset () |
const sim::ParticleList * | GetList () const |
std::map< int, GeneratedParticleIndex_t > const & | GetPrimaryTruthMap () const |
bool | hasList () const |
Returns whether a particle list is being kept. More... | |
GeneratedParticleIndex_t | GetPrimaryTruthIndex (int trackId) const |
Returns the index of primary truth (sim::NoGeneratorIndex if none). More... | |
sim::ParticleList && | YieldList () |
sim::ParticleList && | YieldDroppedList () |
Yields the (dropped) ParticleList accumulated during the current event. More... | |
virtual void | Config (fhicl::ParameterSet const &) |
Override Config() to extract any necessary parameters. More... | |
virtual void | PrintConfig (std::string const &) |
Override PrintConfig() to print out current configuration. More... | |
virtual void | BeginOfRunAction (const G4Run *) |
G4UserRunAction interfaces. More... | |
virtual void | EndOfRunAction (const G4Run *) |
virtual bool | ProvidesStacking () |
virtual G4ClassificationOfNewTrack | StackClassifyNewTrack (const G4Track *) |
G4UserStackingAction interfaces. More... | |
virtual void | StackNewStage () |
virtual void | StackPrepareNewEvent () |
std::string const & | GetName () const |
void | SetName (std::string const &name) |
Static Public Member Functions | |
static int | GetCurrentTrackID () |
static int | GetCurrentOrigTrackID () |
static int | GetCurrentPdgCode () |
static bool | isDropped (simb::MCParticle const *p) |
returns whether the specified particle has been marked as dropped More... | |
Private Member Functions | |
int | GetParentage (int trackid, bool useOrigTrackIDMap=false) const |
void | AddPointToCurrentParticle (TLorentzVector const &pos, TLorentzVector const &mom, std::string const &process) |
Adds a trajectory point to the current particle, and runs the filter. More... | |
Private Attributes | |
G4double | fenergyCut |
ParticleInfo_t | fCurrentParticle |
std::unique_ptr< sim::ParticleList > | fparticleList |
std::unique_ptr< sim::ParticleList > | fdroppedParticleList |
G4bool | fstoreTrajectories |
Whether to store particle trajectories with each particle. More... | |
std::map< int, int > | fParentIDMap |
key is current track ID, value is parent ID More... | |
std::map< int, int > | fParentIDMap_OrigTrackID |
key is current track ID, value is parent ID – for real G4 track ID tracking only More... | |
bool | fKeepEMShowerDaughters |
whether to keep EM shower secondaries, tertiaries, etc More... | |
std::unique_ptr< util::PositionInVolumeFilter > | fFilter |
filter for particles to be kept More... | |
std::map< int, GeneratedParticleIndex_t > | fPrimaryTruthMap |
Map: particle track ID -> index of primary information in MC truth. More... | |
Static Private Attributes | |
static int | fCurrentTrackID = sim::NoParticleId |
static int | fCurrentOrigTrackID = sim::NoParticleId |
except for EM shower particles where it always shows the original track ID More... | |
static int | fCurrentPdgCode = 0 |
pdg code of current particle More... | |
static int | fTrackIDOffset = 0 |
Definition at line 45 of file ParticleListAction.h.
Definition at line 47 of file ParticleListAction.h.
larg4::ParticleListAction::ParticleListAction | ( | double | energyCut, |
bool | storeTrajectories = false , |
||
bool | keepEMShowerDaughters = false , |
||
bool | keepMCParticleList = true , |
||
bool | storeDroppedMCParticles = false |
||
) |
Definition at line 57 of file ParticleListAction.cxx.
|
private |
Adds a trajectory point to the current particle, and runs the filter.
Definition at line 567 of file ParticleListAction.cxx.
References fCurrentParticle, fFilter, larg4::ParticleListAction::ParticleInfo_t::keep, and larg4::ParticleListAction::ParticleInfo_t::particle.
Referenced by SteppingAction().
|
virtual |
G4UserEventAction interfaces.
Reimplemented from g4b::UserAction.
Definition at line 72 of file ParticleListAction.cxx.
References larg4::ParticleListAction::ParticleInfo_t::clear(), fCurrentOrigTrackID, fCurrentParticle, fCurrentPdgCode, fCurrentTrackID, fdroppedParticleList, fParentIDMap, fParentIDMap_OrigTrackID, fparticleList, and sim::NoParticleId.
|
inlinevirtualinherited |
G4UserRunAction interfaces.
The following a list of methods that correspond to the available user action classes in Geant 4.0.1 and higher.
Reimplemented in larg4::VisualizationAction.
Definition at line 74 of file UserAction.h.
|
inlinevirtualinherited |
Override Config() to extract any necessary parameters.
Reimplemented in altns::ExampleAction.
Definition at line 65 of file UserAction.h.
Referenced by g4b::UserAction::UserAction().
|
virtual |
Reimplemented from g4b::UserAction.
Definition at line 462 of file ParticleListAction.cxx.
References fparticleList, and larg4::UpdateDaughterInformation::SetParticleList().
|
inlinevirtualinherited |
|
inlinestatic |
Definition at line 104 of file ParticleListAction.h.
Referenced by larg4::LArVoxelReadout::ProcessHits(), and larg4::OpFastScintillation::ProcessStep().
|
inlinestatic |
Definition at line 105 of file ParticleListAction.h.
|
inlinestatic |
Definition at line 103 of file ParticleListAction.h.
Referenced by larg4::AuxDetReadout::ProcessHits(), larg4::LArVoxelReadout::ProcessHits(), larg4::OpFastScintillation::ProcessStep(), and larg4::OpFastScintillation::RecordPhotonsProduced().
const sim::ParticleList * larg4::ParticleListAction::GetList | ( | ) | const |
Definition at line 480 of file ParticleListAction.cxx.
References fdroppedParticleList, fparticleList, and fTrackIDOffset.
|
inlineinherited |
Definition at line 98 of file UserAction.h.
References g4b::UserAction::myName.
Referenced by g4b::UserActionManager::PrintActionList().
|
private |
Definition at line 90 of file ParticleListAction.cxx.
References fParentIDMap, fParentIDMap_OrigTrackID, MF_LOG_DEBUG, and sim::NoParticleId.
Referenced by PreTrackingAction().
simb::GeneratedParticleIndex_t larg4::ParticleListAction::GetPrimaryTruthIndex | ( | int | trackId | ) | const |
Returns the index of primary truth (sim::NoGeneratorIndex
if none).
Definition at line 505 of file ParticleListAction.cxx.
References util::end(), GetPrimaryTruthMap(), and simb::NoGeneratedParticleIndex.
Referenced by larg4::LArG4::produce().
|
inline |
Returns a map of truth record information index for each of the primary particles (by track ID).
Definition at line 114 of file ParticleListAction.h.
Referenced by GetPrimaryTruthIndex().
|
inline |
Returns whether a particle list is being kept.
Definition at line 120 of file ParticleListAction.h.
|
static |
returns whether the specified particle has been marked as dropped
Definition at line 50 of file ParticleListAction.cxx.
References simb::MCTrajectory::empty(), and simb::MCParticle::Trajectory().
Referenced by larg4::LArG4::produce().
|
inline |
Grabs a particle filter.
Definition at line 97 of file ParticleListAction.h.
Referenced by larg4::LArG4::beginRun().
|
virtual |
Reimplemented from g4b::UserAction.
Definition at line 276 of file ParticleListAction.cxx.
References larg4::ParticleListAction::ParticleInfo_t::clear(), larg4::ParticleListAction::ParticleInfo_t::drop, fCurrentParticle, fdroppedParticleList, fparticleList, fPrimaryTruthMap, larg4::ParticleListAction::ParticleInfo_t::hasParticle(), larg4::ParticleListAction::ParticleInfo_t::isPrimary(), larg4::ParticleListAction::ParticleInfo_t::keep, larg4::ParticleListAction::ParticleInfo_t::particle, and larg4::ParticleListAction::ParticleInfo_t::truthInfoIndex().
|
virtual |
G4UserTrackingAction interfaces.
Reimplemented from g4b::UserAction.
Definition at line 114 of file ParticleListAction.cxx.
References larg4::ParticleListAction::ParticleInfo_t::clear(), larg4::ParticleListAction::ParticleInfo_t::drop, energy, fCurrentOrigTrackID, fCurrentParticle, fCurrentPdgCode, fCurrentTrackID, fdroppedParticleList, fenergyCut, fFilter, fKeepEMShowerDaughters, fParentIDMap, fParentIDMap_OrigTrackID, fparticleList, fTrackIDOffset, GetParentage(), larg4::ParticleListAction::ParticleInfo_t::keep, g4b::PrimaryParticleInformation::MCParticleIndex(), MF_LOG_WARNING, simb::NoGeneratedParticleIndex, sim::NoParticleId, larg4::ParticleListAction::ParticleInfo_t::particle, and larg4::ParticleListAction::ParticleInfo_t::truthIndex.
|
inlinevirtualinherited |
Override PrintConfig() to print out current configuration.
Reimplemented in altns::ExampleAction.
Definition at line 68 of file UserAction.h.
Referenced by g4b::UserActionManager::PrintActionList().
|
inlinevirtualinherited |
Does this UserAction do stacking? Override to return "true" if the following interfaces are implemented
Reimplemented in altns::ExampleAction.
Definition at line 90 of file UserAction.h.
Referenced by g4b::UserActionManager::PrintActionList().
|
inline |
Definition at line 107 of file ParticleListAction.h.
Referenced by larg4::LArG4::produce().
|
inlineinherited |
Definition at line 99 of file UserAction.h.
References g4b::UserAction::myName.
Referenced by g4b::UserActionFactory::GetUserAction().
|
inlinevirtualinherited |
G4UserStackingAction interfaces.
Reimplemented in altns::ExampleAction.
Definition at line 93 of file UserAction.h.
|
inlinevirtualinherited |
|
inlinevirtualinherited |
|
virtual |
G4UserSteppingAction interface.
Reimplemented from g4b::UserAction.
Definition at line 317 of file ParticleListAction.cxx.
References AddPointToCurrentParticle(), energy, fCurrentParticle, fstoreTrajectories, globalTime, larg4::ParticleListAction::ParticleInfo_t::hasParticle(), MF_LOG_DEBUG, larg4::ParticleListAction::ParticleInfo_t::particle, velocity_G4, and velocity_step.
sim::ParticleList && larg4::ParticleListAction::YieldDroppedList | ( | ) |
Yields the (dropped) ParticleList accumulated during the current event.
Definition at line 542 of file ParticleListAction.cxx.
References fdroppedParticleList, fparticleList, and fTrackIDOffset.
Referenced by larg4::LArG4::produce().
sim::ParticleList && larg4::ParticleListAction::YieldList | ( | ) |
Definition at line 513 of file ParticleListAction.cxx.
References fdroppedParticleList, fparticleList, and fTrackIDOffset.
Referenced by larg4::LArG4::produce().
|
staticprivate |
except for EM shower particles where it always shows the original track ID
g4 real track ID of the current particle (including for EM shower daughters)
Definition at line 155 of file ParticleListAction.h.
Referenced by BeginOfEventAction(), and PreTrackingAction().
|
private |
information about the particle currently being simulated for a single particle.
Definition at line 141 of file ParticleListAction.h.
Referenced by AddPointToCurrentParticle(), BeginOfEventAction(), PostTrackingAction(), PreTrackingAction(), and SteppingAction().
|
staticprivate |
pdg code of current particle
Definition at line 157 of file ParticleListAction.h.
Referenced by BeginOfEventAction(), and PreTrackingAction().
|
staticprivate |
track ID of the current particle, set to eve ID for EM shower particles
Definition at line 152 of file ParticleListAction.h.
Referenced by BeginOfEventAction(), and PreTrackingAction().
|
private |
The accumulated particle information for all dropped particles in the event.
Definition at line 146 of file ParticleListAction.h.
Referenced by BeginOfEventAction(), GetList(), PostTrackingAction(), PreTrackingAction(), YieldDroppedList(), and YieldList().
|
private |
The minimum energy for a particle to be included in the list.
Definition at line 139 of file ParticleListAction.h.
Referenced by PreTrackingAction().
|
private |
filter for particles to be kept
Definition at line 162 of file ParticleListAction.h.
Referenced by AddPointToCurrentParticle(), and PreTrackingAction().
|
private |
whether to keep EM shower secondaries, tertiaries, etc
Definition at line 160 of file ParticleListAction.h.
Referenced by PreTrackingAction().
|
private |
key is current track ID, value is parent ID
Definition at line 149 of file ParticleListAction.h.
Referenced by BeginOfEventAction(), GetParentage(), and PreTrackingAction().
|
private |
key is current track ID, value is parent ID – for real G4 track ID tracking only
Definition at line 151 of file ParticleListAction.h.
Referenced by BeginOfEventAction(), GetParentage(), and PreTrackingAction().
|
private |
The accumulated particle information for all particles in the event.
Definition at line 143 of file ParticleListAction.h.
Referenced by BeginOfEventAction(), EndOfEventAction(), GetList(), PostTrackingAction(), PreTrackingAction(), YieldDroppedList(), and YieldList().
|
private |
Map: particle track ID -> index of primary information in MC truth.
Definition at line 165 of file ParticleListAction.h.
Referenced by PostTrackingAction().
|
private |
Whether to store particle trajectories with each particle.
Definition at line 148 of file ParticleListAction.h.
Referenced by SteppingAction().
|
staticprivate |
offset added to track ids when running over multiple MCTruth objects.
Definition at line 158 of file ParticleListAction.h.
Referenced by GetList(), PreTrackingAction(), YieldDroppedList(), and YieldList().