|
ATLAS Offline Software
|
Go to the documentation of this file.
29 #include "G4ParticleDefinition.hh"
30 #include "G4DynamicParticle.hh"
31 #include "G4TouchableHistory.hh"
33 #include "G4TransportationManager.hh"
34 #include "G4LogicalVolumeStore.hh"
36 #include "G4EventManager.hh"
38 #include "G4PrimaryParticle.hh"
77 const std::vector<const G4Track*> *secondaryVector = aStep->GetSecondaryInCurrentStep();
78 for (
auto* aConstSecondaryTrack : *secondaryVector ) {
80 G4Track* aSecondaryTrack
ATLAS_THREAD_SAFE =
const_cast<G4Track*
>( aConstSecondaryTrack );
86 if (!particleReturnedToISF) {
91 generationZeroGenParticle );
100 bool isPrimary = ! aTrack->GetParentID();
121 <<
"Started simulation of primary particle which already has a TrackInformation/TrackBarcodeInfo object attached (trackID: "
122 << aTrack.GetTrackID() <<
", track pos: "<<aTrack.GetPosition() <<
", mom: "<<aTrack.GetMomentum()
123 <<
", parentID " << aTrack.GetParentID() <<
")";
124 G4Exception(
"iGeant4::TrackProcessorUserActionBase",
"TrackInformationAlreadyExists", FatalException,
description);
128 auto* primaryPartInfo =
dynamic_cast <PrimaryParticleInformation*
> (aTrack.GetDynamicParticle()->GetPrimaryParticle()->GetUserInformation());
129 if (!primaryPartInfo) {
131 description << G4String(
"PreUserTrackingAction: ") +
"NULL PrimaryParticleInformation pointer for current G4Step (trackID "
132 << aTrack.GetTrackID() <<
", track pos: "<<aTrack.GetPosition() <<
", mom: "<<aTrack.GetMomentum()
133 <<
", parentID " << aTrack.GetParentID() <<
")";
134 G4Exception(
"iGeant4::TrackProcessorUserActionBase",
"NoPPInfo", FatalException,
description);
139 auto* baseISP = primaryPartInfo->GetISFParticle();
142 description << G4String(
"PreUserTrackingAction: ") +
"No ISFParticle associated with primary particle (trackID: "
143 << aTrack.GetTrackID() <<
", track pos: "<<aTrack.GetPosition() <<
", mom: "<<aTrack.GetMomentum()
144 <<
", parentID " << aTrack.GetParentID() <<
")";
145 G4Exception(
"iGeant4::TrackProcessorUserActionBase",
"NoISFParticle", FatalException,
description);
152 description << G4String(
"PreUserTrackingAction: ") +
"No ISF::TruthBinding associated with primary particle (trackID: "
153 << aTrack.GetTrackID() <<
", track pos: "<<aTrack.GetPosition() <<
", mom: "<<aTrack.GetMomentum()
154 <<
", parentID " << aTrack.GetParentID() <<
")";
155 G4Exception(
"iGeant4::TrackProcessorUserActionBase",
"NoISFTruthBinding", FatalException,
description);
159 int regenerationNr = primaryPartInfo->GetRegenerationNr();
165 auto classification =
classify(primaryGenParticle,
166 generationZeroGenParticle,
173 generationZeroGenParticle );
174 newTrackInfo->SetRegenerationNr(regenerationNr);
211 int regenerationNumber)
const
215 if (currentGenParticle) {
216 if (currentGenParticle == primaryGenParticle) {
219 else if (generationZeroGenParticle == primaryGenParticle && regenerationNumber>0) {
std::list< ISF::ISFParticle * > ISFParticleContainer
generic ISFParticle container (not necessarily a std::list!)
void SetCurrentPrimaryGenParticle(HepMC::ConstGenParticlePtr p)
set m_currentPrimaryGenParticle, the pointer to the HepMC::GenParticle used to create the current G4P...
static TrackInformation * attachTrackInfoToNewG4Track(G4Track &aTrack, ISF::ISFParticle &baseIsp, VTrackInformation::TrackClassification classification, HepMC::GenParticlePtr generationZeroGenParticle=nullptr)
attach a new TrackInformation object to the given new (!) G4Track (the G4Track must not have a UserIn...
HepMC::GenParticlePtr getCurrentGenParticle()
pointer to the particle in the simulation truth
VTrackInformation::TrackClassification classify(HepMC::ConstGenParticlePtr primaryGenParticle, HepMC::ConstGenParticlePtr generationZeroGenParticle, HepMC::ConstGenParticlePtr currentGenParticle, int regenerationNumber) const
Classify the particle represented by the given set of truth links.
GenParticle * GenParticlePtr
virtual void EndOfEventAction(const G4Event *) override final
virtual void ISFSteppingAction(const G4Step *, ISF::ISFParticle *)=0
This method is called by TrackProcessorUserActionBase after the G4Track->ISFParticle association has ...
virtual void BeginOfEventAction(const G4Event *) override final
ISF::ISFParticleContainer m_storedSecondaries
HepMC::GenParticlePtr getGenerationZeroGenParticle()
pointer to the simulation truth particle before any regeneration happened (eg.
static AtlasG4EventUserInfo * getAtlasG4EventUserInfo()
return pointer to current AtlasG4EventUserInfo
ISF::ISFParticleContainer ReturnSecondaries(ISF::ISFParticle const *parent)
void setupSecondary(const G4Track &)
Setup the given G4Track as the current secondary particle which we'll process.
AtlasG4EventUserInfo * m_atlasG4EvtUserInfo
event-global G4 UserInformation
const GenParticle * ConstGenParticlePtr
void updateCachedParticleInfo(ISF::ISFParticle *baseISFParticle, HepMC::ConstGenParticlePtr primaryGenParticle, HepMC::GenParticlePtr currentGenParticle)
Set the following information as the currently traced particle.
void setupPrimary(G4Track &)
Setup the given G4Track as the current primary particle which we'll process.
This class is attached to G4PrimaryParticle objects as UserInformation. The member variable m_thePart...
virtual void PostUserTrackingAction(const G4Track *) override final
#define ATLAS_THREAD_SAFE
virtual void PreUserTrackingAction(const G4Track *) override
ISF::ISFParticle * m_curBaseISP
The most recent ISFParticle ancestor that triggers the currently processed G4Track.
virtual void UserSteppingAction(const G4Step *) override final
static VTrackInformation * getISFTrackInfo(const G4Track &aTrack)
return a valid UserInformation object of the G4Track for use within the ISF
Define macros for attributes used to control the static checker.
void SetCurrentGenParticle(HepMC::GenParticlePtr p)
set m_currentGenParticle, the pointer to the GenParticle corresponding to the current G4Track.
@ isPrimary
true if matched track has a hit in first or second pixel layer
std::string description
glabal timer - how long have I taken so far?