16#include "GaudiKernel/PhysicalConstants.h"
25#include "G4VProcess.hh"
27#include "G4TrackStatus.hh"
28#include "G4DynamicParticle.hh"
29#include "G4PrimaryParticle.hh"
40 const G4DynamicParticle* dynamicParticle =
track ?
track->GetDynamicParticle() :
nullptr;
41 G4PrimaryParticle* primaryParticle = dynamicParticle ? dynamicParticle->GetPrimaryParticle() :
nullptr;
42 auto* primaryPartInfo = primaryParticle ?
44 return primaryPartInfo ? primaryPartInfo->GetHepMCParticle() :
nullptr;
77 const G4StepPoint *postStepPoint =
m_step->GetPostStepPoint();
78 const G4ThreeVector &pos = postStepPoint->GetPosition();
79 const G4double time = postStepPoint->GetGlobalTime()*Gaudi::Units::c_light;
80 m_position.set( pos.x(), pos.y(), pos.z(), time );
88 const G4VProcess *
process =
m_step->GetPostStepPoint()->GetProcessDefinedStep();
90 return process->GetProcessType();
94 const G4VProcess *
process =
m_step->GetPostStepPoint()->GetProcessDefinedStep();
96 return process->GetProcessSubType();
100 const G4ThreeVector & mom=
m_step->GetPreStepPoint()->GetMomentum();
105 const G4ThreeVector & mom=
m_step->GetPreStepPoint()->GetMomentum();
110 return (
m_step->GetPreStepPoint()->GetKineticEnergy()/CLHEP::MeV);
114 return m_step->GetTrack()->GetDefinition()->GetPDGEncoding();
132 return (parent) ? parent->status() : 0;
142 const G4Track *track =
m_step->GetTrack();
153 const G4Track *track =
m_step->GetTrack();
188 const G4ThreeVector & mom=
m_children[i]->GetMomentum();
193 const G4ThreeVector & mom=
m_children[i]->GetMomentum();
198 const G4ThreeVector & mom=
m_children[i]->GetMomentum();
203 return (
m_children[i]->GetKineticEnergy()/CLHEP::MeV);
207 return m_children[i]->GetDefinition()->GetPDGEncoding();
217 if (track->GetDynamicParticle() &&
218 track->GetDynamicParticle()->GetPrimaryParticle() &&
219 track->GetDynamicParticle()->GetPrimaryParticle()->GetUserInformation()){
230 const G4Track* thisChildTrack =
m_children[i];
243 thisChildTrack->SetUserInformation(
trackInfo );
247 trackInfo->SetPrimaryGenParticle(primary);
249 trackInfo->SetGenerationZeroGenParticle(hepParticle);
250 trackInfo->SetCurrentGenParticle(hepParticle);
259 G4TrackStatus trackStatus = track->GetTrackStatus();
261 if ( trackStatus != fAlive && trackStatus != fStopButAlive ) {
267 if ( !returnedToISF ) {
278 const G4ThreeVector & mom = track->GetMomentum();
279 const double energy = track->GetTotalEnergy();
280 const int pdgCode = track->GetDefinition()->GetPDGEncoding();
289 const G4DynamicParticle* dynPart = track->GetDynamicParticle();
290 bool hasPredefinedDecay = (dynPart && (
nullptr!=(dynPart->GetPreAssignedDecayProducts())));
291 status = (hasPredefinedDecay)? 2 : 1;
313 const std::vector<const G4Track*>* tracks =
m_step->GetSecondaryInCurrentStep();
314 const int iSize = tracks->size();
316 for(
int i=iSize-1;i>iLast;i--) {
329 G4Track* track=
m_step->GetTrack();
330 const G4DynamicParticle* dynPart = track->GetDynamicParticle();
331 const double preAsgnDecPropTime = dynPart->GetPreAssignedDecayProperTime();
332 const double trackPropTime = track->GetProperTime();
333 bool parentIsQuasiStable = (
nullptr!=(dynPart->GetPreAssignedDecayProducts()));
334 const G4VProcess *
process =
m_step->GetPostStepPoint()->GetProcessDefinedStep();
335 const int processType =
process->GetProcessType();
337 if(parentIsQuasiStable) {
341 else if(processType==6 && (trackPropTime-preAsgnDecPropTime) < -std::numeric_limits<double>::epsilon()) {
349 return classification;
size_t size() const
Number of registered mappings.
unsigned short numberOfChildren() const
Return total number of child particles.
AtlasDetDescr::AtlasRegion geoID()
Return the SimGeoID corresponding to the vertex of the truth incident.
ITruthIncident(AtlasDetDescr::AtlasRegion geoID, unsigned short numChildren)
This class is attached to G4PrimaryParticle objects as UserInformation.
int GetParticleBarcode() const
TrackInformation * GetTrackInformation()
Return concrete TrackInformation when callers need fields that are not part of the VTrackInformation ...
int physicsProcessCode() const override final
Return specific physics process code of the truth incident (eg ionisation, bremsstrahlung,...
double childEkin(unsigned short index) const override final
Return Ekin of the i-th child particle.
int parentBarcode() override final
Return the barcode of the parent particle.
HepMC::GenParticlePtr m_parentParticleAfterIncident
double parentPt2() const override final
Return pT^2 of the parent particle.
bool particleAlive(const G4Track *track) const
check if the given G4Track represents a particle that is alive in ISF or ISF-G4
int childBarcode(unsigned short index) const override final
Return the barcode of the i-th child particle (if defined as part of the TruthIncident) otherwise ret...
HepMC::FourVector m_position
double childP2(unsigned short index) const override final
Return p^2 of the i-th child particle.
int parentStatus() override final
Return the status of the parent particle.
HepMC::GenParticlePtr parentParticleAfterIncident(int newBC) override final
Return the parent particle after the TruthIncident vertex (and give it a new barcode).
ISF::InteractionClass_t interactionClassification() const override final
The interaction classifications are described as follows: STD_VTX: interaction of a particle without ...
int physicsProcessCategory() const override final
Return category of the physics process represented by the truth incident (eg hadronic,...
const HepMC::FourVector & position() const override final
Return HepMC position of the truth vertex.
bool parentSurvivesIncident() const override final
Return a boolean whether or not the parent particle survives the incident.
int parentPdgCode() const override final
Return the PDG Code of the parent particle.
HepMC::GenParticlePtr childParticle(unsigned short index, int bc) override final
Return the i-th child as a HepMC particle type and assign the given Barcode to the simulator particle...
int childPdgCode(unsigned short index) const override final
Return the PDG Code of the i-th child particle.
int parentUniqueID() override final
Return the unique ID of the parent particle.
void prepareChildren()
prepare the child particles
double parentP2() const override final
Return p^2 of the parent particle.
std::vector< const G4Track * > m_children
double childPt2(unsigned short index) const override final
Return pT^2 of the i-th child particle.
double parentEkin() const override final
Return Ekin of the parent particle.
HepMC::GenParticlePtr parentParticle() override final
Return the parent particle as a HepMC particle type.
const G4ThreeVector childP(unsigned short index) const
Return p of the i-th child particle.
HepMC::GenParticlePtr convert(const G4Track *particle, const int barcode, const bool secondary) const
static VTrackInformation * getISFTrackInfo(const G4Track &aTrack)
return a valid UserInformation object of the G4Track for use within the ISF
const std::string process
AtlasRegion
A simple enum of ATLAS regions and sub-detectors.
HepMC3::FourVector FourVector
constexpr int UNDEFINED_ID
GenParticlePtr newGenParticlePtr(const HepMC3::FourVector &mom=HepMC3::FourVector::ZERO_VECTOR(), int pid=0, int status=0)
constexpr int SIM_STATUS_INCREMENT
Constant defining the barcode threshold for regenerated particles, i.e. particles surviving an intera...
constexpr int SIM_STATUS_THRESHOLD
Constant definiting the status threshold for simulated particles, eg. can be used to separate generat...
HepMC3::GenParticlePtr GenParticlePtr
InteractionClass_t
The interaction classifications are described as follows: STD_VTX: interaction of a particle without ...