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
G4VTransitionRadiation.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4VTransitionRadiation.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
//
27
//
28
// G4VTransitionRadiation class -- implementation file
29
30
// GEANT 4 class implementation file --- Copyright CERN 1995
31
// CERN Geneva Switzerland
32
33
// History:
34
// 29.02.04 V.Ivanchenko create
35
// 28.07.05, P.Gumplinger add G4ProcessType to constructor
36
37
#include "
G4VTransitionRadiation.hh
"
38
#include "
G4ParticleDefinition.hh
"
39
#include "
G4VTRModel.hh
"
40
#include "
G4Material.hh
"
41
#include "
G4Region.hh
"
42
#include "
G4TransportationManager.hh
"
43
#include "
G4EmProcessSubType.hh
"
44
#include "
G4LossTableManager.hh
"
45
47
48
G4VTransitionRadiation::G4VTransitionRadiation
(
const
G4String
& processName,
49
G4ProcessType
type )
50
:
G4VDiscreteProcess
(processName, type),
51
region(nullptr),
52
model
(nullptr),
53
nSteps(0),
54
gammaMin(100.),
55
cosDThetaMax(std::cos(0.1))
56
{
57
SetProcessSubType
(
fTransitionRadiation
);
58
Clear
();
59
theManager
=
G4LossTableManager::Instance
();
60
theManager
->
Register
(
this
);
61
}
62
64
65
G4VTransitionRadiation::~G4VTransitionRadiation
()
66
{
67
Clear
();
68
theManager
->
DeRegister
(
this
);
69
}
70
72
73
void
G4VTransitionRadiation::Clear
()
74
{
75
materials
.clear();
76
steps
.clear();
77
normals
.clear();
78
nSteps
= 0;
79
}
80
82
83
G4VParticleChange
*
G4VTransitionRadiation::PostStepDoIt
(
84
const
G4Track
&
track
,
85
const
G4Step
&
step
)
86
{
87
88
// Fill temporary vectors
89
90
const
G4Material
*
material
= track.
GetMaterial
();
91
G4double
length
= step.
GetStepLength
();
92
G4ThreeVector
direction = track.
GetMomentumDirection
();
93
94
if
(
nSteps
== 0) {
95
96
nSteps
= 1;
97
materials
.push_back(material);
98
steps
.push_back(length);
99
const
G4StepPoint
*
point
= step.
GetPreStepPoint
();
100
startingPosition
= point->
GetPosition
();
101
startingDirection
= point->
GetMomentumDirection
();
102
G4bool
valid
=
true
;
103
G4ThreeVector
n
=
G4TransportationManager::GetTransportationManager
()
104
->
GetNavigatorForTracking
()->
GetLocalExitNormal
(&valid);
105
if
(valid)
normals
.push_back(n);
106
else
normals
.push_back(direction);
107
108
}
else
{
109
110
if
(material ==
materials
[
nSteps
-1]) {
111
steps
[
nSteps
-1] +=
length
;
112
}
else
{
113
nSteps
++;
114
materials
.push_back(material);
115
steps
.push_back(length);
116
G4bool
valid
=
true
;
117
G4ThreeVector
n
=
G4TransportationManager::GetTransportationManager
()
118
->
GetNavigatorForTracking
()->
GetLocalExitNormal
(&valid);
119
if
(valid)
normals
.push_back(n);
120
else
normals
.push_back(direction);
121
}
122
}
123
124
// Check POstStepPoint condition
125
126
if
(track.
GetTrackStatus
() ==
fStopAndKill
||
127
track.
GetVolume
()->
GetLogicalVolume
()->
GetRegion
() !=
region
||
128
startingDirection
.
x
()*direction.
x
() +
129
startingDirection
.
y
()*direction.
y
() +
130
startingDirection
.
z
()*direction.
z
() <
cosDThetaMax
)
131
{
132
if
(
model
) {
133
model
->GenerateSecondaries(*
pParticleChange
,
materials
,
steps
,
134
normals
,
startingPosition
, track);
135
}
136
Clear
();
137
}
138
139
return
pParticleChange
;
140
}
141
143
144
G4bool
G4VTransitionRadiation::IsApplicable
(
145
const
G4ParticleDefinition
& aParticle)
146
{
147
return
( aParticle.
GetPDGCharge
() != 0.0 );
148
}
149
151
152
153
void
G4VTransitionRadiation::SetRegion
(
const
G4Region
*
reg
)
154
{
155
region
=
reg
;
156
}
157
159
160
void
G4VTransitionRadiation::SetModel
(
G4VTRModel
* mod)
161
{
162
model
= mod;
163
}
164
166
167
void
G4VTransitionRadiation::PrintInfoDefinition
()
168
{
169
if
(
model
)
model
->PrintInfo();
170
}
171
173
174
G4double
G4VTransitionRadiation::GetMeanFreePath
(
175
const
G4Track
&
track
,
G4double
,
176
G4ForceCondition
*
condition
)
177
{
178
if
(
nSteps
> 0) {
179
*condition =
StronglyForced
;
180
}
else
{
181
*condition =
NotForced
;
182
if
(track.
GetKineticEnergy
()/track.
GetDefinition
()->
GetPDGMass
() + 1.0 >
gammaMin
&&
183
track.
GetVolume
()->
GetLogicalVolume
()->
GetRegion
() ==
region
) {
184
*condition =
StronglyForced
;
185
}
186
}
187
return
DBL_MAX
;
// so TR doesn't limit mean free path
188
}
189
geant4
tree
geant4-10.6-release
source
processes
electromagnetic
xrays
src
G4VTransitionRadiation.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:36
using
1.8.2 with
ECCE GitHub integration