ATLAS Offline Software
Loading...
Searching...
No Matches
iGeant4::Geant4TruthIncident Class Reference

ISF_Geant4 specific implementation of the ISF::ITruthIncident. More...

#include <Geant4TruthIncident.h>

Inheritance diagram for iGeant4::Geant4TruthIncident:
Collaboration diagram for iGeant4::Geant4TruthIncident:

Public Member Functions

 Geant4TruthIncident (const G4Step *, AtlasDetDescr::AtlasRegion geoID)
virtual ~Geant4TruthIncident ()
const HepMC::FourVectorposition () 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, em, ..).
int physicsProcessCode () const override final
 Return specific physics process code of the truth incident (eg ionisation, bremsstrahlung, ..).
double parentP2 () const override final
 Return p^2 of the parent particle.
double parentPt2 () const override final
 Return pT^2 of the parent particle.
double parentEkin () const override final
 Return Ekin of the parent particle.
int parentPdgCode () const override final
 Return the PDG Code of the parent particle.
int parentBarcode () override final
 Return the barcode of the parent particle.
int parentUniqueID () override final
 Return the unique ID of the parent particle.
int parentStatus () override final
 Return the status of the parent particle.
bool parentSurvivesIncident () const override final
 Return a boolean whether or not the parent particle survives the incident.
HepMC::GenParticlePtr parentParticleAfterIncident (int newBC) override final
 Return the parent particle after the TruthIncident vertex (and give it a new barcode).
const G4ThreeVector childP (unsigned short index) const
 Return p of the i-th child particle.
double childP2 (unsigned short index) const override final
 Return p^2 of the i-th child particle.
double childPt2 (unsigned short index) const override final
 Return pT^2 of the i-th child particle.
double childEkin (unsigned short index) const override final
 Return Ekin of the i-th child particle.
int childPdgCode (unsigned short index) const override final
 Return the PDG Code of the i-th child particle.
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 return 0.
ISF::InteractionClass_t interactionClassification () const override final
 The interaction classifications are described as follows: STD_VTX: interaction of a particle without a pre-defined decay; QS_SURV_VTX: a particle with a pre-defined decay under-going a non-destructive interaction; QS_DEST_VTX: a particle with a pre-defined decay under-going a destructive interaction other than its pre-defined decay; QS_PREDEF_VTX: a particle under-going its pre-defined decay.
HepMC::GenParticlePtr parentParticle () override final
 Return the parent particle as a HepMC particle type.
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.
AtlasDetDescr::AtlasRegion geoID ()
 Return the SimGeoID corresponding to the vertex of the truth incident.
unsigned short numberOfChildren () const
 Return total number of child particles.
bool childrenP2Pass (double p2cut)
 Return true if at least one child particle passes the given p^2 cut (= at least one child with p^2 >= pt2cut).
bool childrenPt2Pass (double pt2cut)
 Return true if at least one child particle passes the given pT^2 cut (= at least one child with pT^2 >= pt2cut).
bool childrenEkinPass (double ekincut)
 Return true if at least one child particle passes the given Ekin cut (= at least one child with Ekin >= ekincut).
void setChildPassedFilters (unsigned short index)
 Record that a particular child passed a check.
bool childPassedFilters (unsigned short index) const
 Should a particular child be written out to the GenEvent.
void setPassWholeVertices (bool passWholeVertex)
 Set whether this TruthIncident should pass the vertex as a whole or individual children.

Protected Attributes

int m_numChildren
bool m_passWholeVertex
std::vector< bool > m_childPassedFilters

Private Member Functions

 Geant4TruthIncident ()
void prepareChildren ()
 prepare the child particles
bool particleAlive (const G4Track *track) const
 check if the given G4Track represents a particle that is alive in ISF or ISF-G4
HepMC::GenParticlePtr convert (const G4Track *particle, const int barcode, const bool secondary) const

Private Attributes

bool m_positionSet
HepMC::FourVector m_position
const G4Step * m_step {}
std::vector< const G4Track * > m_children
HepMC::GenParticlePtr m_parentParticleAfterIncident {}
AtlasDetDescr::AtlasRegion m_geoID
 region that the TruthIncident is located in

Detailed Description

ISF_Geant4 specific implementation of the ISF::ITruthIncident.

Author
Andre.nosp@m.as.S.nosp@m.chael.nosp@m.icke.nosp@m.@cern.nosp@m..ch

Definition at line 42 of file Geant4TruthIncident.h.

Constructor & Destructor Documentation

◆ Geant4TruthIncident() [1/2]

iGeant4::Geant4TruthIncident::Geant4TruthIncident ( const G4Step * step,
AtlasDetDescr::AtlasRegion geoID )

Definition at line 66 of file Geant4TruthIncident.cxx.

67 :
68 ITruthIncident(geoID, step->GetSecondaryInCurrentStep()->size()), // switch to G4Step::GetNumberOfSecondariesInCurrentStep() once we're using G4 10.2 or later
69 m_positionSet(false),
70 m_position(),
71 m_step(step)
72{
73 // prepare children:
75
76 // calculate position:
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 );
81}
AtlasDetDescr::AtlasRegion geoID()
Return the SimGeoID corresponding to the vertex of the truth incident.
ITruthIncident(AtlasDetDescr::AtlasRegion geoID, unsigned short numChildren)
void prepareChildren()
prepare the child particles
time(flags, cells_name, *args, **kw)

◆ ~Geant4TruthIncident()

virtual iGeant4::Geant4TruthIncident::~Geant4TruthIncident ( )
inlinevirtual

Definition at line 46 of file Geant4TruthIncident.h.

46{};

◆ Geant4TruthIncident() [2/2]

iGeant4::Geant4TruthIncident::Geant4TruthIncident ( )
private

Member Function Documentation

◆ childBarcode()

int iGeant4::Geant4TruthIncident::childBarcode ( unsigned short index) const
finaloverridevirtual

Return the barcode of the i-th child particle (if defined as part of the TruthIncident) otherwise return 0.

Implements ISF::ITruthIncident.

Definition at line 210 of file Geant4TruthIncident.cxx.

210 {
211 // the G4Track instance for the current child particle
212 const G4Track* track = m_children[index];
213 // This should be a *secondary* track. If it has a primary, it was a decay and
214 // we are running with quasi-stable particle simulation. Note that if the primary
215 // track is passed in as a secondary that survived the interaction, then this was
216 // *not* a decay and we should not treat it in this way
217 if (track->GetDynamicParticle() &&
218 track->GetDynamicParticle()->GetPrimaryParticle() &&
219 track->GetDynamicParticle()->GetPrimaryParticle()->GetUserInformation()){
220 // Then the new particle should use the same barcode as the old one!!
221 PrimaryParticleInformation* primaryPartInfo = dynamic_cast<PrimaryParticleInformation*>( track->GetDynamicParticle()->GetPrimaryParticle()->GetUserInformation() );
222 return primaryPartInfo->GetParticleBarcode();
223 }
224 return 0;
225}
std::vector< const G4Track * > m_children
str index
Definition DeMoScan.py:362

◆ childEkin()

double iGeant4::Geant4TruthIncident::childEkin ( unsigned short index) const
finaloverridevirtual

Return Ekin of the i-th child particle.

Implements ISF::ITruthIncident.

Definition at line 202 of file Geant4TruthIncident.cxx.

202 {
203 return (m_children[i]->GetKineticEnergy()/CLHEP::MeV);
204}

◆ childP()

const G4ThreeVector iGeant4::Geant4TruthIncident::childP ( unsigned short index) const

Return p of the i-th child particle.

Definition at line 192 of file Geant4TruthIncident.cxx.

192 {
193 const G4ThreeVector & mom= m_children[i]->GetMomentum();
194 return mom;
195}

◆ childP2()

double iGeant4::Geant4TruthIncident::childP2 ( unsigned short index) const
finaloverridevirtual

Return p^2 of the i-th child particle.

Implements ISF::ITruthIncident.

Definition at line 187 of file Geant4TruthIncident.cxx.

187 {
188 const G4ThreeVector & mom= m_children[i]->GetMomentum();
189 return mom.mag2();
190}

◆ childParticle()

HepMC::GenParticlePtr iGeant4::Geant4TruthIncident::childParticle ( unsigned short index,
int bc )
finaloverridevirtual

Return the i-th child as a HepMC particle type and assign the given Barcode to the simulator particle.

Implements ISF::ITruthIncident.

Definition at line 227 of file Geant4TruthIncident.cxx.

228 {
229 // the G4Track instance for the current child particle
230 const G4Track* thisChildTrack = m_children[i];
231
232 // NB: NOT checking if secondary is actually alive. Even with zero momentum,
233 // secondary could decay right away and create further particles which pass the
234 // truth strategies.
235
236 HepMC::GenParticlePtr hepParticle = convert( thisChildTrack, newBarcode, true );
237 TrackHelper tHelper(thisChildTrack);
238 TrackInformation *trackInfo = tHelper.GetTrackInformation();
239
240 // needed to make AtlasG4 work with ISF TruthService
241 if (trackInfo==nullptr) {
242 trackInfo = new TrackInformation( hepParticle );
243 thisChildTrack->SetUserInformation( trackInfo );
244 }
245
246 if (HepMC::GenParticlePtr primary = primaryGenParticle(m_step->GetTrack())) {
247 trackInfo->SetPrimaryGenParticle(primary);
248 }
249 trackInfo->SetGenerationZeroGenParticle(hepParticle);
250 trackInfo->SetCurrentGenParticle(hepParticle);
252 trackInfo->SetRegenerationNr(0);
253
254 return hepParticle;
255}
virtual void SetGenerationZeroGenParticle(HepMC::GenParticlePtr) override
set m_generationZeroGenParticle, the pointer to the simulation truth particle before any regeneration...
void SetRegenerationNr(int i)
update the number of times the particle represented by the G4Track has undergone a non-destructive in...
virtual void SetCurrentGenParticle(HepMC::GenParticlePtr) override
set m_currentGenParticle, the pointer to the GenParticle corresponding to the current G4Track.
void SetPrimaryGenParticle(HepMC::GenParticlePtr)
set the pointer to the GenParticle used to create the initial G4PrimaryParticle from which the curren...
void SetClassification(TrackClassification tc)
update the classification of the currently tracked particle, usually called when a new G4Track is cre...
HepMC::GenParticlePtr convert(const G4Track *particle, const int barcode, const bool secondary) const
HepMC3::GenParticlePtr GenParticlePtr
Definition GenParticle.h:19

◆ childPassedFilters()

bool ISF::ITruthIncident::childPassedFilters ( unsigned short index) const
inlineinherited

Should a particular child be written out to the GenEvent.

Definition at line 186 of file ITruthIncident.h.

186 {
188 }
std::vector< bool > m_childPassedFilters

◆ childPdgCode()

int iGeant4::Geant4TruthIncident::childPdgCode ( unsigned short index) const
finaloverridevirtual

Return the PDG Code of the i-th child particle.

Implements ISF::ITruthIncident.

Definition at line 206 of file Geant4TruthIncident.cxx.

206 {
207 return m_children[i]->GetDefinition()->GetPDGEncoding();
208}

◆ childPt2()

double iGeant4::Geant4TruthIncident::childPt2 ( unsigned short index) const
finaloverridevirtual

Return pT^2 of the i-th child particle.

Implements ISF::ITruthIncident.

Definition at line 197 of file Geant4TruthIncident.cxx.

197 {
198 const G4ThreeVector & mom= m_children[i]->GetMomentum();
199 return mom.perp2();
200}

◆ childrenEkinPass()

bool ISF::ITruthIncident::childrenEkinPass ( double ekincut)
inlineinherited

Return true if at least one child particle passes the given Ekin cut (= at least one child with Ekin >= ekincut).

Definition at line 170 of file ITruthIncident.h.

170 {
171 bool pass = false; // true if cut passed
172 // as soon as at a particle passes the cut -> end loop and return true
173 for ( unsigned short i=0; !(pass && m_passWholeVertex) && (i<m_numChildren); ++i) {
174 bool thispassed = (childEkin(i) >= ekincut);
175 if(thispassed) { setChildPassedFilters(i); }
176 pass |= thispassed;
177 }
178 return pass;
179 }
void setChildPassedFilters(unsigned short index)
Record that a particular child passed a check.
virtual double childEkin(unsigned short index) const =0
Return Ekin of the i-th child particle.

◆ childrenP2Pass()

bool ISF::ITruthIncident::childrenP2Pass ( double p2cut)
inlineinherited

Return true if at least one child particle passes the given p^2 cut (= at least one child with p^2 >= pt2cut).

Definition at line 146 of file ITruthIncident.h.

146 {
147 bool pass = false; // true if cut passed
148 // as soon as at a particle passes the cut -> end loop and return true
149 for ( unsigned short i=0; !(pass && m_passWholeVertex) && (i<m_numChildren); ++i) {
150 bool thispassed = (childP2(i) >= p2cut);
151 if(thispassed) { setChildPassedFilters(i); }
152 pass |= thispassed;
153 }
154 return pass;
155 }
virtual double childP2(unsigned short index) const =0
Return p^2 of the i-th child particle.

◆ childrenPt2Pass()

bool ISF::ITruthIncident::childrenPt2Pass ( double pt2cut)
inlineinherited

Return true if at least one child particle passes the given pT^2 cut (= at least one child with pT^2 >= pt2cut).

Definition at line 158 of file ITruthIncident.h.

158 {
159 bool pass = false; // true if cut passed
160 // as soon as at a particle passes the cut -> end loop and return true
161 for ( unsigned short i=0; !(pass && m_passWholeVertex) && (i<m_numChildren); ++i) {
162 bool thispassed = (childPt2(i) >= pt2cut);
163 if(thispassed) { setChildPassedFilters(i); }
164 pass |= thispassed;
165 }
166 return pass;
167 }
virtual double childPt2(unsigned short index) const =0
Return pT^2 of the i-th child particle.

◆ convert()

HepMC::GenParticlePtr iGeant4::Geant4TruthIncident::convert ( const G4Track * particle,
const int barcode,
const bool secondary ) const
private

Definition at line 276 of file Geant4TruthIncident.cxx.

276 {
277
278 const G4ThreeVector & mom = track->GetMomentum();
279 const double energy = track->GetTotalEnergy();
280 const int pdgCode = track->GetDefinition()->GetPDGEncoding();
281 const HepMC::FourVector fourMomentum( mom.x(), mom.y(), mom.z(), energy);
282
283 TrackHelper tHelper(m_step->GetTrack());
284 TrackInformation* trackInfo = tHelper.GetTrackInformation();
285 const HepMC::GenParticlePtr parent = trackInfo ? trackInfo->GetCurrentGenParticle() : nullptr;
286 int status = (secondary) ? 1 + HepMC::SIM_STATUS_THRESHOLD : parent->status() + HepMC::SIM_STATUS_INCREMENT;
287 // Treat child particles of pre-defined decays differently
289 const G4DynamicParticle* dynPart = track->GetDynamicParticle();
290 bool hasPredefinedDecay = (dynPart && (nullptr!=(dynPart->GetPreAssignedDecayProducts())));
291 status = (hasPredefinedDecay)? 2 : 1;
292 }
293 // Treat particles with a pre-defined decay which have survived an
294 // interaction differently for now.
297 // Such particles were previously assigned barcodes below
298 // HepMC::SIM_BARCODE_OFFSET and therefore
299 // HepMC::is_simulation_particle(barcode) would return false. Not
300 // applying HepMC::SIM_STATUS_INCREMENT means that
301 // HepMC::is_simulation_particle(status) will also return false.
302 // TODO This should be revisited in the future should we decide
303 // that we want to be able to easily identify such particles.
304 }
305 HepMC::GenParticlePtr newParticle = HepMC::newGenParticlePtr(fourMomentum, pdgCode, status);
306
307 return newParticle;
308}
virtual HepMC::ConstGenParticlePtr GetCurrentGenParticle() const override
return a pointer to the GenParticle corresponding to the current G4Track (if there is one).
ISF::InteractionClass_t interactionClassification() const override final
The interaction classifications are described as follows: STD_VTX: interaction of a particle without ...
HepMC3::FourVector FourVector
GenParticlePtr newGenParticlePtr(const HepMC3::FourVector &mom=HepMC3::FourVector::ZERO_VECTOR(), int pid=0, int status=0)
Definition GenParticle.h:21
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...
@ QS_SURV_VTX
@ QS_PREDEF_VTX
status
Definition merge.py:16

◆ geoID()

AtlasDetDescr::AtlasRegion ISF::ITruthIncident::geoID ( )
inlineinherited

Return the SimGeoID corresponding to the vertex of the truth incident.

Definition at line 53 of file ITruthIncident.h.

53{ return m_geoID; };
AtlasDetDescr::AtlasRegion m_geoID
region that the TruthIncident is located in

◆ interactionClassification()

ISF::InteractionClass_t iGeant4::Geant4TruthIncident::interactionClassification ( ) const
finaloverridevirtual

The interaction classifications are described as follows: STD_VTX: interaction of a particle without a pre-defined decay; QS_SURV_VTX: a particle with a pre-defined decay under-going a non-destructive interaction; QS_DEST_VTX: a particle with a pre-defined decay under-going a destructive interaction other than its pre-defined decay; QS_PREDEF_VTX: a particle under-going its pre-defined decay.

Reimplemented from ISF::ITruthIncident.

Definition at line 328 of file Geant4TruthIncident.cxx.

328 {
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) {
338 if(this->parentSurvivesIncident()) {
339 classification = ISF::QS_SURV_VTX;
340 }
341 else if(processType==6 && (trackPropTime-preAsgnDecPropTime) < -std::numeric_limits<double>::epsilon()) {
342 // Particle decayed before its expected pre-defined decay time
343 classification = ISF::QS_DEST_VTX;
344 }
345 else {
346 classification = ISF::QS_PREDEF_VTX;
347 }
348 }
349 return classification;
350 // end of code to determine interaction type
351}
bool parentSurvivesIncident() const override final
Return a boolean whether or not the parent particle survives the incident.
const std::string process
InteractionClass_t
The interaction classifications are described as follows: STD_VTX: interaction of a particle without ...
@ QS_DEST_VTX

◆ numberOfChildren()

unsigned short ISF::ITruthIncident::numberOfChildren ( ) const
inlineinherited

Return total number of child particles.

Definition at line 139 of file ITruthIncident.h.

139 {
140 return m_numChildren;
141 }

◆ parentBarcode()

int iGeant4::Geant4TruthIncident::parentBarcode ( )
finaloverridevirtual

Return the barcode of the parent particle.

Implements ISF::ITruthIncident.

Definition at line 117 of file Geant4TruthIncident.cxx.

117 { // TODO Remove this method
118 auto parent = parentParticle();
119
120 return (parent) ? HepMC::barcode(parent) : HepMC::UNDEFINED_ID;
121}
HepMC::GenParticlePtr parentParticle() override final
Return the parent particle as a HepMC particle type.
int barcode(const T *p)
Definition Barcode.h:15
constexpr int UNDEFINED_ID

◆ parentEkin()

double iGeant4::Geant4TruthIncident::parentEkin ( ) const
finaloverridevirtual

Return Ekin of the parent particle.

Implements ISF::ITruthIncident.

Definition at line 109 of file Geant4TruthIncident.cxx.

109 {
110 return (m_step->GetPreStepPoint()->GetKineticEnergy()/CLHEP::MeV);
111}

◆ parentP2()

double iGeant4::Geant4TruthIncident::parentP2 ( ) const
finaloverridevirtual

Return p^2 of the parent particle.

Implements ISF::ITruthIncident.

Definition at line 99 of file Geant4TruthIncident.cxx.

99 {
100 const G4ThreeVector & mom= m_step->GetPreStepPoint()->GetMomentum();
101 return mom.mag2();
102}

◆ parentParticle()

HepMC::GenParticlePtr iGeant4::Geant4TruthIncident::parentParticle ( )
finaloverridevirtual

Return the parent particle as a HepMC particle type.

Implements ISF::ITruthIncident.

Definition at line 135 of file Geant4TruthIncident.cxx.

135 {
136 TrackHelper tHelper(m_step->GetTrack());
137 TrackInformation *tInfo = tHelper.GetTrackInformation();
138 return tInfo ? tInfo->GetCurrentGenParticle() : nullptr;
139}

◆ parentParticleAfterIncident()

HepMC::GenParticlePtr iGeant4::Geant4TruthIncident::parentParticleAfterIncident ( int newBC)
finaloverridevirtual

Return the parent particle after the TruthIncident vertex (and give it a new barcode).

Implements ISF::ITruthIncident.

Definition at line 152 of file Geant4TruthIncident.cxx.

152 {
153 const G4Track *track = m_step->GetTrack();
154
155 // check if particle is a alive in G4 or in ISF
156 if ( !parentSurvivesIncident() ) {
157 return nullptr;
158 }
159
160 // internally cache the HepMC representation of the parent particle
161 // (to allow multiple calls to this method on the same instance)
163 // create new HepMC particle, using momentum and energy
164 // from G4DynamicParticle (which should be equivalent to postStep)
165 m_parentParticleAfterIncident = convert(track, newBarcode, false);
166
167 // store (new) hepmc particle in track's UserInformation
168 TrackHelper tHelper(track);
169 TrackInformation *tInfo = tHelper.GetTrackInformation();
170 if (tInfo) {
172 int regenerationNr = tInfo->GetRegenerationNr();
173 regenerationNr++;
174 tInfo->SetRegenerationNr(regenerationNr);
175 if ( tHelper.IsPrimary() ) {
177 }
178 }
179
180 } // <-- end if m_parentParticleAfterIncident is not filled
181
182
183 // return the HepMC particle representation of the parent
185}
int GetRegenerationNr() const
return the number of times the particle represented by the G4Track has undergone a non-destructive in...
HepMC::GenParticlePtr m_parentParticleAfterIncident

◆ parentPdgCode()

int iGeant4::Geant4TruthIncident::parentPdgCode ( ) const
finaloverridevirtual

Return the PDG Code of the parent particle.

Implements ISF::ITruthIncident.

Definition at line 113 of file Geant4TruthIncident.cxx.

113 {
114 return m_step->GetTrack()->GetDefinition()->GetPDGEncoding();
115}

◆ parentPt2()

double iGeant4::Geant4TruthIncident::parentPt2 ( ) const
finaloverridevirtual

Return pT^2 of the parent particle.

Implements ISF::ITruthIncident.

Definition at line 104 of file Geant4TruthIncident.cxx.

104 {
105 const G4ThreeVector & mom= m_step->GetPreStepPoint()->GetMomentum();
106 return mom.perp2();
107}

◆ parentStatus()

int iGeant4::Geant4TruthIncident::parentStatus ( )
finaloverridevirtual

Return the status of the parent particle.

Implements ISF::ITruthIncident.

Definition at line 129 of file Geant4TruthIncident.cxx.

129 {
130 auto parent = parentParticle();
131
132 return (parent) ? parent->status() : 0;
133}

◆ parentSurvivesIncident()

bool iGeant4::Geant4TruthIncident::parentSurvivesIncident ( ) const
finaloverridevirtual

Return a boolean whether or not the parent particle survives the incident.

Implements ISF::ITruthIncident.

Definition at line 141 of file Geant4TruthIncident.cxx.

141 {
142 const G4Track *track = m_step->GetTrack();
143
144 // check if particle is a alive in G4 or in ISF
145 if ( particleAlive(track) ) {
146 return true;
147 } else {
148 return false;
149 }
150}
bool particleAlive(const G4Track *track) const
check if the given G4Track represents a particle that is alive in ISF or ISF-G4

◆ parentUniqueID()

int iGeant4::Geant4TruthIncident::parentUniqueID ( )
finaloverridevirtual

Return the unique ID of the parent particle.

Implements ISF::ITruthIncident.

Definition at line 123 of file Geant4TruthIncident.cxx.

123 {
124 auto parent = parentParticle();
125
126 return (parent) ? HepMC::uniqueID(parent) : HepMC::UNDEFINED_ID;
127}
int uniqueID(const T &p)

◆ particleAlive()

bool iGeant4::Geant4TruthIncident::particleAlive ( const G4Track * track) const
inlineprivate

check if the given G4Track represents a particle that is alive in ISF or ISF-G4

Definition at line 258 of file Geant4TruthIncident.cxx.

258 {
259 G4TrackStatus trackStatus = track->GetTrackStatus();
260
261 if ( trackStatus != fAlive && trackStatus != fStopButAlive ) {
262 // parent does not exist in G4 anymore after this step
263
264 // check whether the particle was returned to ISF
265 auto* trackInfo = ISFG4Helper::getISFTrackInfo( *track );
266 bool returnedToISF = trackInfo ? trackInfo->GetReturnedToISF() : false;
267 if ( !returnedToISF ) {
268 // particle was not sent to ISF either
269 return false;
270 }
271 }
272
273 return true;
274}
static VTrackInformation * getISFTrackInfo(const G4Track &aTrack)
return a valid UserInformation object of the G4Track for use within the ISF

◆ physicsProcessCategory()

int iGeant4::Geant4TruthIncident::physicsProcessCategory ( ) const
finaloverridevirtual

Return category of the physics process represented by the truth incident (eg hadronic, em, ..).

Implements ISF::ITruthIncident.

Definition at line 87 of file Geant4TruthIncident.cxx.

87 {
88 const G4VProcess *process = m_step->GetPostStepPoint()->GetProcessDefinedStep();
89 // TODO: need to check that G4ProcessSubTypes Match int
90 return process->GetProcessType();
91}

◆ physicsProcessCode()

int iGeant4::Geant4TruthIncident::physicsProcessCode ( ) const
finaloverridevirtual

Return specific physics process code of the truth incident (eg ionisation, bremsstrahlung, ..).

Implements ISF::ITruthIncident.

Definition at line 93 of file Geant4TruthIncident.cxx.

93 {
94 const G4VProcess *process = m_step->GetPostStepPoint()->GetProcessDefinedStep();
95 // TODO: need to check that G4ProcessSubTypes Match int
96 return process->GetProcessSubType();
97}

◆ position()

const HepMC::FourVector & iGeant4::Geant4TruthIncident::position ( ) const
finaloverridevirtual

Return HepMC position of the truth vertex.

Implements ISF::ITruthIncident.

Definition at line 83 of file Geant4TruthIncident.cxx.

83 {
84 return m_position;
85}

◆ prepareChildren()

void iGeant4::Geant4TruthIncident::prepareChildren ( )
inlineprivate

prepare the child particles

Definition at line 311 of file Geant4TruthIncident.cxx.

311 {
312
313 const std::vector<const G4Track*>* tracks = m_step->GetSecondaryInCurrentStep();
314 const int iSize = tracks->size();
315 const int iLast = iSize - numberOfChildren() - 1; //NB can be -1.
316 for(int i=iSize-1;i>iLast;i--) {
317 m_children.push_back((*tracks)[i]);
318 }
319}
unsigned short numberOfChildren() const
Return total number of child particles.

◆ setChildPassedFilters()

void ISF::ITruthIncident::setChildPassedFilters ( unsigned short index)
inlineinherited

Record that a particular child passed a check.

Definition at line 181 of file ITruthIncident.h.

181 {
183 return;
184 }

◆ setPassWholeVertices()

void ISF::ITruthIncident::setPassWholeVertices ( bool passWholeVertex)
inlineinherited

Set whether this TruthIncident should pass the vertex as a whole or individual children.

Definition at line 190 of file ITruthIncident.h.

190 {
191 m_passWholeVertex=passWholeVertex;
192 }

Member Data Documentation

◆ m_childPassedFilters

std::vector<bool> ISF::ITruthIncident::m_childPassedFilters
protectedinherited

Definition at line 131 of file ITruthIncident.h.

◆ m_children

std::vector<const G4Track*> iGeant4::Geant4TruthIncident::m_children
private

Definition at line 120 of file Geant4TruthIncident.h.

◆ m_geoID

AtlasDetDescr::AtlasRegion ISF::ITruthIncident::m_geoID
privateinherited

region that the TruthIncident is located in

Definition at line 127 of file ITruthIncident.h.

◆ m_numChildren

int ISF::ITruthIncident::m_numChildren
protectedinherited

Definition at line 129 of file ITruthIncident.h.

◆ m_parentParticleAfterIncident

HepMC::GenParticlePtr iGeant4::Geant4TruthIncident::m_parentParticleAfterIncident {}
private

Definition at line 122 of file Geant4TruthIncident.h.

122{};

◆ m_passWholeVertex

bool ISF::ITruthIncident::m_passWholeVertex
protectedinherited

Definition at line 130 of file ITruthIncident.h.

◆ m_position

HepMC::FourVector iGeant4::Geant4TruthIncident::m_position
private

Definition at line 117 of file Geant4TruthIncident.h.

◆ m_positionSet

bool iGeant4::Geant4TruthIncident::m_positionSet
private

Definition at line 116 of file Geant4TruthIncident.h.

◆ m_step

const G4Step* iGeant4::Geant4TruthIncident::m_step {}
private

Definition at line 118 of file Geant4TruthIncident.h.

118{};

The documentation for this class was generated from the following files: