G4INCLDecayAvatar.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // INCL++ intra-nuclear cascade model
00027 // Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
00028 // Davide Mancusi, CEA
00029 // Alain Boudard, CEA
00030 // Sylvie Leray, CEA
00031 // Joseph Cugnon, University of Liege
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 // #include <cassert>
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     // Make sure we have at least two particles in the final state
00074 // assert(fs->getModifiedParticles().size() + fs->getCreatedParticles().size() - fs->getDestroyedParticles().size() >= 2);
00075 
00076     if(!forced) { // Normal decay
00077 
00078       // Call the postInteraction method of the parent class
00079       // (provides Pauli blocking and enforces energy conservation)
00080       fs = InteractionAvatar::postInteraction(fs);
00081 
00082       if(fs->getValidity() == PauliBlockedFS)
00083         /* If the decay was Pauli-blocked, make sure the propagation model
00084          * generates a new decay avatar on the next call to propagate().
00085          *
00086          * \bug{Note that we don't generate new decay avatars for deltas that
00087          * could not satisfy energy conservation. This is in keeping with
00088          * INCL4.6, but doesn't seem to make much sense to me (DM), as energy
00089          * conservation can be impossible to satisfy due to weird local-energy
00090          * conditions, for example, that evolve with time.}
00091          */
00092         fs->setBlockedDelta(particle1);
00093 
00094     } else { // Forced decay
00095       ParticleList created = fs->getCreatedParticles();
00096 
00097       // Try to enforce energy conservation
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           // Restore the state of the initial particles
00105           restoreParticles();
00106 
00107           // Delete newly created particles
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; // Interaction is blocked. Return an empty final state.
00117         } else {
00118           // If there is no nucleus we have to continue anyway, even if energy
00119           // conservation failed. We cannot afford producing unphysical
00120           // remnants.
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         // Copy the final state, but don't include the pion (as if it had been
00131         // emitted right away).
00132         FinalState *emissionFS = new FinalState;
00133         for(ParticleIter i=modified.begin(); i!=modified.end(); ++i)
00134           emissionFS->addModifiedParticle(*i);
00135 
00136         // Test CDPP blocking
00137         G4bool isCDPPBlocked = Pauli::isCDPPBlocked(created, theNucleus);
00138 
00139         if(isCDPPBlocked) {
00140           DEBUG("CDPP: Blocked!" << std::endl);
00141 
00142           // Restore the state of both particles
00143           restoreParticles();
00144 
00145           // Delete newly created particles
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; // Interaction is blocked. Return an empty final state.
00157         }
00158         DEBUG("CDPP: Allowed!" << std::endl);
00159 
00160         // If all went well (energy conservation enforced and CDPP satisfied),
00161         // delete the auxiliary final state
00162         delete emissionFS;
00163 
00164       }
00165     }
00166 
00167     // If there is a nucleus, increment the counters
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 }

Generated on Mon May 27 17:48:34 2013 for Geant4 by  doxygen 1.4.7