11 #ifndef PARTICLELISTACTION_SERVICE_H 12 #define PARTICLELISTACTION_SERVICE_H 19 #include "nug4/ParticleNavigation/ParticleList.h" 24 #include "artg4tk/actionBase/EventActionBase.hh" 25 #include "artg4tk/actionBase/SteppingActionBase.hh" 26 #include "artg4tk/actionBase/TrackingActionBase.hh" 30 #include "Geant4/globals.hh" 45 public artg4tk::TrackingActionBase,
46 public artg4tk::SteppingActionBase {
53 void preUserTrackingAction(
const G4Track*)
override;
54 void postUserTrackingAction(
const G4Track*)
override;
55 void userSteppingAction(
const G4Step*)
override;
62 void beginOfEventAction(
const G4Event*)
override;
67 void endOfEventAction(
const G4Event*)
override;
81 productGetter_ = productGetter;
84 std::unique_ptr<std::vector<simb::MCParticle>>
90 std::unique_ptr<art::Assns<simb::MCTruth, simb::MCParticle, sim::GeneratedParticleInfo>>
99 bool keepFullTrajectory =
false;
109 keepFullTrajectory =
false;
137 sim::ParticleList&& YieldList();
141 int GetParentage(
int trackid)
const;
150 std::vector<std::string>
170 std::vector<art::Handle<std::vector<simb::MCTruth>>>
const*
188 std::unique_ptr<std::vector<simb::MCParticle>>
partCol_;
189 std::unique_ptr<art::Assns<simb::MCTruth, simb::MCParticle, sim::GeneratedParticleInfo>>
194 void AddPointToCurrentParticle(TLorentzVector
const&
pos,
195 TLorentzVector
const& mom,
203 #endif // PARTICLELISTACTION_SERVICE_H
bool fKeepEMShowerDaughters
whether to keep EM shower secondaries, tertiaries, etc
bool fKeepSecondToLast
tell whether or not to force keeping the second to last point
std::unique_ptr< art::Assns< simb::MCTruth, simb::MCParticle, sim::GeneratedParticleInfo > > tpassn_
double fSparsifyMargin
set the sparsification margin
std::unique_ptr< std::vector< simb::MCParticle > > ParticleCollection()
bool fKeepTransportation
tell whether or not to keep the transportation process
std::unique_ptr< art::Assns< simb::MCTruth, simb::MCParticle, sim::GeneratedParticleInfo > > AssnsMCTruthToMCParticle()
std::unique_ptr< std::vector< simb::MCParticle > > partCol_
std::map< int, size_t > fMCTIndexMap
Map: particle track ID -> index of primary parent in std::vector<simb::MCTruth> object.
constexpr GeneratedParticleIndex_t NoGeneratedParticleIndex
Constant representing the absence of generator truth information.
bool fSparsifyTrajectories
help reduce the number of trajectory points.
void setInputCollections(std::vector< art::Handle< std::vector< simb::MCTruth >>> const &mclists)
#define DECLARE_ART_SERVICE(svc, scope)
std::map< size_t, std::pair< std::string, G4bool > > fMCTIndexToGeneratorMap
Map: MCTruthIndex -> generator, input label of generator and keepGenerator decision.
std::unordered_map< std::string, int > fNotStoredCounterUMap
Map: not stored process and counter.
bool isGeneratedParticleIndex(GeneratedParticleIndex_t index)
Returns whether the specified one is an acceptable generator index.
Code to link reconstructed objects back to the MC truth information.
bool isPrimary() const
Returns whether there is a particle.
std::vector< std::string > fNotStoredPhysics
Physics processes that will not be stored.
std::map< int, int > fParentIDMap
key is current track ID, value is parent ID
simb::GeneratedParticleIndex_t truthInfoIndex() const
Returns the index of the particle in the generator truth record.
Contains data associated to particles from detector simulation.
void clear()
Resets the information (does not release memory it does not own)
std::vector< std::string > fkeepGenTrajectories
std::map< int, bool > fMCTPrimProcessKeepMap
Map: particle trakc ID -> boolean decision to keep or not full trajectory points. ...
sim::ParticleList fParticleList
bool hasParticle() const
Returns whether there is a particle.
G4bool fstoreTrajectories
Whether to store particle trajectories with each particle.
static constexpr ProductID invalid() noexcept
bool fkeepOnlyPrimaryFullTraj
std::map< int, simb::GeneratedParticleIndex_t > fPrimaryTruthMap
Map: particle track ID -> index of primary information in MC truth.
ParticleInfo_t fCurrentParticle
std::vector< art::Handle< std::vector< simb::MCTruth > > > const * fMCLists
MCTruthCollection input lists.
void setPtrInfo(art::ProductID pid, art::EDProductGetter const *productGetter)
Common type definitions for data products (and a bit beyond).
std::size_t GeneratedParticleIndex_t
Type of particle index in the generator truth record (simb::MCTruth).