source: trunk/source/processes/hadronic/models/cascade/cascade/src/G4CascadeColliderBase.cc @ 1350

Last change on this file since 1350 was 1350, checked in by garnier, 13 years ago

update to last version 4.9.4

File size: 7.0 KB
Line 
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// $Id: G4CascadeColliderBase.cc,v 1.5 2010/09/26 04:06:03 mkelsey Exp $
26// Geant4 tag: $Name: hadr-casc-V09-03-85 $
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
37#include "G4CascadeColliderBase.hh"
38#include "G4CascadeCheckBalance.hh"
39#include "G4CollisionOutput.hh"
40#include "G4Fragment.hh"
41#include "G4InteractionCase.hh"
42#include "G4InuclElementaryParticle.hh"
43#include "G4InuclNuclei.hh"
44#include "G4InuclSpecialFunctions.hh"
45#include "G4ios.hh"
46
47using namespace G4InuclSpecialFunctions;
48
49
50// Constructor and destructor
51
52G4CascadeColliderBase::G4CascadeColliderBase(const char* name, G4int verbose)
53  : G4VCascadeCollider(name, verbose),
54#ifdef G4CASCADE_CHECK_ECONS   
55    doConservationChecks(true),
56#else
57    doConservationChecks(false),
58#endif
59    balance(new G4CascadeCheckBalance(0.001, 0.001, name)) {}
60
61G4CascadeColliderBase::~G4CascadeColliderBase() {
62  delete balance;
63}
64
65
66// Both bullet and target must be hadrons or leptons for this to work
67
68G4bool G4CascadeColliderBase::useEPCollider(G4InuclParticle* bullet, 
69                                            G4InuclParticle* target) const {
70  return (dynamic_cast<G4InuclElementaryParticle*>(bullet) &&
71          dynamic_cast<G4InuclElementaryParticle*>(target));
72}
73
74
75// Decide wether nuclear fragment is candidate for G4BigBanger
76
77G4bool G4CascadeColliderBase::explosion(G4InuclNuclei* target) const {
78  return target && explosion(target->getA(), target->getZ(), 
79                             target->getExitationEnergy());     // in MeV
80}
81
82G4bool G4CascadeColliderBase::explosion(G4Fragment* fragment) const {
83  return fragment && explosion(fragment->GetA_asInt(), fragment->GetZ_asInt(),
84                               fragment->GetExcitationEnergy());     // in MeV
85}
86
87G4bool
88G4CascadeColliderBase::explosion(G4int A, G4int Z,
89                                 G4double excitation) const {
90  if (verboseLevel) G4cout << " >>> " << theName << "::explosion ?" << G4endl;
91
92  const G4int a_cut = 20;
93  const G4double be_cut = 3.0;
94
95  // Neutron balls, or small fragments with high excitations can explode
96  return ((A <= a_cut || Z==0) && 
97          (excitation >= be_cut * bindingEnergy(A,Z))
98          );
99}
100
101
102// Decide whether bullet-target interaction is candidate for cascade
103
104G4bool
105G4CascadeColliderBase::inelasticInteractionPossible(G4InuclParticle* bullet,
106                                                    G4InuclParticle* target, 
107                                                    G4double ekin) const {
108  if (verboseLevel) {
109    G4cout << " >>> " << theName << "::inelasticInteractionPossible" << G4endl;
110  }
111
112  // If hadron-hadron collision, defer to ElementaryParticleCollider
113  if (useEPCollider(bullet, target)) return true;
114
115  // See which one of the two (or both) is a nucleus, get properties
116  // FIXME:  Should set a = baryon() for both, but that's not in base
117  G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet);
118  G4double ab = nuclei_bullet ? nuclei_bullet->getA() : 1;      // FIXME
119  G4double zb = nuclei_bullet ? nuclei_bullet->getZ() : bullet->getCharge();
120 
121  G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target);
122  G4double at = nuclei_target ? nuclei_target->getA() : 1;      // FIXME
123  G4double zt = nuclei_target ? nuclei_target->getZ() : target->getCharge();
124 
125  // VCOL (Coulomb barrier) used for testing if elastic collision necessary
126  const G4double coeff = 0.001 * 1.2;
127
128  G4double VCOL = coeff * zt * zb / (G4cbrt(at) + G4cbrt(ab)); 
129 
130  G4bool possible = true;       // Force inelastic; should be (ekin >= VCOL)
131
132  if (verboseLevel > 3) {
133    G4cout << " VCOL: " << VCOL << " ekin: " << ekin << " inelastic possible: "
134           << possible << G4endl;
135  }
136
137  return possible;
138}
139
140
141// Validate output for energy, momentum conservation, etc.
142
143G4bool G4CascadeColliderBase::validateOutput(G4InuclParticle* bullet,
144                                             G4InuclParticle* target,
145                                             G4CollisionOutput& output) {
146  if (!doConservationChecks) return true;       // Skip checks if requested
147
148  if (verboseLevel > 1)
149    G4cout << " >>> " << theName << "::validateOutput" << G4endl;
150
151  // Show final state particles
152  if (verboseLevel > 2) output.printCollisionOutput();
153
154  balance->setVerboseLevel(verboseLevel);
155  balance->collide(bullet, target, output);
156  return balance->okay();                       // Returns false if violations
157}
158
159G4bool G4CascadeColliderBase::validateOutput(G4InuclParticle* bullet,
160                                             G4InuclParticle* target,
161                     const std::vector<G4InuclElementaryParticle>& particles) {
162  if (!doConservationChecks) return true;       // Skip checks if requested
163
164  if (verboseLevel > 1)
165    G4cout << " >>> " << theName << "::validateOutput" << G4endl;
166
167  balance->setVerboseLevel(verboseLevel);
168  balance->collide(bullet, target, particles);
169  return balance->okay();                       // Returns false if violations
170}
171
172G4bool G4CascadeColliderBase::validateOutput(G4InuclParticle* bullet,
173                                             G4InuclParticle* target,
174                     const std::vector<G4InuclNuclei>& fragments) {
175  if (!doConservationChecks) return true;       // Skip checks if requested
176
177  if (verboseLevel > 1)
178    G4cout << " >>> " << theName << "::validateOutput" << G4endl;
179
180  balance->setVerboseLevel(verboseLevel);
181  balance->collide(bullet, target, fragments);
182  return balance->okay();                       // Returns false if violations
183}
Note: See TracBrowser for help on using the repository browser.