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
G4VEmAdjointModel.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4VEmAdjointModel.hh
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
//
28
// Module: G4VEMAdjointModel
29
// Author: L. Desorgher
30
// Organisation: SpaceIT GmbH
31
// Contract: ESA contract 21435/08/NL/AT
32
// Customer: ESA/ESTEC
34
//
35
// CHANGE HISTORY
36
// --------------
37
// ChangeHistory:
38
// 10 September 2009 Move to a virtual class. L. Desorgher
39
// 1st April 2007 creation by L. Desorgher
40
//
41
//-------------------------------------------------------------
42
// Documentation:
43
// Base class for Adjoint EM model. It is based on the use of direct G4VEmModel.
44
//
45
46
47
#ifndef G4VEmAdjointModel_h
48
#define G4VEmAdjointModel_h 1
49
50
#include "
globals.hh
"
51
#include "
G4DynamicParticle.hh
"
52
#include "
G4ParticleDefinition.hh
"
53
#include "
G4MaterialCutsCouple.hh
"
54
#include "
G4Material.hh
"
55
#include "
G4Element.hh
"
56
#include "
G4ElementVector.hh
"
57
#include "
Randomize.hh
"
58
#include "
G4ParticleDefinition.hh
"
59
#include "
G4VEmModel.hh
"
60
#include "
G4Electron.hh
"
61
#include "
G4Gamma.hh
"
62
#include "
G4ProductionCutsTable.hh
"
63
64
class
G4PhysicsTable
;
65
class
G4Region
;
66
class
G4VParticleChange
;
67
class
G4ParticleChange
;
68
class
G4Track
;
69
class
G4AdjointCSMatrix
;
70
71
class
G4VEmAdjointModel
72
{
73
74
public
:
// public methods
75
76
G4VEmAdjointModel
(
const
G4String
& nam);
77
78
virtual
~G4VEmAdjointModel
();
79
80
//------------------------------------------------------------------------
81
// Virtual methods to be implemented for the sample secondaries concrete model
82
//------------------------------------------------------------------------
83
84
//virtual void Initialise()=0;
85
86
virtual
void
SampleSecondaries
(
const
G4Track
& aTrack,
87
G4bool
IsScatProjToProjCase,
88
G4ParticleChange
* fParticleChange)=0;
89
90
91
//------------------------------------------------------------------------
92
// Methods for adjoint processes; may be overwritten if needed;
93
//------------------------------------------------------------------------
94
95
96
virtual
G4double
AdjointCrossSection
(
const
G4MaterialCutsCouple
* aCouple,
97
G4double
primEnergy,
98
G4bool
IsScatProjToProjCase);
99
100
virtual
G4double
GetAdjointCrossSection
(
const
G4MaterialCutsCouple
* aCouple,
101
G4double
primEnergy,
102
G4bool
IsScatProjToProjCase);
103
104
virtual
G4double
DiffCrossSectionPerAtomPrimToSecond
(
105
G4double
kinEnergyProj,
// kinetic energy of the primary particle before the interaction
106
G4double
kinEnergyProd,
// kinetic energy of the secondary particle
107
G4double
Z
,
108
G4double
A
= 0.);
109
110
virtual
G4double
DiffCrossSectionPerAtomPrimToScatPrim
(
111
G4double
kinEnergyProj,
// kinetic energy of the primary particle before the interaction
112
G4double
kinEnergyScatProj,
// kinetic energy of the primary particle after the interaction
113
G4double
Z,
114
G4double
A
= 0.);
115
116
117
118
virtual
G4double
DiffCrossSectionPerVolumePrimToSecond
(
119
const
G4Material
* aMaterial,
120
G4double
kinEnergyProj,
// kinetic energy of the primary particle before the interaction
121
G4double
kinEnergyProd
// kinetic energy of the secondary particle
122
);
123
124
virtual
G4double
DiffCrossSectionPerVolumePrimToScatPrim
(
125
const
G4Material
* aMaterial,
126
G4double
kinEnergyProj,
// kinetic energy of the primary particle before the interaction
127
G4double
kinEnergyScatProj
// kinetic energy of the primary particle after the interaction
128
);
129
130
131
//Energy limits of adjoint secondary
132
//------------------
133
134
virtual
G4double
GetSecondAdjEnergyMaxForScatProjToProjCase
(
G4double
PrimAdjEnergy);
135
virtual
G4double
GetSecondAdjEnergyMinForScatProjToProjCase
(
G4double
PrimAdjEnergy,
G4double
Tcut=0);
136
virtual
G4double
GetSecondAdjEnergyMaxForProdToProjCase
(
G4double
PrimAdjEnergy);
137
virtual
G4double
GetSecondAdjEnergyMinForProdToProjCase
(
G4double
PrimAdjEnergy);
138
139
140
141
//Other Methods
142
//---------------
143
144
void
DefineCurrentMaterial
(
const
G4MaterialCutsCouple
* couple);
145
146
147
std::vector< std::vector< double>* >
ComputeAdjointCrossSectionVectorPerAtomForSecond
(
148
G4double
kinEnergyProd,
149
G4double
Z,
150
G4double
A
= 0.,
151
G4int
nbin_pro_decade=10
152
);
153
std::vector< std::vector< double>* >
ComputeAdjointCrossSectionVectorPerAtomForScatProj
(
154
G4double
kinEnergyProd,
155
G4double
Z,
156
G4double
A
= 0.,
157
G4int
nbin_pro_decade=10
158
);
159
160
std::vector< std::vector< double>* >
ComputeAdjointCrossSectionVectorPerVolumeForSecond
(
161
G4Material
* aMaterial,
162
G4double
kinEnergyProd,
163
G4int
nbin_pro_decade=10
164
);
165
std::vector< std::vector< double>* >
ComputeAdjointCrossSectionVectorPerVolumeForScatProj
(
166
G4Material
* aMaterial,
167
G4double
kinEnergyProd,
168
G4int
nbin_pro_decade=10
169
);
170
171
172
173
inline
void
SetCSMatrices
(std::vector< G4AdjointCSMatrix* >* Vec1CSMatrix, std::vector< G4AdjointCSMatrix* >* Vec2CSMatrix){
174
pOnCSMatrixForProdToProjBackwardScattering
= Vec1CSMatrix;
175
pOnCSMatrixForScatProjToProjBackwardScattering
= Vec2CSMatrix;
176
177
178
};
179
180
inline
G4ParticleDefinition
*
GetAdjointEquivalentOfDirectPrimaryParticleDefinition
(){
return
theAdjEquivOfDirectPrimPartDef
;}
181
182
inline
G4ParticleDefinition
*
GetAdjointEquivalentOfDirectSecondaryParticleDefinition
(){
return
theAdjEquivOfDirectSecondPartDef
;}
183
184
inline
G4double
GetHighEnergyLimit
(){
return
HighEnergyLimit
;}
185
186
inline
G4double
GetLowEnergyLimit
(){
return
LowEnergyLimit
;}
187
188
void
SetHighEnergyLimit
(
G4double
aVal);
189
190
void
SetLowEnergyLimit
(
G4double
aVal);
191
192
inline
void
DefineDirectEMModel
(
G4VEmModel
* aModel){
theDirectEMModel
= aModel;}
193
194
void
SetAdjointEquivalentOfDirectPrimaryParticleDefinition
(
G4ParticleDefinition
* aPart);
195
196
inline
void
SetAdjointEquivalentOfDirectSecondaryParticleDefinition
(
G4ParticleDefinition
* aPart){
197
theAdjEquivOfDirectSecondPartDef
=aPart;
198
}
199
200
inline
void
SetSecondPartOfSameType
(
G4bool
aBool){
second_part_of_same_type
=aBool;}
201
202
inline
G4bool
GetSecondPartOfSameType
(){
return
second_part_of_same_type
;}
203
204
inline
void
SetUseMatrix
(
G4bool
aBool) {
UseMatrix
= aBool;}
205
206
inline
void
SetUseMatrixPerElement
(
G4bool
aBool){
UseMatrixPerElement
= aBool;}
207
inline
void
SetUseOnlyOneMatrixForAllElements
(
G4bool
aBool){
UseOnlyOneMatrixForAllElements
= aBool;}
208
209
inline
void
SetApplyCutInRange
(
G4bool
aBool){
ApplyCutInRange
= aBool;}
210
inline
G4bool
GetUseMatrix
() {
return
UseMatrix
;}
211
inline
G4bool
GetUseMatrixPerElement
(){
return
UseMatrixPerElement
;}
212
inline
G4bool
GetUseOnlyOneMatrixForAllElements
(){
return
UseOnlyOneMatrixForAllElements
;}
213
inline
G4bool
GetApplyCutInRange
(){
return
ApplyCutInRange
;}
214
215
inline
G4String
GetName
(){
return
name
;}
216
inline
virtual
void
SetCSBiasingFactor
(
G4double
aVal) {
CS_biasing_factor
= aVal;}
217
218
inline
void
SetCorrectWeightForPostStepInModel
(
G4bool
aBool) {
correct_weight_for_post_step_in_model
= aBool;}
219
inline
void
SetAdditionalWeightCorrectionFactorForPostStepOutsideModel
(
G4double
factor) {
additional_weight_correction_factor_for_post_step_outside_model
= factor;}
220
221
protected
:
222
223
//Some of them can be overriden by daughter classes
224
225
226
G4double
DiffCrossSectionFunction1
(
G4double
kinEnergyProj);
227
G4double
DiffCrossSectionFunction2
(
G4double
kinEnergyProj);
228
G4double
DiffCrossSectionPerVolumeFunctionForIntegrationOverEkinProj
(
G4double
EkinProd);
229
230
231
232
//General methods to sample secondary energy
233
//--------------------------------------
234
G4double
SampleAdjSecEnergyFromCSMatrix
(
size_t
MatrixIndex,
G4double
prim_energy,
G4bool
IsScatProjToProjCase);
235
G4double
SampleAdjSecEnergyFromCSMatrix
(
G4double
prim_energy,
G4bool
IsScatProjToProjCase);
236
void
SelectCSMatrix
(
G4bool
IsScatProjToProjCase);
237
238
virtual
G4double
SampleAdjSecEnergyFromDiffCrossSectionPerAtom
(
G4double
prim_energy,
G4bool
IsScatProjToProjCase);
239
240
241
242
//Post Step weight correction
243
//----------------------------
244
virtual
void
CorrectPostStepWeight
(
G4ParticleChange
* fParticleChange,
245
G4double
old_weight,
246
G4double
adjointPrimKinEnergy,
247
G4double
projectileKinEnergy,
248
G4bool
IsScatProjToProjCase);
249
250
251
252
253
254
255
protected
:
//attributes
256
257
G4VEmModel
*
theDirectEMModel
;
258
G4VParticleChange
*
pParticleChange
;
259
260
261
262
263
//Name
264
//-----
265
266
const
G4String
name
;
267
268
//Needed for CS integration at the initialisation phase
269
//-----------------------------------------------------
270
271
G4int
ASelectedNucleus
;
272
G4int
ZSelectedNucleus
;
273
G4Material
*
SelectedMaterial
;
274
G4double
kinEnergyProdForIntegration
;
275
G4double
kinEnergyScatProjForIntegration
;
276
G4double
kinEnergyProjForIntegration
;
277
278
//for the adjoint simulation we need for each element or material:
279
//an adjoint CS Matrix
280
//-----------------------------
281
282
std::vector< G4AdjointCSMatrix* >*
pOnCSMatrixForProdToProjBackwardScattering
;
283
std::vector< G4AdjointCSMatrix* >*
pOnCSMatrixForScatProjToProjBackwardScattering
;
284
std::vector<G4double>
CS_Vs_ElementForScatProjToProjCase
;
285
std::vector<G4double>
CS_Vs_ElementForProdToProjCase
;
286
287
G4double
lastCS
;
288
G4double
lastAdjointCSForScatProjToProjCase
;
289
G4double
lastAdjointCSForProdToProjCase
;
290
291
//particle definition
292
//------------------
293
294
G4ParticleDefinition
*
theAdjEquivOfDirectPrimPartDef
;
295
G4ParticleDefinition
*
theAdjEquivOfDirectSecondPartDef
;
296
G4ParticleDefinition
*
theDirectPrimaryPartDef
;
297
G4bool
second_part_of_same_type
;
298
299
//Prestep energy
300
//-------------
301
G4double
preStepEnergy
;
302
303
//Current couple material
304
//----------------------
305
G4Material
*
currentMaterial
;
306
G4MaterialCutsCouple
*
currentCouple
;
307
size_t
currentMaterialIndex
;
308
size_t
currentCoupleIndex
;
309
G4double
currentTcutForDirectPrim
;
310
G4double
currentTcutForDirectSecond
;
311
G4bool
ApplyCutInRange
;
312
313
//For ions
314
//---------
315
G4double
mass_ratio_product
;
316
G4double
mass_ratio_projectile
;
317
318
//Energy limits
319
//-------------
320
321
G4double
HighEnergyLimit
;
322
G4double
LowEnergyLimit
;
323
324
//Cross Section biasing factor
325
//---------------------------
326
G4double
CS_biasing_factor
;
327
328
//Type of Model with Matrix or not
329
//--------------------------------
330
G4bool
UseMatrix
;
331
G4bool
UseMatrixPerElement
;
//other possibility is per Material
332
G4bool
UseOnlyOneMatrixForAllElements
;
333
334
//Index of Cross section matrices to be used
335
//------------
336
size_t
indexOfUsedCrossSectionMatrix
;
337
338
size_t
model_index
;
339
340
//This is needed for the forced interaction where part of the weight correction
341
// is given outside the model while the secondary are created in the model
342
//The weight should be fixed before adding the secondary
343
G4bool
correct_weight_for_post_step_in_model
;
344
G4double
additional_weight_correction_factor_for_post_step_outside_model
;
345
346
};
347
348
349
#endif
350
geant4
tree
geant4-10.6-release
source
processes
electromagnetic
adjoint
include
G4VEmAdjointModel.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:28
using
1.8.2 with
ECCE GitHub integration