Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
source
processes
electromagnetic
adjoint
src
G4AdjointProcessEquivalentToDirectProcess.cc
Go to the documentation of this file.
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
// $Id: G4AdjointProcessEquivalentToDirectProcess.cc 69844 2013-05-16 09:19:33Z gcosmo $
28
//
29
//
30
// ------------------------------------------------------------
31
// GEANT 4 class implementation file
32
//
33
// Class Description
34
//
35
// This class is for adjoint process equivalent to direct process
36
37
// ------------------------------------------------------------
38
// Created by L.Desorgher 25 Sept. 2009 Inspired from G4WrapperProcess
39
// ------------------------------------------------------------
40
41
#include "
G4AdjointProcessEquivalentToDirectProcess.hh
"
42
#include "
G4DynamicParticle.hh
"
43
G4AdjointProcessEquivalentToDirectProcess::G4AdjointProcessEquivalentToDirectProcess
(
const
G4String
& aName,
44
G4VProcess
* aProcess,
45
G4ParticleDefinition
* fwd_particle_def)
46
:
G4VProcess
(aName)
47
{
48
theDirectProcess =aProcess;
49
theProcessType
= theDirectProcess->
GetProcessType
();
50
theFwdParticleDef = fwd_particle_def;
51
}
52
53
54
G4AdjointProcessEquivalentToDirectProcess::~G4AdjointProcessEquivalentToDirectProcess
()
55
{
56
if
(theDirectProcess!=0)
delete
theDirectProcess;
57
}
58
59
void
G4AdjointProcessEquivalentToDirectProcess::ResetNumberOfInteractionLengthLeft
()
60
{
61
theDirectProcess->
ResetNumberOfInteractionLengthLeft
();
62
}
63
64
G4double
G4AdjointProcessEquivalentToDirectProcess::
65
AlongStepGetPhysicalInteractionLength
(
const
G4Track
& track,
66
G4double
previousStepSize,
67
G4double
currentMinimumStep,
68
G4double
& proposedSafety,
69
G4GPILSelection
* selection )
70
{
71
72
73
//Change the particle definition to the direct one
74
//------------------------------------------------
75
G4DynamicParticle
* theDynPart =
const_cast<
G4DynamicParticle
*
>
(track.
GetDynamicParticle
());
76
G4ParticleDefinition
* adjPartDef = theDynPart->
GetDefinition
();
77
78
G4DecayProducts
* decayProducts =
const_cast<
G4DecayProducts
*
>
(theDynPart->
GetPreAssignedDecayProducts
());
79
theDynPart->
SetPreAssignedDecayProducts
((
G4DecayProducts
*)(0));
80
theDynPart->
SetDefinition
(theFwdParticleDef);
81
82
83
//Call the direct process
84
//----------------------
85
G4double
GPIL = theDirectProcess->
86
AlongStepGetPhysicalInteractionLength
( track,
87
previousStepSize,
88
currentMinimumStep,
89
proposedSafety,
90
selection );
91
92
93
//Restore the adjoint particle definition to the direct one
94
//------------------------------------------------
95
theDynPart->
SetDefinition
(adjPartDef);
96
theDynPart->
SetPreAssignedDecayProducts
(decayProducts);
97
98
99
return
GPIL;
100
101
}
102
103
G4double
G4AdjointProcessEquivalentToDirectProcess::
104
AtRestGetPhysicalInteractionLength
(
const
G4Track
& track,
105
G4ForceCondition
*
condition
)
106
{
//Change the particle definition to the direct one
107
//------------------------------------------------
108
G4DynamicParticle
* theDynPart =
const_cast<
G4DynamicParticle
*
>
(track.
GetDynamicParticle
());
109
G4ParticleDefinition
* adjPartDef = theDynPart->
GetDefinition
();
110
111
G4DecayProducts
* decayProducts =
const_cast<
G4DecayProducts
*
>
(theDynPart->
GetPreAssignedDecayProducts
());
112
theDynPart->
SetPreAssignedDecayProducts
((
G4DecayProducts
*)(0));
113
theDynPart->
SetDefinition
(theFwdParticleDef);
114
115
116
//Call the direct process
117
//----------------------
118
119
120
G4double
GPIL = theDirectProcess->
AtRestGetPhysicalInteractionLength
( track, condition );
121
122
//Restore the adjoint particle definition to the direct one
123
//------------------------------------------------
124
theDynPart->
SetDefinition
(adjPartDef);
125
theDynPart->
SetPreAssignedDecayProducts
(decayProducts);
126
127
return
GPIL;
128
129
130
}
131
132
G4double
G4AdjointProcessEquivalentToDirectProcess::
133
PostStepGetPhysicalInteractionLength
(
const
G4Track
& track,
134
G4double
previousStepSize,
135
G4ForceCondition
*
condition
)
136
{
137
//Change the particle definition to the direct one
138
//------------------------------------------------
139
G4DynamicParticle
* theDynPart =
const_cast<
G4DynamicParticle
*
>
(track.
GetDynamicParticle
());
140
G4ParticleDefinition
* adjPartDef = theDynPart->
GetDefinition
();
141
142
G4DecayProducts
* decayProducts =
const_cast<
G4DecayProducts
*
>
(theDynPart->
GetPreAssignedDecayProducts
());
143
144
theDynPart->
SetPreAssignedDecayProducts
((
G4DecayProducts
*)(0));
145
theDynPart->
SetDefinition
(theFwdParticleDef);
146
147
148
//Call the direct process
149
//----------------------
150
151
152
G4double
GPIL = theDirectProcess->
PostStepGetPhysicalInteractionLength
( track,
153
previousStepSize,
154
condition );
155
156
//Restore the adjoint particle definition to the direct one
157
//------------------------------------------------
158
theDynPart->
SetDefinition
(adjPartDef);
159
theDynPart->
SetPreAssignedDecayProducts
(decayProducts);
160
161
return
GPIL;
162
163
164
}
165
/*
166
167
void G4AdjointProcessEquivalentToDirectProcess::SetProcessManager(const G4ProcessManager* procMan)
168
{
169
theDirectProcess->SetProcessManager(procMan);
170
}
171
172
const G4ProcessManager* G4AdjointProcessEquivalentToDirectProcess::GetProcessManager()
173
{
174
return theDirectProcess->GetProcessManager();
175
}
176
*/
177
G4VParticleChange
*
G4AdjointProcessEquivalentToDirectProcess::PostStepDoIt
(
const
G4Track
& track,
178
const
G4Step
& stepData )
179
{
180
//Change the particle definition to the direct one
181
//------------------------------------------------
182
G4DynamicParticle
* theDynPart =
const_cast<
G4DynamicParticle
*
>
(track.
GetDynamicParticle
());
183
G4ParticleDefinition
* adjPartDef = theDynPart->
GetDefinition
();
184
185
G4DecayProducts
* decayProducts =
const_cast<
G4DecayProducts
*
>
(theDynPart->
GetPreAssignedDecayProducts
());
186
187
theDynPart->
SetPreAssignedDecayProducts
((
G4DecayProducts
*)(0));
188
theDynPart->
SetDefinition
(theFwdParticleDef);
189
190
191
//Call the direct process
192
//----------------------
193
194
G4VParticleChange
* partChange = theDirectProcess->
PostStepDoIt
( track, stepData );
195
196
197
//Restore the adjoint particle definition to the direct one
198
//------------------------------------------------
199
theDynPart->
SetDefinition
(adjPartDef);
200
theDynPart->
SetPreAssignedDecayProducts
(decayProducts);
201
202
return
partChange;
203
204
205
206
}
207
208
G4VParticleChange
*
G4AdjointProcessEquivalentToDirectProcess::AlongStepDoIt
(
const
G4Track
& track,
209
const
G4Step
& stepData )
210
{
211
//Change the particle definition to the direct one
212
//------------------------------------------------
213
G4DynamicParticle
* theDynPart =
const_cast<
G4DynamicParticle
*
>
(track.
GetDynamicParticle
());
214
G4ParticleDefinition
* adjPartDef = theDynPart->
GetDefinition
();
215
216
G4DecayProducts
* decayProducts =
const_cast<
G4DecayProducts
*
>
(theDynPart->
GetPreAssignedDecayProducts
());
217
218
theDynPart->
SetPreAssignedDecayProducts
((
G4DecayProducts
*)(0));
219
theDynPart->
SetDefinition
(theFwdParticleDef);
220
221
222
//Call the direct process
223
//----------------------
224
G4VParticleChange
* partChange =theDirectProcess->
AlongStepDoIt
( track, stepData );
225
226
//Restore the adjoint particle definition to the direct one
227
//------------------------------------------------
228
theDynPart->
SetDefinition
(adjPartDef);
229
theDynPart->
SetPreAssignedDecayProducts
(decayProducts);
230
231
return
partChange;
232
}
233
234
G4VParticleChange
*
G4AdjointProcessEquivalentToDirectProcess::AtRestDoIt
(
const
G4Track
& track,
235
const
G4Step
& stepData )
236
{
237
//Change the particle definition to the direct one
238
//------------------------------------------------
239
G4DynamicParticle
* theDynPart =
const_cast<
G4DynamicParticle
*
>
(track.
GetDynamicParticle
());
240
G4ParticleDefinition
* adjPartDef = theDynPart->
GetDefinition
();
241
242
G4DecayProducts
* decayProducts =
const_cast<
G4DecayProducts
*
>
(theDynPart->
GetPreAssignedDecayProducts
());
243
244
theDynPart->
SetPreAssignedDecayProducts
((
G4DecayProducts
*)(0));
245
theDynPart->
SetDefinition
(theFwdParticleDef);
246
247
248
//Call the direct process
249
//----------------------
250
G4VParticleChange
* partChange =theDirectProcess->
AtRestDoIt
( track, stepData );
251
252
//Restore the adjoint particle definition to the direct one
253
//------------------------------------------------
254
theDynPart->
SetDefinition
(adjPartDef);
255
theDynPart->
SetPreAssignedDecayProducts
(decayProducts);
256
257
return
partChange;
258
259
260
}
261
262
G4bool
G4AdjointProcessEquivalentToDirectProcess::IsApplicable
(
const
G4ParticleDefinition
&)
263
{
264
return
theDirectProcess->
IsApplicable
(*theFwdParticleDef);
265
}
266
267
void
G4AdjointProcessEquivalentToDirectProcess::BuildPhysicsTable
(
const
G4ParticleDefinition
& )
268
{
269
return
theDirectProcess->
BuildPhysicsTable
(*theFwdParticleDef);
270
}
271
272
void
G4AdjointProcessEquivalentToDirectProcess::PreparePhysicsTable
(
const
G4ParticleDefinition
& )
273
{
274
return
theDirectProcess->
PreparePhysicsTable
(*theFwdParticleDef);
275
}
276
277
G4bool
G4AdjointProcessEquivalentToDirectProcess::
278
StorePhysicsTable
(
const
G4ParticleDefinition
* ,
279
const
G4String
& directory,
280
G4bool
ascii)
281
{
282
return
theDirectProcess->
StorePhysicsTable
(theFwdParticleDef, directory, ascii);
283
}
284
285
G4bool
G4AdjointProcessEquivalentToDirectProcess::
286
RetrievePhysicsTable
(
const
G4ParticleDefinition
* ,
287
const
G4String
& directory,
288
G4bool
ascii)
289
{
290
return
theDirectProcess->
RetrievePhysicsTable
(theFwdParticleDef, directory, ascii);
291
}
292
293
void
G4AdjointProcessEquivalentToDirectProcess::StartTracking
(
G4Track
* track)
294
{
295
//Change the particle definition to the direct one
296
//------------------------------------------------
297
G4DynamicParticle
* theDynPart =
const_cast<
G4DynamicParticle
*
>
(track->
GetDynamicParticle
());
298
G4ParticleDefinition
* adjPartDef = theDynPart->
GetDefinition
();
299
300
G4DecayProducts
* decayProducts =
const_cast<
G4DecayProducts
*
>
(theDynPart->
GetPreAssignedDecayProducts
());
301
theDynPart->
SetPreAssignedDecayProducts
((
G4DecayProducts
*)(0));
302
theDynPart->
SetDefinition
(theFwdParticleDef);
303
304
theDirectProcess->
StartTracking
(track);
305
306
//Restore the adjoint particle definition to the direct one
307
//------------------------------------------------
308
theDynPart->
SetDefinition
(adjPartDef);
309
theDynPart->
SetPreAssignedDecayProducts
(decayProducts);
310
311
312
return
;
313
314
}
315
316
void
G4AdjointProcessEquivalentToDirectProcess::EndTracking
()
317
{
318
theDirectProcess->
EndTracking
();
319
}
320
Generated on Sat May 25 2013 14:33:29 for Geant4 by
1.8.4