Geant4  10.02.p02
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 // Alain Boudard, CEA-Saclay, France
28 // Joseph Cugnon, University of Liege, Belgium
29 // Jean-Christophe David, CEA-Saclay, France
30 // Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
31 // Sylvie Leray, CEA-Saclay, France
32 // Davide Mancusi, CEA-Saclay, France
33 //
34 #define INCLXX_IN_GEANT4_MODE 1
35 
36 #include "globals.hh"
37 
38 #include "G4INCLDecayAvatar.hh"
39 
41 #include "G4INCLPauliBlocking.hh"
42 #include <sstream>
43 #include <string>
44 // #include <cassert>
45 
46 namespace G4INCL {
47 
49  : InteractionAvatar(time, n, aParticle), forced(force),
50  incidentDirection(aParticle->getMomentum())
51  {
53  }
54 
56 
57  }
58 
60  if(particle1->isDelta()) {
61  INCL_DEBUG("DeltaDecayChannel chosen." << '\n');
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
97 
98  // Try to enforce energy conservation
100  const G4bool success = enforceEnergyConservation(fs);
101  if(!success) {
102  INCL_DEBUG("Enforcing energy conservation: failed!" << '\n');
103 
104  if(theNucleus) {
105  // Restore the state of the initial particles
107 
108  // Delete newly created particles
109  for(ParticleIter i=created.begin(), e=created.end(); i!=e; ++i )
110  delete *i;
111 
112  fs->reset();
115 
116  return; // 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  INCL_DEBUG("No nucleus, continuing anyway." << '\n');
122  }
123  } else {
124  INCL_DEBUG("Enforcing energy conservation: success!" << '\n');
125  }
126 
127  if(theNucleus) {
128  // Test CDPP blocking
130 
131  if(isCDPPBlocked) {
132  INCL_DEBUG("CDPP: Blocked!" << '\n');
133 
134  // Restore the state of both particles
136 
137  // Delete newly created particles
138  for(ParticleIter i=created.begin(), e=created.end(); i!=e; ++i )
139  delete *i;
140 
141  fs->reset();
142  fs->makePauliBlocked();
144 
145  return; // Interaction is blocked. Return an empty final state.
146  }
147  INCL_DEBUG("CDPP: Allowed!" << '\n');
148 
149  }
150  }
151 
152  // If there is a nucleus, increment the counters
153  if(theNucleus) {
154  switch(fs->getValidity()) {
155  case PauliBlockedFS:
157  break;
160  case ParticleBelowZeroFS:
161  break;
162  case ValidFS:
164  }
165  }
166  return;
167  }
168 
169  std::string DecayAvatar::dump() const {
170  std::stringstream ss;
171  ss << "(avatar " << theTime << " 'decay" << '\n'
172  << "(list " << '\n'
173  << particle1->dump()
174  << "))" << '\n';
175  return ss.str();
176  }
177 }
void incrementBlockedDecays()
Definition: G4INCLBook.hh:75
G4bool isCDPPBlocked(ParticleList const &p, Nucleus const *const n)
Check CDPP blocking.
FinalStateValidity getValidity() const
Channel generates a final state of an avatar.
ParticleList const & getModifiedParticles() const
Store * getStore() const
G4bool isDelta() const
Is it a Delta?
ThreeVector const incidentDirection
ParticleList const & getCreatedParticles() const
Final state of an interaction.
void setType(AvatarType t)
virtual void preInteraction()
Book & getBook()
Return the pointer to the Book object which keeps track of various counters.
Definition: G4INCLStore.hh:259
bool G4bool
Definition: G4Types.hh:79
const G4int n
void setTotalEnergyBeforeInteraction(G4double E)
std::string dump() const
void incrementAcceptedDecays()
Definition: G4INCLBook.hh:74
G4bool enforceEnergyConservation(FinalState *const fs)
Enforce energy conservation.
void restoreParticles() const
Restore the state of both particles.
double G4double
Definition: G4Types.hh:76
#define INCL_DEBUG(x)
DecayAvatar(G4INCL::Particle *aParticle, G4double time, G4INCL::Nucleus *aNucleus, G4bool force=false)
virtual void postInteraction(FinalState *fs)
void addModifiedParticle(Particle *p)
ParticleList::const_iterator ParticleIter
std::string dump() const