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
G4AdjointAlongStepWeightCorrection.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4AdjointAlongStepWeightCorrection.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
#include "
G4AdjointAlongStepWeightCorrection.hh
"
28
#include "
G4Step.hh
"
29
#include "
G4ParticleDefinition.hh
"
30
#include "
G4VParticleChange.hh
"
31
#include "
G4AdjointCSManager.hh
"
32
34
//
35
36
G4AdjointAlongStepWeightCorrection::G4AdjointAlongStepWeightCorrection
(
const
G4String
&
name
,
37
G4ProcessType
type):
G4VContinuousProcess
(name, type)
38
{
fParticleChange
=
new
G4ParticleChange
();
39
currentMaterialIndex
=0;
40
preStepKinEnergy
=1.;
41
currentCouple
=0;
42
}
43
45
//
46
47
G4AdjointAlongStepWeightCorrection::~G4AdjointAlongStepWeightCorrection
()
48
{
delete
fParticleChange
;
49
}
51
//
52
void
G4AdjointAlongStepWeightCorrection::PreparePhysicsTable
(
53
const
G4ParticleDefinition
& )
54
{
55
;
56
}
58
//
59
60
void
G4AdjointAlongStepWeightCorrection::BuildPhysicsTable
(
const
G4ParticleDefinition
& )
61
{;
62
}
64
//
65
G4VParticleChange
*
G4AdjointAlongStepWeightCorrection::AlongStepDoIt
(
const
G4Track
&
track
,
66
const
G4Step
&
step
)
67
{
68
69
fParticleChange
->
Initialize
(track);
70
71
// Get the actual (true) Step length
72
//----------------------------------
73
G4double
length
= step.
GetStepLength
();
74
75
76
G4double
Tkin = step.
GetPostStepPoint
()->
GetKineticEnergy
();
77
G4ParticleDefinition
* thePartDef=
const_cast<
G4ParticleDefinition
*
>
(track.
GetDynamicParticle
()->
GetDefinition
());
78
G4double
weight_correction=
G4AdjointCSManager::GetAdjointCSManager
()->
GetContinuousWeightCorrection
(thePartDef,
79
preStepKinEnergy
,Tkin,
currentCouple
,length);
80
81
82
83
84
//Caution!!!
85
// It is important to select the weight of the post_step_point
86
// as the current weight and not the weight of the track, as t
87
// the weight of the track is changed after having applied all
88
// the along_step_do_it.
89
90
// G4double new_weight=weight_correction*track.GetWeight(); //old
91
G4double
new_weight=weight_correction*step.
GetPostStepPoint
()->
GetWeight
();
92
93
94
95
//if (weight_correction >2.) new_weight=1.e-300;
96
97
98
//The following test check for zero weight.
99
//This happens after weight correction of gamma for photo electric effect.
100
//When the new weight is 0 it will be later on consider as nan by G4.
101
//Therefore we do put a lower limit of 1.e-300. for new_weight
102
//Correction by L.Desorgher on 15 July 2009
103
if
(new_weight==0 || (new_weight<=0 && new_weight>0)){
104
//G4cout<<new_weight<<'\t'<<weight_correction<<'\t'<<track.GetWeight()<<G4endl;
105
new_weight=1.e-300;
106
}
107
108
//G4cout<<new_weight<<'\t'<<weight_correction<<'\t'<<track.GetWeight()<<G4endl;
109
fParticleChange
->
SetParentWeightByProcess
(
false
);
110
fParticleChange
->
SetSecondaryWeightByProcess
(
false
);
111
fParticleChange
->
ProposeParentWeight
(new_weight);
112
113
114
return
fParticleChange
;
115
116
}
118
//
119
G4double
G4AdjointAlongStepWeightCorrection::GetContinuousStepLimit
(
const
G4Track
&
track
,
120
G4double
,
G4double
,
G4double
& )
121
{
122
G4double
x
=
DBL_MAX
;
123
DefineMaterial
(track.
GetMaterialCutsCouple
());
124
preStepKinEnergy
= track.
GetKineticEnergy
();
125
return
x
;
126
}
geant4
tree
geant4-10.6-release
source
processes
electromagnetic
adjoint
src
G4AdjointAlongStepWeightCorrection.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:28
using
1.8.2 with
ECCE GitHub integration