LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
#include "ParticleListAction_service.h"
Classes | |
struct | ParticleInfo_t |
Public Member Functions | |
ParticleListActionService (fhicl::ParameterSet const &) | |
void | preUserTrackingAction (const G4Track *) override |
void | postUserTrackingAction (const G4Track *) override |
void | userSteppingAction (const G4Step *) override |
simb::GeneratedParticleIndex_t | GetPrimaryTruthIndex (int trackId) const |
Returns the index of primary truth (sim::NoGeneratorIndex if none). More... | |
void | beginOfEventAction (const G4Event *) override |
void | endOfEventAction (const G4Event *) override |
void | setInputCollections (std::vector< art::Handle< std::vector< simb::MCTruth >>> const &mclists) |
void | setPtrInfo (art::ProductID pid, art::EDProductGetter const *productGetter) |
std::unique_ptr< std::vector< simb::MCParticle > > | ParticleCollection () |
std::unique_ptr< std::vector< simb::MCParticle > > | DroppedParticleCollection () |
std::unique_ptr< sim::ParticleAncestryMap > | DroppedTracksCollection () |
std::unique_ptr< art::Assns< simb::MCTruth, simb::MCParticle, sim::GeneratedParticleInfo > > | AssnsMCTruthToMCParticle () |
std::map< int, int > | GetTargetIDMap () |
void | CreateParticleFilter (std::vector< std::string > keepParticlesInVolumes, std::unique_ptr< util::PositionInVolumeFilter > &filter) |
Grabs a particle filter. More... | |
void | ParticleFilter () |
void | DroppedParticleFilter () |
bool | storeDropped () const |
Return whether dropped particles are stored. More... | |
void | callArtProduces (art::ProducesCollector &collector) |
std::string const & | myName () const |
virtual void | initialize () |
std::string const & | myName () const |
std::string const & | myName () const |
Private Member Functions | |
bool | isDropped (simb::MCParticle const *p) |
sim::ParticleList && | YieldList () |
sim::ParticleList && | YieldDroppedList () |
int | GetParentage (int trackid) 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 |
sim::ParticleList | fParticleList |
G4bool | fstoreTrajectories |
Whether to store particle trajectories with each particle. More... | |
std::vector< std::string > | fkeepGenTrajectories |
std::map< int, int > | fParentIDMap |
key is current track ID, value is parent ID More... | |
std::map< int, int > | fTargetIDMap |
key is original track ID, value is ID to assign for downstream objs (e.g. SimEdeps) More... | |
int | fCurrentTrackID |
int | fTrackIDOffset |
bool | fKeepEMShowerDaughters |
whether to keep EM shower secondaries, tertiaries, etc More... | |
std::vector< std::string > | fNotStoredPhysics |
Physics processes that will not be stored. More... | |
bool | fkeepOnlyPrimaryFullTraj |
bool | fSparsifyTrajectories |
help reduce the number of trajectory points. More... | |
double | fSparsifyMargin |
set the sparsification margin More... | |
bool | fKeepTransportation |
tell whether or not to keep the transportation process More... | |
bool | fKeepSecondToLast |
tell whether or not to force keeping the second to last point More... | |
std::vector< std::string > | fKeepParticlesInVolumes |
Only write particles that have trajectories through these volumes. More... | |
std::vector< std::string > | fKeepDroppedParticlesInVolumes |
bool | fStoreDroppedMCParticles |
Whether to keep a sim::MCParticle list of dropped particles. More... | |
std::unique_ptr< sim::ParticleList > | fdroppedParticleList |
std::vector< art::Handle< std::vector< simb::MCTruth > > > const * | fMCLists |
MCTruthCollection input lists. More... | |
std::map< int, simb::GeneratedParticleIndex_t > | fPrimaryTruthMap |
Map: particle track ID -> index of primary information in MC truth. More... | |
std::map< int, size_t > | fMCTIndexMap |
Map: particle track ID -> index of primary parent in std::vector<simb::MCTruth> object. More... | |
std::map< int, bool > | fMCTPrimProcessKeepMap |
Map: particle trakc ID -> boolean decision to keep or not full trajectory points. More... | |
std::map< size_t, std::pair< std::string, G4bool > > | fMCTIndexToGeneratorMap |
Map: MCTruthIndex -> generator, input label of generator and keepGenerator decision. More... | |
std::unordered_map< std::string, int > | fNotStoredCounterUMap |
Map: not stored process and counter. More... | |
std::map< int, std::set< int > > | fdroppedTracksMap |
map <ParentID, set: list of track ids for which no MCParticle was created> More... | |
std::unique_ptr< std::vector< simb::MCParticle > > | partCol_ |
std::unique_ptr< std::vector< simb::MCParticle > > | droppedPartCol_ |
This collection will hold the MCParticleLite objects created from dropped particles. More... | |
std::unique_ptr< sim::ParticleAncestryMap > | droppedCol_ |
std::unique_ptr< art::Assns< simb::MCTruth, simb::MCParticle, sim::GeneratedParticleInfo > > | tpassn_ |
art::ProductID | pid_ {art::ProductID::invalid()} |
art::EDProductGetter const * | productGetter_ {nullptr} |
std::unique_ptr< util::PositionInVolumeFilter > | fFilter |
filter for particles to be kept More... | |
std::unique_ptr< util::PositionInVolumeFilter > | fDroppedFilter |
Definition at line 65 of file ParticleListAction_service.h.
|
explicit |
Definition at line 66 of file ParticleListAction.cc.
References art::errors::Configuration, fdroppedParticleList, fKeepDroppedParticlesInVolumes, fKeepEMShowerDaughters, fkeepOnlyPrimaryFullTraj, fKeepParticlesInVolumes, fKeepSecondToLast, fKeepTransportation, fNotStoredCounterUMap, fNotStoredPhysics, fSparsifyMargin, fSparsifyTrajectories, and fStoreDroppedMCParticles.
|
private |
Adds a trajectory point to the current particle, and runs the filter.
Definition at line 776 of file ParticleListAction.cc.
References simb::MCParticle::AddTrajectoryPoint(), fCurrentParticle, fDroppedFilter, fFilter, fKeepTransportation, larg4::ParticleListActionService::ParticleInfo_t::isDropped, larg4::ParticleListActionService::ParticleInfo_t::isInVolume, and larg4::ParticleListActionService::ParticleInfo_t::particle.
Referenced by postUserTrackingAction(), and userSteppingAction().
|
inline |
Definition at line 116 of file ParticleListAction_service.h.
|
overridevirtual |
Reimplemented from artg4tk::EventActionBase.
Definition at line 141 of file ParticleListAction.cc.
References larg4::ParticleListActionService::ParticleInfo_t::clear(), sim::ParticleList::clear(), fCurrentParticle, fCurrentTrackID, fdroppedParticleList, fdroppedTracksMap, fkeepGenTrajectories, fMCLists, fMCTIndexMap, fMCTIndexToGeneratorMap, fMCTPrimProcessKeepMap, fNotStoredCounterUMap, fParentIDMap, fParticleList, fPrimaryTruthMap, fstoreTrajectories, fTargetIDMap, fTrackIDOffset, and sim::NoParticleId.
|
inlineinherited |
Definition at line 50 of file EventActionBase.hh.
References artg4tk::EventActionBase::doCallArtProduces().
|
inline |
Grabs a particle filter.
Definition at line 124 of file ParticleListAction_service.h.
References util::empty().
|
inline |
Definition at line 106 of file ParticleListAction_service.h.
|
inline |
Definition at line 170 of file ParticleListAction_service.h.
|
inline |
Definition at line 110 of file ParticleListAction_service.h.
|
overridevirtual |
Reimplemented from artg4tk::EventActionBase.
Definition at line 792 of file ParticleListAction.cc.
References sim::ParticleList::begin(), droppedCol_, droppedPartCol_, sim::ParticleList::end(), fdroppedParticleList, fdroppedTracksMap, fMCLists, fMCTIndexMap, fNotStoredCounterUMap, fParticleList, fStoreDroppedMCParticles, fTrackIDOffset, GetPrimaryTruthIndex(), isDropped(), art::errors::LogicError, MF_LOG_INFO, MF_LOG_WARNING, simb::MCTruth::NParticles(), partCol_, pid_, productGetter_, tpassn_, util::values(), YieldDroppedList(), and YieldList().
|
private |
Definition at line 225 of file ParticleListAction.cc.
References fParentIDMap, and sim::NoParticleId.
Referenced by postUserTrackingAction(), and preUserTrackingAction().
simb::GeneratedParticleIndex_t larg4::ParticleListActionService::GetPrimaryTruthIndex | ( | int | trackId | ) | const |
Returns the index of primary truth (sim::NoGeneratorIndex
if none).
Definition at line 707 of file ParticleListAction.cc.
References fPrimaryTruthMap, and simb::NoGeneratedParticleIndex.
Referenced by endOfEventAction().
|
inline |
Definition at line 121 of file ParticleListAction_service.h.
Referenced by larg4::LArG4DetectorService::doFillEventWithArtHits().
|
inlinevirtualinherited |
Reimplemented in artg4tk::myParticleGunActionService, and artg4tk::HepevtInputActionService.
Definition at line 36 of file ActionBase.hh.
|
private |
Definition at line 771 of file ParticleListAction.cc.
References simb::MCTrajectory::empty(), and simb::MCParticle::Trajectory().
Referenced by endOfEventAction().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inline |
Definition at line 102 of file ParticleListAction_service.h.
|
inline |
Definition at line 169 of file ParticleListAction_service.h.
|
overridevirtual |
Reimplemented from artg4tk::TrackingActionBase.
Definition at line 479 of file ParticleListAction.cc.
References AddPointToCurrentParticle(), larg4::ParticleListActionService::ParticleInfo_t::clear(), energy, sim::ParticleList::erase(), fCurrentParticle, fCurrentTrackID, fdroppedParticleList, fdroppedTracksMap, fKeepSecondToLast, fParentIDMap, fParticleList, fPrimaryTruthMap, fSparsifyMargin, fSparsifyTrajectories, fTargetIDMap, fTrackIDOffset, GetParentage(), larg4::ParticleListActionService::ParticleInfo_t::hasParticle(), larg4::ParticleListActionService::ParticleInfo_t::isDropped, larg4::ParticleListActionService::ParticleInfo_t::isInVolume, larg4::ParticleListActionService::ParticleInfo_t::isPrimary(), larg4::ParticleListActionService::ParticleInfo_t::keepFullTrajectory, sim::ParticleList::key(), larg4::ParticleListActionService::ParticleInfo_t::particle, simb::MCParticle::SetEndProcess(), simb::MCParticle::SetWeight(), simb::MCParticle::SparsifyTrajectory(), simb::MCParticle::TrackId(), and larg4::ParticleListActionService::ParticleInfo_t::truthInfoIndex().
|
overridevirtual |
Reimplemented from artg4tk::TrackingActionBase.
Definition at line 244 of file ParticleListAction.cc.
References sim::ParticleList::Add(), util::cend(), larg4::ParticleListActionService::ParticleInfo_t::clear(), energy, fCurrentParticle, fCurrentTrackID, fdroppedParticleList, fdroppedTracksMap, fenergyCut, fFilter, fKeepEMShowerDaughters, fkeepOnlyPrimaryFullTraj, fMCTIndexMap, fMCTIndexToGeneratorMap, fMCTPrimProcessKeepMap, fNotStoredCounterUMap, fNotStoredPhysics, fParentIDMap, fParticleList, fStoreDroppedMCParticles, fstoreTrajectories, fTargetIDMap, fTrackIDOffset, g4b::PrimaryParticleInformation::GetMCParticle(), GetParentage(), larg4::ParticleListActionService::ParticleInfo_t::isDropped, larg4::ParticleListActionService::ParticleInfo_t::isInVolume, larg4::ParticleListActionService::ParticleInfo_t::keepFullTrajectory, sim::ParticleList::KnownParticle(), art::errors::LogicError, g4b::PrimaryParticleInformation::MCParticleIndex(), g4b::PrimaryParticleInformation::MCTruthIndex(), MF_LOG_WARNING, simb::NoGeneratedParticleIndex, sim::NoParticleId, larg4::ParticleListActionService::ParticleInfo_t::particle, simb::MCParticle::Process(), simb::MCParticle::SetPolarization(), and larg4::ParticleListActionService::ParticleInfo_t::truthIndex.
|
inline |
Definition at line 91 of file ParticleListAction_service.h.
|
inline |
Definition at line 96 of file ParticleListAction_service.h.
|
inline |
Return whether dropped particles are stored.
Definition at line 175 of file ParticleListAction_service.h.
|
overridevirtual |
Reimplemented from artg4tk::SteppingActionBase.
Definition at line 571 of file ParticleListAction.cc.
References AddPointToCurrentParticle(), energy, fCurrentParticle, globalTime, larg4::ParticleListActionService::ParticleInfo_t::hasParticle(), larg4::ParticleListActionService::ParticleInfo_t::keepFullTrajectory, simb::MCParticle::NumberTrajectoryPoints(), larg4::ParticleListActionService::ParticleInfo_t::particle, velocity_G4, and velocity_step.
|
private |
Definition at line 741 of file ParticleListAction.cc.
References sim::ParticleList::begin(), sim::ParticleList::end(), fdroppedParticleList, fParticleList, fTrackIDOffset, and sim::ParticleList::size().
Referenced by endOfEventAction().
|
private |
Definition at line 715 of file ParticleListAction.cc.
References sim::ParticleList::begin(), sim::ParticleList::end(), fdroppedParticleList, fParticleList, fTrackIDOffset, and sim::ParticleList::size().
Referenced by endOfEventAction().
|
private |
Definition at line 296 of file ParticleListAction_service.h.
Referenced by endOfEventAction().
|
private |
This collection will hold the MCParticleLite objects created from dropped particles.
Definition at line 295 of file ParticleListAction_service.h.
Referenced by endOfEventAction().
|
private |
information about the particle currently being simulated for a single particle.
Definition at line 234 of file ParticleListAction_service.h.
Referenced by AddPointToCurrentParticle(), beginOfEventAction(), postUserTrackingAction(), preUserTrackingAction(), and userSteppingAction().
|
private |
track ID of the current particle, set to eve ID for EM shower particles
Definition at line 248 of file ParticleListAction_service.h.
Referenced by beginOfEventAction(), postUserTrackingAction(), and preUserTrackingAction().
|
private |
filter for dropped particles to be kept (if any)
Definition at line 303 of file ParticleListAction_service.h.
Referenced by AddPointToCurrentParticle().
|
private |
The accumulated particle information for all (dropped) particles in the event.
Definition at line 270 of file ParticleListAction_service.h.
Referenced by beginOfEventAction(), endOfEventAction(), ParticleListActionService(), postUserTrackingAction(), preUserTrackingAction(), YieldDroppedList(), and YieldList().
|
private |
map <ParentID, set: list of track ids for which no MCParticle was created>
Definition at line 291 of file ParticleListAction_service.h.
Referenced by beginOfEventAction(), endOfEventAction(), postUserTrackingAction(), and preUserTrackingAction().
|
private |
The minimum energy for a particle to be included in the list.
Definition at line 232 of file ParticleListAction_service.h.
Referenced by preUserTrackingAction().
|
private |
filter for particles to be kept
Definition at line 301 of file ParticleListAction_service.h.
Referenced by AddPointToCurrentParticle(), and preUserTrackingAction().
|
private |
Only write particles that have trajectories through these volumes
Definition at line 264 of file ParticleListAction_service.h.
Referenced by ParticleListActionService().
|
private |
whether to keep EM shower secondaries, tertiaries, etc
Definition at line 252 of file ParticleListAction_service.h.
Referenced by ParticleListActionService(), and preUserTrackingAction().
|
private |
List of generators for which fstoreTrajectories applies. if not provided and storeTrajectories is true, then all trajectories for all generators will be stored. If storeTrajectories is set to false, this list is ignored and all additional trajectory points are not stored.
Definition at line 240 of file ParticleListAction_service.h.
Referenced by beginOfEventAction().
|
private |
Whether to store trajectories only for primaries and their descendants with MCTruth process = "primary"
Definition at line 254 of file ParticleListAction_service.h.
Referenced by ParticleListActionService(), and preUserTrackingAction().
|
private |
Only write particles that have trajectories through these volumes.
Definition at line 262 of file ParticleListAction_service.h.
Referenced by ParticleListActionService().
|
private |
tell whether or not to force keeping the second to last point
Definition at line 259 of file ParticleListAction_service.h.
Referenced by ParticleListActionService(), and postUserTrackingAction().
|
private |
tell whether or not to keep the transportation process
Definition at line 258 of file ParticleListAction_service.h.
Referenced by AddPointToCurrentParticle(), and ParticleListActionService().
|
private |
MCTruthCollection input lists.
Definition at line 273 of file ParticleListAction_service.h.
Referenced by beginOfEventAction(), and endOfEventAction().
|
private |
Map: particle track ID -> index of primary parent in std::vector<simb::MCTruth> object.
Definition at line 279 of file ParticleListAction_service.h.
Referenced by beginOfEventAction(), endOfEventAction(), and preUserTrackingAction().
|
private |
Map: MCTruthIndex -> generator, input label of generator and keepGenerator decision.
Definition at line 285 of file ParticleListAction_service.h.
Referenced by beginOfEventAction(), and preUserTrackingAction().
|
private |
Map: particle trakc ID -> boolean decision to keep or not full trajectory points.
Definition at line 282 of file ParticleListAction_service.h.
Referenced by beginOfEventAction(), and preUserTrackingAction().
|
private |
Map: not stored process and counter.
Definition at line 288 of file ParticleListAction_service.h.
Referenced by beginOfEventAction(), endOfEventAction(), ParticleListActionService(), and preUserTrackingAction().
|
private |
Physics processes that will not be stored.
Definition at line 253 of file ParticleListAction_service.h.
Referenced by ParticleListActionService(), and preUserTrackingAction().
|
private |
key is current track ID, value is parent ID
Definition at line 245 of file ParticleListAction_service.h.
Referenced by beginOfEventAction(), GetParentage(), postUserTrackingAction(), and preUserTrackingAction().
|
private |
The accumulated particle information for all particles in the event.
Definition at line 236 of file ParticleListAction_service.h.
Referenced by beginOfEventAction(), endOfEventAction(), postUserTrackingAction(), preUserTrackingAction(), YieldDroppedList(), and YieldList().
|
private |
Map: particle track ID -> index of primary information in MC truth.
Definition at line 276 of file ParticleListAction_service.h.
Referenced by beginOfEventAction(), GetPrimaryTruthIndex(), and postUserTrackingAction().
|
private |
set the sparsification margin
Definition at line 257 of file ParticleListAction_service.h.
Referenced by ParticleListActionService(), and postUserTrackingAction().
|
private |
help reduce the number of trajectory points.
Definition at line 256 of file ParticleListAction_service.h.
Referenced by ParticleListActionService(), and postUserTrackingAction().
|
private |
Whether to keep a sim::MCParticle
list of dropped particles.
Definition at line 267 of file ParticleListAction_service.h.
Referenced by endOfEventAction(), ParticleListActionService(), and preUserTrackingAction().
|
private |
Whether to store particle trajectories with each particle.
Definition at line 238 of file ParticleListAction_service.h.
Referenced by beginOfEventAction(), and preUserTrackingAction().
|
private |
key is original track ID, value is ID to assign for downstream objs (e.g. SimEdeps)
Definition at line 247 of file ParticleListAction_service.h.
Referenced by beginOfEventAction(), postUserTrackingAction(), and preUserTrackingAction().
|
mutableprivate |
offset added to track ids when running over multiple MCTruth objects.
Definition at line 250 of file ParticleListAction_service.h.
Referenced by beginOfEventAction(), endOfEventAction(), postUserTrackingAction(), preUserTrackingAction(), YieldDroppedList(), and YieldList().
|
private |
Definition at line 293 of file ParticleListAction_service.h.
Referenced by endOfEventAction().
|
private |
Definition at line 299 of file ParticleListAction_service.h.
Referenced by endOfEventAction().
|
private |
Definition at line 300 of file ParticleListAction_service.h.
Referenced by endOfEventAction().
|
private |
Definition at line 298 of file ParticleListAction_service.h.
Referenced by endOfEventAction().