G4CascadeColliderBase.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 // 20100714  M. Kelsey -- Move functionality from G4VCascadeCollider, and
00029 //              provide conservation-checking here, with wrapper function
00030 //              and control flag.
00031 // 20100721  M. Kelsey -- Use G4CASCADE_CHECK_ECONS to set default control
00032 //              flag for validations.
00033 // 20100923  M. Kelsey -- Migrate to integer A and Z
00034 // 20100925  M. Kelsey -- Add explosion() interfaces for G4Fragment and for
00035 //              (A,Z,E).  Move implementation to latter.  Add Z==0 condition.
00036 // 20110225  M. Kelsey -- Add setVerboseLevel(), calls through to members
00037 
00038 #include "G4CascadeColliderBase.hh"
00039 #include "G4CascadeCheckBalance.hh"
00040 #include "G4CollisionOutput.hh"
00041 #include "G4Fragment.hh"
00042 #include "G4InteractionCase.hh"
00043 #include "G4InuclElementaryParticle.hh"
00044 #include "G4InuclNuclei.hh"
00045 #include "G4InuclSpecialFunctions.hh"
00046 #include "G4ios.hh"
00047 
00048 using namespace G4InuclSpecialFunctions;
00049 
00050 
00051 // Constructor and destructor
00052 
00053 G4CascadeColliderBase::G4CascadeColliderBase(const char* name, G4int verbose)
00054   : G4VCascadeCollider(name, verbose),
00055 #ifdef G4CASCADE_CHECK_ECONS    
00056     doConservationChecks(true),
00057 #else
00058     doConservationChecks(false),
00059 #endif
00060     balance(new G4CascadeCheckBalance(0.001, 0.001, name)) {}
00061 
00062 G4CascadeColliderBase::~G4CascadeColliderBase() {
00063   delete balance;
00064 }
00065 
00066 void G4CascadeColliderBase::setVerboseLevel(G4int verbose) {
00067   G4VCascadeCollider::setVerboseLevel(verbose);
00068   balance->setVerboseLevel(verbose);
00069 }
00070 
00071 
00072 // Both bullet and target must be hadrons or photons for this to work
00073 
00074 G4bool G4CascadeColliderBase::useEPCollider(G4InuclParticle* bullet, 
00075                                             G4InuclParticle* target) const {
00076   return (dynamic_cast<G4InuclElementaryParticle*>(bullet) &&
00077           dynamic_cast<G4InuclElementaryParticle*>(target));
00078 }
00079 
00080 
00081 // Decide wether nuclear fragment is candidate for G4BigBanger
00082 
00083 G4bool G4CascadeColliderBase::explosion(G4InuclNuclei* target) const {
00084   return target && explosion(target->getA(), target->getZ(), 
00085                              target->getExitationEnergy());     // in MeV
00086 }
00087 
00088 G4bool G4CascadeColliderBase::explosion(G4Fragment* fragment) const {
00089   return fragment && explosion(fragment->GetA_asInt(), fragment->GetZ_asInt(),
00090                                fragment->GetExcitationEnergy());     // in MeV
00091 }
00092 
00093 G4bool 
00094 G4CascadeColliderBase::explosion(G4int A, G4int Z,
00095                                  G4double excitation) const {
00096   if (verboseLevel) G4cout << " >>> " << theName << "::explosion ?" << G4endl;
00097 
00098   const G4int a_cut = 20;
00099   const G4double be_cut = 3.0;
00100 
00101   // Neutron balls, or small fragments with high excitations can explode
00102   return ((A <= a_cut || Z==0) && 
00103           (excitation >= be_cut * bindingEnergy(A,Z))
00104           );
00105 }
00106 
00107 
00108 // Decide whether bullet-target interaction is candidate for cascade
00109 
00110 G4bool 
00111 G4CascadeColliderBase::inelasticInteractionPossible(G4InuclParticle* bullet,
00112                                                     G4InuclParticle* target, 
00113                                                     G4double ekin) const {
00114   if (verboseLevel) {
00115     G4cout << " >>> " << theName << "::inelasticInteractionPossible" << G4endl;
00116   }
00117 
00118   // If hadron-hadron collision, defer to ElementaryParticleCollider
00119   if (useEPCollider(bullet, target)) return true;
00120 
00121   // See which one of the two (or both) is a nucleus, get properties
00122   // FIXME:  Should set a = baryon() for both, but that's not in base
00123   G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet);
00124   G4double ab = nuclei_bullet ? nuclei_bullet->getA() : 1;      // FIXME
00125   G4double zb = nuclei_bullet ? nuclei_bullet->getZ() : bullet->getCharge();
00126   
00127   G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target);
00128   G4double at = nuclei_target ? nuclei_target->getA() : 1;      // FIXME
00129   G4double zt = nuclei_target ? nuclei_target->getZ() : target->getCharge();
00130   
00131   // VCOL (Coulomb barrier) used for testing if elastic collision necessary
00132   const G4double coeff = 0.001 * 1.2;
00133 
00134   G4double VCOL = coeff * zt * zb / (G4cbrt(at) + G4cbrt(ab)); 
00135   
00136   G4bool possible = true;       // Force inelastic; should be (ekin >= VCOL)
00137 
00138   if (verboseLevel > 3) {
00139     G4cout << " VCOL: " << VCOL << " ekin: " << ekin << " inelastic possible: "
00140            << possible << G4endl;
00141   }
00142 
00143   return possible;
00144 }
00145 
00146 
00147 // Validate output for energy, momentum conservation, etc.
00148 
00149 G4bool G4CascadeColliderBase::validateOutput(G4InuclParticle* bullet,
00150                                              G4InuclParticle* target,
00151                                              G4CollisionOutput& output) {
00152   if (!doConservationChecks) return true;       // Skip checks if requested
00153 
00154   if (verboseLevel > 1)
00155     G4cout << " >>> " << theName << "::validateOutput" << G4endl;
00156 
00157   // Show final state particles
00158   if (verboseLevel > 2) output.printCollisionOutput();
00159 
00160   balance->setVerboseLevel(verboseLevel);
00161   balance->collide(bullet, target, output);
00162   return balance->okay();                       // Returns false if violations
00163 }
00164 
00165 G4bool G4CascadeColliderBase::validateOutput(G4InuclParticle* bullet,
00166                                              G4InuclParticle* target,
00167                      const std::vector<G4InuclElementaryParticle>& particles) {
00168   if (!doConservationChecks) return true;       // Skip checks if requested
00169 
00170   if (verboseLevel > 1)
00171     G4cout << " >>> " << theName << "::validateOutput" << G4endl;
00172 
00173   balance->setVerboseLevel(verboseLevel);
00174   balance->collide(bullet, target, particles);
00175   return balance->okay();                       // Returns false if violations
00176 }
00177 
00178 G4bool G4CascadeColliderBase::validateOutput(G4InuclParticle* bullet,
00179                                              G4InuclParticle* target,
00180                      const std::vector<G4InuclNuclei>& fragments) {
00181   if (!doConservationChecks) return true;       // Skip checks if requested
00182 
00183   if (verboseLevel > 1)
00184     G4cout << " >>> " << theName << "::validateOutput" << G4endl;
00185 
00186   balance->setVerboseLevel(verboseLevel);
00187   balance->collide(bullet, target, fragments);
00188   return balance->okay();                       // Returns false if violations
00189 }

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