Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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// $Id$
27//
28// 20100714 M. Kelsey -- Move functionality from G4VCascadeCollider, and
29// provide conservation-checking here, with wrapper function
30// and control flag.
31// 20100721 M. Kelsey -- Use G4CASCADE_CHECK_ECONS to set default control
32// flag for validations.
33// 20100923 M. Kelsey -- Migrate to integer A and Z
34// 20100925 M. Kelsey -- Add explosion() interfaces for G4Fragment and for
35// (A,Z,E). Move implementation to latter. Add Z==0 condition.
36// 20110225 M. Kelsey -- Add setVerboseLevel(), calls through to members
37
40#include "G4CollisionOutput.hh"
41#include "G4Fragment.hh"
42#include "G4InteractionCase.hh"
44#include "G4InuclNuclei.hh"
46#include "G4ios.hh"
47
48using namespace G4InuclSpecialFunctions;
49
50
51// Constructor and destructor
52
54 : G4VCascadeCollider(name, verbose),
55#ifdef G4CASCADE_CHECK_ECONS
56 doConservationChecks(true),
57#else
58 doConservationChecks(false),
59#endif
60 balance(new G4CascadeCheckBalance(0.001, 0.001, name)) {}
61
63 delete balance;
64}
65
68 balance->setVerboseLevel(verbose);
69}
70
71
72// Both bullet and target must be hadrons or photons for this to work
73
75 G4InuclParticle* target) const {
76 return (dynamic_cast<G4InuclElementaryParticle*>(bullet) &&
77 dynamic_cast<G4InuclElementaryParticle*>(target));
78}
79
80
81// Decide wether nuclear fragment is candidate for G4BigBanger
82
84 return target && explosion(target->getA(), target->getZ(),
85 target->getExitationEnergy()); // in MeV
86}
87
89 return fragment && explosion(fragment->GetA_asInt(), fragment->GetZ_asInt(),
90 fragment->GetExcitationEnergy()); // in MeV
91}
92
93G4bool
95 G4double excitation) const {
96 if (verboseLevel) G4cout << " >>> " << theName << "::explosion ?" << G4endl;
97
98 const G4int a_cut = 20;
99 const G4double be_cut = 3.0;
100
101 // Neutron balls, or small fragments with high excitations can explode
102 return ((A <= a_cut || Z==0) &&
103 (excitation >= be_cut * bindingEnergy(A,Z))
104 );
105}
106
107
108// Decide whether bullet-target interaction is candidate for cascade
109
110G4bool
112 G4InuclParticle* target,
113 G4double ekin) const {
114 if (verboseLevel) {
115 G4cout << " >>> " << theName << "::inelasticInteractionPossible" << G4endl;
116 }
117
118 // If hadron-hadron collision, defer to ElementaryParticleCollider
119 if (useEPCollider(bullet, target)) return true;
120
121 // See which one of the two (or both) is a nucleus, get properties
122 // FIXME: Should set a = baryon() for both, but that's not in base
123 G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet);
124 G4double ab = nuclei_bullet ? nuclei_bullet->getA() : 1; // FIXME
125 G4double zb = nuclei_bullet ? nuclei_bullet->getZ() : bullet->getCharge();
126
127 G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target);
128 G4double at = nuclei_target ? nuclei_target->getA() : 1; // FIXME
129 G4double zt = nuclei_target ? nuclei_target->getZ() : target->getCharge();
130
131 // VCOL (Coulomb barrier) used for testing if elastic collision necessary
132 const G4double coeff = 0.001 * 1.2;
133
134 G4double VCOL = coeff * zt * zb / (G4cbrt(at) + G4cbrt(ab));
135
136 G4bool possible = true; // Force inelastic; should be (ekin >= VCOL)
137
138 if (verboseLevel > 3) {
139 G4cout << " VCOL: " << VCOL << " ekin: " << ekin << " inelastic possible: "
140 << possible << G4endl;
141 }
142
143 return possible;
144}
145
146
147// Validate output for energy, momentum conservation, etc.
148
150 G4InuclParticle* target,
151 G4CollisionOutput& output) {
152 if (!doConservationChecks) return true; // Skip checks if requested
153
154 if (verboseLevel > 1)
155 G4cout << " >>> " << theName << "::validateOutput" << G4endl;
156
157 // Show final state particles
158 if (verboseLevel > 2) output.printCollisionOutput();
159
161 balance->collide(bullet, target, output);
162 return balance->okay(); // Returns false if violations
163}
164
166 G4InuclParticle* target,
167 const std::vector<G4InuclElementaryParticle>& particles) {
168 if (!doConservationChecks) return true; // Skip checks if requested
169
170 if (verboseLevel > 1)
171 G4cout << " >>> " << theName << "::validateOutput" << G4endl;
172
174 balance->collide(bullet, target, particles);
175 return balance->okay(); // Returns false if violations
176}
177
179 G4InuclParticle* target,
180 const std::vector<G4InuclNuclei>& fragments) {
181 if (!doConservationChecks) return true; // Skip checks if requested
182
183 if (verboseLevel > 1)
184 G4cout << " >>> " << theName << "::validateOutput" << G4endl;
185
187 balance->collide(bullet, target, fragments);
188 return balance->okay(); // Returns false if violations
189}
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
void collide(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
virtual G4bool useEPCollider(G4InuclParticle *bullet, G4InuclParticle *target) const
G4CascadeColliderBase(const char *name, G4int verbose=0)
virtual void setVerboseLevel(G4int verbose=0)
virtual G4bool explosion(G4InuclNuclei *target) const
virtual G4bool validateOutput(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
G4CascadeCheckBalance * balance
virtual G4bool inelasticInteractionPossible(G4InuclParticle *bullet, G4InuclParticle *target, G4double ekin) const
void printCollisionOutput(std::ostream &os=G4cout) const
G4double GetExcitationEnergy() const
Definition: G4Fragment.hh:235
G4int GetZ_asInt() const
Definition: G4Fragment.hh:223
G4int GetA_asInt() const
Definition: G4Fragment.hh:218
G4int getZ() const
G4double getExitationEnergy() const
G4int getA() const
G4double getCharge() const
virtual void setVerboseLevel(G4int verbose=0)
G4double bindingEnergy(G4int A, G4int Z)