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"
72#ifdef ATHSIMULATION_USE_ADEPT
83 const std::vector<const G4Track*> *secondaryVector = aStep->GetSecondaryInCurrentStep();
84 if (secondaryVector && !secondaryVector->empty()) {
85 for (
auto* aConstSecondaryTrack : *secondaryVector ) {
87 G4Track* aSecondaryTrack
ATLAS_THREAD_SAFE =
const_cast<G4Track*
>( aConstSecondaryTrack );
93 if (!particleReturnedToISF) {
98 generationZeroGenParticle );
110#ifdef ATHSIMULATION_USE_ADEPT
114 bool isPrimary = ! aTrack->GetParentID();
135 <<
"Started simulation of primary particle which already has a TrackInformation/TrackBarcodeInfo object attached (trackID: "
136 << aTrack.GetTrackID() <<
", track pos: "<<aTrack.GetPosition() <<
", mom: "<<aTrack.GetMomentum()
137 <<
", parentID " << aTrack.GetParentID() <<
")";
138 G4Exception(
"iGeant4::TrackProcessorUserActionBase",
"TrackInformationAlreadyExists", FatalException,
description);
142 auto* primaryPartInfo =
dynamic_cast <PrimaryParticleInformation*
> (aTrack.GetDynamicParticle()->GetPrimaryParticle()->GetUserInformation());
143 if (!primaryPartInfo) {
145 description << G4String(
"PreUserTrackingAction: ") +
"NULL PrimaryParticleInformation pointer for current G4Step (trackID "
146 << aTrack.GetTrackID() <<
", track pos: "<<aTrack.GetPosition() <<
", mom: "<<aTrack.GetMomentum()
147 <<
", parentID " << aTrack.GetParentID() <<
")";
148 G4Exception(
"iGeant4::TrackProcessorUserActionBase",
"NoPPInfo", FatalException,
description);
156 description << G4String(
"PreUserTrackingAction: ") +
"No ISFParticle associated with primary particle (trackID: "
157 << aTrack.GetTrackID() <<
", track pos: "<<aTrack.GetPosition() <<
", mom: "<<aTrack.GetMomentum()
158 <<
", parentID " << aTrack.GetParentID() <<
")";
159 G4Exception(
"iGeant4::TrackProcessorUserActionBase",
"NoISFParticle", FatalException,
description);
166 description << G4String(
"PreUserTrackingAction: ") +
"No ISF::TruthBinding associated with primary particle (trackID: "
167 << aTrack.GetTrackID() <<
", track pos: "<<aTrack.GetPosition() <<
", mom: "<<aTrack.GetMomentum()
168 <<
", parentID " << aTrack.GetParentID() <<
")";
169 G4Exception(
"iGeant4::TrackProcessorUserActionBase",
"NoISFTruthBinding", FatalException,
description);
173 int regenerationNr = primaryPartInfo->GetRegenerationNr();
179 auto classification =
classify(primaryGenParticle,
180 generationZeroGenParticle,
187 generationZeroGenParticle );
188 newTrackInfo->SetRegenerationNr(regenerationNr);
225 int regenerationNumber)
const
229 if (currentGenParticle) {
230 if (currentGenParticle == primaryGenParticle) {
233 else if (generationZeroGenParticle == primaryGenParticle && regenerationNumber>0) {
Define macros for attributes used to control the static checker.
#define ATLAS_THREAD_SAFE
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.
virtual void PreUserTrackingAction(const G4Track *) override
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 PostUserTrackingAction(const G4Track *) override final
virtual void UserSteppingAction(const G4Step *) override final
ISF::ISFParticleContainer m_storedSecondaries
void setupPrimary(G4Track &)
Setup the given G4Track as the current primary particle which we'll process.
void setupSecondary(const G4Track &)
Setup the given G4Track as the current secondary particle which we'll process.
void updateCachedParticleInfo(ISF::ISFParticle *baseISFParticle, HepMC::ConstGenParticlePtr primaryGenParticle, HepMC::GenParticlePtr currentGenParticle)
Set the following information as the currently traced particle.
AtlasG4EventUserInfo * m_atlasG4EvtUserInfo
event-global G4 UserInformation
ISF::ISFParticleContainer ReturnSecondaries(ISF::ISFParticle const *parent)
virtual void BeginOfEventAction(const G4Event *) override final
ISF::ISFParticle * m_curBaseISP
The most recent ISFParticle ancestor that triggers the currently processed G4Track.
The generic ISF particle definition,.
HepMC::GenParticlePtr getCurrentGenParticle()
pointer to the particle in the simulation truth
HepMC::GenParticlePtr getGenerationZeroGenParticle()
pointer to the simulation truth particle before any regeneration happened (eg.
This class is attached to G4PrimaryParticle objects as UserInformation.
const ISF::ISFParticle * GetISFParticle() const
return a pointer to the ISFParticle used to create the G4PrimaryParticle
static VTrackInformation * getISFTrackInfo(const G4Track &aTrack)
return a valid UserInformation object of the G4Track for use within the ISF
static AtlasG4EventUserInfo * getAtlasG4EventUserInfo()
return pointer to current AtlasG4EventUserInfo
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...
std::string description
glabal timer - how long have I taken so far?
HepMC3::GenParticlePtr GenParticlePtr
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
std::list< ISF::ISFParticle * > ISFParticleContainer
generic ISFParticle container (not necessarily a std::list!)
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)