Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
F04SteppingAction Class Reference

#include <Doxymodules_field.h>

Inheritance diagram for F04SteppingAction:
G4UserSteppingAction

Public Member Functions

 F04SteppingAction ()=default
 
 ~F04SteppingAction () override=default
 
void UserSteppingAction (const G4Step *) override
 

Private Attributes

G4LogicalVolumefTargetVolume = nullptr
 
G4LogicalVolumefTestPlaneVolume = nullptr
 

Detailed Description

Definition at line 119 of file Doxymodules_field.h.

Constructor & Destructor Documentation

◆ F04SteppingAction()

F04SteppingAction::F04SteppingAction ( )
default

◆ ~F04SteppingAction()

F04SteppingAction::~F04SteppingAction ( )
overridedefault

Member Function Documentation

◆ UserSteppingAction()

void F04SteppingAction::UserSteppingAction ( const G4Step theStep)
override

Definition at line 43 of file F04SteppingAction.cc.

44{
45 G4Track* theTrack = theStep->GetTrack();
46
47 // Get pointers to test volumes (only once)
48 if ( ! fTargetVolume ) {
50 = G4LogicalVolumeStore::GetInstance()->GetVolume("Target");
52 = G4LogicalVolumeStore::GetInstance()->GetVolume("TestPlane");
53 }
54
55 if (theTrack->GetParentID()==0) {
56 //This is a primary track
57 G4LogicalVolume* theVolume
58 = theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
59 if (theVolume != fTargetVolume) {
60 theTrack->SetTrackStatus(fStopAndKill);
61 return;
62 }
63 }
64
65// G4ParticleDefinition* particleType = theTrack->GetDefinition();
66
67 // check if it is entering the test volume
68 G4StepPoint* thePrePoint = theStep->GetPreStepPoint();
69 G4VPhysicalVolume* thePrePV = thePrePoint->GetPhysicalVolume();
70 G4LogicalVolume* thePreLV = thePrePV->GetLogicalVolume();
71
72 G4LogicalVolume* thePostLV = nullptr;
73 G4StepPoint* thePostPoint = theStep->GetPostStepPoint();
74
75 if (thePostPoint) {
76 G4VPhysicalVolume* thePostPV = thePostPoint->GetPhysicalVolume();
77 if (thePostPV) thePostLV = thePostPV->GetLogicalVolume();
78 }
79
80 if (thePostLV == fTestPlaneVolume &&
81 thePreLV != fTestPlaneVolume) {
82
83// G4double x = theTrack->GetPosition().x();
84// G4double y = theTrack->GetPosition().y();
85
86 G4ThreeVector theMomentumDirection = theTrack->
87 GetDynamicParticle()->GetMomentumDirection();
88// G4double theTotalMomentum = theTrack->GetDynamicParticle()->
89// GetTotalMomentum();
90
91 // then kill the track
92 theTrack->SetTrackStatus(fStopAndKill);
93 return;
94
95 }
96
97// G4double z = theTrack->GetPosition().z();
98
99 auto trackInformation =
100 (F04UserTrackInformation*)theTrack->GetUserInformation();
101
102 if (trackInformation->GetTrackStatusFlag() != reverse) {
103 if (thePreLV != fTargetVolume ) {
104 if ( theTrack-> GetMomentumDirection().z()>0.0 &&
105 theTrack->GetVertexMomentumDirection().z()<0.0 )
106 {
107 trackInformation->SetTrackStatusFlag(reverse);
108 }
109 }
110 }
111
112 // check if it is alive
113 if (theTrack->GetTrackStatus() == fAlive) { return; }
114
115 if (thePostPoint->GetProcessDefinedStep() != nullptr) {
116 if (thePostPoint->GetProcessDefinedStep()->GetProcessName() != "Decay")
117 return;
118 }
119
120}
G4LogicalVolume * fTargetVolume
G4LogicalVolume * fTestPlaneVolume

Member Data Documentation

◆ fTargetVolume

G4LogicalVolume* F04SteppingAction::fTargetVolume = nullptr
private

Definition at line 51 of file F04SteppingAction.hh.

◆ fTestPlaneVolume

G4LogicalVolume* F04SteppingAction::fTestPlaneVolume = nullptr
private

Definition at line 52 of file F04SteppingAction.hh.


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

Applications | User Support | Publications | Collaboration