16 #ifndef LArG4_ParticleListAction_h
17 #define LArG4_ParticleListAction_h
19 #include "Geant4/G4Types.hh"
20 #include "TLorentzVector.h"
22 #include "cetlib/exempt_ptr.h"
24 #include "nug4/G4Base/UserAction.h"
25 #include "nusimdata/SimulationBase/simb.h"
78 return simb::isGeneratedParticleIndex(
truthIndex);
101 bool keepMCParticleList =
true,
102 bool storeDroppedMCParticles =
false);
143 const sim::ParticleList*
GetList()
const;
147 std::map<int, GeneratedParticleIndex_t>
const&
170 static bool isDropped(simb::MCParticle
const*
p);
175 int GetParentage(
int trackid,
bool useOrigTrackIDMap =
false)
const;
197 std::unique_ptr<util::PositionInVolumeFilter>
fFilter;
204 TLorentzVector
const& mom,
205 std::string
const& process);
210 #endif // LArG4_ParticleListAction_h
ParticleListAction(double energyCut, bool storeTrajectories=false, bool keepEMShowerDaughters=false, bool keepMCParticleList=true, bool storeDroppedMCParticles=false)
G4bool fstoreTrajectories
Whether to store particle trajectories with each particle.
void AddPointToCurrentParticle(TLorentzVector const &pos, TLorentzVector const &mom, std::string const &process)
Adds a trajectory point to the current particle, and runs the filter.
static int GetCurrentOrigTrackID()
static int fCurrentPdgCode
pdg code of current particle
virtual void BeginOfEventAction(const G4Event *)
std::map< int, GeneratedParticleIndex_t > fPrimaryTruthMap
Map: particle track ID -> index of primary information in MC truth.
std::unique_ptr< sim::ParticleList > fdroppedParticleList
std::map< int, int > fParentIDMap_OrigTrackID
key is current track ID, value is parent ID – for real G4 track ID tracking only
GeneratedParticleIndex_t truthIndex
Index of the particle in the original generator truth record.
int GetParentage(int trackid, bool useOrigTrackIDMap=false) const
bool keepParticle() const
Returns whether there is a particle known to be kept.
const sim::ParticleList * GetList() const
GeneratedParticleIndex_t truthInfoIndex() const
Returns the index of the particle in the generator truth record.
ParticleInfo_t fCurrentParticle
std::map< int, int > fParentIDMap
key is current track ID, value is parent ID
virtual void PreTrackingAction(const G4Track *)
BEGIN_PROLOG note Geant4 assumes this is in MeV keepEMShowerDaughters
void clear()
Resets the information (does not release memory it does not own)
sim::ParticleList && YieldList()
void ResetTrackIDOffset()
static int fTrackIDOffset
static bool isDropped(simb::MCParticle const *p)
returns whether the specified particle has been marked as dropped
bool fKeepEMShowerDaughters
whether to keep EM shower secondaries, tertiaries, etc
virtual void PostTrackingAction(const G4Track *)
static int GetCurrentPdgCode()
simb::GeneratedParticleIndex_t GeneratedParticleIndex_t
sim::ParticleList && YieldDroppedList()
Yields the (dropped) ParticleList accumulated during the current event.
void ParticleFilter(std::unique_ptr< util::PositionInVolumeFilter > &&filter)
Grabs a particle filter.
GeneratedParticleIndex_t GetPrimaryTruthIndex(int trackId) const
Returns the index of primary truth (sim::NoGeneratorIndex if none).
std::unique_ptr< util::PositionInVolumeFilter > fFilter
filter for particles to be kept
std::unique_ptr< sim::ParticleList > fparticleList
bool isPrimary() const
Returns whether there is a particle.
cet::exempt_ptr< simb::MCParticle > particle
Object representing particle.
bool hasList() const
Returns whether a particle list is being kept.
BEGIN_PROLOG note Geant4 assumes this is in MeV does not store electromagnetic shower daughter storeTrajectories
static int GetCurrentTrackID()
static int fCurrentOrigTrackID
except for EM shower particles where it always shows the original track ID
virtual void EndOfEventAction(const G4Event *)
bool hasParticle() const
Returns whether there is a particle.
Defines classes to filter particles based on their trajectory.
virtual void SteppingAction(const G4Step *)
std::map< int, GeneratedParticleIndex_t > const & GetPrimaryTruthMap() const
bool keep
if there was decision to keep
static int fCurrentTrackID