Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 // 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 
42 #include "G4INCLPauliBlocking.hh"
43 #include <sstream>
44 #include <string>
45 // #include <cassert>
46 
47 namespace G4INCL {
48 
50  : InteractionAvatar(time, n, aParticle), forced(force),
51  incidentDirection(aParticle->getMomentum())
52  {
54  }
55 
57 
58  }
59 
61  if(particle1->isDelta()) {
62  INCL_DEBUG("DeltaDecayChannel chosen." << '\n');
63  return new DeltaDecayChannel(particle1, incidentDirection);
64  }
65  else if(particle1->isEta() || particle1->isOmega()) {
66  INCL_DEBUG("PionResonanceDecayChannel chosen." << '\n');
67  return new PionResonanceDecayChannel(particle1, incidentDirection);
68  }
69  else
70  return NULL;
71  }
72 
75  }
76 
78  // Make sure we have at least two particles in the final state
79 // assert(fs->getModifiedParticles().size() + fs->getCreatedParticles().size() - fs->getDestroyedParticles().size() >= 2);
80 
81  if(!forced) { // Normal decay
82 
83  // Call the postInteraction method of the parent class
84  // (provides Pauli blocking and enforces energy conservation)
86 
87  if(fs->getValidity() == PauliBlockedFS)
88  /* If the decay was Pauli-blocked, make sure the propagation model
89  * generates a new decay avatar on the next call to propagate().
90  *
91  * \bug{Note that we don't generate new decay avatars for deltas that
92  * could not satisfy energy conservation. This is in keeping with
93  * INCL4.6, but doesn't seem to make much sense to me (DM), as energy
94  * conservation can be impossible to satisfy due to weird local-energy
95  * conditions, for example, that evolve with time.}
96  */
98 
99  } else { // Forced decay
102 
103  // Try to enforce energy conservation
105  const G4bool success = enforceEnergyConservation(fs);
106  if(!success) {
107  INCL_DEBUG("Enforcing energy conservation: failed!" << '\n');
108 
109  if(theNucleus) {
110  // Restore the state of the initial particles
112 
113  // Delete newly created particles
114  for(ParticleIter i=created.begin(), e=created.end(); i!=e; ++i )
115  delete *i;
116 
117  fs->reset();
120 
121  return; // Interaction is blocked. Return an empty final state.
122  } else {
123  // If there is no nucleus we have to continue anyway, even if energy
124  // conservation failed. We cannot afford producing unphysical
125  // remnants.
126  INCL_DEBUG("No nucleus, continuing anyway." << '\n');
127  }
128  } else {
129  INCL_DEBUG("Enforcing energy conservation: success!" << '\n');
130  }
131 
132  if(theNucleus) {
133  // Test CDPP blocking
135 
136  if(isCDPPBlocked) {
137  INCL_DEBUG("CDPP: Blocked!" << '\n');
138 
139  // Restore the state of both particles
141 
142  // Delete newly created particles
143  for(ParticleIter i=created.begin(), e=created.end(); i!=e; ++i )
144  delete *i;
145 
146  fs->reset();
147  fs->makePauliBlocked();
149 
150  return; // Interaction is blocked. Return an empty final state.
151  }
152  INCL_DEBUG("CDPP: Allowed!" << '\n');
153 
154  }
155  }
156 
157  // If there is a nucleus, increment the counters
158  if(theNucleus) {
159  switch(fs->getValidity()) {
160  case PauliBlockedFS:
162  break;
165  case ParticleBelowZeroFS:
166  break;
167  case ValidFS:
169  }
170  }
171  return;
172  }
173 
174  std::string DecayAvatar::dump() const {
175  std::stringstream ss;
176  ss << "(avatar " << theTime << " 'decay" << '\n'
177  << "(list " << '\n'
178  << particle1->dump()
179  << "))" << '\n';
180  return ss.str();
181  }
182 }
G4bool isEta() const
Is this a eta?
void incrementBlockedDecays()
Definition: G4INCLBook.hh:75
G4bool isCDPPBlocked(ParticleList const &p, Nucleus const *const n)
Check CDPP blocking.
FinalStateValidity getValidity() const
ParticleList const & getModifiedParticles() const
Store * getStore() const
G4bool isDelta() const
Is it a Delta?
ParticleList const & getCreatedParticles() const
G4bool isOmega() const
Is this a omega?
void setType(AvatarType t)
virtual void preInteraction()
Book & getBook()
Definition: G4INCLStore.hh:259
bool G4bool
Definition: G4Types.hh:79
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