|
ATLAS Offline Software
|
Go to the documentation of this file.
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"
65 ITruthIncident(geoID,
step->GetSecondaryInCurrentStep()->
size()),
70 m_atlasG4EvtUserInfo(atlasG4EvtUserInfo)
76 const G4StepPoint *postStepPoint =
m_step->GetPostStepPoint();
77 const G4ThreeVector &
pos = postStepPoint->GetPosition();
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();
117 auto parent = parentParticle();
123 auto parent = parentParticle();
129 auto parent = parentParticle();
135 return m_atlasG4EvtUserInfo->GetCurrentGenParticle();
139 const G4Track *
track = m_step->GetTrack();
142 if ( particleAlive(
track) ) {
150 const G4Track *
track = m_step->GetTrack();
153 if ( !parentSurvivesIncident() ) {
159 if ( !m_parentParticleAfterIncident ) {
162 m_parentParticleAfterIncident =
convert(
track, newBarcode,
false);
164 m_atlasG4EvtUserInfo->SetCurrentGenParticle( m_parentParticleAfterIncident );
185 return m_parentParticleAfterIncident;
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();
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;
300 track->GetDynamicParticle() &&
301 track->GetDynamicParticle()->GetPrimaryParticle() &&
302 track->GetDynamicParticle()->GetPrimaryParticle()->GetUserInformation()){
317 const std::vector<const G4Track*>* tracks = m_step->GetSecondaryInCurrentStep();
318 const int iSize = tracks->size();
319 const int iLast = iSize - numberOfChildren() - 1;
320 for(
int i=iSize-1;
i>iLast;
i--) {
321 m_children.push_back((*tracks)[
i]);
333 G4Track*
track=m_step->GetTrack();
334 const G4DynamicParticle* dynPart =
track->GetDynamicParticle();
335 bool parentIsQuasiStable = (
nullptr!=(dynPart->GetPreAssignedDecayProducts()));
336 const G4VProcess *
process = m_step->GetPostStepPoint()->GetProcessDefinedStep();
338 const int processSubType =
process->GetProcessSubType();
340 if(parentIsQuasiStable) {
341 if(this->parentSurvivesIncident()) {
351 return classification;
double parentP2() const override final
Return p^2 of the parent particle.
int parentBarcode() override final
Return the barcode 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)
HepMC::GenParticlePtr parentParticle() override final
Return the parent particle as a HepMC particle type.
bool suggest_barcode(T &p, int i)
This class is attached to G4Event objects as UserInformation. It holds a pointer to the HepMC::GenEve...
int parentStatus() override final
Return the status of the parent particle.
int parentUniqueID() override final
Return the unique ID of the parent particle.
constexpr int SIM_STATUS_INCREMENT
Constant defining the barcode threshold for regenerated particles, i.e. particles surviving an intera...
GenParticle * GenParticlePtr
double parentEkin() const override final
Return Ekin of the parent particle.
HepMC::GenParticlePtr convert(const G4Track *particle, const int barcode, const bool secondary) const
HepMC::FourVector m_position
int GetParticleBarcode() const
double childPt2(unsigned short index) const override final
Return pT^2 of the i-th child particle.
int physicsProcessCode() const override final
Return specific physics process code of the truth incident (eg ionisation, bremsstrahlung,...
const HepMC::FourVector & position() const override final
Return HepMC position of the truth vertex.
int physicsProcessCategory() const override final
Return category of the physics process represented by the truth incident (eg hadronic,...
double childEkin(unsigned short index) const override final
Return Ekin of the i-th child particle.
double childP2(unsigned short index) const override final
Return p^2 of the i-th child particle.
constexpr int UNDEFINED_ID
const G4ThreeVector childP(unsigned short index) const
Return p of the i-th child particle.
TrackInformation * GetTrackInformation()
void prepareChildren()
prepare the child particles
constexpr int SIM_STATUS_THRESHOLD
Constant definiting the status threshold for simulated particles, eg. can be used to separate generat...
InteractionClass_t
The interaction classifications are described as follows: STD_VTX: interaction of a particle without ...
std::unique_ptr< MVAUtils::BDT > convert(TMVA::MethodBDT *bdt, bool isRegression=true, bool useYesNoLeaf=false)
bool parentSurvivesIncident() const override final
Return a boolean whether or not the parent particle survives the incident.
This class is attached to G4PrimaryParticle objects as UserInformation. The member variable m_thePart...
bool particleAlive(const G4Track *track) const
check if the given G4Track represents a particle that is alive in ISF or ISF-G4
GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
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 parentPdgCode() const override final
Return the PDG Code of the parent particle.
ISF::InteractionClass_t interactionClassification() const override final
The interaction classifications are described as follows: STD_VTX: interaction of a particle without ...
static VTrackInformation * getISFTrackInfo(const G4Track &aTrack)
return a valid UserInformation object of the G4Track for use within the ISF
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...
double parentPt2() const override final
Return pT^2 of the parent particle.