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
G4PreCompoundDeexcitation.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// Takes an arbitrary excited or unphysical nuclear state and produces
29// a final state with evaporated particles and (possibly) a stable nucleus.
30//
31// 20100922 M. Kelsey -- Remove convertFragment() function, pass buffer
32// instead of copying, clean up code somewhat
33// 20100925 M. Kelsey -- Use new G4InuclNuclei->G4Fragment conversion, and
34// G4ReactionProducts -> G4CollisionOutput convertor. Move Z==0
35// explosion condition to base-class function.
36// 20100926 M. Kelsey -- Move to new G4VCascadeDeexcitation base class,
37// replace getDeexcitationFragments() with deExcite().
38// 20110214 M. Kelsey -- Follow G4InuclParticle::Model enumerator migration
39// 20110803 M. Kelsey -- Add post-deexcitation diagnostic messages
40// 20120120 V. Ivanchenko -- Pre-compound model and its handler should not be deleted here
41
43#include "globals.hh"
45#include "G4InuclNuclei.hh"
46#include "G4InuclParticle.hh"
48#include "G4PreCompoundModel.hh"
50
51using namespace G4InuclParticleNames;
52
53
54// Constructor and destructor
55
57 : G4VCascadeDeexcitation("G4PreCompoundDeexcitation"),
58 theExcitationHandler(new G4ExcitationHandler),
59 theDeExcitation(new G4PreCompoundModel(theExcitationHandler)) {}
60
62 // we need to delete here because G4PreComp does NOT delete it
63 // all objects following G4HadronicInteraction interface are
64 // deleted
65 //delete theExcitationHandler;
66 //delete theDeExcitation;
67}
68
69// Main processing
70
72 G4InuclParticle* target,
73 G4CollisionOutput& globalOutput) {
74 if (verboseLevel)
75 G4cout << " >>> G4PreCompoundDeexcitation::collide" << G4endl;
76
77 // Ensure that input state is sensible
78 G4InuclNuclei* ntarget = dynamic_cast<G4InuclNuclei*>(target);
79 if (!ntarget) {
80 G4cerr << " G4PreCompoundDeexcitation ERROR: residual fragment must be G4InuclNuclei"
81 << G4endl;
82 return;
83 }
84
85 // NOTE: Should not get this case, as G4IntraNucleiCascade should catch it
86 if (ntarget->getA() == 1) { // Just a nucleon; move to output list
87 G4int type = (ntarget->getZ() == 0) ? neutron : proton;
88 G4InuclElementaryParticle ptarget(target->getMomentum(), type,
90
91 globalOutput.addOutgoingParticle(ptarget);
92 return;
93 }
94
95 G4Fragment frag(*ntarget);
96
97 output.reset(); // Use temporary buffer for conservation checks
98 deExcite(&frag, output);
99 validateOutput(0, target, output);
100
101 globalOutput.add(output); // Return results
102}
103
105 G4CollisionOutput& globalOutput) {
106 if (verboseLevel)
107 G4cout << " >>> G4PreCompoundDeexcitation::deExcite" << G4endl;
108
109 if (!fragment) {
110 if (verboseLevel > 1) G4cerr << " NULL pointer fragment" << G4endl;
111 return;
112 }
113
114 if (verboseLevel > 1) G4cout << *fragment << G4endl;
115
116 G4ReactionProductVector* precompoundProducts = 0;
117
118 // FIXME: in principle, the explosion(...) stuff should also
119 // handle properly the case of Z=0 (neutron blob)
120 if (explosion(fragment) && theExcitationHandler) {
121 if (verboseLevel) G4cout << " calling BreakItUp" << G4endl;
122 precompoundProducts = theExcitationHandler->BreakItUp(*fragment);
123 } else {
124 if (verboseLevel) G4cout << " calling DeExcite" << G4endl;
125 precompoundProducts = theDeExcitation->DeExcite(*fragment);
126 }
127
128 // Transfer output of de-excitation back into Bertini objects
129 if (precompoundProducts) {
130 if (verboseLevel>1) {
131 G4cout << " Got " << precompoundProducts->size()
132 << " secondaries back from PreCompound:" << G4endl;
133 }
134
135 globalOutput.setVerboseLevel(verboseLevel); // For debugging
136 globalOutput.addOutgoingParticles(precompoundProducts);
137 globalOutput.setVerboseLevel(0);
138
139 precompoundProducts->clear();
140 delete precompoundProducts;
141 }
142}
@ neutron
std::vector< G4ReactionProduct * > G4ReactionProductVector
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
virtual G4bool explosion(G4InuclNuclei *target) const
virtual G4bool validateOutput(G4InuclParticle *bullet, G4InuclParticle *target, G4CollisionOutput &output)
void addOutgoingParticle(const G4InuclElementaryParticle &particle)
void setVerboseLevel(G4int verbose)
void add(const G4CollisionOutput &right)
void addOutgoingParticles(const std::vector< G4InuclElementaryParticle > &particles)
G4ReactionProductVector * BreakItUp(const G4Fragment &theInitialState) const
G4int getZ() const
G4int getA() const
G4LorentzVector getMomentum() const
virtual void deExcite(G4Fragment *fragment, G4CollisionOutput &globalOutput)
void collide(G4InuclParticle *, G4InuclParticle *target, G4CollisionOutput &globalOutput)
virtual G4ReactionProductVector * DeExcite(G4Fragment &aFragment)=0