00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #define INCLXX_IN_GEANT4_MODE 1
00034
00035 #include "globals.hh"
00036
00037 #include "G4INCLDecayAvatar.hh"
00038
00039 #include "G4INCLDeltaDecayChannel.hh"
00040 #include "G4INCLPauliBlocking.hh"
00041 #include <sstream>
00042 #include <string>
00043
00044
00045 namespace G4INCL {
00046
00047 DecayAvatar::DecayAvatar(G4INCL::Particle *aParticle, G4double time, G4INCL::Nucleus *n, G4bool force)
00048 : InteractionAvatar(time, n, aParticle), forced(force),
00049 incidentDirection(aParticle->getMomentum())
00050 {
00051 setType(DecayAvatarType);
00052 }
00053
00054 DecayAvatar::~DecayAvatar() {
00055
00056 }
00057
00058 G4INCL::IChannel* DecayAvatar::getChannel() const
00059 {
00060 if(particle1->isDelta()) {
00061 DEBUG("DeltaDecayChannel chosen." << std::endl);
00062 return new DeltaDecayChannel(theNucleus, particle1, incidentDirection);
00063 }
00064 else
00065 return NULL;
00066 }
00067
00068 void DecayAvatar::preInteraction() {
00069 InteractionAvatar::preInteraction();
00070 }
00071
00072 FinalState *DecayAvatar::postInteraction(FinalState *fs) {
00073
00074
00075
00076 if(!forced) {
00077
00078
00079
00080 fs = InteractionAvatar::postInteraction(fs);
00081
00082 if(fs->getValidity() == PauliBlockedFS)
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 fs->setBlockedDelta(particle1);
00093
00094 } else {
00095 ParticleList created = fs->getCreatedParticles();
00096
00097
00098 fs->setTotalEnergyBeforeInteraction(oldTotalEnergy);
00099 const G4bool success = enforceEnergyConservation(fs);
00100 if(!success) {
00101 DEBUG("Enforcing energy conservation: failed!" << std::endl);
00102
00103 if(theNucleus) {
00104
00105 restoreParticles();
00106
00107
00108 for( ParticleIter i = created.begin(); i != created.end(); ++i )
00109 delete *i;
00110
00111 FinalState *fsBlocked = new FinalState;
00112 delete fs;
00113 fsBlocked->makeNoEnergyConservation();
00114 fsBlocked->setTotalEnergyBeforeInteraction(0.0);
00115
00116 return fsBlocked;
00117 } else {
00118
00119
00120
00121 DEBUG("No nucleus, continuing anyway." << std::endl);
00122 }
00123 } else {
00124 DEBUG("Enforcing energy conservation: success!" << std::endl);
00125 }
00126
00127 if(theNucleus) {
00128 ParticleList modified = fs->getModifiedParticles();
00129
00130
00131
00132 FinalState *emissionFS = new FinalState;
00133 for(ParticleIter i=modified.begin(); i!=modified.end(); ++i)
00134 emissionFS->addModifiedParticle(*i);
00135
00136
00137 G4bool isCDPPBlocked = Pauli::isCDPPBlocked(created, theNucleus);
00138
00139 if(isCDPPBlocked) {
00140 DEBUG("CDPP: Blocked!" << std::endl);
00141
00142
00143 restoreParticles();
00144
00145
00146 for( ParticleIter i = created.begin(); i != created.end(); ++i )
00147 delete *i;
00148
00149 FinalState *fsBlocked = new FinalState;
00150 delete fs;
00151 delete emissionFS;
00152
00153 fsBlocked->makePauliBlocked();
00154 fsBlocked->setTotalEnergyBeforeInteraction(0.0);
00155
00156 return fsBlocked;
00157 }
00158 DEBUG("CDPP: Allowed!" << std::endl);
00159
00160
00161
00162 delete emissionFS;
00163
00164 }
00165 }
00166
00167
00168 if(theNucleus) {
00169 switch(fs->getValidity()) {
00170 case PauliBlockedFS:
00171 theNucleus->getStore()->getBook()->incrementBlockedDecays();
00172 break;
00173 case NoEnergyConservationFS:
00174 case ParticleBelowFermiFS:
00175 case ParticleBelowZeroFS:
00176 break;
00177 case ValidFS:
00178 theNucleus->getStore()->getBook()->incrementAcceptedDecays();
00179 }
00180 }
00181 return fs;
00182 }
00183
00184 std::string DecayAvatar::dump() const {
00185 std::stringstream ss;
00186 ss << "(avatar " << theTime << " 'decay" << std::endl
00187 << "(list " << std::endl
00188 << particle1->dump()
00189 << "))" << std::endl;
00190 return ss.str();
00191 }
00192 }