LDMX Software
DecayChildrenKeeper.cxx
1#include "Biasing/Utility/DecayChildrenKeeper.h"
2
3/*~~~~~~~~~~~~*/
4/* Geant4 */
5/*~~~~~~~~~~~~*/
6#include "G4Track.hh"
7#include "G4VProcess.hh"
8
9/*~~~~~~~~~~~~~*/
10/* SimCore */
11/*~~~~~~~~~~~~~*/
12#include "SimCore/UserTrackInformation.h"
13
14namespace biasing {
15namespace utility {
16
18 const std::string& name, framework::config::Parameters& parameters)
19 : simcore::UserAction(name, parameters) {
20 parents_ = parameters.getParameter<std::vector<int>>("parents");
21}
22
24
26 const auto& particle_map{getCurrentParticleMap()};
27 if (particle_map.find(track->GetParentID()) != particle_map.end()) {
28 const int& parent_pdg{particle_map.at(track->GetParentID()).getPdgID()};
29 for (const int& parent : parents_) {
30 if (parent_pdg == parent) {
32 break;
33 } // parent is an interesting one
34 } // loop through interesting parent options
35 } // parent is in particle map
36}
37
38} // namespace utility
39} // namespace biasing
40
41DECLARE_ACTION(biasing::utility, DecayChildrenKeeper)
std::vector< int > parents_
The PDG IDs for which to keep decay children.
void PostUserTrackingAction(const G4Track *track) override
Method called when a track is done being processed.
DecayChildrenKeeper(const std::string &name, framework::config::Parameters &parameters)
Constructor.
Class encapsulating parameters for configuring a processor.
Definition Parameters.h:27
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89
const std::map< int, ldmx::SimParticle > & getCurrentParticleMap() const
Get the current particle map.
static UserTrackInformation * get(const G4Track *track)
get
void setSaveFlag(bool saveFlag)
Set the save flag so the associated track will be persisted as a Trajectory.