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
G4INCLDecayAvatar.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// INCL++ intra-nuclear cascade model
27// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
28// Davide Mancusi, CEA
29// Alain Boudard, CEA
30// Sylvie Leray, CEA
31// Joseph Cugnon, University of Liege
32//
33// INCL++ revision: v5.1.8
34//
35#define INCLXX_IN_GEANT4_MODE 1
36
37#include "globals.hh"
38
39#include "G4INCLDecayAvatar.hh"
40
43#include <sstream>
44#include <string>
45// #include <cassert>
46
47namespace G4INCL {
48
50 : InteractionAvatar(time, n, aParticle), forced(force),
51 incidentDirection(aParticle->getMomentum())
52 {
54 }
55
57
58 }
59
61 {
62 if(particle1->isDelta()) {
63 DEBUG("DeltaDecayChannel chosen." << std::endl);
64 return new DeltaDecayChannel(theNucleus, particle1, incidentDirection);
65 }
66 else
67 return NULL;
68 }
69
72 }
73
75 // Make sure we have at least two particles in the final state
76// assert(fs->getModifiedParticles().size() + fs->getCreatedParticles().size() - fs->getDestroyedParticles().size() >= 2);
77
78 if(!forced) { // Normal decay
79
80 // Call the postInteraction method of the parent class
81 // (provides Pauli blocking and enforces energy conservation)
83
84 if(fs->getValidity() == PauliBlockedFS)
85 /* If the decay was Pauli-blocked, make sure the propagation model
86 * generates a new decay avatar on the next call to propagate().
87 *
88 * \bug{Note that we don't generate new decay avatars for deltas that
89 * could not satisfy energy conservation. This is in keeping with
90 * INCL4.6, but doesn't seem to make much sense to me (DM), as energy
91 * conservation can be impossible to satisfy due to weird local-energy
92 * conditions, for example, that evolve with time.}
93 */
95
96 } else { // Forced decay
97 ParticleList created = fs->getCreatedParticles();
98
99 // Try to enforce energy conservation
101 const G4bool success = enforceEnergyConservation(fs);
102 if(!success) {
103 DEBUG("Enforcing energy conservation: failed!" << std::endl);
104
105 if(theNucleus) {
106 // Restore the state of the initial particles
108
109 // Delete newly created particles
110 for( ParticleIter i = created.begin(); i != created.end(); ++i )
111 delete *i;
112
113 FinalState *fsBlocked = new FinalState;
114 delete fs;
115 fsBlocked->makeNoEnergyConservation();
116 fsBlocked->setTotalEnergyBeforeInteraction(0.0);
117
118 return fsBlocked; // Interaction is blocked. Return an empty final state.
119 } else {
120 // If there is no nucleus we have to continue anyway, even if energy
121 // conservation failed. We cannot afford producing unphysical
122 // remnants.
123 DEBUG("No nucleus, continuing anyway." << std::endl);
124 }
125 } else {
126 DEBUG("Enforcing energy conservation: success!" << std::endl);
127 }
128
129 if(theNucleus) {
130 ParticleList modified = fs->getModifiedParticles();
131
132 // Copy the final state, but don't include the pion (as if it had been
133 // emitted right away).
134 FinalState *emissionFS = new FinalState;
135 for(ParticleIter i=modified.begin(); i!=modified.end(); ++i)
136 emissionFS->addModifiedParticle(*i);
137
138 // Test CDPP blocking
139 G4bool isCDPPBlocked = Pauli::isCDPPBlocked(created, theNucleus);
140
141 if(isCDPPBlocked) {
142 DEBUG("CDPP: Blocked!" << std::endl);
143
144 // Restore the state of both particles
146
147 // Delete newly created particles
148 for( ParticleIter i = created.begin(); i != created.end(); ++i )
149 delete *i;
150
151 FinalState *fsBlocked = new FinalState;
152 delete fs;
153 delete emissionFS;
154
155 fsBlocked->makePauliBlocked();
156 fsBlocked->setTotalEnergyBeforeInteraction(0.0);
157
158 return fsBlocked; // Interaction is blocked. Return an empty final state.
159 }
160 DEBUG("CDPP: Allowed!" << std::endl);
161
162 // If all went well (energy conservation enforced and CDPP satisfied),
163 // delete the auxiliary final state
164 delete emissionFS;
165
166 }
167 }
168
169 // If there is a nucleus, increment the counters
170 if(theNucleus) {
171 switch(fs->getValidity()) {
172 case PauliBlockedFS:
174 break;
178 break;
179 case ValidFS:
181 }
182 }
183 return fs;
184 }
185
186 std::string DecayAvatar::dump() const {
187 std::stringstream ss;
188 ss << "(avatar " << theTime << " 'decay" << std::endl
189 << "(list " << std::endl
190 << particle1->dump()
191 << "))" << std::endl;
192 return ss.str();
193 }
194}
#define DEBUG(x)
double G4double
Definition: G4Types.hh:64
bool G4bool
Definition: G4Types.hh:67
void incrementAcceptedDecays()
Definition: G4INCLBook.hh:70
void incrementBlockedDecays()
Definition: G4INCLBook.hh:71
std::string dump() const
virtual FinalState * postInteraction(FinalState *)
G4INCL::IChannel * getChannel() const
DecayAvatar(G4INCL::Particle *aParticle, G4double time, G4INCL::Nucleus *aNucleus, G4bool force=false)
virtual void preInteraction()
void addModifiedParticle(Particle *p)
ParticleList const & getModifiedParticles() const
void setBlockedDelta(Particle *const p)
void setTotalEnergyBeforeInteraction(G4double E)
FinalStateValidity getValidity() const
ParticleList const & getCreatedParticles() const
void setType(AvatarType t)
FinalState * postInteraction(FinalState *)
void restoreParticles() const
Restore the state of both particles.
G4bool enforceEnergyConservation(FinalState *const fs)
Enforce energy conservation.
Store * getStore() const
std::string dump() const
G4bool isDelta() const
Is it a Delta?
static G4bool isCDPPBlocked(ParticleList const p, Nucleus const *const n)
Check CDPP blocking.
Book * getBook()
Definition: G4INCLStore.hh:243
@ DecayAvatarType
@ ParticleBelowZeroFS
@ NoEnergyConservationFS
@ ParticleBelowFermiFS
std::list< G4INCL::Particle * > ParticleList
std::list< G4INCL::Particle * >::const_iterator ParticleIter