18#include "GaudiKernel/PhysicalConstants.h"
27#include "G4VProcess.hh"
29#include "G4TrackStatus.hh"
30#include "G4ProcessType.hh"
31#include "G4EmProcessSubType.hh"
32#include "G4DynamicParticle.hh"
33#include "G4PrimaryParticle.hh"
35#include "G4EventManager.hh"
70 m_atlasG4EvtUserInfo(atlasG4EvtUserInfo)
76 const G4StepPoint *postStepPoint =
m_step->GetPostStepPoint();
77 const G4ThreeVector &pos = postStepPoint->GetPosition();
78 const G4double time = postStepPoint->GetGlobalTime()*Gaudi::Units::c_light;
79 m_position.set( pos.x(), pos.y(), pos.z(), time );
87 const G4VProcess *
process =
m_step->GetPostStepPoint()->GetProcessDefinedStep();
89 return process->GetProcessType();
93 const G4VProcess *
process =
m_step->GetPostStepPoint()->GetProcessDefinedStep();
95 return process->GetProcessSubType();
99 const G4ThreeVector & mom=
m_step->GetPreStepPoint()->GetMomentum();
104 const G4ThreeVector & mom=
m_step->GetPreStepPoint()->GetMomentum();
109 return (
m_step->GetPreStepPoint()->GetKineticEnergy()/CLHEP::MeV);
113 return m_step->GetTrack()->GetDefinition()->GetPDGEncoding();
131 return (parent) ? parent->status() : 0;
135 return m_atlasG4EvtUserInfo->GetCurrentGenParticle();
139 const G4Track *track =
m_step->GetTrack();
150 const G4Track *track =
m_step->GetTrack();
189 const G4ThreeVector & mom=
m_children[i]->GetMomentum();
194 const G4ThreeVector & mom=
m_children[i]->GetMomentum();
199 const G4ThreeVector & mom=
m_children[i]->GetMomentum();
204 return (
m_children[i]->GetKineticEnergy()/CLHEP::MeV);
208 return m_children[i]->GetDefinition()->GetPDGEncoding();
218 if (track->GetDynamicParticle() &&
219 track->GetDynamicParticle()->GetPrimaryParticle() &&
220 track->GetDynamicParticle()->GetPrimaryParticle()->GetUserInformation()){
231 const G4Track* thisChildTrack =
m_children[i];
244 thisChildTrack->SetUserInformation(
trackInfo );
247 trackInfo->SetCurrentGenParticle(hepParticle);
256 G4TrackStatus trackStatus = track->GetTrackStatus();
258 if ( trackStatus != fAlive && trackStatus != fStopButAlive ) {
264 if ( !returnedToISF ) {
279 const G4ThreeVector & mom = track->GetMomentum();
280 const double energy = track->GetTotalEnergy();
281 const int pdgCode = track->GetDefinition()->GetPDGEncoding();
282 const HepMC::FourVector fourMomentum( mom.x(), mom.y(), mom.z(), energy);
288 const G4DynamicParticle* dynPart = track->GetDynamicParticle();
289 bool hasPredefinedDecay = (dynPart && (
nullptr!=(dynPart->GetPreAssignedDecayProducts())));
290 status = (hasPredefinedDecay)? 2 : 1;
312 track->GetDynamicParticle() &&
313 track->GetDynamicParticle()->GetPrimaryParticle() &&
314 track->GetDynamicParticle()->GetPrimaryParticle()->GetUserInformation()){
329 const std::vector<const G4Track*>* tracks =
m_step->GetSecondaryInCurrentStep();
330 const int iSize = tracks->size();
332 for(
int i=iSize-1;i>iLast;i--) {
345 G4Track* track=
m_step->GetTrack();
346 const G4DynamicParticle* dynPart = track->GetDynamicParticle();
347 const double preAsgnDecPropTime = dynPart->GetPreAssignedDecayProperTime();
348 const double trackPropTime = track->GetProperTime();
349 bool parentIsQuasiStable = (
nullptr!=(dynPart->GetPreAssignedDecayProducts()));
350 const G4VProcess *
process =
m_step->GetPostStepPoint()->GetProcessDefinedStep();
351 const int processType =
process->GetProcessType();
353 if(parentIsQuasiStable) {
357 else if(processType==6 && (trackPropTime-preAsgnDecPropTime) < -std::numeric_limits<double>::epsilon()) {
365 return classification;
This class is attached to G4Event objects as UserInformation.
The generic ISF particle definition,.
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()
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.
const ISF::ISFParticle & m_baseISP
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.
constexpr int UNDEFINED_ID
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...
bool suggest_barcode(T &p, int i)
GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
GenParticle * GenParticlePtr
InteractionClass_t
The interaction classifications are described as follows: STD_VTX: interaction of a particle without ...