Geant4_10
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  if(particle1->isDelta()) {
60  INCL_DEBUG("DeltaDecayChannel chosen." << std::endl);
61  return new DeltaDecayChannel(particle1, incidentDirection);
62  }
63  else
64  return NULL;
65  }
66 
69  }
70 
72  // Make sure we have at least two particles in the final state
73 // assert(fs->getModifiedParticles().size() + fs->getCreatedParticles().size() - fs->getDestroyedParticles().size() >= 2);
74 
75  if(!forced) { // Normal decay
76 
77  // Call the postInteraction method of the parent class
78  // (provides Pauli blocking and enforces energy conservation)
80 
81  if(fs->getValidity() == PauliBlockedFS)
82  /* If the decay was Pauli-blocked, make sure the propagation model
83  * generates a new decay avatar on the next call to propagate().
84  *
85  * \bug{Note that we don't generate new decay avatars for deltas that
86  * could not satisfy energy conservation. This is in keeping with
87  * INCL4.6, but doesn't seem to make much sense to me (DM), as energy
88  * conservation can be impossible to satisfy due to weird local-energy
89  * conditions, for example, that evolve with time.}
90  */
92 
93  } else { // Forced decay
94  ParticleList created = fs->getCreatedParticles();
95 
96  // Try to enforce energy conservation
98  const G4bool success = enforceEnergyConservation(fs);
99  if(!success) {
100  INCL_DEBUG("Enforcing energy conservation: failed!" << std::endl);
101 
102  if(theNucleus) {
103  // Restore the state of the initial particles
105 
106  // Delete newly created particles
107  for(ParticleIter i=created.begin(), e=created.end(); i!=e; ++i )
108  delete *i;
109 
110  FinalState *fsBlocked = new FinalState;
111  delete fs;
112  fsBlocked->makeNoEnergyConservation();
113  fsBlocked->setTotalEnergyBeforeInteraction(0.0);
114 
115  return fsBlocked; // Interaction is blocked. Return an empty final state.
116  } else {
117  // If there is no nucleus we have to continue anyway, even if energy
118  // conservation failed. We cannot afford producing unphysical
119  // remnants.
120  INCL_DEBUG("No nucleus, continuing anyway." << std::endl);
121  }
122  } else {
123  INCL_DEBUG("Enforcing energy conservation: success!" << std::endl);
124  }
125 
126  if(theNucleus) {
127  ParticleList modified = fs->getModifiedParticles();
128 
129  // Copy the final state, but don't include the pion (as if it had been
130  // emitted right away).
131  FinalState *emissionFS = new FinalState;
132  for(ParticleIter i=modified.begin(), e=modified.end(); i!=e; ++i)
133  emissionFS->addModifiedParticle(*i);
134 
135  // Test CDPP blocking
136  G4bool isCDPPBlocked = Pauli::isCDPPBlocked(created, theNucleus);
137 
138  if(isCDPPBlocked) {
139  INCL_DEBUG("CDPP: Blocked!" << std::endl);
140 
141  // Restore the state of both particles
143 
144  // Delete newly created particles
145  for(ParticleIter i=created.begin(), e=created.end(); i!=e; ++i )
146  delete *i;
147 
148  FinalState *fsBlocked = new FinalState;
149  delete fs;
150  delete emissionFS;
151 
152  fsBlocked->makePauliBlocked();
153  fsBlocked->setTotalEnergyBeforeInteraction(0.0);
154 
155  return fsBlocked; // Interaction is blocked. Return an empty final state.
156  }
157  INCL_DEBUG("CDPP: Allowed!" << std::endl);
158 
159  // If all went well (energy conservation enforced and CDPP satisfied),
160  // delete the auxiliary final state
161  delete emissionFS;
162 
163  }
164  }
165 
166  // If there is a nucleus, increment the counters
167  if(theNucleus) {
168  switch(fs->getValidity()) {
169  case PauliBlockedFS:
171  break;
174  case ParticleBelowZeroFS:
175  break;
176  case ValidFS:
178  }
179  }
180  return fs;
181  }
182 
183  std::string DecayAvatar::dump() const {
184  std::stringstream ss;
185  ss << "(avatar " << theTime << " 'decay" << std::endl
186  << "(list " << std::endl
187  << particle1->dump()
188  << "))" << std::endl;
189  return ss.str();
190  }
191 }
void incrementBlockedDecays()
Definition: G4INCLBook.hh:74
void setBlockedDelta(Particle *const p)
FinalStateValidity getValidity() const
static G4bool isCDPPBlocked(ParticleList const &p, Nucleus const *const n)
Check CDPP blocking.
G4INCL::IChannel * getChannel()
ParticleList const & getModifiedParticles() const
Store * getStore() const
G4bool isDelta() const
Is it a Delta?
ParticleList const & getCreatedParticles() const
Char_t n[5]
void setType(AvatarType t)
virtual void preInteraction()
Book & getBook()
Definition: G4INCLStore.hh:237
bool G4bool
Definition: G4Types.hh:79
FinalState * postInteraction(FinalState *)
void setTotalEnergyBeforeInteraction(G4double E)
std::string dump() const
void incrementAcceptedDecays()
Definition: G4INCLBook.hh:73
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 FinalState * postInteraction(FinalState *)
void addModifiedParticle(Particle *p)
ParticleList::const_iterator ParticleIter
std::string dump() const