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
GB04BOptnBremSplitting.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file GB04BOptnBremSplitting.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
#include "
GB04BOptnBremSplitting.hh
"
31
#include "
G4BiasingProcessInterface.hh
"
32
33
#include "
G4ParticleChangeForLoss.hh
"
34
35
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
36
37
GB04BOptnBremSplitting::GB04BOptnBremSplitting
(
G4String
name
)
38
:
G4VBiasingOperation
(name),
39
fSplittingFactor(1),
40
fParticleChange()
41
{
42
}
43
44
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45
46
GB04BOptnBremSplitting::~GB04BOptnBremSplitting
()
47
{
48
}
49
50
G4VParticleChange
*
51
GB04BOptnBremSplitting::
52
ApplyFinalStateBiasing
(
const
G4BiasingProcessInterface
* callingProcess,
53
const
G4Track
*
track
,
54
const
G4Step
*
step
,
55
G4bool
& )
56
{
57
58
// -- Collect brem. process (wrapped process) final state:
59
G4VParticleChange
* processFinalState =
60
callingProcess->
GetWrappedProcess
()->
PostStepDoIt
(*track, *step);
61
62
// -- if no splitting requested, let the brem. process to return directly its
63
// -- generated final state:
64
if
(
fSplittingFactor
== 1 )
return
processFinalState;
65
66
// -- a special case here: the brem. process corrects for cross-section change
67
// -- over the step due to energy loss by sometimes "abandoning" the interaction,
68
// -- returning an unchanged incoming electron/positron.
69
// -- We respect this correction, and if no secondary is produced, its means this
70
// -- case is happening:
71
if
( processFinalState->
GetNumberOfSecondaries
() == 0 )
return
processFinalState;
72
73
// -- Now start the biasing:
74
// -- - the electron state will be taken as the first one produced by the brem.
75
// -- process, hence the one stored in above processFinalState particle change.
76
// -- This state will be stored in our fParticleChange object.
77
// -- - the photon accompagnying the electron will be stored also this way.
78
// -- - we will then do fSplittingFactor - 1 call to the brem. process to collect
79
// -- fSplittingFactor - 1 additionnal gammas. All these will be stored in our
80
// -- fParticleChange object.
81
82
// -- We called the brem. process above. Its concrete particle change is indeed
83
// -- a "G4ParticleChangeForLoss" object. We cast this particle change to access
84
// -- methods of the concrete G4ParticleChangeForLoss type:
85
G4ParticleChangeForLoss
* actualParticleChange =
86
(
G4ParticleChangeForLoss
* ) processFinalState ;
87
88
fParticleChange
.
Initialize
(*track);
89
90
// -- Store electron final state:
91
fParticleChange
.
92
ProposeTrackStatus ( actualParticleChange->
GetTrackStatus
() );
93
fParticleChange
.
94
ProposeEnergy ( actualParticleChange->
GetProposedKineticEnergy
() );
95
fParticleChange
.
96
ProposeMomentumDirection( actualParticleChange->
GetProposedMomentumDirection
() );
97
98
// -- Now deal with the gamma's:
99
// -- their common weight:
100
G4double
gammaWeight = track->
GetWeight
() /
fSplittingFactor
;
101
102
// -- inform we will have fSplittingFactor gamma's:
103
fParticleChange
.
SetNumberOfSecondaries
(
fSplittingFactor
);
104
105
// -- inform we take care of secondaries weight (otherwise these
106
// -- secondaries are by default given the primary weight).
107
fParticleChange
.
SetSecondaryWeightByProcess
(
true
);
108
109
// -- Store first gamma:
110
G4Track
* gammaTrack = actualParticleChange->
GetSecondary
(0);
111
gammaTrack->
SetWeight
( gammaWeight );
112
fParticleChange
.
AddSecondary
( gammaTrack );
113
// -- and clean-up the brem. process particle change:
114
actualParticleChange->
Clear
();
115
116
// -- now start the fSplittingFactor-1 calls to the brem. process to store each
117
// -- related gamma:
118
G4int
nCalls = 1;
119
while
( nCalls <
fSplittingFactor
)
120
{
121
// ( note: we don't need to cast to actual type here, as methods for accessing
122
// secondary particles are from base class G4VParticleChange )
123
processFinalState = callingProcess->
GetWrappedProcess
()->
PostStepDoIt
(*track, *step);
124
if
( processFinalState->
GetNumberOfSecondaries
() == 1 )
125
{
126
gammaTrack = processFinalState->
GetSecondary
(0);
127
gammaTrack->
SetWeight
( gammaWeight );
128
fParticleChange
.
AddSecondary
( gammaTrack );
129
nCalls++;
130
}
131
// -- very rare special case: we ignore for now.
132
else
if
( processFinalState->
GetNumberOfSecondaries
() > 1 )
133
{
134
for
(
G4int
i = 0 ; i < processFinalState->
GetNumberOfSecondaries
() ; i++)
135
delete
processFinalState->
GetSecondary
(i);
136
}
137
processFinalState->
Clear
();
138
}
139
140
// -- we are done:
141
return
&
fParticleChange
;
142
}
143
144
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
geant4
tree
geant4-10.6-release
examples
extended
biasing
GB04
src
GB04BOptnBremSplitting.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:02
using
1.8.2 with
ECCE GitHub integration