Geant4
11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4CascadeColliderBase.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
// 20100714 M. Kelsey -- Move functionality from G4VCascadeCollider, and
28
// provide conservation-checking here, with wrapper function
29
// and control flag.
30
// 20100721 M. Kelsey -- Use G4CASCADE_CHECK_ECONS to set default control
31
// flag for validations.
32
// 20100923 M. Kelsey -- Migrate to integer A and Z
33
// 20100925 M. Kelsey -- Add explosion() interfaces for G4Fragment and for
34
// (A,Z,E). Move implementation to latter. Add Z==0 condition.
35
// 20110225 M. Kelsey -- Add setVerboseLevel(), calls through to members
36
// 20130621 Move doConservationChecks to G4CascadeParameters, check there
37
// before instantiating CheckBalance; change explosion() to
38
// use reference, add validateOutput() w/G4Fragment
39
// 20130622 Move fragment-handling functions to G4CascadeDeexciteBase
40
// 20140930 Change name from "const char*" to "const G4String"
41
42
#include "
G4CascadeColliderBase.hh
"
43
#include "
G4CascadeCheckBalance.hh
"
44
#include "
G4CascadeParameters.hh
"
45
#include "
G4CollisionOutput.hh
"
46
#include "
G4InteractionCase.hh
"
47
#include "
G4InuclElementaryParticle.hh
"
48
#include "
G4InuclNuclei.hh
"
49
#include "
G4InuclSpecialFunctions.hh
"
50
#include <vector>
51
52
using namespace
G4InuclSpecialFunctions
;
53
54
55
// Constructor and destructor
56
57
G4CascadeColliderBase::G4CascadeColliderBase
(
const
G4String
& name,
G4int
verbose)
58
:
G4VCascadeCollider
(name, verbose), balance(0) {
59
if
(
G4CascadeParameters::checkConservation
())
60
balance
=
new
G4CascadeCheckBalance
(name);
61
}
62
63
G4CascadeColliderBase::~G4CascadeColliderBase
() {
64
delete
balance
;
65
}
66
67
void
G4CascadeColliderBase::setVerboseLevel
(
G4int
verbose) {
68
G4VCascadeCollider::setVerboseLevel
(verbose);
69
if
(
balance
)
balance
->
setVerboseLevel
(verbose);
70
}
71
72
73
// Both bullet and target must be hadrons or photons for this to work
74
75
G4bool
G4CascadeColliderBase::useEPCollider
(
G4InuclParticle
* bullet,
76
G4InuclParticle
* target)
const
{
77
return
(
dynamic_cast<
G4InuclElementaryParticle
*
>
(bullet) &&
78
dynamic_cast<
G4InuclElementaryParticle
*
>
(target));
79
}
80
81
82
// Decide whether bullet-target interaction is candidate for cascade
83
84
G4bool
85
G4CascadeColliderBase::inelasticInteractionPossible
(
G4InuclParticle
* bullet,
86
G4InuclParticle
* target,
87
G4double
ekin)
const
{
88
if
(
verboseLevel
) {
89
G4cout
<<
" >>> "
<<
theName
<<
"::inelasticInteractionPossible"
<<
G4endl
;
90
}
91
92
// If hadron-hadron collision, defer to ElementaryParticleCollider
93
if
(
useEPCollider
(bullet, target))
return
true
;
94
95
// See which one of the two (or both) is a nucleus, get properties
96
// FIXME: Should set a = baryon() for both, but that's not in base
97
G4InuclNuclei
* nuclei_bullet =
dynamic_cast<
G4InuclNuclei
*
>
(bullet);
98
G4double
ab = nuclei_bullet ? nuclei_bullet->
getA
() : 1;
// FIXME
99
G4double
zb = nuclei_bullet ? nuclei_bullet->
getZ
() : bullet->
getCharge
();
100
101
G4InuclNuclei
* nuclei_target =
dynamic_cast<
G4InuclNuclei
*
>
(target);
102
G4double
at = nuclei_target ? nuclei_target->
getA
() : 1;
// FIXME
103
G4double
zt = nuclei_target ? nuclei_target->
getZ
() : target->
getCharge
();
104
105
// VCOL (Coulomb barrier) used for testing if elastic collision necessary
106
const
G4double
coeff = 0.001 * 1.2;
107
108
G4double
VCOL = coeff * zt * zb / (
G4cbrt
(at) +
G4cbrt
(ab));
109
110
G4bool
possible =
true
;
// Force inelastic; should be (ekin >= VCOL)
111
112
if
(
verboseLevel
> 3) {
113
G4cout
<<
" VCOL: "
<< VCOL <<
" ekin: "
<< ekin <<
" inelastic possible: "
114
<< possible <<
G4endl
;
115
}
116
117
return
possible;
118
}
119
120
121
// Validate output for energy, momentum conservation, etc.
122
123
G4bool
G4CascadeColliderBase::validateOutput
(
G4InuclParticle
* bullet,
124
G4InuclParticle
* target,
125
G4CollisionOutput
& output) {
126
if
(!
balance
)
return
true
;
// Skip checks unless requested
127
128
if
(
verboseLevel
> 1)
129
G4cout
<<
" >>> "
<<
theName
<<
"::validateOutput"
<<
G4endl
;
130
131
// Show final state particles
132
if
(
verboseLevel
> 2) output.
printCollisionOutput
();
133
134
balance
->
setVerboseLevel
(
verboseLevel
);
135
balance
->
collide
(bullet, target, output);
136
return
balance
->
okay
();
// Returns false if violations
137
}
138
139
G4bool
G4CascadeColliderBase::validateOutput
(
const
G4Fragment
& fragment,
140
G4CollisionOutput
& output) {
141
if
(!
balance
)
return
true
;
// Skip checks unless requested
142
143
if
(
verboseLevel
> 1)
144
G4cout
<<
" >>> "
<<
theName
<<
"::validateOutput"
<<
G4endl
;
145
146
balance
->
setVerboseLevel
(
verboseLevel
);
147
balance
->
collide
(fragment, output);
148
return
balance
->
okay
();
// Returns false if violations
149
}
150
151
G4bool
G4CascadeColliderBase::validateOutput
(
G4InuclParticle
* bullet,
152
G4InuclParticle
* target,
153
const
std::vector<G4InuclElementaryParticle>& particles) {
154
if
(!
balance
)
return
true
;
// Skip checks unless requested
155
156
if
(
verboseLevel
> 1)
157
G4cout
<<
" >>> "
<<
theName
<<
"::validateOutput"
<<
G4endl
;
158
159
balance
->
setVerboseLevel
(
verboseLevel
);
160
balance
->
collide
(bullet, target, particles);
161
return
balance
->
okay
();
// Returns false if violations
162
}
G4CascadeCheckBalance.hh
G4CascadeColliderBase.hh
G4CascadeParameters.hh
G4CollisionOutput.hh
G4InteractionCase.hh
G4InuclElementaryParticle.hh
G4InuclNuclei.hh
G4InuclSpecialFunctions.hh
G4double
double G4double
Definition
G4Types.hh:83
G4bool
bool G4bool
Definition
G4Types.hh:86
G4int
int G4int
Definition
G4Types.hh:85
G4endl
#define G4endl
Definition
G4ios.hh:67
G4cout
G4GLOB_DLL std::ostream G4cout
G4CascadeCheckBalance
Definition
G4CascadeCheckBalance.hh:64
G4CascadeCheckBalance::collide
void collide(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
Definition
G4CascadeCheckBalance.cc:88
G4CascadeCheckBalance::okay
G4bool okay() const
Definition
G4CascadeCheckBalance.hh:121
G4CascadeColliderBase::useEPCollider
virtual G4bool useEPCollider(G4InuclParticle *bullet, G4InuclParticle *target) const
Definition
G4CascadeColliderBase.cc:75
G4CascadeColliderBase::setVerboseLevel
virtual void setVerboseLevel(G4int verbose=0)
Definition
G4CascadeColliderBase.cc:67
G4CascadeColliderBase::G4CascadeColliderBase
G4CascadeColliderBase(const G4String &name, G4int verbose=0)
Definition
G4CascadeColliderBase.cc:57
G4CascadeColliderBase::~G4CascadeColliderBase
virtual ~G4CascadeColliderBase()
Definition
G4CascadeColliderBase.cc:63
G4CascadeColliderBase::validateOutput
virtual G4bool validateOutput(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
Definition
G4CascadeColliderBase.cc:123
G4CascadeColliderBase::balance
G4CascadeCheckBalance * balance
Definition
G4CascadeColliderBase.hh:88
G4CascadeColliderBase::inelasticInteractionPossible
virtual G4bool inelasticInteractionPossible(G4InuclParticle *bullet, G4InuclParticle *target, G4double ekin) const
Definition
G4CascadeColliderBase.cc:85
G4CascadeParameters::checkConservation
static G4bool checkConservation()
Definition
G4CascadeParameters.hh:53
G4CollisionOutput
Definition
G4CollisionOutput.hh:66
G4CollisionOutput::printCollisionOutput
void printCollisionOutput(std::ostream &os=G4cout) const
Definition
G4CollisionOutput.cc:304
G4Fragment
Definition
G4Fragment.hh:68
G4InuclElementaryParticle
Definition
G4InuclElementaryParticle.hh:58
G4InuclNuclei
Definition
G4InuclNuclei.hh:67
G4InuclNuclei::getZ
G4int getZ() const
Definition
G4InuclNuclei.hh:137
G4InuclNuclei::getA
G4int getA() const
Definition
G4InuclNuclei.hh:136
G4InuclParticle
Definition
G4InuclParticle.hh:52
G4InuclParticle::getCharge
G4double getCharge() const
Definition
G4InuclParticle.hh:110
G4String
Definition
G4String.hh:62
G4VCascadeCollider
Definition
G4VCascadeCollider.hh:40
G4VCascadeCollider::theName
G4String theName
Definition
G4VCascadeCollider.hh:52
G4VCascadeCollider::verboseLevel
G4int verboseLevel
Definition
G4VCascadeCollider.hh:53
G4VCascadeCollider::setVerboseLevel
virtual void setVerboseLevel(G4int verbose=0)
Definition
G4VCascadeCollider.hh:49
G4InuclSpecialFunctions
Definition
G4InuclSpecialFunctions.hh:52
G4InuclSpecialFunctions::G4cbrt
G4double G4cbrt(G4double x)
Definition
G4InuclSpecialFunctions.cc:116
geant4-v11.2.2
source
processes
hadronic
models
cascade
cascade
src
G4CascadeColliderBase.cc
Generated by
1.12.0