G4PreCompoundDeexcitation.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 // $Id$
00027 //
00028 // Takes an arbitrary excited or unphysical nuclear state and produces
00029 // a final state with evaporated particles and (possibly) a stable nucleus.
00030 //
00031 // 20100922  M. Kelsey -- Remove convertFragment() function, pass buffer
00032 //              instead of copying, clean up code somewhat
00033 // 20100925  M. Kelsey -- Use new G4InuclNuclei->G4Fragment conversion, and
00034 //              G4ReactionProducts -> G4CollisionOutput convertor.  Move Z==0
00035 //              explosion condition to base-class function.
00036 // 20100926  M. Kelsey -- Move to new G4VCascadeDeexcitation base class,
00037 //              replace getDeexcitationFragments() with deExcite().
00038 // 20110214  M. Kelsey -- Follow G4InuclParticle::Model enumerator migration
00039 // 20110803  M. Kelsey -- Add post-deexcitation diagnostic messages
00040 // 20120120  V. Ivanchenko -- Pre-compound model and its handler should not be deleted here
00041 
00042 #include "G4PreCompoundDeexcitation.hh"
00043 #include "globals.hh"
00044 #include "G4InuclElementaryParticle.hh"
00045 #include "G4InuclNuclei.hh"
00046 #include "G4InuclParticle.hh"
00047 #include "G4InuclParticleNames.hh"
00048 #include "G4PreCompoundModel.hh"
00049 #include "G4ReactionProductVector.hh"
00050 
00051 using namespace G4InuclParticleNames;
00052 
00053 
00054 // Constructor and destructor
00055 
00056 G4PreCompoundDeexcitation::G4PreCompoundDeexcitation() 
00057   : G4VCascadeDeexcitation("G4PreCompoundDeexcitation"),
00058     theExcitationHandler(new G4ExcitationHandler),
00059     theDeExcitation(new G4PreCompoundModel(theExcitationHandler)) {}
00060 
00061 G4PreCompoundDeexcitation::~G4PreCompoundDeexcitation() {
00062   // we need to delete here because G4PreComp does NOT delete it
00063   // all objects following G4HadronicInteraction interface are
00064   // deleted 
00065   //delete theExcitationHandler;
00066   //delete theDeExcitation;
00067 }
00068 
00069 // Main processing
00070 
00071 void G4PreCompoundDeexcitation::collide(G4InuclParticle* /*bullet*/, 
00072                                         G4InuclParticle* target,
00073                                         G4CollisionOutput& globalOutput) {
00074   if (verboseLevel)
00075     G4cout << " >>> G4PreCompoundDeexcitation::collide" << G4endl;
00076   
00077   // Ensure that input state is sensible
00078   G4InuclNuclei* ntarget = dynamic_cast<G4InuclNuclei*>(target);
00079   if (!ntarget) {
00080     G4cerr << " G4PreCompoundDeexcitation ERROR:  residual fragment must be G4InuclNuclei"
00081            << G4endl;
00082     return;
00083   }
00084 
00085   // NOTE:  Should not get this case, as G4IntraNucleiCascade should catch it
00086   if (ntarget->getA() == 1) {           // Just a nucleon; move to output list
00087     G4int type = (ntarget->getZ() == 0) ? neutron : proton;
00088     G4InuclElementaryParticle ptarget(target->getMomentum(), type, 
00089                                       G4InuclParticle::PreCompound);
00090 
00091     globalOutput.addOutgoingParticle(ptarget);
00092     return;
00093   }
00094 
00095   G4Fragment frag(*ntarget);
00096 
00097   output.reset();               // Use temporary buffer for conservation checks
00098   deExcite(&frag, output);
00099   validateOutput(0, target, output);
00100 
00101   globalOutput.add(output);     // Return results
00102 }
00103 
00104 void G4PreCompoundDeexcitation::deExcite(G4Fragment* fragment,
00105                                          G4CollisionOutput& globalOutput) {
00106   if (verboseLevel)
00107     G4cout << " >>> G4PreCompoundDeexcitation::deExcite" << G4endl;
00108 
00109   if (!fragment) {
00110     if (verboseLevel > 1) G4cerr << " NULL pointer fragment" << G4endl;
00111     return;
00112   }
00113 
00114   if (verboseLevel > 1) G4cout << *fragment << G4endl;
00115 
00116   G4ReactionProductVector* precompoundProducts = 0;
00117 
00118   // FIXME: in principle, the explosion(...) stuff should also 
00119   //        handle properly the case of Z=0 (neutron blob) 
00120   if (explosion(fragment) && theExcitationHandler) {
00121     if (verboseLevel) G4cout << " calling BreakItUp" << G4endl;
00122     precompoundProducts = theExcitationHandler->BreakItUp(*fragment);
00123   } else {
00124     if (verboseLevel) G4cout << " calling DeExcite" << G4endl;
00125     precompoundProducts = theDeExcitation->DeExcite(*fragment);
00126   }
00127 
00128   // Transfer output of de-excitation back into Bertini objects
00129   if (precompoundProducts) {
00130     if (verboseLevel>1) {
00131       G4cout << " Got " << precompoundProducts->size()
00132              << " secondaries back from PreCompound:" << G4endl;
00133     }
00134 
00135     globalOutput.setVerboseLevel(verboseLevel); // For debugging
00136     globalOutput.addOutgoingParticles(precompoundProducts);
00137     globalOutput.setVerboseLevel(0);
00138 
00139     precompoundProducts->clear();
00140     delete precompoundProducts;
00141   }
00142 }

Generated on Mon May 27 17:49:24 2013 for Geant4 by  doxygen 1.4.7