12 #ifndef PARTICLELISTACTION_SERVICE_H
13 #define PARTICLELISTACTION_SERVICE_H
15 #include "art/Framework/Principal/Handle.h"
16 #include "art/Framework/Services/Registry/ServiceDeclarationMacros.h"
20 #include "artg4tk/actionBase/EventActionBase.hh"
21 #include "artg4tk/actionBase/SteppingActionBase.hh"
22 #include "artg4tk/actionBase/TrackingActionBase.hh"
24 #include "nug4/ParticleNavigation/ParticleList.h"
26 #include "nusimdata/SimulationBase/MCParticle.h"
27 #include "nusimdata/SimulationBase/MCTruth.h"
28 #include "nusimdata/SimulationBase/simb.h"
30 #include "art/Framework/Principal/Handle.h"
31 #include "art/Framework/Services/Registry/ServiceDeclarationMacros.h"
33 #include "canvas/Persistency/Common/Assns.h"
34 #include "canvas/Persistency/Common/Ptr.h"
35 #include "canvas/Persistency/Provenance/ProductID.h"
38 class EDProductGetter;
41 #include "messagefacility/MessageLogger/MessageLogger.h"
43 #include "Geant4/globals.hh"
55 #include <unordered_map>
62 public artg4tk::TrackingActionBase,
63 public artg4tk::SteppingActionBase {
95 art::EDProductGetter
const* productGetter)
110 std::unique_ptr<art::Assns<simb::MCTruth, simb::MCParticle, sim::GeneratedParticleInfo>>
123 simb::GeneratedParticleIndex_t
truthIndex = simb::NoGeneratedParticleIndex;
145 return simb::isGeneratedParticleIndex(
truthIndex);
149 simb::GeneratedParticleIndex_t
171 std::vector<std::string>
192 std::vector<art::Handle<std::vector<simb::MCTruth>>>
const*
213 std::unique_ptr<std::vector<simb::MCParticle>>
partCol_;
215 std::unique_ptr<art::Assns<simb::MCTruth, simb::MCParticle, sim::GeneratedParticleInfo>>
217 art::ProductID
pid_{art::ProductID::invalid()};
221 TLorentzVector
const& mom,
222 std::string
const& process);
229 #endif // PARTICLELISTACTION_SERVICE_H
simb::MCParticle * particle
simple structure representing particle
void userSteppingAction(const G4Step *) override
ParticleListActionService(fhicl::ParameterSet const &)
void beginOfEventAction(const G4Event *) override
void preUserTrackingAction(const G4Track *) override
sim::ParticleList && YieldList()
bool fKeepEMShowerDaughters
whether to keep EM shower secondaries, tertiaries, etc
bool fKeepSecondToLast
tell whether or not to force keeping the second to last point
bool keepFullTrajectory
if there was decision to keep
std::unique_ptr< art::Assns< simb::MCTruth, simb::MCParticle, sim::GeneratedParticleInfo > > tpassn_
int GetParentage(int trackid) const
double fSparsifyMargin
set the sparsification margin
Contains data associated to particles from detector simulation.
void AddPointToCurrentParticle(TLorentzVector const &pos, TLorentzVector const &mom, std::string const &process)
Adds a trajectory point to the current particle, and runs the filter.
void postUserTrackingAction(const G4Track *) override
std::unique_ptr< std::vector< simb::MCParticle > > ParticleCollection()
simb::GeneratedParticleIndex_t GetPrimaryTruthIndex(int trackId) const
Returns the index of primary truth (sim::NoGeneratorIndex if none).
std::unique_ptr< std::map< int, std::set< int > > > droppedCol_
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.
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
bool fSparsifyTrajectories
help reduce the number of trajectory points.
void setInputCollections(std::vector< art::Handle< std::vector< simb::MCTruth >>> const &mclists)
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.
std::map< int, int > fTargetIDMap
key is original track ID, value is ID to assign for downstream objs (e.g. SimEdeps) ...
void endOfEventAction(const G4Event *) override
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
std::map< int, int > GetTargetIDMap()
simb::GeneratedParticleIndex_t truthInfoIndex() const
Returns the index of the particle in the generator truth record.
art::EDProductGetter const * productGetter_
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. ...
simb::GeneratedParticleIndex_t truthIndex
Index of the particle in the original generator truth record.
sim::ParticleList fParticleList
bool hasParticle() const
Returns whether there is a particle.
std::unique_ptr< std::map< int, std::set< int > > > DroppedTracksCollection()
G4bool fstoreTrajectories
Whether to store particle trajectories with each particle.
bool fkeepOnlyPrimaryFullTraj
std::map< int, simb::GeneratedParticleIndex_t > fPrimaryTruthMap
Map: particle track ID -> index of primary information in MC truth.
ParticleInfo_t fCurrentParticle
std::map< int, std::set< int > > fdroppedTracksMap
map <ParentID, set: list of track ids for which no MCParticle was created>
std::vector< art::Handle< std::vector< simb::MCTruth > > > const * fMCLists
MCTruthCollection input lists.
void setPtrInfo(art::ProductID pid, art::EDProductGetter const *productGetter)