ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
F04SteppingAction.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file F04SteppingAction.cc
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
//
29
//
30
31
#include "
G4Track.hh
"
32
33
#include "
F04SteppingAction.hh
"
34
#include "
G4SteppingManager.hh
"
35
#include "
F04SteppingActionMessenger.hh
"
36
37
#include "
G4ParticleTypes.hh
"
38
#include "
G4LogicalVolumeStore.hh
"
39
40
#include "
F04UserTrackInformation.hh
"
41
42
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43
44
F04SteppingAction::F04SteppingAction
()
45
:
G4UserSteppingAction
(),
46
fSteppingMessenger(0),
47
fTargetVolume(0),
48
fTestPlaneVolume(0)
49
{
50
fSteppingMessenger
=
new
F04SteppingActionMessenger
();
51
}
52
53
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54
55
F04SteppingAction::~F04SteppingAction
()
56
{
57
delete
fSteppingMessenger
;
58
}
59
60
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61
62
void
F04SteppingAction::UserSteppingAction
(
const
G4Step
* theStep)
63
{
64
G4Track
* theTrack = theStep->
GetTrack
();
65
66
// Get pointers to test volumes (only once)
67
if
( !
fTargetVolume
) {
68
fTargetVolume
69
=
G4LogicalVolumeStore::GetInstance
()->
GetVolume
(
"Target"
);
70
fTestPlaneVolume
71
=
G4LogicalVolumeStore::GetInstance
()->
GetVolume
(
"TestPlane"
);
72
}
73
74
if
(theTrack->
GetParentID
()==0) {
75
//This is a primary track
76
G4LogicalVolume
* theVolume
77
= theStep->
GetPreStepPoint
()->
GetPhysicalVolume
()->
GetLogicalVolume
();
78
if
(theVolume !=
fTargetVolume
) {
79
theTrack->
SetTrackStatus
(
fStopAndKill
);
80
return
;
81
}
82
}
83
84
// G4ParticleDefinition* particleType = theTrack->GetDefinition();
85
86
// check if it is entering the test volume
87
G4StepPoint
* thePrePoint = theStep->
GetPreStepPoint
();
88
G4VPhysicalVolume
* thePrePV = thePrePoint->
GetPhysicalVolume
();
89
G4LogicalVolume
* thePreLV = thePrePV->
GetLogicalVolume
();
90
91
G4LogicalVolume
* thePostLV = 0;
92
G4StepPoint
* thePostPoint = theStep->
GetPostStepPoint
();
93
94
if
(thePostPoint) {
95
G4VPhysicalVolume
* thePostPV = thePostPoint->
GetPhysicalVolume
();
96
if
(thePostPV) thePostLV = thePostPV->
GetLogicalVolume
();
97
}
98
99
if
(thePostLV ==
fTestPlaneVolume
&&
100
thePreLV !=
fTestPlaneVolume
) {
101
102
// G4double x = theTrack->GetPosition().x();
103
// G4double y = theTrack->GetPosition().y();
104
105
G4ThreeVector
theMomentumDirection = theTrack->
106
GetDynamicParticle()->
GetMomentumDirection
();
107
// G4double theTotalMomentum = theTrack->GetDynamicParticle()->
108
// GetTotalMomentum();
109
110
// then kill the track
111
theTrack->
SetTrackStatus
(
fStopAndKill
);
112
return
;
113
114
}
115
116
// G4double z = theTrack->GetPosition().z();
117
118
F04UserTrackInformation
* trackInformation =
119
(
F04UserTrackInformation
*)theTrack->
GetUserInformation
();
120
121
if
(trackInformation->
GetTrackStatusFlag
() !=
reverse
) {
122
if
(thePreLV !=
fTargetVolume
) {
123
if
( theTrack-> GetMomentumDirection().z()>0.0 &&
124
theTrack->
GetVertexMomentumDirection
().
z
()<0.0 )
125
{
126
trackInformation->
SetTrackStatusFlag
(
reverse
);
127
}
128
}
129
}
130
131
// check if it is alive
132
if
(theTrack->
GetTrackStatus
() ==
fAlive
) {
return
; }
133
134
if
(thePostPoint->
GetProcessDefinedStep
() != 0) {
135
if
(thePostPoint->
GetProcessDefinedStep
()->
GetProcessName
() !=
"Decay"
)
136
return
;
137
}
138
139
}
geant4
tree
geant4-10.6-release
examples
extended
field
field04
src
F04SteppingAction.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:05
using
1.8.2 with
ECCE GitHub integration