ATLAS Offline Software
Loading...
Searching...
No Matches
G4UA::FixG4CreatorProcess Class Reference

#include <FixG4CreatorProcess.h>

Inheritance diagram for G4UA::FixG4CreatorProcess:
Collaboration diagram for G4UA::FixG4CreatorProcess:

Public Member Functions

 FixG4CreatorProcess ()
virtual void UserSteppingAction (const G4Step *) override final

Detailed Description

Definition at line 14 of file FixG4CreatorProcess.h.

Constructor & Destructor Documentation

◆ FixG4CreatorProcess()

G4UA::FixG4CreatorProcess::FixG4CreatorProcess ( )

Definition at line 18 of file FixG4CreatorProcess.cxx.

18{}

Member Function Documentation

◆ UserSteppingAction()

void G4UA::FixG4CreatorProcess::UserSteppingAction ( const G4Step * aStep)
finaloverridevirtual

Definition at line 22 of file FixG4CreatorProcess.cxx.

23 {
24 //
25 // M. Novak, M. Bandieramonte: 10 November 2021
26 //
27 // Make sure that the creator process of the secondary tracks of the current step
28 // is the same as the one that limited the step. These can be different in case of
29 // using `wrapper` processes e.g. G4GammaGeneralProcess or G4HepEm, etc.
30 if (G4EmParameters::Instance()->GeneralProcessActive()) {
31 const G4ParticleDefinition* thePrimaryParticle = aStep->GetTrack()->GetParticleDefinition();
32 const std::size_t numThisSecondaries = aStep->GetNumberOfSecondariesInCurrentStep();
33 if (thePrimaryParticle==G4Gamma::GammaDefinition() && numThisSecondaries>0) {
34 // Get the pointer to the process that limited the step: i.e. the one that
35 // created the secondaries of the current step
36 const G4VProcess* theLimiterProcess = aStep->GetPostStepPoint()->GetProcessDefinedStep();
37 // note: this is a vector of secondaries containing all secondaries created
38 // along the tracking of the current `primary` track (i.e. not only
39 // secondaries created in this step)
40 const G4TrackVector* theSecTrackVector = aStep->GetSecondary();
41 const std::size_t numAllSecondaries = theSecTrackVector->size();
42 for (std::size_t it = numAllSecondaries-numThisSecondaries; it<numAllSecondaries; ++it) {
43
44 G4Track* secTrack = (*theSecTrackVector)[it];
45 if (secTrack->GetCreatorProcess()!=theLimiterProcess) {
46
47 secTrack->SetCreatorProcess(theLimiterProcess);
48 }
49 }
50 }
51
52 }
53 }

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