Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 #define INCLXX_IN_GEANT4_MODE 1
34 
35 #include "globals.hh"
36 
37 #include "G4INCLDecayAvatar.hh"
38 
40 #include "G4INCLPauliBlocking.hh"
41 #include <sstream>
42 #include <string>
43 // #include <cassert>
44 
45 namespace G4INCL {
46 
48  : InteractionAvatar(time, n, aParticle), forced(force),
49  incidentDirection(aParticle->getMomentum())
50  {
52  }
53 
55 
56  }
57 
59  {
60  if(particle1->isDelta()) {
61  DEBUG("DeltaDecayChannel chosen." << std::endl);
62  return new DeltaDecayChannel(theNucleus, particle1, incidentDirection);
63  }
64  else
65  return NULL;
66  }
67 
70  }
71 
73  // Make sure we have at least two particles in the final state
74 // assert(fs->getModifiedParticles().size() + fs->getCreatedParticles().size() - fs->getDestroyedParticles().size() >= 2);
75 
76  if(!forced) { // Normal decay
77 
78  // Call the postInteraction method of the parent class
79  // (provides Pauli blocking and enforces energy conservation)
81 
82  if(fs->getValidity() == PauliBlockedFS)
83  /* If the decay was Pauli-blocked, make sure the propagation model
84  * generates a new decay avatar on the next call to propagate().
85  *
86  * \bug{Note that we don't generate new decay avatars for deltas that
87  * could not satisfy energy conservation. This is in keeping with
88  * INCL4.6, but doesn't seem to make much sense to me (DM), as energy
89  * conservation can be impossible to satisfy due to weird local-energy
90  * conditions, for example, that evolve with time.}
91  */
93 
94  } else { // Forced decay
95  ParticleList created = fs->getCreatedParticles();
96 
97  // Try to enforce energy conservation
99  const G4bool success = enforceEnergyConservation(fs);
100  if(!success) {
101  DEBUG("Enforcing energy conservation: failed!" << std::endl);
102 
103  if(theNucleus) {
104  // Restore the state of the initial particles
106 
107  // Delete newly created particles
108  for( ParticleIter i = created.begin(); i != created.end(); ++i )
109  delete *i;
110 
111  FinalState *fsBlocked = new FinalState;
112  delete fs;
113  fsBlocked->makeNoEnergyConservation();
114  fsBlocked->setTotalEnergyBeforeInteraction(0.0);
115 
116  return fsBlocked; // Interaction is blocked. Return an empty final state.
117  } else {
118  // If there is no nucleus we have to continue anyway, even if energy
119  // conservation failed. We cannot afford producing unphysical
120  // remnants.
121  DEBUG("No nucleus, continuing anyway." << std::endl);
122  }
123  } else {
124  DEBUG("Enforcing energy conservation: success!" << std::endl);
125  }
126 
127  if(theNucleus) {
128  ParticleList modified = fs->getModifiedParticles();
129 
130  // Copy the final state, but don't include the pion (as if it had been
131  // emitted right away).
132  FinalState *emissionFS = new FinalState;
133  for(ParticleIter i=modified.begin(); i!=modified.end(); ++i)
134  emissionFS->addModifiedParticle(*i);
135 
136  // Test CDPP blocking
137  G4bool isCDPPBlocked = Pauli::isCDPPBlocked(created, theNucleus);
138 
139  if(isCDPPBlocked) {
140  DEBUG("CDPP: Blocked!" << std::endl);
141 
142  // Restore the state of both particles
144 
145  // Delete newly created particles
146  for( ParticleIter i = created.begin(); i != created.end(); ++i )
147  delete *i;
148 
149  FinalState *fsBlocked = new FinalState;
150  delete fs;
151  delete emissionFS;
152 
153  fsBlocked->makePauliBlocked();
154  fsBlocked->setTotalEnergyBeforeInteraction(0.0);
155 
156  return fsBlocked; // Interaction is blocked. Return an empty final state.
157  }
158  DEBUG("CDPP: Allowed!" << std::endl);
159 
160  // If all went well (energy conservation enforced and CDPP satisfied),
161  // delete the auxiliary final state
162  delete emissionFS;
163 
164  }
165  }
166 
167  // If there is a nucleus, increment the counters
168  if(theNucleus) {
169  switch(fs->getValidity()) {
170  case PauliBlockedFS:
172  break;
175  case ParticleBelowZeroFS:
176  break;
177  case ValidFS:
179  }
180  }
181  return fs;
182  }
183 
184  std::string DecayAvatar::dump() const {
185  std::stringstream ss;
186  ss << "(avatar " << theTime << " 'decay" << std::endl
187  << "(list " << std::endl
188  << particle1->dump()
189  << "))" << std::endl;
190  return ss.str();
191  }
192 }