Import Geant4 9.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:25:56 +02:00
parent 74cad5e589
commit 89a9605df1
4440 changed files with 379508 additions and 189225 deletions
@@ -0,0 +1,18 @@
#------------------------------------------------------------------------------
# CMakeLists.txt
# Module : G4hadronic_bert_cascade
# Package: Geant4.src.G4processes.G4hadronic.G4hadronic_models.G4had_hetcpp.G4hadronic_bert_cascade
#
# CMakeLists.txt for building a single granular library.
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010/09/29 18:56:20 bmorgan Exp $
#
#------------------------------------------------------------------------------
if(GEANT4_BUILD_GRANULAR_LIBS)
include(Geant4MacroLibraryTargets)
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
endif()
@@ -1,14 +1,49 @@
# $Id: GNUmakefile,v 1.9 2007/05/20 12:01:26 miheikki Exp $
# $Id: GNUmakefile,v 1.15 2010/09/23 05:02:14 mkelsey Exp $
# -----------------------------------------------------------
# GNUmakefile for hadronic library. Gabriele Cosmo, 18/9/96.
#
# Map user environment/GMake variables onto preprocessor debugging flags
#
# 20100922 J. Yarba -- Add include directories for pre-compound model
# -----------------------------------------------------------
name := G4hadronic_bert_cascade
ifdef G4CASCADE_COULOMB_DEV
CPPFLAGS += -DG4CASCADE_COULOMB_DEV=1
endif
ifdef G4CASCADE_DEBUG_CHARGE
CPPFLAGS += -DG4CASCADE_DEBUG_CHARGE=1
endif
ifdef G4CASCADE_DEBUG_INTERFACE
CPPFLAGS += -DG4CASCADE_DEBUG_INTERFACE=1
endif
ifdef G4CASCADE_DEBUG_SAMPLER
CPPFLAGS += -DG4CASCADE_DEBUG_SAMPLER=1
endif
ifdef G4CASCADE_DEBUG_SORT
CPPFLAGS += -DG4CASCADE_DEBUG_SORT=1
endif
ifdef G4CASCADE_WATCHER_HIGHZ
CPPFLAGS += -DG4CASCADE_WATCHER_HIGHZ=1
endif
ifdef G4CASCADE_SKIP_ECONS
CPPFLAGS += -DG4CASCADE_SKIP_ECONS=1
endif
ifdef G4CASCADE_CHECK_ECONS
CPPFLAGS += -DG4CASCADE_CHECK_ECONS=1
endif
ifndef G4INSTALL
G4INSTALL = ../../../../../..
endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -I$(G4BASE)/global/management/include \
@@ -25,7 +60,14 @@ CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/processes/hadronic/cross_sections/include \
-I$(G4BASE)/processes/hadronic/models/management/include \
-I$(G4BASE)/processes/hadronic/models/util/include \
-I$(G4BASE)/processes/hadronic/models/pre_equilibrium/exciton_model/include/ \
-I$(G4BASE)/processes/hadronic/models/de_excitation/multifragmentation/include/ \
-I$(G4BASE)/processes/hadronic/models/de_excitation/fermi_breakup/include/ \
-I$(G4BASE)/processes/hadronic/models/de_excitation/photon_evaporation/include/ \
-I$(G4BASE)/processes/hadronic/models/de_excitation/management/include/ \
-I$(G4BASE)/processes/hadronic/models/de_excitation/evaporation/include/ \
-I$(G4BASE)/processes/hadronic/models/de_excitation/handler/include/ \
-I$(G4BASE)/processes/hadronic/models/de_excitation/util/include/ \
-I$(G4BASE)/processes/hadronic/models/cascade/cascade/include \
-I$(G4BASE)/processes/hadronic/models/cascade/utils/include \
-I$(G4BASE)/particles/management/include \
@@ -23,6 +23,10 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4Analyser.hh,v 1.11 2010/12/15 07:39:28 gunter Exp $
//
// 20101010 M. Kelsey -- Migrate to integer A and Z
#ifndef G4ANALYSER_HH
#define G4ANALYSER_HH
@@ -42,12 +46,9 @@ class G4Analyser {
public:
G4Analyser();
void setInelCsec(G4double csec,
G4bool withn);
void setInelCsec(G4double csec, G4bool withn);
void setWatchers(const std::vector<G4NuclWatcher>& watchers);
void try_watchers(G4double a,
G4double z,
G4bool if_nucl);
void try_watchers(G4int a, G4int z, G4bool if_nucl);
void analyse(const G4CollisionOutput& output);
void printResults();
void printResultsSimple();
@@ -67,7 +68,7 @@ private:
G4double averageNeutronKinEnergy;
G4double averagePionKinEnergy;
G4double averageExitationEnergy;
G4double averageNucleiFragments;
G4double averageOutgoingNuclei;
G4double fissy_prob;
G4double averagePionPl;
G4double averagePionMin;
@@ -1,195 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4BERTININUCLEI_MODEL_HH
#define G4BERTININUCLEI_MODEL_HH
#ifndef G4INUCL_ELEMENTARY_PARTICLE_HH
#include "G4InuclElementaryParticle.hh"
#endif
#include "G4CascadParticle.hh"
#include "G4InuclSpecialFunctions.hh"
#include "G4CascadSpecialFunctions.hh"
#include "G4ElementaryParticleCollider.hh"
#include <vector>
class G4InuclNuclei;
using namespace G4InuclSpecialFunctions;
using namespace G4CascadSpecialFunctions;
typedef std::pair<G4InuclElementaryParticle, G4double> partner;
typedef std::vector<partner> partners;
class G4BertiniNucleiModel {
/*! \class G4BertiniNucleiModel
* \brief Implements HETC nuclei model in Geant4
* \author Aatos Heikkinen and
* \author Original HETC authors
* \version 0.0
* \date 25.11.2002
* \bug
* \warning Wery preliminary
*/
public:
G4BertiniNucleiModel();
G4BertiniNucleiModel(G4InuclNuclei* nuclei) {
generateModel(nuclei->getA(), nuclei->getZ());
};
void generateModel(G4double a,
G4double z); /// create nuclei model
/// @param a is atom mumber (number of protons and neutron in nuclei)
/// @param z in number of protons in nuclei
/// @see
/// @return void
void reset() {
neutronNumberCurrent = neutronNumber;
protonNumberCurrent = protonNumber;
};
void printModel() const;
G4double getDensity(G4int ip,
G4int izone) const {
return nucleon_densities[ip - 1][izone];
};
G4double getFermiMomentum(G4int ip,
G4int izone) const {
return fermi_momenta[ip - 1][izone];
};
G4double getFermiKinetic(G4int ip,
G4int izone) const {
G4double ekin = 0.0;
if (ip < 3 && izone < number_of_zones) {
G4double pf = fermi_momenta[ip - 1][izone];
G4double mass = ip == 1 ? 0.93827 : 0.93957;
ekin = std::sqrt(pf * pf + mass * mass) - mass;
};
return ekin;
};
G4double getPotential(G4int ip,
G4int izone) const {
G4int ip0 = ip < 3 ? ip - 1 : 2;
return izone < number_of_zones ? zone_potentials[ip0][izone] : 0.0;
};
std::vector<G4CascadParticle>
generateParticleFate(G4CascadParticle& cparticle,
G4ElementaryParticleCollider* theElementaryParticleCollider);
G4double getNumberOfNeutrons() const {
return neutronNumberCurrent;
};
G4double getNumberOfProtons() const {
return protonNumberCurrent;
};
G4bool empty() const { /*!< See if there is no nucleon. */
/// @return TRUE if no current nucleons.
return neutronNumberCurrent < 1.0 && protonNumberCurrent < 1.0;
};
G4bool stillInside(const G4CascadParticle& cparticle) { /*!< Check if the cascade particle is still inside the nuclei. */
/// @return TRUE if no current nucleons.
return cparticle.getCurrentZone() < number_of_zones;
};
G4CascadParticle initializeCascad(G4InuclElementaryParticle* particle);
std::pair<std::vector<G4CascadParticle>, std::vector<G4InuclElementaryParticle> > initializeCascad(G4InuclNuclei* bullet, G4InuclNuclei* target);
std::pair<G4int, G4int> getTypesOfNucleonsInvolved() const {
return std::pair<G4int, G4int>(current_nucl1, current_nucl2);
};
G4bool worthToPropagate(const G4CascadParticle& cparticle) const; /*!< Check if cascade particle will continue. */
private:
G4int verboseLevel; /*!< Each cascade class has a verbosity level of its own. */
G4bool passFermi(const std::vector<G4InuclElementaryParticle>& particles,
G4int zone);
void boundaryTransition(G4CascadParticle& cparticle);
G4InuclElementaryParticle generateNucleon(G4int type,
G4int zone) const;
G4InuclElementaryParticle generateQuasiDeutron(G4int type1,
G4int type2,
G4int zone) const;
partners generateInteractionPartners(G4CascadParticle& cparticle) const;
G4double volNumInt(G4double r1,
G4double r2,
G4double cu,
G4double d1) const; /// :::
G4double volNumInt1(G4double r1,
G4double r2,
G4double cu2) const; /// :::
G4double getRatio(G4int ip) const;
std::vector<std::vector<G4double> > nucleon_densities;
std::vector<std::vector<G4double> > zone_potentials;
std::vector<std::vector<G4double> > fermi_momenta;
std::vector<G4double> zone_radii;
std::vector<G4double> binding_energies;
G4double nuclei_radius;
G4int number_of_zones; /*!< Usually = 3, but number of zones is free parameter. */
G4double A;
G4double Z;
G4double neutronNumber;
G4double protonNumber;
G4double neutronNumberCurrent;
G4double protonNumberCurrent;
G4int current_nucl1;
G4int current_nucl2;
};
#endif
@@ -23,52 +23,54 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4BigBanger.hh,v 1.17 2010/09/28 20:15:00 mkelsey Exp $
// GEANT4 tag: $Name: geant4-09-04 $
//
// 20100315 M. Kelsey -- Remove "using" directive and unnecessary #includes.
// 20100407 M. Kelsey -- Replace std::vector<> returns with data members.
// 20100413 M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
// 20100517 M. Kelsey -- Inherit from common base class
// 20100519 M. Kelsey -- Get rid of proton and neutron masses as arguments!
// 20100714 M. Kelsey -- Switch to new G4CascadeColliderBase class
// 20100726 M. Kelsey -- Move std::vector<> buffer to .hh file
// 20100928 M. Kelsey -- Migrate to integer A and Z
#ifndef G4BIG_BANGER_HH
#define G4BIG_BANGER_HH
#include "G4Collider.hh"
#include "G4CascadeColliderBase.hh"
#include "G4InuclElementaryParticle.hh"
#include "G4InuclSpecialFunctions.hh"
#include <vector>
class G4CollisionOutput;
using namespace G4InuclSpecialFunctions;
class G4BigBanger {
class G4BigBanger : public G4CascadeColliderBase {
public:
G4BigBanger();
virtual ~G4BigBanger() {};
G4CollisionOutput collide(G4InuclParticle* bullet,
G4InuclParticle* target);
void collide(G4InuclParticle* bullet, G4InuclParticle* target,
G4CollisionOutput& output);
private:
void generateBangInSCM(G4double etot, G4int a, G4int z);
G4int verboseLevel;
std::vector<G4InuclElementaryParticle> generateBangInSCM(G4double etot,
G4double a,
G4double z,
G4double mp,
G4double mn) const;
void generateMomentumModules(G4double etot, G4int a, G4int z);
std::vector<G4double> generateMomentumModules(G4double etot,
G4double a,
G4double z,
G4double mp,
G4double mn) const;
G4double xProbability(G4double x, G4int a) const;
G4double xProbability(G4double x,
G4int ia) const;
G4double maxProbability(G4int a) const;
G4double maxProbability(G4double a) const;
G4double generateX(G4int ia,
G4double a,
G4double promax) const;
G4double generateX(G4int ia, G4double promax) const;
// Buffers for big-bang results
std::vector<G4InuclElementaryParticle> particles;
std::vector<G4double> momModules;
std::vector<G4LorentzVector> scm_momentums;
};
#endif // G4BIG_BANGER_HH
#endif /* G4BIG_BANGER_HH */
@@ -23,120 +23,114 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadParticle.hh,v 1.16 2010/09/16 05:21:00 mkelsey Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100112 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
// 20100126 M. Kelsey -- Replace vector<G4Double> position with G4ThreeVector,
// move ::print() to .cc file, fix uninitialized data members
// 20100915 M. Kelsey -- Make getGeneration() const
#ifndef G4CASCAD_PARTICLE_HH
#define G4CASCAD_PARTICLE_HH
#include "G4InuclElementaryParticle.hh"
#include "G4LorentzVector.hh"
#include "G4ThreeVector.hh"
class G4CascadParticle {
public:
// NOTE: Default constructor does not make a functional object!
G4CascadParticle();
G4CascadParticle(const G4InuclElementaryParticle& particle,
const std::vector<G4double>& pos,
const G4ThreeVector& pos,
G4int izone,
G4double cpath,
G4int gen)
: verboseLevel(0), theParticle(particle), position(pos),
current_zone(izone), current_path(cpath), movingIn(true),
reflectionCounter(0), reflected(false), generation(gen) {}
: theParticle(particle),
position(pos),
current_zone(izone),
current_path(cpath) {
current_path = cpath;
movingIn = true;
reflectionCounter = 0;
generation = gen;
};
void updateParticleMomentum(const G4CascadeMomentum& mom) {
void updateParticleMomentum(const G4LorentzVector& mom) {
theParticle.setMomentum(mom);
};
}
void updatePosition(const std::vector<G4double>& pos) {
void updatePosition(const G4ThreeVector& pos) {
position = pos;
};
}
void incrementReflectionCounter() {
reflectionCounter++;
reflected = true;
};
}
void resetReflection() {
reflected = false;
};
}
void incrementCurrentPath(G4double npath) {
current_path += npath;
};
}
void updateZone(G4int izone) {
current_zone = izone;
};
}
G4bool movingInsideNuclei() const {
return movingIn;
};
}
G4double getPathToTheNextZone(G4double rz_in,
G4double rz_out);
const G4CascadeMomentum& getMomentum() const {
G4LorentzVector getMomentum() const { // Can't return ref; temporary
return theParticle.getMomentum();
};
}
G4InuclElementaryParticle getParticle() const {
const G4InuclElementaryParticle& getParticle() const {
return theParticle;
};
}
const std::vector<G4double>& getPosition() const {
G4InuclElementaryParticle& getParticle() {
return theParticle;
}
const G4ThreeVector& getPosition() const {
return position;
};
}
G4int getCurrentZone() const {
return current_zone;
};
}
G4int getNumberOfReflections() const {
return reflectionCounter;
};
}
G4bool young(G4double young_path_cut,
G4double cpath) const {
if(current_path < 1000.0) {
return cpath < young_path_cut;
}
else {
return false;
};
// return current_path + cpath < young_path_cut;
};
return ((current_path < 1000.) && (cpath < young_path_cut));
}
G4bool reflectedNow() const {
return reflected;
};
}
void propagateAlongThePath(G4double path);
void print() const {
theParticle.printParticle();
G4cout << " zone " << current_zone << " current_path " << current_path
<< " reflectionCounter " << reflectionCounter << G4endl
<< " x " << position[0] << " y " << position[1]
<< " z " << position[2] << G4endl;
};
void print() const;
G4int getGeneration() {
G4int getGeneration() const {
return generation;
}
private:
G4int verboseLevel;
G4InuclElementaryParticle theParticle;
std::vector<G4double> position;
G4ThreeVector position;
G4int current_zone;
G4double current_path;
G4bool movingIn;
@@ -23,24 +23,28 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeChannel.hh,v 1.7 2010/06/25 09:41:52 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100514 M. Kelsey -- All functionality removed except quantum-number
// validation functions.
#ifndef G4_CASCADE_CHANNEL_HH
#define G4_CASCADE_CHANNEL_HH
#include "globals.hh"
#include "G4FastVector.hh"
#include "G4ReactionProduct.hh"
#include <vector>
class G4CascadeChannel {
namespace G4CascadeChannel {
std::vector<G4int> getQnums(G4int type);
public:
static std::pair<G4int, G4double> interpolateEnergy(G4double ke);
static G4int sampleFlat(std::vector<G4double> const& sigma);
static std::vector<G4int> getQnums(G4int type);
private:
G4CascadeChannel(); // not implemented
static const double energyScale[31];
};
void CheckQnums(const G4FastVector<G4ReactionProduct,256> &vec,
G4int &vecLen,
G4ReactionProduct &currentParticle,
G4ReactionProduct &targetParticle,
G4double Q, G4double B, G4double S);
}
#endif
@@ -0,0 +1,147 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4CASCADE_CHECK_BALANCE_HH
#define G4CASCADE_CHECK_BALANCE_HH
// $Id: G4CascadeCheckBalance.hh,v 1.12 2010/12/15 07:39:30 gunter Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// Verify and report four-momentum conservation for collision output; uses
// same interface as collision generators.
//
// 20100624 M. Kelsey -- Add baryon conservation check and kinetic energy
// 20100628 M. Kelsey -- Add interface to take list of particles directly
// 20100711 M. Kelsey -- Add name of parent Collider for reporting messages,
// allow changing parent name, add interface for nuclear fragments
// 20100713 M. Kelsey -- Add (publicly adjustable) tolerance for zeroes
// 20100715 M. Kelsey -- FPE! Need to check initial values before computing
// relative error.
// 20100715 M. Kelsey -- Add G4CascadParticle interface for G4NucleiModel;
// do momentum check on direction, not just magnitude. Move
// temporary G4CollisionOutput buffer here, for thread-safety
// 20100909 M. Kelsey -- Add interface to get four-vector difference, and
// to supply both kinds of particle lists (G4IntraNucleiCascader)
// 20100923 M. Kelsey -- Baryon and charge deltas should have been integer
#include "G4VCascadeCollider.hh"
#include "globals.hh"
#include "G4CollisionOutput.hh"
#include "G4LorentzVector.hh"
#include <cmath>
#include <vector>
class G4CascadParticle;
class G4InuclElementaryParticle;
class G4InuclNuclei;
class G4InuclParticle;
class G4CascadeCheckBalance : public G4VCascadeCollider {
public:
static const G4double tolerance; // Don't do floating zero!
G4CascadeCheckBalance(G4double relative, G4double absolute,
const char* owner="G4CascadeCheckBalance");
virtual ~G4CascadeCheckBalance() {};
void setOwner(const char* owner) { setName(owner); }
void collide(G4InuclParticle* bullet, G4InuclParticle* target,
G4CollisionOutput& output);
// This is for use with G4EPCollider internal checks
void collide(G4InuclParticle* bullet, G4InuclParticle* target,
const std::vector<G4InuclElementaryParticle>& particles);
// This is for use with G4Fissioner internal checks
void collide(G4InuclParticle* bullet, G4InuclParticle* target,
const std::vector<G4InuclNuclei>& fragments);
// This is for use with G4NucleiModel internal checks
void collide(G4InuclParticle* bullet, G4InuclParticle* target,
const std::vector<G4CascadParticle>& particles);
// This is for use with G4IntraNucleiCascader
void collide(G4InuclParticle* bullet, G4InuclParticle* target,
const std::vector<G4InuclElementaryParticle>& particles,
const std::vector<G4CascadParticle>& cparticles);
// Checks on conservation laws (kinematics, baryon number, charge)
G4bool energyOkay() const;
G4bool ekinOkay() const;
G4bool momentumOkay() const;
G4bool baryonOkay() const;
G4bool chargeOkay() const;
// Global check, used by G4CascadeInterface validation loop
G4bool okay() const { return (energyOkay() && momentumOkay() &&
baryonOkay() && chargeOkay()); }
// Calculations of conserved quantities from initial and final state
// FIXME: Relative comparisons don't work for zero!
G4double deltaE() const { return (final.e() - initial.e()); }
G4double relativeE() const {
return ( (std::abs(deltaE())<tolerance) ? 0. :
(initial.e()<tolerance) ? 1. : deltaE()/initial.e() );
}
G4double deltaKE() const { return (ekin(final) - ekin(initial)); }
G4double relativeKE() const {
return ( (std::abs(deltaKE())<tolerance) ? 0. :
(ekin(initial)<tolerance) ? 1. : deltaKE()/ekin(initial) );
}
G4double deltaP() const { return deltaLV().rho(); }
G4double relativeP() const {
return ( (std::abs(deltaP())<tolerance) ? 0. :
(initial.rho()<tolerance) ? 1. : deltaP()/initial.rho() );
}
G4LorentzVector deltaLV() const { return final - initial; }
// Baryon number and charge are discrete; no bounds and no "relative" scale
G4int deltaB() const { return (finalBaryon - initialBaryon); }
G4int deltaQ() const { return (finalCharge - initialCharge); }
protected:
// Utility function for kinetic energy
G4double ekin(const G4LorentzVector& p) const { return (p.e() - p.m()); }
private:
G4double relativeLimit;
G4double absoluteLimit;
G4LorentzVector initial; // Four-vectors for computing violations
G4LorentzVector final;
G4int initialBaryon; // Total baryon number
G4int finalBaryon;
G4int initialCharge; // Total charge
G4int finalCharge;
G4CollisionOutput tempOutput; // Buffer for direct-list interfaces
};
#endif /* G4CASCADE_CHECK_BALANCE_HH */
@@ -0,0 +1,97 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4CASCADE_COLLIDER_BASE_HH
#define G4CASCADE_COLLIDER_BASE_HH
// $Id: G4CascadeColliderBase.hh,v 1.4 2010/12/15 07:39:32 gunter Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100714 M. Kelsey -- Move functionality from G4VCascadeCollider, and
// provide conservation-checking here, with wrapper function
// and control flag.
// 20100720 M. Kelsey -- Change G4CascadeCheckBalance to pointer member
// 20010925 M. Kelsey -- Add explosion(A,Z,Eex) and explosion(G4Fragment)
// interfaces
#include "G4VCascadeCollider.hh"
#include "globals.hh"
#include "G4InteractionCase.hh"
#include <vector>
class G4InuclElementaryParticle;
class G4InuclNuclei;
class G4InuclParticle;
class G4CollisionOutput;
class G4CascadeCheckBalance;
class G4Fragment;
class G4CascadeColliderBase : public G4VCascadeCollider {
public:
G4CascadeColliderBase(const char* name, G4int verbose=0);
virtual ~G4CascadeColliderBase();
virtual void setConservationChecks(G4bool doBalance=true) {
doConservationChecks = doBalance;
}
protected:
G4InteractionCase interCase; // Determine bullet vs. target
G4bool doConservationChecks; // Conservation-law validation
G4CascadeCheckBalance* balance;
// Decide whether to use G4ElementaryParticleCollider or not
virtual G4bool useEPCollider(G4InuclParticle* bullet,
G4InuclParticle* target) const;
// Decide whether to use G4BigBanger or not
virtual G4bool explosion(G4InuclNuclei* target) const;
virtual G4bool explosion(G4Fragment* target) const;
virtual G4bool explosion(G4int A, G4int Z, G4double excitation) const;
// Decide whether to use G4IntraNuclearCascader or not
virtual G4bool inelasticInteractionPossible(G4InuclParticle* bullet,
G4InuclParticle* target,
G4double ekin) const;
// ==> Provide same interfaces as G4CascadeCheckBalance itself
// Validate output for energy, momentum conservation, etc.
virtual G4bool validateOutput(G4InuclParticle* bullet,
G4InuclParticle* target,
G4CollisionOutput& output);
// This is for use with G4EPCollider and G4BigBanger
virtual G4bool validateOutput(G4InuclParticle* bullet,
G4InuclParticle* target,
const std::vector<G4InuclElementaryParticle>& particles);
// This is for use with G4Fissioner
virtual G4bool validateOutput(G4InuclParticle* bullet,
G4InuclParticle* target,
const std::vector<G4InuclNuclei>& fragments);
};
#endif /* G4CASCADE_COLLIDER_BASE_HH */
@@ -23,85 +23,118 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeData.hh,v 1.10 2010/08/04 05:28:24 mkelsey Exp $
// GEANT4 tag: $Name: geant4-09-04 $
//
// 20100507 M. Kelsey -- Use template arguments to dimension const-refs
// to arrays,for use in passing to functions as dimensioned.
// Add two additional optional(!) template args for piN/NN.
// Add new data member "sum" to separate summed xsec values
// from measured inclusive (tot) cross-sections. Add two
// ctors to pass inclusive xsec array as input (for piN/NN).
// 20100611 M. Kelsey -- Work around Intel ICC compiler warning about
// index[] subscripts out of range. Dimension to full [9].
// 20100803 M. Kelsey -- Add printing function for debugging, split
// implementation code to .icc file. Add name argument.
#ifndef G4_CASCADE_DATA_HH
#define G4_CASCADE_DATA_HH
#include "globals.hh"
#include "G4CascadeSampler.hh" /* To get number of energy bins */
#include "G4String.hh"
template <int n2, int n3, int n4, int n5, int n6, int n7, int nxs>
template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8=0,int N9=0>
struct G4CascadeData
{
G4double * tot;
// NOTE: Need access to N2 by value to initialize index array
enum { N02=N2, N23=N2+N3, N24=N23+N4, N25=N24+N5, N26=N25+N6, N27=N26+N7,
N28=N27+N8, N29=N28+N9 };
typedef G4double multiplicities_t[31];
multiplicities_t * multiplicities;
enum { N8D=N8?N8:1, N9D=N9?N9:1 }; // SPECIAL: Can't dimension arrays [0]
typedef G4int index_t[2];
index_t const * index;
enum { NM=N9?8:N8?7:6, NXS=N29 }; // Multiplicity and cross-section bins
typedef G4int x2bfs_t[2];
x2bfs_t const * x2bfs;
G4int index[9]; // Start and stop indices to xsec's
G4double multiplicities[NM][NE]; // Multiplicity distributions
typedef G4int x3bfs_t[3];
x3bfs_t const * x3bfs;
const G4int (&x2bfs)[N2][2]; // Initialized from file-scope inputs
const G4int (&x3bfs)[N3][3];
const G4int (&x4bfs)[N4][4];
const G4int (&x5bfs)[N5][5];
const G4int (&x6bfs)[N6][6];
const G4int (&x7bfs)[N7][7];
const G4int (&x8bfs)[N8D][8]; // These may not be used if mult==7
const G4int (&x9bfs)[N9D][9];
const G4double (&crossSections)[NXS][NE];
typedef G4int x4bfs_t[4];
x4bfs_t const * x4bfs;
G4double sum[NE]; // Summed cross-sections, computed
const G4double (&tot)[NE]; // Inclusive cross-sections (from input)
typedef G4int x5bfs_t[5];
x5bfs_t const * x5bfs;
static const G4int empty8bfs[1][8]; // For multiplicity==7 case
static const G4int empty9bfs[1][9];
typedef G4int x6bfs_t[6];
x6bfs_t const * x6bfs;
const G4String name; // For diagnostic purposes
typedef G4int x7bfs_t[7];
x7bfs_t const * x7bfs;
G4int maxMultiplicity() const { return NM+1; } // Used by G4CascadeFunctions
typedef G4float crossSections_t[31];
crossSections_t const * crossSections;
void print(G4int mult=-1) const; // Dump multiplicty tables (-1 == all)
void printXsec(const G4double (&xsec)[NE]) const;
void initialize();
// Constructor for kaon/hyperon channels, with multiplicity <= 7
G4CascadeData(const G4int (&the2bfs)[N2][2], const G4int (&the3bfs)[N3][3],
const G4int (&the4bfs)[N4][4], const G4int (&the5bfs)[N5][5],
const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7],
const G4double (&xsec)[NXS][NE],
const G4String& aName="G4CascadeData")
: x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs),
x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(empty8bfs), x9bfs(empty9bfs),
crossSections(xsec), tot(sum), name(aName) { initialize(); }
// G4double tot[31];
// G4double multiplicities[6][31];
// Constructor for kaon/hyperon channels, with multiplicity <= 7 and inclusive
G4CascadeData(const G4int (&the2bfs)[N2][2], const G4int (&the3bfs)[N3][3],
const G4int (&the4bfs)[N4][4], const G4int (&the5bfs)[N5][5],
const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7],
const G4double (&xsec)[NXS][NE], const G4double (&theTot)[NE],
const G4String& aName="G4CascadeData")
: x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs),
x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(empty8bfs), x9bfs(empty9bfs),
crossSections(xsec), tot(theTot), name(aName) { initialize(); }
// G4int index[6][2];
// G4int x2bfs[n2][2];
// G4int x3bfs[n3][3];
// G4int x4bfs[n4][4];
// G4int x5bfs[n5][5];
// G4int x6bfs[n6][6];
// G4int x7bfs[n7][7];
// Constructor for pion/nuleon channels, with multiplicity > 7
G4CascadeData(const G4int (&the2bfs)[N2][2], const G4int (&the3bfs)[N3][3],
const G4int (&the4bfs)[N4][4], const G4int (&the5bfs)[N5][5],
const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7],
const G4int (&the8bfs)[N8D][8], const G4int (&the9bfs)[N9D][9],
const G4double (&xsec)[NXS][NE],
const G4String& aName="G4CascadeData")
: x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs),
x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(the8bfs), x9bfs(the9bfs),
crossSections(xsec), tot(sum), name(aName) { initialize(); }
// G4float crossSections[nxs][31];
// Constructor for pion/nuleon channels, with multiplicity > 7 and inclusive
G4CascadeData(const G4int (&the2bfs)[N2][2], const G4int (&the3bfs)[N3][3],
const G4int (&the4bfs)[N4][4], const G4int (&the5bfs)[N5][5],
const G4int (&the6bfs)[N6][6], const G4int (&the7bfs)[N7][7],
const G4int (&the8bfs)[N8D][8], const G4int (&the9bfs)[N9D][9],
const G4double (&xsec)[NXS][NE], const G4double (&theTot)[NE],
const G4String& aName="G4CascadeData")
: x2bfs(the2bfs), x3bfs(the3bfs), x4bfs(the4bfs), x5bfs(the5bfs),
x6bfs(the6bfs), x7bfs(the7bfs), x8bfs(the8bfs), x9bfs(the9bfs),
crossSections(xsec), tot(theTot), name(aName) { initialize(); }
void initialize(); // Fill summed arrays from input
};
template <int n2, int n3, int n4, int n5, int n6, int n7, int nxs>
inline
void
G4CascadeData<n2, n3, n4, n5, n6, n7, nxs>::initialize()
{
// Initialize multiplicity array
for (G4int m = 0; m < 6; m++) {
G4int start = index[m][0];
G4int stop = index[m][1];
for (G4int k = 0; k < 31; k++) {
multiplicities[m][k] = 0.0;
for (G4int i = start; i < stop; i++) {
multiplicities[m][k] += crossSections[i][k];
}
}
}
// Initialize total cross section array
for (G4int k = 0; k < 31; k++) {
tot[k] = 0.0;
for (G4int m = 0; m < 6; m++) {
tot[k] += multiplicities[m][k];
}
}
}
// Dummy arrays for use when optional template arguments are skipped
template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8,int N9>
const G4int G4CascadeData<NE,N2,N3,N4,N5,N6,N7,N8,N9>::empty8bfs[1][8] = {{0}};
template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8,int N9>
const G4int G4CascadeData<NE,N2,N3,N4,N5,N6,N7,N8,N9>::empty9bfs[1][9] = {{0}};
// GCC and other compilers require template implementations here
#include "G4CascadeData.icc"
#endif
@@ -0,0 +1,123 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4_CASCADE_DATA_ICC
#define G4_CASCADE_DATA_ICC
// $Id: G4CascadeData.icc,v 1.3 2010/12/15 07:39:34 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04 $
//
// 20100803 M. Kelsey -- Move implementations to this .icc file. Use name
// string to report output
#include "G4CascadeData.hh"
#include <iomanip>
// Fill cumulative cross-section arrays from input data
template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8,int N9> inline
void G4CascadeData<NE,N2,N3,N4,N5,N6,N7,N8,N9>::initialize() {
// Initialize index offsets for cross-section array (can't do globally)
index[0] = 0; index[1] = N02; index[2] = N23; index[3] = N24;
index[4] = N25; index[5] = N26; index[6] = N27; index[7] = N28;
index[8] = N29;
// Initialize multiplicity array
for (G4int m = 0; m < NM; m++) {
G4int start = index[m];
G4int stop = index[m+1];
for (G4int k = 0; k < NE; k++) {
multiplicities[m][k] = 0.0;
for (G4int i = start; i < stop; i++) {
multiplicities[m][k] += crossSections[i][k];
}
}
}
// Initialize total cross section array
for (G4int k = 0; k < NE; k++) {
sum[k] = 0.0;
for (G4int m = 0; m < NM; m++) {
sum[k] += multiplicities[m][k];
}
}
}
// Dump individual cross-section table, two lines of 12 values
template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8,int N9> inline
void G4CascadeData<NE,N2,N3,N4,N5,N6,N7,N8,N9>::
printXsec(const G4double (&xsec)[NE]) const {
for (G4int k=0; k<NE; k++) {
G4cout << std::setw(6) << xsec[k]; // Use sign-gap as separator
if ((k+1)%12 == 0) G4cout << G4endl;
}
G4cout << G4endl;
}
// Dump tables for specified multiplicity
template <int NE,int N2,int N3,int N4,int N5,int N6,int N7,int N8,int N9> inline
void G4CascadeData<NE,N2,N3,N4,N5,N6,N7,N8,N9>::print(G4int mult) const {
if (mult < 0) {
G4cout << "\n " << name << " Total cross section:" << G4endl;
printXsec(tot);
G4cout << "\n Summed cross section:" << G4endl;
printXsec(sum);
G4cout << "\n Individual channel cross sections" << G4endl;
for (int m=2; m<NM+2; m++) print(m);
return;
}
G4int im = mult-2; // Convert multiplicity to array index
G4int start = index[im];
G4int stop = index[im+1];
G4cout << "\n Mulitplicity " << mult << " (indices " << start << " to "
<< stop-1 << ") summed cross section:" << G4endl;
printXsec(multiplicities[im]);
for (G4int i=start; i<stop; i++) {
G4int ichan=i-start;
G4cout << "\n final state x" << mult << "bfs[" << ichan << "] : ";
for (G4int fsi=0; fsi<mult; fsi++) {
switch (mult) {
case 2: G4cout << " " << x2bfs[ichan][fsi]; break;
case 3: G4cout << " " << x3bfs[ichan][fsi]; break;
case 4: G4cout << " " << x4bfs[ichan][fsi]; break;
case 5: G4cout << " " << x5bfs[ichan][fsi]; break;
case 6: G4cout << " " << x6bfs[ichan][fsi]; break;
case 7: G4cout << " " << x7bfs[ichan][fsi]; break;
case 8: G4cout << " " << x8bfs[ichan][fsi]; break;
case 9: G4cout << " " << x9bfs[ichan][fsi]; break;
default: ;
}
}
G4cout << " -- cross section [" << i << "]:" << G4endl;
printXsec(crossSections[i]);
}
}
#endif /* G4_CASCADE_DATA_ICC */
@@ -0,0 +1,64 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4CASCADE_DEEXCITATION_HH
#define G4CASCADE_DEEXCITATION_HH
// $Id: G4CascadeDeexcitation.hh,v 1.4 2010/12/15 07:39:36 gunter Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// Takes an arbitrary excited or unphysical nuclear state and produces
// a final state with evaporated particles and (possibly) a stable nucleus.
//
// 20100926 M. Kelsey -- Move to new G4VCascadeDeexcitation base class.
#include "G4VCascadeDeexcitation.hh"
#include "globals.hh"
class G4InuclParticle;
class G4BigBanger;
class G4NonEquilibriumEvaporator;
class G4EquilibriumEvaporator;
class G4CascadeDeexcitation : public G4VCascadeDeexcitation {
public:
G4CascadeDeexcitation();
virtual ~G4CascadeDeexcitation();
// Standard Collider interface (bullet is not used in this case)
virtual void collide(G4InuclParticle* /*bullet*/, G4InuclParticle* target,
G4CollisionOutput& globalOutput);
// Interface specific to pre-compound (post-cascade) processing
virtual void deExcite(G4Fragment* fragment,
G4CollisionOutput& globalOutput);
private:
G4BigBanger* theBigBanger;
G4NonEquilibriumEvaporator* theNonEquilibriumEvaporator;
G4EquilibriumEvaporator* theEquilibriumEvaporator;
};
#endif /* G4CASCADE_DEEXCITATION_HH */
@@ -1,74 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// CLASS DESCRIPTION
// G4CascadeElasticInterface defines an interface to INUCL
// models from low to medium energy ( - 10 GeV) intra-nuclear transport.
// If you have any questions, please contact
// package writer aatos.heikkinen@cern.ch.
// --------------------------------------------------------------------
#ifndef G4CASCADEELASTICINTERFACE_H
#define G4CASCADEELASTICINTERFACE_H 1
#include "G4Nucleon.hh"
#include "G4Nucleus.hh"
#include "G4VIntraNuclearTransportModel.hh"
#include "G4KineticTrackVector.hh"
#include "G4FragmentVector.hh"
#include "G4ParticleChange.hh"
#include "G4ReactionProductVector.hh"
#include "G4ReactionProduct.hh"
class G4CascadeElasticInterface : public G4VIntraNuclearTransportModel {
public:
G4CascadeElasticInterface();
~G4CascadeElasticInterface(){
}
G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus);
G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack,
G4Nucleus& theNucleus);
private:
G4int operator==(G4CascadeElasticInterface& right) {
return (this == &right);
}
G4int operator!=(G4CascadeElasticInterface& right) {
return (this != &right);
}
G4int verboseLevel;
private:
G4HadFinalState theResult;
};
#endif // G4CASCADEELASTICINTERFACE_H
@@ -23,99 +23,53 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeFunctions.hh,v 1.8 2010/12/15 07:39:38 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04 $
//
// 20100407 M. Kelsey -- Return particle types std::vector<> by const ref,
// using a static variable in the function as a buffer.
// 20100505 M. Kelsey -- Use new interpolator class, drop std::pair<>, move
// sampleFlat(...) from G4CascadeChannel, move functionality
// to new base class, to allow data-member buffers. Move
// function definitions to .icc file (needed with templating).
// 20100510 M. Kelsey -- Use both summed and inclusive cross-sections for
// multiplicity, as done in G4{Pion,Nucleon}Sampler. Support
// up to 9-body final states. Add second argument specifying
// which Sampler is used. Move implementations to .icc file.
// 20100511 M. Kelsey -- Pass "kinds" buffer as input to getOutputPartTypes
// 20100803 M. Kelsey -- Add printing function for debugging
#ifndef G4_CASCADE_FUNCTIONS_HH
#define G4_CASCADE_FUNCTIONS_HH
#include <vector>
#include "globals.hh"
#include "G4CascadeChannel.hh"
#include "Randomize.hh"
#include <vector>
template <class T>
class G4CascadeFunctions
{
template <class DATA, class SAMP>
class G4CascadeFunctions : public SAMP {
public:
static G4double getCrossSection(double ke);
static G4double getCrossSection(double ke) {
return instance.findCrossSection(ke, DATA::data.tot);
}
static G4double getCrossSectionSum(double ke) {
return instance.findCrossSection(ke, DATA::data.sum);
}
static G4int getMultiplicity(G4double ke);
static std::vector<G4int> getOutgoingParticleTypes(G4int mult, G4double ke);
static void
getOutgoingParticleTypes(std::vector<G4int>& kinds, G4int mult, G4double ke);
static void printTable();
private:
G4CascadeFunctions() : SAMP() {}
static const G4CascadeFunctions<DATA,SAMP> instance;
};
template <class T>
inline
G4double
G4CascadeFunctions<T>::getCrossSection(double ke)
{
std::pair<G4int, G4double> epair = G4CascadeChannel::interpolateEnergy(ke);
G4int k = epair.first;
G4double fraction = epair.second;
return T::data.tot[k] + fraction*(T::data.tot[k+1] - T::data.tot[k]);
}
#include "G4CascadeFunctions.icc"
template <class T>
inline
G4int
G4CascadeFunctions<T>::getMultiplicity(G4double ke)
{
G4double multint(0.0);
std::vector<G4double> sigma;
std::pair<G4int, G4double> epair = G4CascadeChannel::interpolateEnergy(ke);
G4int k = epair.first;
G4double fraction = epair.second;
for (G4int m = 0; m < 6; ++m)
{
multint = T::data.multiplicities[m][k]
+ fraction * (T::data.multiplicities[m][k+1] - T::data.multiplicities[m][k]);
sigma.push_back(multint);
}
return G4CascadeChannel::sampleFlat(sigma);
}
template <class T>
inline
std::vector<G4int>
G4CascadeFunctions<T>::getOutgoingParticleTypes(G4int mult, G4double ke)
{
G4int i;
G4double sigint(0.);
std::vector<G4double> sigma;
std::pair<G4int, G4double> epair = G4CascadeChannel::interpolateEnergy(ke);
G4int k = epair.first;
G4double fraction = epair.second;
G4int start = T::data.index[mult-2][0];
G4int stop = T::data.index[mult-2][1];
for (i = start; i < stop; i++) {
sigint = T::data.crossSections[i][k]
+ fraction*(T::data.crossSections[i][k+1] - T::data.crossSections[i][k]);
sigma.push_back(sigint);
}
G4int channel = G4CascadeChannel::sampleFlat(sigma);
std::vector<G4int> kinds;
if (mult == 2) {
for(i = 0; i < mult; i++) kinds.push_back(T::data.x2bfs[channel][i]);
} else if (mult == 3) {
for(i = 0; i < mult; i++) kinds.push_back(T::data.x3bfs[channel][i]);
} else if (mult == 4) {
for(i = 0; i < mult; i++) kinds.push_back(T::data.x4bfs[channel][i]);
} else if (mult == 5) {
for(i = 0; i < mult; i++) kinds.push_back(T::data.x5bfs[channel][i]);
} else if (mult == 6) {
for(i = 0; i < mult; i++) kinds.push_back(T::data.x6bfs[channel][i]);
} else if (mult == 7) {
for(i = 0; i < mult; i++) kinds.push_back(T::data.x7bfs[channel][i]);
} else {
G4cout << " Illegal multiplicity " << G4endl;
}
return kinds;
}
#endif
#endif /* G4_CASCADE_FUNCTIONS_HH */
@@ -0,0 +1,115 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4_CASCADE_FUNCTIONS_ICC
#define G4_CASCADE_FUNCTIONS_ICC
// $Id: G4CascadeFunctions.icc,v 1.6 2010/12/15 07:39:40 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04 $
//
// 20100512 M. Kelsey -- Pass std::vector<> buffer as argument to
// getOutgoingPartTypes().
// 20100803 M. Kelsey -- Add printing function for debugging
// 20100804 M. Kelsey -- Pretty up printing function
#include "G4CascadeFunctions.hh"
#include "globals.hh"
// Make sure singleton is instantiated
template <class DATA, class SAMP>
const G4CascadeFunctions<DATA,SAMP> G4CascadeFunctions<DATA,SAMP>::instance;
// Compare summed partial cross section with total cross section
// Truncate multiplicity at maximum if summed < total
template <class DATA, class SAMP> inline
G4int G4CascadeFunctions<DATA,SAMP>::getMultiplicity(G4double ke) {
// Use pointer comparison to see whether tot is just a ref to sum)
if (&DATA::data.sum != &DATA::data.tot) {
G4double summed = instance.findCrossSection(ke, DATA::data.sum);
G4double total = instance.findCrossSection(ke, DATA::data.tot);
if (G4UniformRand() > summed/total) return DATA::data.maxMultiplicity();
}
return instance.findMultiplicity(ke, DATA::data.multiplicities);
}
// Generate list of final state particles
template <class DATA, class SAMP> inline
void G4CascadeFunctions<DATA,SAMP>::
getOutgoingParticleTypes(std::vector<G4int>& kinds, G4int mult, G4double ke) {
const G4int maxMult = DATA::data.maxMultiplicity();
kinds.clear();
kinds.reserve(mult);
if (mult > maxMult+2) {
G4cerr << " Illegal multiplicity " << G4endl;
return;
}
G4int channel = instance.findFinalStateIndex(mult, ke, DATA::data.index,
DATA::data.crossSections);
#ifdef G4CASCADE_DEBUG_SAMPLER
G4cout << " getOutgoingParticleTypes: mult=" << mult << " KE=" << ke
<< ": channel=" << channel << G4endl;
#endif
// Identify final-state array to be copied
const G4int* chan = 0;
if (mult == 2) chan = DATA::data.x2bfs[channel];
if (mult == 3) chan = DATA::data.x3bfs[channel];
if (mult == 4) chan = DATA::data.x4bfs[channel];
if (mult == 5) chan = DATA::data.x5bfs[channel];
if (mult == 6) chan = DATA::data.x6bfs[channel];
if (mult == 7) chan = DATA::data.x7bfs[channel];
if (mult == 8) chan = DATA::data.x8bfs[channel];
if (mult == 9) chan = DATA::data.x9bfs[channel];
if (!chan) {
G4cerr << " getOutgoingParticleTypes: invalid multiplicity " << mult
<< G4endl;
return;
}
kinds.insert(kinds.begin(), chan, chan+mult); // Transfer data into vector
return;
}
// Dump lookup tables, including interpolation bins, to log file
template <class DATA, class SAMP> inline
void G4CascadeFunctions<DATA,SAMP>::printTable() {
G4cout << " ---------- " << DATA::data.name << " ----------" << G4endl;
instance.print();
DATA::data.print();
G4cout << " ------------------------------" << G4endl;
}
#endif /* G4_CASCADE_FUNCTIONS_ICC */
@@ -23,29 +23,37 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeInterface.hh,v 1.14 2009/09/24 20:48:02 dennis Exp $
// $Id: G4CascadeInterface.hh,v 1.23 2010/09/23 18:13:32 mkelsey Exp $
// Defines an interface to Bertini (BERT) cascade
// based on INUCL intra-nuclear transport.models
// with bullet hadron energy ~< 10 GeV
//
// 20100405 M. Kelsey -- Fix constness of op== and op!=
// 20100519 M. Kelsey -- Remove Collider data members
// 20100617 M. Kelsey -- Make G4InuclCollider a local data member
// 20100723 M. Kelsey -- Move G4CollisionOutput here for reuse
// 20100916 M. Kelsey -- Add functions to encapsulate ApplyYourself() actions,
// make colliders pointers (don't expose dependencies)
// 20100922 M. Kelsey -- Add functions to select de-excitation method
#ifndef G4CASCADEINTERFACE_H
#define G4CASCADEINTERFACE_H 1
#include "G4VIntraNuclearTransportModel.hh"
#include "G4FragmentVector.hh"
#include "G4KineticTrackVector.hh"
#include "G4LorentzRotation.hh"
#include "G4Nucleon.hh"
#include "G4Nucleus.hh"
#include "G4VIntraNuclearTransportModel.hh"
#include "G4KineticTrackVector.hh"
#include "G4FragmentVector.hh"
#include "G4ParticleChange.hh"
#include "G4ReactionProductVector.hh"
#include "G4ReactionProduct.hh"
#include "G4ReactionProductVector.hh"
#include "G4ElementaryParticleCollider.hh"
#include "G4NonEquilibriumEvaporator.hh"
#include "G4EquilibriumEvaporator.hh"
#include "G4Fissioner.hh"
#include "G4BigBanger.hh"
#include "G4IntraNucleiCascader.hh"
class G4InuclCollider;
class G4InuclParticle;
class G4CollisionOutput;
class G4CascadeCheckBalance;
class G4V3DNucleus;
class G4CascadeInterface : public G4VIntraNuclearTransportModel {
@@ -55,32 +63,64 @@ public:
virtual ~G4CascadeInterface();
G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus);
G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries,
G4V3DNucleus* theNucleus);
G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack,
G4Nucleus& theNucleus);
G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& theNucleus);
void setVerboseLevel(G4int verbose) { verboseLevel = verbose; }
// Select betweeen different post-cascade de-excitation models
void useCascadeDeexcitation();
void usePreCompoundDeexcitation();
protected:
// Convert input projectile and target to Bertini internal types
void createBullet(const G4HadProjectile& aTrack);
void createTarget(G4Nucleus& theNucleus);
// Evaluate whether any outgoing particles penetrated Coulomb barrier
G4bool coulombBarrierViolation() const;
// Conditions for rejecting cascade attempt
G4bool retryInelasticProton() const;
G4bool retryInelasticNucleus() const;
// Fill sparse array with minimum momenta for inelastic on hydrogen
void initializeElasticCuts();
// Transfer Bertini internal final state to hadronics interface
void copyOutputToHadronicResult();
// Terminate job because of energy/momentum/etc. violations
void throwNonConservationFailure();
private:
G4int operator==(G4CascadeInterface& right) {
G4int operator==(const G4CascadeInterface& right) const {
return (this == &right);
}
G4int operator!=(G4CascadeInterface& right) {
G4int operator!=(const G4CascadeInterface& right) const {
return (this != &right);
}
static const G4int maximumTries; // Number of iterations for inelastic
G4double cutElastic[32]; // Bullet momenta for hydrogen target
G4int verboseLevel;
G4int numberOfTries;
private:
G4HadFinalState theResult;
G4InuclCollider* collider;
G4CascadeCheckBalance* balance;
G4ElementaryParticleCollider colep;
G4NonEquilibriumEvaporator noneq;
G4EquilibriumEvaporator eqil;
G4Fissioner fiss;
G4BigBanger bigb;
G4IntraNucleiCascader inc;
G4HadFinalState theResult;
G4InuclParticle* bullet;
G4InuclParticle* target;
G4CollisionOutput* output;
G4LorentzRotation bulletInLabFrame;
};
#endif // G4CASCADEINTERFACE_H
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeInterpolator.hh,v 1.3 2010/08/03 23:09:36 mkelsey Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// Author: Michael Kelsey <kelsey@slac.stanford.edu>
//
// Simple linear interpolation class, more lightweight than
// G4PhysicsVector. Templated on number of X-axis (usually energy)
// bins, constructor takes a C-array of bin edges as input, and an
// optional flag whether to extrapolate (the default) or truncate values
// beyond the bin boundaries.
//
// The interpolation action returns a simple double: the integer part
// is the bin index, and the fractional part is, obviously, the
// fractional part.
//
// 20100803 M. Kelsey -- Add printBins() function for debugging
#ifndef G4CASCADE_INTERPOLATOR_HH
#define G4CASCADE_INTERPOLATOR_HH
#include "globals.hh"
#include <cfloat>
template <int NBINS>
class G4CascadeInterpolator {
public:
enum { nBins=NBINS, last=NBINS-1 };
G4CascadeInterpolator(const G4double (&xb)[nBins], G4bool extrapolate=true)
: xBins(xb), doExtrapolation(extrapolate),
lastX(-DBL_MAX), lastVal(-DBL_MAX) {}
virtual ~G4CascadeInterpolator() {}
// Find bin position (index and fraction) from input argument
G4double getBin(const G4double x) const;
// Apply bin position from first input to second (array)
G4double interpolate(const G4double x, const G4double (&yb)[nBins]) const;
G4double interpolate(const G4double (&yb)[nBins]) const;
void printBins() const; // Show bin edges for debugging purposes
private:
const G4double (&xBins)[nBins];
G4bool doExtrapolation;
mutable G4double lastX; // Buffers to remember previous call
mutable G4double lastVal;
};
// NOTE: G4 requires template function definitions in .hh file
#include "G4CascadeInterpolator.icc"
#endif /* G4CASCADE_INTERPOLATOR_HH */
@@ -0,0 +1,124 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4CASCADE_INTERPOLATOR_ICC
#define G4CASCADE_INTERPOLATOR_ICC
// $Id: G4CascadeInterpolator.icc,v 1.9 2010/12/15 07:39:42 gunter Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// Author: Michael Kelsey <kelsey@slac.stanford.edu>
//
// Simple linear interpolation class, more lightweight than
// G4PhysicsVector. Templated on number of X-axis (usually energy)
// bins, constructor takes a C-array of bin edges as input, and an
// optional flag whether to truncate or extrapolate (the default) values
// beyond the bin boundaries.
//
// The interpolation action returns a simple double: the integer part
// is the bin index, and the fractional part is, obviously, the
// fractional part.
//
// 20100517 M. Kelsey -- Bug fix in interpolate: If bin position is _exactly_
// at upper edge (== last + 0.0), just return bin value.
// 20100520 M. Kelsey -- Second bug fix: Loop in bin search should start at
// i=1, not i=0 (since i-1 is the key).
// 20100803 M. Kelsey -- Add printBins() function for debugging
// 20101019 M. Kelsey -- CoVerity reports: recursive #include, index overrun
#include "globals.hh"
#include "G4CascadeInterpolator.hh"
#include <iomanip>
// Find bin position (index and fraction) using input argument and array
template <int NBINS>
G4double G4CascadeInterpolator<NBINS>::getBin(const G4double x) const {
if (x == lastX) return lastVal; // Avoid unnecessary work
G4double xindex, xdiff, xbin;
lastX = x;
if (x < xBins[0]) { // Handle boundaries first
xindex = 0.;
xbin = xBins[1]-xBins[0];
xdiff = doExtrapolation ? x-xBins[0] : 0.; // Less than zero
} else if (x >= xBins[last]) {
xindex = last;
xbin = xBins[last]-xBins[last-1];
xdiff = doExtrapolation ? x-xBins[last] : 0.;
} else { // Assume nBins small; linear search
int i;
for (i=1; i<last && x>xBins[i]; i++) {;} // Stops when x within bin i-1
xindex = i-1;
xbin = xBins[i] - xBins[i-1];
xdiff = x - xBins[i-1];
}
#ifdef G4CASCADE_DEBUG_SAMPLER
G4cout << " G4CascadeInterpolator<" << NBINS << ">: x=" << x
<< " index=" << xindex << " fraction=" << xdiff/xbin << G4endl;
#endif
return (lastVal = xindex + xdiff/xbin); // Save return value for later
}
// Apply interpolation of input argument to user array
template <int NBINS>
G4double G4CascadeInterpolator<NBINS>::
interpolate(const G4double x, const G4double (&yb)[nBins]) const {
getBin(x);
return interpolate(yb);
}
// Apply last found interpolation to user array
template <int NBINS>
G4double G4CascadeInterpolator<NBINS>::
interpolate(const G4double (&yb)[nBins]) const {
// Treat boundary extrapolations specially, otherwise just truncate
G4int i = (lastVal<0) ? 0 : (lastVal>last) ? last-1 : G4int(lastVal);
G4double frac = lastVal - G4double(i); // May be <0 or >1 if extrapolating
// Special case: if exactly on upper bin edge, just return value
return (i==last) ? yb[last] : (yb[i] + frac*(yb[i+1]-yb[i]));
}
// Print bin edges for debugging
template <int NBINS>
void G4CascadeInterpolator<NBINS>::printBins() const {
G4cout << " G4CascadeInterpolator<" << NBINS << "> : " << G4endl;
for (G4int k=0; k<NBINS; k++) {
G4cout << " " << std::setw(5) << xBins[k];
if ((k+1)%12 == 0) G4cout << G4endl;
}
G4cout << G4endl;
}
#endif /* G4CASCADE_INTERPOLATOR_ICC */
@@ -23,19 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeKminusNChannel.hh,v 1.7 2010/06/25 09:42:04 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_KMINUSN_CHANNEL_HH
#define G4_CASCADE_KMINUSN_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeKminusNChannelData {
typedef G4CascadeData<5,15,28,42,20,11,121> data_t;
typedef G4CascadeData<31,5,15,28,42,20,11> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeKminusNChannelData> G4CascadeKminusNChannel;
typedef G4CascadeFunctions<G4CascadeKminusNChannelData,G4KaonHypSampler> G4CascadeKminusNChannel;
#endif
@@ -23,18 +23,27 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeKminusPChannel.hh,v 1.7 2010/06/25 09:42:06 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_KMINUSP_CHANNEL_HH
#define G4_CASCADE_KMINUSP_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeKminusPChannelData {
typedef G4CascadeData<8,20,34,48,22,16,148> data_t;
typedef G4CascadeData<31,8,20,34,48,22,16> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeKminusPChannelData> G4CascadeKminusPChannel;
typedef G4CascadeFunctions<G4CascadeKminusPChannelData,G4KaonHypSampler> G4CascadeKminusPChannel;
#endif
@@ -23,17 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeKplusNChannel.hh,v 1.7 2010/06/25 09:42:08 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_KPLUSN_CHANNEL_HH
#define G4_CASCADE_KPLUSN_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeKplusNChannelData {
typedef G4CascadeData<2,5,13,22,32,41,115> data_t;
typedef G4CascadeData<31,2,5,13,22,32,41> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeKplusNChannelData> G4CascadeKplusNChannel;
typedef G4CascadeFunctions<G4CascadeKplusNChannelData,G4KaonHypSampler> G4CascadeKplusNChannel;
#endif
@@ -23,18 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeKplusPChannel.hh,v 1.7 2010/06/25 09:42:10 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_KPLUSP_CHANNEL_HH
#define G4_CASCADE_KPLUSP_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeKplusPChannelData {
typedef G4CascadeData<1,4,10,19,28,38,100> data_t;
typedef G4CascadeData<31,1,4,10,19,28,38> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeKplusPChannelData> G4CascadeKplusPChannel;
typedef G4CascadeFunctions<G4CascadeKplusPChannelData,G4KaonHypSampler> G4CascadeKplusPChannel;
#endif
@@ -23,17 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeKzeroBarNChannel.hh,v 1.7 2010/06/25 09:42:12 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_KZEROBARN_CHANNEL_HH
#define G4_CASCADE_KZEROBARN_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeKzeroBarNChannelData {
typedef G4CascadeData<8,20,34,48,22,16,148> data_t;
typedef G4CascadeData<31,8,20,34,48,22,16> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeKzeroBarNChannelData> G4CascadeKzeroBarNChannel;
typedef G4CascadeFunctions<G4CascadeKzeroBarNChannelData,G4KaonHypSampler> G4CascadeKzeroBarNChannel;
#endif
@@ -23,19 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeKzeroBarPChannel.hh,v 1.7 2010/06/25 09:42:14 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_KZEROBARP_CHANNEL_HH
#define G4_CASCADE_KZEROBARP_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeKzeroBarPChannelData {
typedef G4CascadeData<5,15,28,42,20,11,121> data_t;
typedef G4CascadeData<31,5,15,28,42,20,11> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeKzeroBarPChannelData> G4CascadeKzeroBarPChannel;
typedef G4CascadeFunctions<G4CascadeKzeroBarPChannelData,G4KaonHypSampler> G4CascadeKzeroBarPChannel;
#endif
@@ -23,18 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeKzeroNChannel.hh,v 1.7 2010/06/25 09:42:16 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_KZERON_CHANNEL_HH
#define G4_CASCADE_KZERON_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeKzeroNChannelData {
typedef G4CascadeData<1,4,10,19,28,38,100> data_t;
typedef G4CascadeData<31,1,4,10,19,28,38> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeKzeroNChannelData> G4CascadeKzeroNChannel;
typedef G4CascadeFunctions<G4CascadeKzeroNChannelData,G4KaonHypSampler> G4CascadeKzeroNChannel;
#endif
@@ -23,17 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeKzeroPChannel.hh,v 1.7 2010/06/25 09:42:18 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_KZEROP_CHANNEL_HH
#define G4_CASCADE_KZEROP_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeKzeroPChannelData {
typedef G4CascadeData<2,5,13,22,32,41,115> data_t;
typedef G4CascadeData<31,2,5,13,22,32,41> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeKzeroPChannelData> G4CascadeKzeroPChannel;
typedef G4CascadeFunctions<G4CascadeKzeroPChannelData,G4KaonHypSampler> G4CascadeKzeroPChannel;
#endif
@@ -23,18 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeLambdaNChannel.hh,v 1.7 2010/06/25 09:42:20 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_LAMBDAN_CHANNEL_HH
#define G4_CASCADE_LAMBDAN_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeLambdaNChannelData {
typedef G4CascadeData<3,12,33,59,30,20,157> data_t;
typedef G4CascadeData<31,3,12,33,59,30,20> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeLambdaNChannelData> G4CascadeLambdaNChannel;
typedef G4CascadeFunctions<G4CascadeLambdaNChannelData,G4KaonHypSampler> G4CascadeLambdaNChannel;
#endif
@@ -23,17 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeLambdaPChannel.hh,v 1.7 2010/06/25 09:42:22 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_LAMBDAP_CHANNEL_HH
#define G4_CASCADE_LAMBDAP_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeLambdaPChannelData {
typedef G4CascadeData<3,12,33,59,30,20,157> data_t;
typedef G4CascadeData<31,3,12,33,59,30,20> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeLambdaPChannelData> G4CascadeLambdaPChannel;
typedef G4CascadeFunctions<G4CascadeLambdaPChannelData,G4KaonHypSampler> G4CascadeLambdaPChannel;
#endif
@@ -23,13 +23,21 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#include "globals.hh"
#include "G4BertiniData.hh"
// $Id: G4CascadeNNChannel.hh,v 1.3 2010/06/25 09:42:24 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//#include "G4Cascade.hh"
#ifndef G4_CASCADE_NN_CHANNEL_HH
#define G4_CASCADE_NN_CHANNEL_HH
// Initialize static pointer for singleton instance
G4BertiniData* G4BertiniData::theInstance = 0;
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4PionNucSampler.hh"
const G4int G4BertiniData::pair[6][2] =
{{0, 1}, {1, 7}, {7,27}, {27,69}, {69,94}, {94,111}};
struct G4CascadeNNChannelData {
typedef G4CascadeData<30,1,6,18,32,7,8,10,11> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeNNChannelData,G4PionNucSampler> G4CascadeNNChannel;
#endif /* G4_CASCADE_NN_CHANNEL_HH */
@@ -23,43 +23,21 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4BertiniData_h
#define G4BertiniData_h 1
// $Id: G4CascadeNPChannel.hh,v 1.3 2010/06/25 09:42:26 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
#include "globals.hh"
#ifndef G4_CASCADE_NP_CHANNEL_HH
#define G4_CASCADE_NP_CHANNEL_HH
class G4BertiniData //: public G4VIntraNuclearTransportModel
{
public:
G4BertiniData(){
G4cout << " G4BertiniData constructor" << G4endl;
}
~G4BertiniData(){
G4cout << " G4BertiniData destructor" << G4endl;
}
static G4BertiniData* Instance()
{
if (!theInstance) theInstance = new G4BertiniData();
else G4cout << "singleton instance already created" << G4endl;
return theInstance;
}
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4PionNucSampler.hh"
private:
static G4BertiniData* theInstance;
public:
static const G4int pair[6][2];
struct G4CascadeNPChannelData {
typedef G4CascadeData<30,1,9,22,38,7,9,10,12> data_t;
static data_t data;
};
#endif
typedef G4CascadeFunctions<G4CascadeNPChannelData,G4PionNucSampler> G4CascadeNPChannel;
#endif /* G4_CASCADE_NP_CHANNEL_HH */
@@ -0,0 +1,43 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadePPChannel.hh,v 1.3 2010/06/25 09:42:28 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
#ifndef G4_CASCADE_PP_CHANNEL_HH
#define G4_CASCADE_PP_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4PionNucSampler.hh"
struct G4CascadePPChannelData {
typedef G4CascadeData<30,1,6,18,32,7,8,10,11> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadePPChannelData,G4PionNucSampler> G4CascadePPChannel;
#endif /* G4_CASCADE_PP_CHANNEL_HH */
@@ -0,0 +1,43 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadePiMinusNChannel.hh,v 1.3 2010/06/25 09:42:30 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
#ifndef G4_CASCADE_PIMINUSN_CHANNEL_HH
#define G4_CASCADE_PIMINUSN_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4PionNucSampler.hh"
struct G4CascadePiMinusNChannelData {
typedef G4CascadeData<30,2,7,15,24,5,6,7,8> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadePiMinusNChannelData,G4PionNucSampler> G4CascadePiMinusNChannel;
#endif /* G4_CASCADE_PIMINUSN_CHANNEL_HH */
@@ -0,0 +1,43 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadePiMinusPChannel.hh,v 1.3 2010/06/25 09:42:32 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
#ifndef G4_CASCADE_PIMINUSP_CHANNEL_HH
#define G4_CASCADE_PIMINUSP_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4PionNucSampler.hh"
struct G4CascadePiMinusPChannelData {
typedef G4CascadeData<30,5,13,22,31,6,7,8,9> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadePiMinusPChannelData,G4PionNucSampler> G4CascadePiMinusPChannel;
#endif /* G4_CASCADE_PIMINUSP_CHANNEL_HH */
@@ -0,0 +1,43 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadePiPlusNChannel.hh,v 1.3 2010/06/25 09:42:34 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
#ifndef G4_CASCADE_PIPLUSN_CHANNEL_HH
#define G4_CASCADE_PIPLUSN_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4PionNucSampler.hh"
struct G4CascadePiPlusNChannelData {
typedef G4CascadeData<30,5,13,22,31,6,7,8,9> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadePiPlusNChannelData,G4PionNucSampler> G4CascadePiPlusNChannel;
#endif /* G4_CASCADE_PIPLUSN_CHANNEL_HH */
@@ -0,0 +1,43 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadePiPlusPChannel.hh,v 1.3 2010/06/25 09:42:36 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
#ifndef G4_CASCADE_PIPLUSP_CHANNEL_HH
#define G4_CASCADE_PIPLUSP_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4PionNucSampler.hh"
struct G4CascadePiPlusPChannelData {
typedef G4CascadeData<30,2,7,15,24,5,6,7,8> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadePiPlusPChannelData,G4PionNucSampler> G4CascadePiPlusPChannel;
#endif /* G4_CASCADE_PIPLUSP_CHANNEL_HH */
@@ -0,0 +1,43 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadePiZeroNChannel.hh,v 1.3 2010/06/25 09:42:38 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
#ifndef G4_CASCADE_PIZERON_CHANNEL_HH
#define G4_CASCADE_PIZERON_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4PionNucSampler.hh"
struct G4CascadePiZeroNChannelData {
typedef G4CascadeData<30,5,13,21,30,6,7,8,9> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadePiZeroNChannelData,G4PionNucSampler> G4CascadePiZeroNChannel;
#endif /* G4_CASCADE_PIZERON_CHANNEL_HH */
@@ -0,0 +1,43 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadePiZeroPChannel.hh,v 1.3 2010/06/25 09:42:40 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
#ifndef G4_CASCADE_PIZEROP_CHANNEL_HH
#define G4_CASCADE_PIZEROP_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4PionNucSampler.hh"
struct G4CascadePiZeroPChannelData {
typedef G4CascadeData<30,5,13,21,30,6,7,8,9> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadePiZeroPChannelData,G4PionNucSampler> G4CascadePiZeroPChannel;
#endif /* G4_CASCADE_PIZEROP_CHANNEL_HH */
@@ -0,0 +1,125 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4CASCADE_RECOIL_MAKER_HH
#define G4CASCADE_RECOIL_MAKER_HH
// $Id: G4CascadeRecoilMaker.hh,v 1.7 2010/12/15 07:39:44 gunter Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// Collects generated cascade data (using Collider::collide() interface)
// and computes the nuclear recoil kinematics needed to balance the event.
//
// 20100909 M. Kelsey -- Inspired by G4CascadeCheckBalance
// 20100909 M. Kelsey -- Move G4IntraNucleiCascader::goodCase() here, add
// tolerance for "almost zero" excitation energy, add function
// to manually override excitation energy
// 20100910 M. Kelsey -- Drop getRecoilFragment() in favor of user calling
// makeRecoilFragment() with returned non-const pointer. Drop
// handling of excitons.
// 20100914 M. Kelsey -- Migrate to integer A and Z
// 20100921 M. Kelsey -- Return G4InuclNuclei using "makeRecoilNuclei()".
// Repurpose "makeRecoilFragment()" to return G4Fragment.
// 20100924 M. Kelsey -- Add raw excitation energy (mass difference) function
#include "G4VCascadeCollider.hh"
#include "globals.hh"
#include "G4CollisionOutput.hh"
#include "G4InuclNuclei.hh"
#include "G4Fragment.hh"
#include "G4LorentzVector.hh"
#include <cmath>
#include <vector>
class G4CascadParticle;
class G4CascadeCheckBalance;
class G4InuclElementaryParticle;
class G4InuclParticle;
class G4CascadeRecoilMaker : public G4VCascadeCollider {
public:
explicit G4CascadeRecoilMaker(G4double tolerance=0.001*MeV);
virtual ~G4CascadeRecoilMaker();
// Standard Collider interface (non-const output "buffer")
void collide(G4InuclParticle* bullet, G4InuclParticle* target,
G4CollisionOutput& output);
// This is for use with G4IntraNucleiCascader
void collide(G4InuclParticle* bullet, G4InuclParticle* target,
const std::vector<G4InuclElementaryParticle>& particles,
const std::vector<G4CascadParticle>& cparticles);
// Modifiable parameters
void setTolerance(G4double tolerance) { excTolerance = tolerance; }
void setRecoilExcitation(G4double Eexc) { excitationEnergy = Eexc; }
// Build nucleus from current parameters, if physically reasonable
G4InuclNuclei* makeRecoilNuclei(G4int model=0);
G4Fragment* makeRecoilFragment(); // For use with PreCompound
// Attach exciton configuration for use by "nucleus makers"
void addExcitonConfiguration(const G4ExitonConfiguration exciton) {
theExcitons = exciton;
}
// Access nuclear configuration parameters
G4int getRecoilA() const { return recoilA; }
G4int getRecoilZ() const { return recoilZ; }
G4double getRecoilExcitation() const { return excitationEnergy; }
const G4LorentzVector& getRecoilMomentum() const { return recoilMomentum; }
// Data quality checks
G4bool goodFragment() const; // Verify A, Z both meaningful
G4bool goodRecoil() const; // And sensible four-vector
G4bool wholeEvent() const; // Zero recoil
G4bool unphysicalRecoil() const { return !wholeEvent() && !goodRecoil(); }
G4bool goodNucleus() const; // Ensure that fragment is energetically okay
protected:
void fillRecoil(); // Set recoil parameters from CheckBalance
G4double deltaM() const; // Mass difference from current parameters
private:
G4CascadeCheckBalance* balance; // Used to do kinematics calculations
G4double excTolerance; // Minimum excitation energy, rounds to zero
G4double inputEkin; // Available initial kinetic energy
G4int recoilA; // Nuclear parameters of recoil
G4int recoilZ;
G4LorentzVector recoilMomentum;
G4double excitationEnergy;
G4ExitonConfiguration theExcitons; // Used by G4InuclNuclei and G4Fragment
G4InuclNuclei theRecoilNuclei; // Reusable buffers for recoil
G4Fragment theRecoilFragment;
};
#endif /* G4CASCADE_RECOIL_MAKER_HH */
@@ -23,61 +23,56 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4BERTINIREGIONMODEL
#define G4BERTINIREGIONMODEL
// $Id: G4CascadeSampler.hh,v 1.4 2010/08/03 23:09:36 mkelsey Exp $
// GEANT4 tag: $Name: geant4-09-04 $
//
// 20100506 M. Kelsey -- Move functionality of G4CascadeChannel here,
// use as base class to G4CascadeFunctions<T>.
// 20100512 M. Kelsey -- Make this templated on energy and multiplicity
// binning, as base to new sampler.
// 20100803 M. Kelsey -- Add print function for debugging.
#ifndef G4_CASCADE_SAMPLER_HH
#define G4_CASCADE_SAMPLER_HH
#include "G4ios.hh"
#include <vector>
#include <cmath>
#include "globals.hh"
#include "G4Proton.hh"
#include "G4Neutron.hh"
typedef std::vector<G4double>::const_iterator my_iterator;
class G4BertiniRegionModel {
/*! \class G4BertiniRegionModel
* \brief Implements HETC nucleus regions
* \author Aatos Heikkinen
* \author Original HETC authors
* \version 0.0
* \date 25.11.2002
* \bug
* \warning Wery preliminary
*/
#include "G4CascadeInterpolator.hh"
template <int NBINS, int NMULT>
class G4CascadeSampler {
public:
G4BertiniRegionModel(const G4int numberOfLayers, const G4int A, const G4int Z);
~G4BertiniRegionModel();
enum { energyBins=NBINS, multBins=NMULT }; // For use in function arguments
G4double GetDensity(G4double radius);
G4double GetPotentialEnergy(G4double r, G4int particle);
G4double GetMaximumNucleonMomentum(G4double radius, G4int nucleon);
G4CascadeSampler(const G4double (&ebins)[energyBins])
: interpolator(ebins), energyScale(ebins) {}
virtual ~G4CascadeSampler() {}
virtual G4double
findCrossSection(double ke, const G4double (&xsec)[energyBins]) const;
virtual G4int
findMultiplicity(G4double ke, const G4double xmult[][energyBins]) const;
virtual G4int
findFinalStateIndex(G4int mult, G4double ke, const G4int index[],
const G4double xsec[][energyBins]) const;
virtual void print() const;
private:
std::vector<G4double> radius; /*!< contains the outer radiuses of the shells */
std::vector<G4double> density;
std::vector<G4double> protonFermiEnergy;
std::vector<G4double> neutronFermiEnergy;
std::vector<G4double> protonFermiMomentum;
std::vector<G4double> neutronFermiMomentum;
std::vector<G4double> protonPotentialEnergy;
std::vector<G4double> neutronPotentialEnergy;
G4int massNumber;
G4int protonNumber;
static const G4double radius0;
static const G4double BE;
G4double GetFermiMomentum(G4double density, G4double mass);
G4double GetFermiEnergy(G4double density, G4double mass);
};
#endif
// Optional start/stop arguments default to inclusive arrays
void fillSigmaBuffer(G4double ke, const G4double x[][energyBins],
G4int startBin=0, G4int stopBin=multBins) const;
G4int sampleFlat() const;
G4CascadeInterpolator<NBINS> interpolator;
mutable std::vector<G4double> sigmaBuf;
const G4double (&energyScale)[energyBins];
};
#include "G4CascadeSampler.icc"
#endif /* G4_CASCADE_SAMPLER_HH */
@@ -0,0 +1,121 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4CASCADE_SAMPLER_ICC
#define G4CASCADE_SAMPLER_ICC
// $Id: G4CascadeSampler.icc,v 1.6 2010/12/15 07:39:46 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04 $
//
// 20100506 M. Kelsey -- Move functionity of G4CascadeChannel here,
// use as base class to G4CascadeFunctions<T>.
// 20100512 M. Kelsey -- Move implementation to .icc with templating
// 20100803 M. Kelsey -- Add print function for debugging.
// 20101019 M. Kelsey -- CoVerity report: recursive #include
#include "G4CascadeSampler.hh"
#include "Randomize.hh"
#include <vector>
template <int NBINS, int NMULT> inline
G4double G4CascadeSampler<NBINS,NMULT>::
findCrossSection(double ke,
const G4double (&xsec)[energyBins]) const {
return interpolator.interpolate(ke, xsec);
}
template <int NBINS, int NMULT> inline
G4int G4CascadeSampler<NBINS,NMULT>::
findMultiplicity(G4double ke,
const G4double xmult[][energyBins]) const {
fillSigmaBuffer(ke, xmult);
return sampleFlat() + 2; // Convert array index to actual mult (2 to 7)
}
template <int NBINS, int NMULT> inline
G4int G4CascadeSampler<NBINS,NMULT>::
findFinalStateIndex(G4int mult, G4double ke, const G4int index[],
const G4double xsec[][energyBins]) const {
G4int start = index[mult-2];
G4int stop = index[mult-1];
if (stop-start <= 1) return start; // Avoid unnecessary work
fillSigmaBuffer(ke, xsec, start, stop);
return sampleFlat();
}
// Optional start/stop arguments default to multiplicity arrays
template <int NBINS, int NMULT> inline
void G4CascadeSampler<NBINS,NMULT>::
fillSigmaBuffer(G4double ke, const G4double x[][energyBins],
G4int startBin, G4int stopBin) const {
sigmaBuf.clear();
if (stopBin-startBin <= 1) return; // Avoid unnecessary work
// NOTE: push_back() must be used to ensure that size() gets set!
sigmaBuf.reserve(stopBin-startBin);
for(G4int m = startBin; m < stopBin; m++)
sigmaBuf.push_back(interpolator.interpolate(ke, x[m]));
}
template <int NBINS, int NMULT> inline
G4int G4CascadeSampler<NBINS,NMULT>::sampleFlat() const {
G4int nbins = sigmaBuf.size();
if (nbins <= 1) return 0; // Avoid unnecessary work
#ifdef G4CASCADE_DEBUG_SAMPLER
G4cout << "G4CascadeSampler::sampleFlat() has " << nbins << "bins:" << G4endl;
for (G4int sbi=0; sbi<nbins; sbi++) G4cout << " " << sigmaBuf[sbi];
G4cout << G4endl;
#endif
G4int i;
G4double fsum = 0.;
for (i = 0; i < nbins; i++) fsum += sigmaBuf[i];
#ifdef G4CASCADE_DEBUG_SAMPLER
G4cout << " buffer total (fsum) " << fsum;
#endif
fsum *= G4UniformRand();
#ifdef G4CASCADE_DEBUG_SAMPLER
G4cout << " *random-scale " << fsum << G4endl;
#endif
G4double partialSum = 0.0;
for (i = 0; i < nbins; i++) {
partialSum += sigmaBuf[i];
if (fsum < partialSum) return i; // Breaks out of loop automatically
}
return 0; // Is this right? Shouldn't it return maximum, not minimum?
}
template <int NBINS, int NMULT> inline
void G4CascadeSampler<NBINS,NMULT>::print() const {
interpolator.printBins();
}
#endif /* G4CASCADE_SAMPLER_ICC */
@@ -23,18 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeSigmaMinusNChannel.hh,v 1.7 2010/06/25 09:42:46 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_SIGMAMINUSN_CHANNEL_HH
#define G4_CASCADE_SIGMAMINUSN_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeSigmaMinusNChannelData {
typedef G4CascadeData<1,6,20,42,25,17,111> data_t;
typedef G4CascadeData<31,1,6,20,42,25,17> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeSigmaMinusNChannelData> G4CascadeSigmaMinusNChannel;
typedef G4CascadeFunctions<G4CascadeSigmaMinusNChannelData,G4KaonHypSampler> G4CascadeSigmaMinusNChannel;
#endif
@@ -23,18 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeSigmaMinusPChannel.hh,v 1.7 2010/06/25 09:42:48 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_SIGMAMINUSP_CHANNEL_HH
#define G4_CASCADE_SIGMAMINUSP_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeSigmaMinusPChannelData {
typedef G4CascadeData<3,12,33,59,30,20,157> data_t;
typedef G4CascadeData<31,3,12,33,59,30,20> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeSigmaMinusPChannelData> G4CascadeSigmaMinusPChannel;
typedef G4CascadeFunctions<G4CascadeSigmaMinusPChannelData,G4KaonHypSampler> G4CascadeSigmaMinusPChannel;
#endif
@@ -23,18 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeSigmaPlusNChannel.hh,v 1.7 2010/06/25 09:42:50 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_SIGMAPLUSN_CHANNEL_HH
#define G4_CASCADE_SIGMAPLUSN_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeSigmaPlusNChannelData {
typedef G4CascadeData<3,12,33,59,30,20,157> data_t;
typedef G4CascadeData<31,3,12,33,59,30,20> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeSigmaPlusNChannelData> G4CascadeSigmaPlusNChannel;
typedef G4CascadeFunctions<G4CascadeSigmaPlusNChannelData,G4KaonHypSampler> G4CascadeSigmaPlusNChannel;
#endif
@@ -23,18 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeSigmaPlusPChannel.hh,v 1.7 2010/06/25 09:42:52 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_SIGMAPLUSP_CHANNEL_HH
#define G4_CASCADE_SIGMAPLUSP_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeSigmaPlusPChannelData {
typedef G4CascadeData<1,6,20,42,25,17,111> data_t;
typedef G4CascadeData<31,1,6,20,42,25,17> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeSigmaPlusPChannelData> G4CascadeSigmaPlusPChannel;
typedef G4CascadeFunctions<G4CascadeSigmaPlusPChannelData,G4KaonHypSampler> G4CascadeSigmaPlusPChannel;
#endif
@@ -23,18 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeSigmaZeroNChannel.hh,v 1.7 2010/06/25 09:42:54 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_SIGMAZERON_CHANNEL_HH
#define G4_CASCADE_SIGMAZERON_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeSigmaZeroNChannelData {
typedef G4CascadeData<3,12,33,59,30,20,157> data_t;
typedef G4CascadeData<31,3,12,33,59,30,20> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeSigmaZeroNChannelData> G4CascadeSigmaZeroNChannel;
typedef G4CascadeFunctions<G4CascadeSigmaZeroNChannelData,G4KaonHypSampler> G4CascadeSigmaZeroNChannel;
#endif
@@ -23,17 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeSigmaZeroPChannel.hh,v 1.7 2010/06/25 09:42:56 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_SIGMAZEROP_CHANNEL_HH
#define G4_CASCADE_SIGMAZEROP_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeSigmaZeroPChannelData {
typedef G4CascadeData<3,12,33,59,30,20,157> data_t;
typedef G4CascadeData<31,3,12,33,59,30,20> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeSigmaZeroPChannelData> G4CascadeSigmaZeroPChannel;
typedef G4CascadeFunctions<G4CascadeSigmaZeroPChannelData,G4KaonHypSampler> G4CascadeSigmaZeroPChannel;
#endif
@@ -23,17 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeXiMinusNChannel.hh,v 1.7 2010/06/25 09:42:58 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_XIMINUSN_CHANNEL_HH
#define G4_CASCADE_XIMINUSN_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeXiMinusNChannelData {
typedef G4CascadeData<3,18,53,2,2,2,80> data_t;
typedef G4CascadeData<31,3,18,53,2,2,2> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeXiMinusNChannelData> G4CascadeXiMinusNChannel;
typedef G4CascadeFunctions<G4CascadeXiMinusNChannelData,G4KaonHypSampler> G4CascadeXiMinusNChannel;
#endif
@@ -23,17 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeXiMinusPChannel.hh,v 1.7 2010/06/25 09:43:00 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_XIMINUSP_CHANNEL_HH
#define G4_CASCADE_XIMINUSP_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeXiMinusPChannelData {
typedef G4CascadeData<6,24,4,4,4,4,46> data_t;
typedef G4CascadeData<31,6,24,4,4,4,4> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeXiMinusPChannelData> G4CascadeXiMinusPChannel;
typedef G4CascadeFunctions<G4CascadeXiMinusPChannelData,G4KaonHypSampler> G4CascadeXiMinusPChannel;
#endif
@@ -23,18 +23,27 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeXiZeroNChannel.hh,v 1.7 2010/06/25 09:43:02 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_XIZERON_CHANNEL_HH
#define G4_CASCADE_XIZERON_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeXiZeroNChannelData {
typedef G4CascadeData<6,24,4,4,4,4,46> data_t;
typedef G4CascadeData<31,6,24,4,4,4,4> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeXiZeroNChannelData> G4CascadeXiZeroNChannel;
typedef G4CascadeFunctions<G4CascadeXiZeroNChannelData,G4KaonHypSampler> G4CascadeXiZeroNChannel;
#endif
@@ -23,17 +23,27 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeXiZeroPChannel.hh,v 1.7 2010/06/25 09:43:04 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100507 M. Kelsey -- Remove redundant total-bins template argument
// 20100510 M. Kelsey -- Add initial "31" template arg. Add G4CascSampler
// to template for channel typedef
// 20100514 M. Kelsey -- Replace G4CascadeSampler with G4KaonHypSampler.
#ifndef G4_CASCADE_XIZEROP_CHANNEL_HH
#define G4_CASCADE_XIZEROP_CHANNEL_HH
#include "G4CascadeData.hh"
#include "G4CascadeFunctions.hh"
#include "G4KaonHypSampler.hh"
struct G4CascadeXiZeroPChannelData {
typedef G4CascadeData<3,18,53,2,2,2,80> data_t;
typedef G4CascadeData<31,3,18,53,2,2,2> data_t;
static data_t data;
};
typedef G4CascadeFunctions<G4CascadeXiZeroPChannelData> G4CascadeXiZeroPChannel;
typedef G4CascadeFunctions<G4CascadeXiZeroPChannelData,G4KaonHypSampler> G4CascadeXiZeroPChannel;
#endif
@@ -23,141 +23,126 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CollisionOutput.hh,v 1.29 2010/09/26 04:06:03 mkelsey Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100114 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
// 20100407 M. Kelsey -- Replace ::resize(0) with ::clear()
// 20100409 M. Kelsey -- Move function code to .cc files, not inlinable
// 20100418 M. Kelsey -- Add function to boost output lists to lab frame
// 20100520 M. Kelsey -- Add function to rotate Z axis, from G4Casc.Interface
// 20100620 M. Kelsey -- Add setVerboseLevel() function
// 20100715 M. Kelsey -- Add total charge and baryon number functions, and a
// combined "add()" function to put two of these together.
// 20100716 M. Kelsey -- Add interface to handle G4CascadParticles
// 20100924 M. Kelsey -- Use "OutgoingNuclei" name consistently, replacing
// old "TargetFragment". Add new (reusable) G4Fragment buffer
// and access functions for initial post-cascade processing.
// Move implementation of add() to .cc file.
// 20100925 M. Kelsey -- Add function to process G4ReactionProduct list
#ifndef G4COLLISION_OUTPUT_HH
#define G4COLLISION_OUTPUT_HH
#include <iostream>
#include "G4Fragment.hh"
#include "G4InuclElementaryParticle.hh"
#include "G4InuclNuclei.hh"
#include "G4LorentzRotation.hh"
#include "G4ReactionProductVector.hh"
#include <algorithm>
#include <vector>
class G4CascadParticle;
class G4LorentzConvertor;
class G4CollisionOutput {
public:
G4CollisionOutput();
G4CollisionOutput& operator=(const G4CollisionOutput& right);
void reset() {
nucleiFragments.resize(0);
outgoingParticles.resize(0);
};
void setVerboseLevel(G4int verbose) { verboseLevel = verbose; };
// ===== Accumulate contents of lists =====
void reset(); // Empties lists for new event
void add(const G4CollisionOutput& right); // Merge complete objects
void addOutgoingParticle(const G4InuclElementaryParticle& particle) {
outgoingParticles.push_back(particle);
}
void addOutgoingParticles(const std::vector<G4InuclElementaryParticle>& particles);
void addOutgoingNucleus(const G4InuclNuclei& nuclei) {
outgoingNuclei.push_back(nuclei);
};
void addOutgoingParticles(const std::vector<G4InuclElementaryParticle>& particles) {
for(G4int i = 0; i < G4int(particles.size()); i++)
outgoingParticles.push_back(particles[i]);
};
void addOutgoingNuclei(const std::vector<G4InuclNuclei>& nuclea);
void addTargetFragment(const G4InuclNuclei& nuclei) {
nucleiFragments.push_back(nuclei);
};
// These are primarily for G4IntraNucleiCascader internal checks
void addOutgoingParticle(const G4CascadParticle& cparticle);
void addOutgoingParticles(const std::vector<G4CascadParticle>& cparticles);
void addTargetFragments(const std::vector<G4InuclNuclei>& nuclea) {
for(G4int i = 0; i < G4int(nuclea.size()); i++)
nucleiFragments.push_back(nuclea[i]);
};
void addOutgoingParticles(const G4ReactionProductVector* rproducts);
// Special buffer for initial, possible unstable fragment from cascade
void addRecoilFragment(const G4Fragment* aFragment) {
if (aFragment) addRecoilFragment(*aFragment);
}
void addRecoilFragment(const G4Fragment& aFragment) {
theRecoilFragment = aFragment;
}
// ===== Access contents of lists =====
G4int numberOfOutgoingParticles() const { return outgoingParticles.size(); }
const std::vector<G4InuclElementaryParticle>& getOutgoingParticles() const {
return outgoingParticles;
};
G4int numberOfNucleiFragments() const {
return nucleiFragments.size();
};
G4int numberOfOutgoingNuclei() const { return outgoingNuclei.size(); };
const std::vector<G4InuclNuclei>& getNucleiFragments() const {
return nucleiFragments;
const std::vector<G4InuclNuclei>& getOutgoingNuclei() const {
return outgoingNuclei;
};
G4CascadeMomentum getTotalOutputMomentum() const {
G4CascadeMomentum tot_mom;
double eex_r = 0.0;
G4int i(0);
for(i = 0; i < G4int(outgoingParticles.size()); i++) {
const G4CascadeMomentum& mom = outgoingParticles[i].getMomentum();
for(G4int j = 0; j < 4; j++) tot_mom[j] += mom[j];
};
for(i = 0; i < G4int(nucleiFragments.size()); i++) {
const G4CascadeMomentum& mom = nucleiFragments[i].getMomentum();
for(G4int j = 0; j < 4; j++) tot_mom[j] += mom[j];
eex_r += 0.001 * nucleiFragments[i].getExitationEnergy();
};
tot_mom[0] += eex_r;
return tot_mom;
};
const G4Fragment& getRecoilFragment() const { return theRecoilFragment; }
void printCollisionOutput() const {
G4cout << " Output: " << G4endl
<< " Outgoing Particles: " << outgoingParticles.size() << G4endl;
G4int i(0);
for(i = 0; i < G4int(outgoingParticles.size()); i++) {
outgoingParticles[i].printParticle();
};
G4cout << " Nuclei fragments: " << nucleiFragments.size() << G4endl;
for(i = 0; i < G4int(nucleiFragments.size()); i++) {
nucleiFragments[i].printParticle();
};
};
// ===== Get event totals for conservation checking, recoil, etc. ======
void trivialise(G4InuclParticle* bullet,
G4InuclParticle* target) {
if(G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {
nucleiFragments.push_back(*nuclei_target);
}
else {
G4InuclElementaryParticle* particle =
dynamic_cast<G4InuclElementaryParticle*>(target);
outgoingParticles.push_back(*particle);
};
if(G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet)) {
nucleiFragments.push_back(*nuclei_bullet);
}
else {
G4InuclElementaryParticle* particle =
dynamic_cast<G4InuclElementaryParticle*>(bullet);
outgoingParticles.push_back(*particle);
};
};
G4LorentzVector getTotalOutputMomentum() const;
G4int getTotalCharge() const; // NOTE: No fractional charges!
G4int getTotalBaryonNumber() const;
void setOnShell(G4InuclParticle* bullet,
G4InuclParticle* target);
void printCollisionOutput() const;
void setRemainingExitationEnergy() {
eex_rest = 0.0;
for(G4int i = 0; i < G4int(nucleiFragments.size()); i++)
eex_rest += 0.001 * nucleiFragments[i].getExitationEnergy();
};
// ===== Manipulate final-state particles for kinematics =====
double getRemainingExitationEnergy() const {
return eex_rest;
};
void boostToLabFrame(const G4LorentzConvertor& convertor);
void rotateEvent(const G4LorentzRotation& rotate);
void trivialise(G4InuclParticle* bullet, G4InuclParticle* target);
void setOnShell(G4InuclParticle* bullet, G4InuclParticle* target);
void setRemainingExitationEnergy();
G4bool acceptable() const {
return on_shell;
};
double getRemainingExitationEnergy() const { return eex_rest; };
G4bool acceptable() const { return on_shell; };
private:
G4int verboseLevel;
G4int verboseLevel;
std::vector<G4InuclElementaryParticle> outgoingParticles;
std::vector<G4InuclNuclei> outgoingNuclei;
G4Fragment theRecoilFragment;
std::vector<G4InuclNuclei> nucleiFragments;
G4double eex_rest; // Used by setOnShell() for kinematics
G4double eex_rest;
std::pair<std::pair<G4int, G4int>, G4int> selectPairToTune(G4double de) const;
std::pair<std::pair<G4int,G4int>, G4int> selectPairToTune(G4double de) const;
G4bool on_shell;
};
#endif // G4COLLISION_OUTPUT_HH
@@ -0,0 +1,59 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4Dineutron.hh,v 1.4 2010/06/25 09:43:08 gunter Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
// ------------------------------------------------------------
// Bertini Cascade dineutron class header file
//
// History: first implementation, inspired by G4Proton
// 17 Nov 2009: Michael Kelsey
// 06 Apr 2010: Reset theInstance in dtor, implement ctor in .cc.
// 13 Apr 2010: Per Kurashige, inherit from G4VShortLivedParticle.
// ----------------------------------------------------------------
#ifndef G4DINEUTRON_HH
#define G4DINEUTRON_HH
#include "G4VShortLivedParticle.hh"
// ######################################################################
// ### DINEUTRON ###
// ######################################################################
class G4Dineutron : public G4VShortLivedParticle {
private:
static G4Dineutron* theInstance;
G4Dineutron();
virtual ~G4Dineutron() { theInstance = 0; }
public:
static G4Dineutron* Definition();
static G4Dineutron* DineutronDefinition();
static G4Dineutron* Dineutron();
};
#endif /* G4DINEUTRON_HH */
@@ -23,47 +23,37 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeMomentum.hh,v 1.1 2008/09/22 10:06:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4Diproton.hh,v 1.4 2010/06/25 09:43:10 gunter Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
// ------------------------------------------------------------
// Bertini Cascade diproton class header file
//
// Class G4CascadeMomentum
//
// Class description:
//
// A simple wrapper class meant to replace the widespread use of
// std::vector<double> in the cascade mode code, which causes
// problems for performance due to excess memory allocations.
// History: first implementation, inspired by G4Proton
// 17 Nov 2009: Michael Kelsey
// 06 Apr 2010: Reset theInstance in dtor, implement ctor in .cc.
// 13 Apr 2010: Per Kurashige, inherit from G4VShortLivedParticle.
// ----------------------------------------------------------------
// Author: Peter Elmer, Princeton University 7-Aug-2008
// --------------------------------------------------------------------
#ifndef G4CASCADE_MOMENTUM_HH
#define G4CASCADE_MOMENTUM_HH
#ifndef G4DIPROTON_HH
#define G4DIPROTON_HH
#include <cassert>
#include "G4VShortLivedParticle.hh"
#include "G4Types.hh"
// ######################################################################
// ### DIPROTON ###
// ######################################################################
class G4CascadeMomentum
{
public:
G4CascadeMomentum() {for (int i=0; i<4; ++i) data_[i]=0.0;}
G4double& operator[](int i)
{
assert(i>=0 && i<4);
return data_[i];
}
const G4double& operator[](int i) const
{
assert(i>=0 && i<4);
return data_[i];
}
private:
G4double data_[4];
class G4Diproton : public G4VShortLivedParticle {
private:
static G4Diproton* theInstance;
G4Diproton();
~G4Diproton() { theInstance = 0; }
public:
static G4Diproton* Definition();
static G4Diproton* DiprotonDefinition();
static G4Diproton* Diproton();
};
#endif
#endif /* G4DIPROTON_HH */
@@ -23,102 +23,103 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ElementaryParticleCollider.hh,v 1.35 2010/08/04 05:28:24 mkelsey Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100114 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
// 20100315 M. Kelsey -- Remove "using" directive and unnecessary #includes.
// 20100407 M. Kelsey -- Eliminate return-by-value std::vector<> by creating
// three data buffers for particles, momenta, and particle types.
// The following functions now return void and are non-const:
// ::generateSCMfinalState()
// ::generateMomModules() (also remove input vector)
// ::generateStrangeChannelPartTypes()
// ::generateSCMpionAbsorption()
// 20100413 M. Kelsey -- Pass G4CollisionOutput by ref to ::collide(); merge
// public vs. private ::collide() functions.
// 20100511 M. Kelsey -- Remove G4PionSampler and G4NucleonSampler. Expand
// particle-types selector to all modes, not just strangeness.
// 20100517 M. Kelsey -- Inherit from common base class, make arrays static
// 20100714 M. Kelsey -- Switch to new G4CascadeColliderBase class
// 20100726 M. Kelsey -- Move remaining std::vector<> buffers here
// 20100804 M. Kelsey -- Add printFinalStateTables() function.
#ifndef G4ELEMENTARY_PARTICLE_COLLIDER_HH
#define G4ELEMENTARY_PARTICLE_COLLIDER_HH
#include "G4Collider.hh"
#include "G4CascadeColliderBase.hh"
#include "G4InuclElementaryParticle.hh"
#include "G4InuclSpecialFunctions.hh"
#include "G4CascadSpecialFunctions.hh"
#include "G4LorentzConvertor.hh"
#include "G4NucleonSampler.hh"
#include "G4PionSampler.hh"
#include "G4LorentzVector.hh"
#include <vector>
using namespace G4InuclSpecialFunctions;
using namespace G4CascadSpecialFunctions;
class G4LorentzConvertor;
class G4CollisionOutput;
class G4ElementaryParticleCollider {
class G4ElementaryParticleCollider : public G4CascadeColliderBase {
public:
G4ElementaryParticleCollider();
G4CollisionOutput collide(G4InuclParticle* bullet,
G4InuclParticle* target);
virtual ~G4ElementaryParticleCollider() {};
void collide(G4InuclParticle* bullet, G4InuclParticle* target,
G4CollisionOutput& output);
private:
G4int verboseLevel;
void initializeArrays();
G4int generateMultiplicity(G4int is, G4double ekin) const;
void collide(G4InuclElementaryParticle* bullet,
G4InuclElementaryParticle* target,
G4CollisionOutput& output);
void generateOutgoingPartTypes(G4int is, G4int mult, G4double ekin);
std::vector<G4InuclElementaryParticle>
generateSCMfinalState(G4double ekin, G4double etot_scm, G4double pscm,
G4InuclElementaryParticle* particle1,
G4InuclElementaryParticle* particle2,
G4LorentzConvertor* toSCM) const;
void generateSCMfinalState(G4double ekin, G4double etot_scm, G4double pscm,
G4InuclElementaryParticle* particle1,
G4InuclElementaryParticle* particle2,
G4LorentzConvertor* toSCM);
void generateSCMpionAbsorption(G4double etot_scm,
G4InuclElementaryParticle* particle1,
G4InuclElementaryParticle* particle2);
void generateMomModules(G4int mult, G4int is, G4double ekin,
G4double etot_cm);
// Samples the CM momentum for elastic and charge exchange scattering
//
G4LorentzVector
sampleCMmomentumFor2to2(G4int is, G4int kw, G4double ekin,
G4double pscm) const;
std::vector<G4double>
generateMomModules(const std::vector<G4int>& kinds, G4int mult,
G4int is, G4double ekin, G4double etot_cm) const;
// Samples cos(theta) in the CM for elastic and charge exchange scattering
//
G4double sampleCMcosFor2to2(G4double pscm, G4double pFrac,
G4double pA, G4double pC, G4double pCos) const;
G4CascadeMomentum
particleSCMmomentumFor2to2(G4int is, G4int kw, G4double ekin,
G4double pscm) const;
G4int getElasticCase(G4int is, G4int kw, G4double ekin) const;
std::vector<G4int>
generateStrangeChannelPartTypes(G4int is, G4int mult,
G4double ekin) const;
G4double
getMomModuleFor2toMany(G4int is, G4int mult, G4int knd,
G4double ekin) const;
G4double getMomModuleFor2toMany(G4int is, G4int mult, G4int knd,
G4double ekin) const;
G4bool satisfyTriangle(const std::vector<G4double>& modules) const;
G4CascadeMomentum
G4LorentzVector
particleSCMmomentumFor2to3(G4int is, G4int knd, G4double ekin,
G4double pmod) const;
void printFinalStateTables() const;
std::pair<G4double, G4double>
adjustIntervalForElastic(G4double ekin, G4double ak, G4double ae,
G4int k, G4int l, const std::vector<G4double>& ssv,
G4double st) const;
std::vector<G4InuclElementaryParticle>
generateSCMpionAbsorption(G4double etot_scm,
G4InuclElementaryParticle* particle1,
G4InuclElementaryParticle* particle2) const;
G4NucleonSampler nucSampler;
G4PionSampler piSampler;
// Internal buffers for lists of secondaries
std::vector<G4InuclElementaryParticle> particles;
std::vector<G4LorentzVector> scm_momentums;
std::vector<G4double> modules;
std::vector<G4double> masses2;
std::vector<G4int> particle_kinds;
// Parameter arrays
G4double rmn[14][10][2];
G4double ang[4][4][13];
G4double abn[4][4][4];
static const G4double rmn[14][10][2];
static const G4double abn[4][4][4];
};
#endif // G4ELEMENTARY_PARTICLE_COLLIDER_HH
#endif /* G4ELEMENTARY_PARTICLE_COLLIDER_HH */
@@ -23,63 +23,58 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EquilibriumEvaporator.hh,v 1.16 2010/12/15 07:39:48 gunter Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100413 M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
// 20100517 M. Kelsey -- Inherit from common base class, make other colliders
// simple data members. Rename timeToBigBang() to override
// base explosion().
// 20100714 M. Kelsey -- Switch to new G4CascadeColliderBase class
// 20100923 M. Kelsey -- Migrate to integer A and Z
// 20100925 M. Kelsey -- Remove no longer necessary explosion() interface
#ifndef G4EQUILIBRIUM_EVAPORATOR_HH
#define G4EQUILIBRIUM_EVAPORATOR_HH
#include "G4Collider.hh"
#include "G4CascadeColliderBase.hh"
#include "G4Fissioner.hh"
#include "G4BigBanger.hh"
#include "G4InuclSpecialFunctions.hh"
using namespace G4InuclSpecialFunctions;
class G4EquilibriumEvaporator {
class G4CollisionOutput;
class G4InuclParticle;
class G4EquilibriumEvaporator : public G4CascadeColliderBase {
public:
G4EquilibriumEvaporator();
virtual ~G4EquilibriumEvaporator();
void setFissioner(G4Fissioner* fissioner) {
theFissioner = fissioner;
};
void setBigBanger(G4BigBanger* banger) {
theBigBanger = banger;
};
G4CollisionOutput collide(G4InuclParticle* bullet,
G4InuclParticle* target);
void collide(G4InuclParticle* bullet, G4InuclParticle* target,
G4CollisionOutput& output);
private:
G4int verboseLevel;
G4double getE0(G4double A) const;
// Replace base class verision
virtual G4bool explosion(G4int a, G4int z, G4double e) const;
G4double getPARLEVDEN(G4double A,
G4double Z) const;
// FIXME: Need to redeclare and call through base-class polymorphisms
virtual G4bool explosion(G4InuclNuclei* target) const {
return G4CascadeColliderBase::explosion(target);
}
G4bool timeToBigBang(G4double a,
G4double z,
G4double e) const;
virtual G4bool explosion(G4Fragment* target) const {
return G4CascadeColliderBase::explosion(target);
}
G4bool goodRemnant(G4double a,
G4double z) const;
G4double getQF(G4double x,
G4double x2,
G4double a,
G4double z,
G4double e) const;
G4double getAF(G4double x,
G4double a,
G4double z,
G4double e) const;
G4Fissioner* theFissioner;
G4BigBanger* theBigBanger;
G4bool goodRemnant(G4int a, G4int z) const;
G4double getE0(G4int A) const;
G4double getPARLEVDEN(G4int A, G4int Z) const;
G4double getQF(G4double x, G4double x2, G4int a, G4int z, G4double e) const;
G4double getAF(G4double x, G4int a, G4int z, G4double e) const;
G4Fissioner theFissioner;
G4BigBanger theBigBanger;
};
#endif // G4EQUILIBRIUM_EVAPORATOR_HH
#endif /* G4EQUILIBRIUM_EVAPORATOR_HH */
@@ -23,66 +23,36 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EvaporationInuclCollider.hh,v 1.2 2008/06/29 23:56:03 dennis Exp $
// $Id: G4EvaporationInuclCollider.hh,v 1.6 2010/07/14 15:41:12 mkelsey Exp $
// GEANT4 tag: $Name: geant4-09-04 $
//
// 20100315 M. Kelsey -- Remove "using" directive and unnecessary #includes.
// 20100413 M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
// 20100517 M. Kelsey -- Inherit from common base class, make other colliders
// simple data members
// 20100714 M. Kelsey -- Switch to new G4CascadeColliderBase class
#ifndef G4EVAPORATIONINUCL_COLLIDER_HH
#define G4EVAPORATIONINUCL_COLLIDER_HH
#include "G4Collider.hh"
#include "G4CascadeColliderBase.hh"
#include "G4EquilibriumEvaporator.hh"
#include "G4Fissioner.hh"
#include "G4BigBanger.hh"
#include "G4ElementaryParticleCollider.hh"
#include "G4InteractionCase.hh"
#include "G4InuclNuclei.hh"
#include "G4InuclSpecialFunctions.hh"
#include "G4Analyser.hh"
using namespace G4InuclSpecialFunctions;
class G4EvaporationInuclCollider {
class G4InuclParticle;
class G4CollisionOutput;
class G4EquilibriumEvaporator;
class G4BigBanger;
class G4EvaporationInuclCollider : public G4CascadeColliderBase {
public:
G4EvaporationInuclCollider();
G4EvaporationInuclCollider(G4EquilibriumEvaporator* eqevaporator, G4Fissioner* fissioner, G4BigBanger* bigbanger) {
setEquilibriumEvaporator(eqevaporator, fissioner, bigbanger);
};
void setEquilibriumEvaporator(G4EquilibriumEvaporator* eqevaporator, G4Fissioner* fissioner, G4BigBanger* bigbanger) {
theEquilibriumEvaporator = eqevaporator;
theEquilibriumEvaporator->setFissioner(fissioner);
theEquilibriumEvaporator->setBigBanger(bigbanger);
};
void setBigBanger(G4BigBanger* bigbanger) {
theBigBanger = bigbanger;
};
G4CollisionOutput collide(G4InuclParticle* bullet, G4InuclParticle* target);
void collide(G4InuclParticle* bullet, G4InuclParticle* target,
G4CollisionOutput& output);
private:
G4int verboseLevel;
G4bool inelasticInteractionPossible(G4InuclParticle* bullet,
G4InuclParticle* target,
G4double ekin) const;
G4InteractionCase bulletTargetSetter(G4InuclParticle* bullet,
G4InuclParticle* target) const;
G4bool explosion(G4InuclNuclei* target) const;
G4EquilibriumEvaporator* theEquilibriumEvaporator;
G4BigBanger* theBigBanger;
};
#endif // G4EVAPORATIONINUCL_COLLIDER_HH
#endif /* G4EVAPORATIONINUCL_COLLIDER_HH */
@@ -23,51 +23,38 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ExitonConfiguration.hh,v 1.8 2010/12/15 07:39:50 gunter Exp $
//
// 20100909 Add function to reset values to zero
// 20100924 Migrate to integer A and Z
#ifndef G4EXITON_CONFIGURATION_HH
#define G4EXITON_CONFIGURATION_HH
class G4ExitonConfiguration {
public:
G4ExitonConfiguration()
: protonQuasiParticles(0), neutronQuasiParticles(0),
protonHoles(0), neutronHoles(0) {}
G4ExitonConfiguration() {
protonQuasiParticles = 0.0;
neutronQuasiParticles = 0.0;
protonHoles = 0.0;
neutronHoles = 0.0;
};
G4ExitonConfiguration(G4int qpp, G4int qnp, G4int qph, G4int qnh)
: protonQuasiParticles(qpp), neutronQuasiParticles(qnp),
protonHoles(qph), neutronHoles(qnh) {}
void clear() {
protonQuasiParticles = neutronQuasiParticles = 0;
protonHoles = neutronHoles = 0;
}
G4ExitonConfiguration(G4double qpp,
G4double qnp,
G4double qph,
G4double qnh)
: protonQuasiParticles(qpp),
neutronQuasiParticles(qnp),
protonHoles(qph),
neutronHoles(qnh) {
};
void incrementQP(G4int ip) {
if(ip < 3) {
if(ip == 1) {
protonQuasiParticles += 1.0;
}
else if(ip == 2) {
neutronQuasiParticles += 1.0;
};
};
};
if (ip == 1) protonQuasiParticles++;
else if (ip == 2) neutronQuasiParticles++;
}
void incrementHoles(G4int ip) {
if(ip < 3) {
if(ip == 1) {
protonHoles += 1.0;
}
else if(ip == 2) {
neutronHoles += 1.0;
};
};
};
if (ip == 1) protonHoles++;
else if (ip == 2) neutronHoles++;
}
void print() const {
G4cout << " Exiton configuration " << G4endl
@@ -75,13 +62,12 @@ public:
<< protonHoles << G4endl
<< " neutron particles " << neutronQuasiParticles << " holes "
<< neutronHoles << G4endl;
};
}
G4double protonQuasiParticles;
G4double neutronQuasiParticles;
G4double protonHoles;
G4double neutronHoles;
G4int protonQuasiParticles;
G4int neutronQuasiParticles;
G4int protonHoles;
G4int neutronHoles;
};
#endif // G4EXITON_CONFIGURATION_HH
@@ -23,41 +23,34 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4FissionStore.hh,v 1.12 2010/12/15 07:39:52 gunter Exp $
//
// 20100728 Move ::addConfig() to .cc file, add setVerboseLevel(), clear()
#ifndef G4FISSION_STORE_HH
#define G4FISSION_STORE_HH
#include "G4FissionConfiguration.hh"
#include <vector>
class G4FissionStore {
public:
G4FissionStore();
void addConfig(G4double a,
G4double z,
G4double ez,
G4double ek,
G4double ev) {
G4FissionConfiguration config(a, z, ez, ek, ev);
configurations.push_back(config);
// config.print();
};
void setVerboseLevel(G4int verbose=1) { verboseLevel = verbose; }
G4int size() const {
return configurations.size();
};
void addConfig(G4double a, G4double z, G4double ez, G4double ek, G4double ev);
void clear() { configurations.clear(); }
G4int size() const { return configurations.size(); }
G4FissionConfiguration generateConfiguration(G4double amax,
G4double rand) const;
private:
G4int verboseLevel;
std::vector<G4FissionConfiguration> configurations;
};
#endif // G4FISSION_STORE_HH
@@ -23,34 +23,47 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4Fissioner.hh,v 1.16 2010/09/14 17:51:36 mkelsey Exp $
// GEANT4 tag: $Name: geant4-09-04 $
//
// 20100315 M. Kelsey -- Remove "using" directive and unnecessary #includes.
// 20100413 M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
// 20100517 M. Kelsey -- Inherit from common base class
// 20100714 M. Kelsey -- Switch to new G4CascadeColliderBase class
// 20100728 M. Kelsey -- Move G4FissionStore to data member and reuse
// 20100914 M. Kelsey -- Migrate to integer A and Z
#ifndef G4FISSIONER_HH
#define G4FISSIONER_HH
#include "G4Collider.hh"
#include "G4InuclSpecialFunctions.hh"
#include "G4CascadeColliderBase.hh"
#include "G4FissionStore.hh"
#include <vector>
using namespace G4InuclSpecialFunctions;
class G4CollisionOutput;
class G4InuclParticle;
class G4Fissioner {
class G4Fissioner : public G4CascadeColliderBase {
public:
G4Fissioner();
virtual ~G4Fissioner() {}
G4CollisionOutput collide(G4InuclParticle* bullet,
G4InuclParticle* target);
void collide(G4InuclParticle* bullet, G4InuclParticle* target,
G4CollisionOutput& output);
private:
G4int verboseLevel;
G4double getC2(G4double A1,
G4double A2,
G4FissionStore fissionStore;
G4double getC2(G4int A1,
G4int A2,
G4double X3,
G4double X4,
G4double R12) const;
G4double getZopt(G4double A1,
G4double A2,
G4double ZT,
G4double getZopt(G4int A1,
G4int A2,
G4int ZT,
G4double X3,
G4double X4,
G4double R12) const;
@@ -58,14 +71,13 @@ G4int verboseLevel;
void potentialMinimization(G4double& VP,
std::vector<G4double>& ED,
G4double& VC,
G4double AF,
G4double AS,
G4double ZF,
G4double ZS,
G4int AF,
G4int AS,
G4int ZF,
G4int ZS,
std::vector<G4double>& AL1,
std::vector<G4double>& BET1,
G4double& R12) const;
};
#endif // G4FISSIONER_HH
#endif /* G4FISSIONER_HH */
@@ -23,58 +23,53 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4InteractionCase.hh,v 1.12 2010/06/25 09:43:18 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100518 M. Kelsey -- Why use std::pair<> at all? Never exported; just
// store pointers. Add clear() function. Move code from
// Colliders' "bulletTargetSetter()" to set().
#ifndef G4INTERACTION_CASE_HH
#define G4INTERACTION_CASE_HH
//#ifndef G4INUCL_PARTICLE_HH
#include "G4InuclParticle.hh"
//#endif
#include "globals.hh"
class G4InuclParticle;
#include <algorithm>
class G4InteractionCase {
public:
G4InteractionCase() : bullet(0), target(0), inter_case(0) {}
G4InteractionCase() {
bultag = std::pair<G4InuclParticle*, G4InuclParticle*>(0, 0);
G4InteractionCase(G4InuclParticle* part1, G4InuclParticle* part2) {
set(part1, part2);
}
void set(G4InuclParticle* part1, G4InuclParticle* part2);
void clear() {
bullet = target = 0;
inter_case = 0;
};
}
G4InteractionCase(G4InuclParticle* part1,
G4InuclParticle* part2,
G4int ic) {
setBulletTarget(part1, part2);
setInterCase(ic);
};
G4InuclParticle* getBullet() const { return bullet; }
G4InuclParticle* getTarget() const { return target; }
void setBulletTarget(G4InuclParticle* part1,
G4InuclParticle* part2) {
bultag = std::pair<G4InuclParticle*, G4InuclParticle*>(part1, part2);
};
G4bool valid() const { return inter_case != 0; }
void setInterCase(G4int ic) {
inter_case = ic;
};
G4bool twoNuclei() const { return inter_case == -2; }
G4bool hadNucleus() const { return inter_case == -1; }
G4int hadrons() const { return inter_case; } // "rtype" or "is" code
G4InuclParticle* getBullet() const {
return bultag.first;
};
G4InuclParticle* getTarget() const {
return bultag.second;
};
G4int getInterCase() const {
return inter_case;
};
// For compatibility with G4IntraNucleiCascader code
G4int code() const { return ((inter_case<0) ? -inter_case : 0); }
private:
std::pair<G4InuclParticle*, G4InuclParticle*> bultag;
G4InuclParticle* bullet;
G4InuclParticle* target;
G4int inter_case;
};
#endif // G4INTERACTION_CASE_HH
@@ -23,43 +23,69 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4IntraNucleiCascader.hh,v 1.22 2010/12/15 07:39:54 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04 $
//
// 20100315 M. Kelsey -- Remove "using" directory and unnecessary #includes.
// 20100413 M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
// 20100517 M. Kelsey -- Inherit from common base class, make other colliders
// simple data members
// 20100617 M. Kelsey -- Make G4NucleiModel a data member, instead of
// creating and deleting on every cycle.
// 20100623 M. Kelsey -- Undo change from 0617. G4NucleiModel not reusable.
// 20100714 M. Kelsey -- Switch to new G4CascadeColliderBase class
// 20100716 M. Kelsey -- Eliminate inter_case; use base-class functionality,
// add function to compute recoil nuclear mass on the fly
// 20100720 M. Kelsey -- Make EPCollider pointer member
// 20100722 M. Kelsey -- Move cascade output buffers to .hh file
// 20100728 M. Kelsey -- Move G4NucleiModel here, as pointer member
// 20100907 M. Kelsey -- Add new "makeResidualFragment" to create
// G4InuclNuclei at current stage of cascade
// 20100909 M. Kelsey -- Drop makeResidualFragment(), getResidualMass() and
// local G4InuclNuclei object, replace with new RecoilMaker.
// Move goodCase() to RecoilMaker.
// 20100916 M. Kelsey -- Add functions to handle trapped particles, and to
// decay hyperons.
#ifndef G4INTRA_NUCLEI_CASCADER_HH
#define G4INTRA_NUCLEI_CASCADER_HH
#include "G4Collider.hh"
#include "G4ElementaryParticleCollider.hh"
#include "G4InuclSpecialFunctions.hh"
#include "G4CascadSpecialFunctions.hh"
#include "G4InuclElementaryParticle.hh"
#include "G4CascadeColliderBase.hh"
#include "G4CollisionOutput.hh"
#include <vector>
using namespace G4InuclSpecialFunctions;
using namespace G4CascadSpecialFunctions;
class G4CascadParticle;
class G4CascadeRecoilMaker;
class G4CollisionOutput;
class G4ElementaryParticleCollider;
class G4InuclElementaryParticle;
class G4InuclParticle;
class G4NucleiModel;
class G4IntraNucleiCascader {
class G4IntraNucleiCascader : public G4CascadeColliderBase {
public:
G4IntraNucleiCascader();
virtual ~G4IntraNucleiCascader();
void setElementaryParticleCollider(G4ElementaryParticleCollider* ecollider) {
theElementaryParticleCollider = ecollider;
};
G4CollisionOutput collide(G4InuclParticle* bullet,
G4InuclParticle* target);
void collide(G4InuclParticle* bullet, G4InuclParticle* target,
G4CollisionOutput& output);
void setInteractionCase(G4int intcase) {
inter_case = intcase;
};
protected:
void processTrappedParticle(const G4CascadParticle& trapped);
void decayTrappedParticle(const G4CascadParticle& trapped);
private:
G4int verboseLevel;
G4NucleiModel* model;
G4ElementaryParticleCollider* theElementaryParticleCollider;
G4CascadeRecoilMaker* theRecoilMaker;
G4int inter_case;
G4bool goodCase(G4double a, G4double z, G4double eexs, G4double ein) const;
// Buffers for collecting result of cascade (reset on each iteration)
G4CollisionOutput output;
std::vector<G4CascadParticle> cascad_particles;
std::vector<G4CascadParticle> new_cascad_particles;
std::vector<G4InuclElementaryParticle> output_particles;
G4ExitonConfiguration theExitonConfiguration;
};
#endif // G4INTRA_NUCLEI_CASCADER_HH
#endif /* G4INTRA_NUCLEI_CASCADER_HH */
@@ -23,99 +23,55 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4InuclCollider.hh,v 1.22 2010/12/15 07:39:56 gunter Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100413 M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
// 20100517 M. Kelsey -- Inherit from common base class, make other colliders
// simple data members
// 20100620 M. Kelsey -- Move output buffers here to reduce memory churn
// 20100714 M. Kelsey -- Switch to new G4CascadeColliderBase class
// 20100720 M. Kelsey -- Make all the collders pointer members (to reducde
// external compile dependences).
// 20100915 M. Kelsey -- Move de-excitation colliders to G4CascadeDeexcitation
// 20100922 M. Kelsey -- Add functions to select de-excitation method, change
// "theDeexcitation" to be a base-class pointer for switching
// 20100926 M. Kelsey -- Use new intermediate base class for de-exciations.
#ifndef G4INUCL_COLLIDER_HH
#define G4INUCL_COLLIDER_HH
#include "G4Collider.hh"
#include "G4IntraNucleiCascader.hh"
#include "G4NonEquilibriumEvaporator.hh"
#include "G4EquilibriumEvaporator.hh"
#include "G4Fissioner.hh"
#include "G4BigBanger.hh"
#include "G4ElementaryParticleCollider.hh"
#include "G4InteractionCase.hh"
#include "G4InuclNuclei.hh"
#include "G4InuclSpecialFunctions.hh"
#include "G4Analyser.hh"
using namespace G4InuclSpecialFunctions;
#include "G4CascadeColliderBase.hh"
#include "G4CollisionOutput.hh"
class G4InuclCollider {
class G4InuclParticle;
class G4ElementaryParticleCollider;
class G4IntraNucleiCascader;
class G4VCascadeDeexcitation;
class G4InuclCollider : public G4CascadeColliderBase {
public:
G4InuclCollider();
virtual ~G4InuclCollider();
G4InuclCollider(G4ElementaryParticleCollider* ecollider,
G4IntraNucleiCascader* incascader,
G4NonEquilibriumEvaporator* noeqevaporator,
G4EquilibriumEvaporator* eqevaporator,
G4Fissioner* fissioner,
G4BigBanger* bigbanger) {
void collide(G4InuclParticle* bullet, G4InuclParticle* target,
G4CollisionOutput& globalOutput);
setElementaryParticleCollider(ecollider);
setIntraNucleiCascader(incascader,ecollider);
setNonEquilibriumEvaporator(noeqevaporator);
setEquilibriumEvaporator(eqevaporator, fissioner, bigbanger);
setBigBanger(bigbanger);
};
void setElementaryParticleCollider(G4ElementaryParticleCollider* ecollider) {
theElementaryParticleCollider = ecollider;
};
void setIntraNucleiCascader(G4IntraNucleiCascader* incascader,
G4ElementaryParticleCollider* ecollider) {
theIntraNucleiCascader = incascader;
theIntraNucleiCascader->setElementaryParticleCollider(ecollider);
};
void setNonEquilibriumEvaporator(G4NonEquilibriumEvaporator* noeqevaporator) {
theNonEquilibriumEvaporator = noeqevaporator;
};
void setEquilibriumEvaporator(G4EquilibriumEvaporator* eqevaporator,
G4Fissioner* fissioner,
G4BigBanger* bigbanger) {
theEquilibriumEvaporator = eqevaporator;
theEquilibriumEvaporator->setFissioner(fissioner);
theEquilibriumEvaporator->setBigBanger(bigbanger);
};
void setBigBanger(G4BigBanger* bigbanger) {
theBigBanger = bigbanger;
};
G4CollisionOutput collide(G4InuclParticle* bullet,
G4InuclParticle* target);
// Select betweeen different post-cascade de-excitation models
void useCascadeDeexcitation();
void usePreCompoundDeexcitation();
private:
G4int verboseLevel;
G4bool inelasticInteractionPossible(G4InuclParticle* bullet,
G4InuclParticle* target,
G4double ekin) const;
G4InteractionCase bulletTargetSetter(G4InuclParticle* bullet,
G4InuclParticle* target) const;
G4bool explosion(G4InuclNuclei* target) const;
G4ElementaryParticleCollider* theElementaryParticleCollider;
G4IntraNucleiCascader* theIntraNucleiCascader;
G4NonEquilibriumEvaporator* theNonEquilibriumEvaporator;
G4EquilibriumEvaporator* theEquilibriumEvaporator;
G4BigBanger* theBigBanger;
G4VCascadeDeexcitation* theDeexcitation; // User switchable!
G4CollisionOutput output; // Secondaries from main cascade
G4CollisionOutput DEXoutput; // Secondaries from de-excitation
};
#endif // G4INUCL_COLLIDER_HH
#endif /* G4INUCL_COLLIDER_HH */
@@ -23,459 +23,95 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4InuclElementaryParticle.hh,v 1.25 2010/09/16 05:21:00 mkelsey Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100114 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
// 20100409 M. Kelsey -- Drop unused string argument from ctors.
// 20100429 M. Kelsey -- Change "photon()" to "isPhoton()", use enum names
// 20100914 M. Kelsey -- Move printout to .cc file
// 20100915 M. Kelsey -- Add hyperon() identification function, ctor for
// G4DynamicParticle
#ifndef G4INUCL_ELEMENTARY_PARTICLE_HH
#define G4INUCL_ELEMENTARY_PARTICLE_HH
#include "G4InuclParticle.hh"
#include "G4InuclParticleNames.hh"
#include "globals.hh"
#ifndef G4INUCL_PARTICLE_HH
#include "G4InuclParticle.hh"
#endif
class G4ParticleDefinition;
class G4InuclElementaryParticle : public G4InuclParticle {
// known particle types:
// 1 - proton 11 - k+ 111 - quasideuteron PP
// 2 - neutron 13 - k- 112 - quasideuteron PN
// 3 - pi+ 15 - k0 122 - quasideuteron NN
// 5 - pi- 17 - k0bar
// 7 - pi 0 21 - lambda
// 10 - photon 23 - sigma+
// 25 - sigma0
// 27 - sigma-
// 29 - xi0
// 31 - xi-
public:
G4InuclElementaryParticle()
: G4InuclParticle(), generation(0) {}
G4InuclElementaryParticle() {
particleType = 0; // DHW: added to keep 4.3 compiler happy
particleMass = 0.; // " "
valid_particle = false;
generation = 0;
};
explicit G4InuclElementaryParticle(G4int type)
: G4InuclParticle(makeDefinition(type)), generation(0) {}
G4InuclElementaryParticle(G4int type)
: particleType(type) {
particleMass = getParticleMass(type);
valid_particle = false;
};
G4InuclElementaryParticle(const G4CascadeMomentum& mom,
G4int type)
: G4InuclParticle(mom),
particleType(type) {
particleMass = getParticleMass(type);
momentum[0] = std::sqrt(momentum[1] * momentum[1] + momentum[2] * momentum[2] +
momentum[3] * momentum[3] + particleMass * particleMass);
valid_particle = true;
};
G4InuclElementaryParticle(const G4CascadeMomentum& mom,
G4int type, G4int model)
: G4InuclParticle(mom),
particleType(type) {
G4InuclParticle::setModel(model);
particleMass = getParticleMass(type);
momentum[0] = std::sqrt(momentum[1] * momentum[1] + momentum[2] * momentum[2] +
momentum[3] * momentum[3] + particleMass * particleMass);
valid_particle = true;
};
G4InuclElementaryParticle(G4double ekin,
G4int type)
: particleType(type) {
particleMass = getParticleMass(type);
momentum[0] = ekin + particleMass;
momentum[3] = std::sqrt(momentum[0] * momentum[0] - particleMass * particleMass);
momentum[1] = momentum[2] = 0.0;
valid_particle = true;
};
void setType(G4int ityp) {
particleType = ityp;
particleMass = getParticleMass(ityp);
};
void setMomentum(const G4CascadeMomentum& mom) {
momentum = mom;
momentum[0] = std::sqrt(momentum[1] * momentum[1] + momentum[2] * momentum[2] +
momentum[3] * momentum[3] + particleMass * particleMass);
valid_particle = true;
};
G4int type() const {
return particleType;
};
G4bool photon() const {
return particleType == 10;
};
G4bool nucleon() const {
return particleType <= 2;
};
G4bool baryon() const {
return (particleType == 1 ||
particleType == 2 ||
particleType == 21 ||
particleType == 23 ||
particleType == 25 ||
particleType == 27 ||
particleType == 29 ||
particleType == 31 );
};
G4bool pion() const {
return particleType == 3 || particleType == 5 || particleType == 7;
};
G4bool quasi_deutron() const {
return particleType > 100;
};
G4double getMass() const {
return particleMass;
};
G4double getParticleMass() const {
G4double mass;
switch(particleType) {
case 1: // proton
mass = 0.93827;
break;
case 2: // neutron
mass = 0.93957;
break;
case 3: // pi+
mass = 0.13957;
break;
case 5: // pi-
mass = 0.13957;
break;
case 7: // pi0
mass = 0.13498;
break;
case 10: // photon
mass = 0.0;
break;
case 11: // k+
mass = 0.49368;
break;
case 13: // k-
mass = 0.49368;
break;
case 15: // k0
mass = 0.49767;
break;
case 17: // k0bar
mass = 0.49767;
break;
case 21: // lambda
mass = 1.1157;
break;
case 23: // sigma+
mass = 1.1894;
break;
case 25: // sigma0
mass = 1.1926;
break;
case 27: // sigma-
mass = 1.1974;
break;
case 29: // xi0
mass = 1.3148;
break;
case 31: // xi-
mass = 1.3213;
break;
case 111: // PP
mass = 0.93827 + 0.93827;
break;
case 112: // PN
mass = 0.93827 + 0.93957;
break;
case 122: // NN
mass = 0.93957 + 0.93957;
break;
default:
G4cout << " uups, unknown particle type " << particleType << G4endl;
mass = 0.;
};
return mass;
};
G4double getCharge() const {
G4double charge;
switch(particleType) {
case 1: // proton
charge = 1.0;
break;
case 2: // neutron
charge = 0.0;
break;
case 3: // pi+
charge = 1.0;
break;
case 5: // pi-
charge = -1.0;
break;
case 7: // pi0
charge = 0.0;
break;
case 10: // photon
charge = 0.0;
break;
case 11: // k+
charge = 1.0;
break;
case 13: // k-
charge = -1.0;
break;
case 15: // k0
charge = 0.0;
break;
case 17: // k0bar
charge = 0.0;
break;
case 21: // lambda
charge = 0.0;
break;
case 23: // sigma+
charge = 1.0;
break;
case 25: // sigma0
charge = 0.0;
break;
case 27: // sigma-
charge = -1.0;
break;
case 29: // xi0
charge = 0.0;
break;
case 31: // xi-
charge = -1.0;
break;
case 111: // PP
charge = 2.0;
break;
case 112: // PN
charge = 1.0;
break;
case 122: // NN
charge = 0.0;
break;
default:
G4cout << " uups, unknown particle type " << particleType << G4endl;
charge = 0.0;
};
return charge;
};
G4double getStrangeness(G4int type) const {
G4double strangeness;
switch(type) {
case 1: // proton
strangeness = 0.0;
break;
case 2: // neutron
strangeness = 0.0;
break;
case 3: // pi+
strangeness = 0.0;
break;
case 5: // pi-
strangeness = 0.0;
break;
case 7: // pi0
strangeness = 0.0;
break;
case 10: // photon
strangeness = 0.0;
break;
case 11: // k+
strangeness = 1.0;
break;
case 13: // k-
strangeness = -1.0;
break;
case 15: // k0
strangeness = 1.0;
break;
case 17: // k0bar
strangeness = -1.0;
break;
case 21: // lambda
strangeness = -1.0;
break;
case 23: // sigma+
strangeness = -1.0;
break;
case 25: // sigma0
strangeness = -1.0;
break;
case 27: // sigma-
strangeness = -1.0;
break;
case 29: // xi0
strangeness = -2.0;
break;
case 31: // xi-
strangeness = -2.0;
break;
case 111: // PP
strangeness = 0.0;
break;
case 112: // PN
strangeness = 0.0;
break;
case 122: // NN
strangeness = 0.0;
break;
default:
G4cout << " unknown particle type " << type << G4endl;
strangeness = 0.0;
};
return strangeness;
};
G4double getParticleMass(G4int type) const {
G4double mass;
switch(type) {
case 1: // proton
mass = 0.93827;
break;
case 2: // neutron
mass = 0.93957;
break;
case 3: // pi+
mass = 0.13957;
break;
case 5: // pi-
mass = 0.13957;
break;
case 7: // pi0
mass = 0.13498;
break;
case 10: // photon
mass = 0.0;
break;
case 11: // k+
mass = 0.49368;
break;
case 13: // k-
mass = 0.49368;
break;
case 15: // k0
mass = 0.49767;
break;
case 17: // k0bar
mass = 0.49767;
break;
case 21: // lambda
mass = 1.1157;
break;
case 23: // sigma+
mass = 1.1894;
break;
case 25: // sigma0
mass = 1.1926;
break;
case 27: // sigma-
mass = 1.1974;
break;
case 29: // xi0
mass = 1.3148;
break;
case 31: // xi-
mass = 1.3213;
break;
case 111: // PP
mass = 0.93827 + 0.93827;
break;
case 112: // PN
mass = 0.93827 + 0.93957;
break;
case 122: // NN
mass = 0.93957 + 0.93957;
break;
default:
G4cout << " uups, unknown particle type " << type << G4endl;
mass = 0.0;
};
return mass;
};
G4double getKineticEnergy() const {
return momentum[0] - particleMass;
};
G4double getEnergy() const {
return momentum[0];
};
G4bool valid() const {
return valid_particle;
};
virtual void printParticle() const {
G4InuclParticle::printParticle();
G4cout << " Particle: type " << particleType << " mass " << particleMass <<
" ekin " << getKineticEnergy() << G4endl;
};
void setGeneration(G4int gen) {
generation = gen;
G4InuclElementaryParticle(const G4DynamicParticle& dynPart, G4int model=0)
: G4InuclParticle(dynPart), generation(0) {
setModel(model);
}
G4int getGeneration() {
return generation;
G4InuclElementaryParticle(const G4LorentzVector& mom,
G4int type, G4int model=0)
: G4InuclParticle(makeDefinition(type), mom), generation(0) {
setModel(model);
}
G4InuclElementaryParticle(G4double ekin, G4int type)
: G4InuclParticle(makeDefinition(type), ekin), generation(0) {}
// Copy and assignment constructors for use with std::vector<>
G4InuclElementaryParticle(const G4InuclElementaryParticle& right)
: G4InuclParticle(right), generation(right.generation) {}
G4InuclElementaryParticle& operator=(const G4InuclElementaryParticle& right);
void setType(G4int ityp);
G4int type() const { return type(getDefinition()); }
static G4int type(const G4ParticleDefinition* pd);
G4bool isPhoton() const { return (type() == G4InuclParticleNames::photon); }
G4bool pion() const { return (type()==G4InuclParticleNames::pionPlus ||
type()==G4InuclParticleNames::pionMinus ||
type()==G4InuclParticleNames::pionZero); }
G4bool nucleon() const { return (type()==G4InuclParticleNames::proton ||
type()==G4InuclParticleNames::neutron); }
G4int baryon() const { // Can use as a bool (!=0 ==> true)
return getDefinition()->GetBaryonNumber();
}
G4bool hyperon() const {
return (baryon() && getStrangeness() != 0.);
}
G4bool quasi_deutron() const { return (type() > 100); }
G4double getStrangeness() const { return getStrangeness(type()); }
G4bool valid() const { return type()>0; }
virtual void printParticle() const;
void setGeneration(G4int gen) { generation = gen; }
G4int getGeneration() const { return generation; }
static G4double getStrangeness(G4int type);
static G4double getParticleMass(G4int type);
protected:
// Convert internal type code to standard GEANT4 pointer
static G4ParticleDefinition* makeDefinition(G4int ityp);
private:
G4int particleType;
G4double particleMass;
G4bool valid_particle;
G4int generation;
};
#endif // G4INUCL_ELEMENTARY_PARTICLE_HH
@@ -23,10 +23,14 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4InuclEvaporation.hh,v 1.5 2007/05/24 23:27:01 miheikki Exp $
// $Id: G4InuclEvaporation.hh,v 1.8 2010/05/21 18:07:30 mkelsey Exp $
// Defines an interface to evaporation models of Bertini cascase (BERT)
// based on INUCL code.
//
// 20100405 M. Kelsey -- Pass const-ref std::vector<>
// 20100517 M. Kelsey -- MakeG4EvaporationInuclCollider a data member.
// 20100520 M. Kelsey -- Clean up interface
#ifndef G4INUCLEVAPORATION_h
#define G4INUCLEVAPORATION_h 1
@@ -34,7 +38,8 @@
#include "G4VEvaporation.hh"
#include "G4Fragment.hh"
//#define DEBUG
class G4EvaporationInuclCollider;
class G4InuclEvaporation : public G4VEvaporation {
public:
@@ -48,21 +53,14 @@ private:
G4bool operator==(const G4InuclEvaporation &right) const;
G4bool operator!=(const G4InuclEvaporation &right) const;
void fillResult( std::vector< G4DynamicParticle * > secondaryParticleVector,
G4FragmentVector * aResult );
public:
G4FragmentVector * BreakItUp(const G4Fragment &theNucleus);
void setVerboseLevel( const G4int verbose );
private:
G4int verboseLevel;
#ifdef DEBUG
#endif
G4EvaporationInuclCollider* evaporator;
};
#endif
@@ -23,146 +23,131 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4InuclNuclei.hh,v 1.27 2010/09/25 04:35:02 mkelsey Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100112 Michael Kelsey -- Replace G4CascadeMomentum with G4LorentzVector
// 20100301 M. Kelsey -- Add function to create unphysical nuclei for use
// as temporary final-state fragments.
// 20100319 M. Kelsey -- Remove "using" directory and unnecessary #includes.
// 20100409 M. Kelsey -- Drop unused string argument from ctors.
// 20100630 M. Kelsey -- Add excitation energy as optional public ctor arg,
// remove excitation energy data member (part of G4Ions). Add
// excitation energy to "getNucleiMass()" function, move print to .cc
// 20100711 M. Kelsey -- Add optional model ID to constructors
// 20100714 M. Kelsey -- Use G4DynamicParticle::theDynamicalMass to deal with
// excitation energy without instantianting "infinite" G4PartDefns.
// 20100719 M. Kelsey -- Move setExitationEnergy implementation to .cc file.
// 20100906 M. Kelsey -- Add fill() functions to rewrite contents
// 20100909 M. Kelsey -- Add function to discard exciton configuration
// 20100914 M. Kelsey -- Use integers for A and Z
// 20100915 M. Kelsey -- Add constructor to copy G4DynamicParticle input
// 20100924 M. Kelsey -- Add constructor to copy G4Fragment input, and output
// functions to create G4Fragment.
#ifndef G4INUCL_NUCLEI_HH
#define G4INUCL_NUCLEI_HH
#ifndef G4INUCL_PARTICLE_HH
#include "G4InuclParticle.hh"
#endif
#include "G4LorentzVector.hh"
#include "G4ExitonConfiguration.hh"
#include "G4InuclSpecialFunctions.hh"
using namespace G4InuclSpecialFunctions;
class G4Fragment;
class G4ParticleDefinition;
class G4InuclNuclei : public G4InuclParticle {
public:
G4InuclNuclei() : G4InuclParticle() {}
G4InuclNuclei() {};
G4InuclNuclei(const G4DynamicParticle& dynPart, G4int model=0)
: G4InuclParticle(dynPart) {
setModel(model);
}
G4InuclNuclei(G4double a,
G4double z)
: A(a),
Z(z) {
G4InuclNuclei(G4int a, G4int z, G4double exc=0., G4int model=0)
: G4InuclParticle(makeDefinition(a,z)) {
setExitationEnergy(exc);
setModel(model);
}
setNucleiMass();
exitationEnergy = 0.0;
};
G4InuclNuclei(const G4LorentzVector& mom, G4int a, G4int z,
G4double exc=0., G4int model=0)
: G4InuclParticle(makeDefinition(a,z), mom) {
setExitationEnergy(exc);
setModel(model);
}
G4InuclNuclei(const G4CascadeMomentum& mom,
G4double a,
G4double z)
: G4InuclParticle(mom),
A(a),
Z(z) {
G4InuclNuclei(G4double ekin, G4int a, G4int z, G4double exc,
G4int model=0)
: G4InuclParticle(makeDefinition(a,z), ekin) {
setExitationEnergy(exc);
setModel(model);
}
setNucleiMass();
exitationEnergy = 0.0;
};
G4InuclNuclei(const G4Fragment& aFragment, G4int model=0);
G4InuclNuclei(G4double ekin,
G4double a,
G4double z)
: A(a),
Z(z) {
virtual ~G4InuclNuclei() {}
setNucleiMass();
G4CascadeMomentum mom;
mom[0] = ekin + nucleiMass;
mom[3] = std::sqrt(mom[0] * mom[0] - nucleiMass * nucleiMass);
G4InuclParticle::setMomentum(mom);
exitationEnergy = 0.0;
};
void setA(G4double a) {
// Copy and assignment constructors for use with std::vector<>
G4InuclNuclei(const G4InuclNuclei& right)
: G4InuclParticle(right),
theExitonConfiguration(right.theExitonConfiguration) {}
A = a;
};
G4InuclNuclei& operator=(const G4InuclNuclei& right);
void setZ(G4double z) {
// Overwrite data structure (avoids creating/copying temporaries)
void fill(G4int a, G4int z, G4double exc=0., G4int model=0) {
fill(0., a, z, exc, model);
}
Z = z;
};
void fill(const G4LorentzVector& mom, G4int a, G4int z,
G4double exc=0., G4int model=0);
void setExitationEnergy(G4double e) {
void fill(G4double ekin, G4int a, G4int z, G4double exc,
G4int model=0);
exitationEnergy = e;
};
void setEnergy() {
momentum[0] = std::sqrt(momentum[1] * momentum[1] + momentum[2] * momentum[2] +
momentum[3] * momentum[3] + nucleiMass * nucleiMass);
};
void setNucleiMass() {
nucleiMass = 0.93827 * Z + 0.93957 * (A - Z) - 0.001 * bindingEnergy(A, Z);
};
// Excitation energy is stored as dynamical mass of particle
void setExitationEnergy(G4double e);
void setExitonConfiguration(const G4ExitonConfiguration& config) {
theExitonConfiguration = config;
};
}
G4double getA() const {
void clearExitonConfiguration() { theExitonConfiguration.clear(); }
return A;
};
G4int getA() const { return getDefinition()->GetAtomicMass(); }
G4int getZ() const { return getDefinition()->GetAtomicNumber(); }
G4double getZ() const {
G4double getNucleiMass() const {
return getDefinition()->GetPDGMass()*MeV/GeV; // From G4 to Bertini
}
return Z;
};
G4double getExitationEnergy() const {
return (getMass()-getNucleiMass())*GeV/MeV; // Always in MeV
}
G4double getExitationEnergy() const {
return exitationEnergy;
};
G4double getExitationEnergyInGeV() const {
return 0.001 * exitationEnergy;
};
G4ExitonConfiguration getExitonConfiguration() const {
G4double getExitationEnergyInGeV() const { return getExitationEnergy()/GeV; }
const G4ExitonConfiguration& getExitonConfiguration() const {
return theExitonConfiguration;
};
}
G4double getMass() const {
static G4double getNucleiMass(G4int a, G4int z, G4double exc=0.);
return nucleiMass;
};
virtual void printParticle() const;
G4double getKineticEnergy() const {
// Convert contents to G4Fragment for use outside package
G4Fragment makeG4Fragment() const;
operator G4Fragment() const;
return momentum[0] - nucleiMass;
};
G4double getNucleiMass(G4double a,
G4double z) const {
return 0.93827 * z + 0.93957 * (a - z) - 0.001 * bindingEnergy(a, z);
};
virtual void printParticle() const {
G4cout << " A " << A << " Z " << Z << " mass " << nucleiMass <<
" Eex (MeV) " << exitationEnergy << G4endl;
G4cout << " Px " << momentum[1] << " Py " << momentum[2] << " Pz " <<
momentum[3] << " E " << momentum[0] << G4endl;
};
protected:
// Convert nuclear configuration to standard GEANT4 pointer
static G4ParticleDefinition* makeDefinition(G4int a, G4int z);
static G4ParticleDefinition* makeNuclearFragment(G4int a, G4int z);
private:
G4double A;
G4double Z;
G4double exitationEnergy;
G4double nucleiMass;
G4ExitonConfiguration theExitonConfiguration;
};
#endif // G4INUCL_NUCLEI_HH
@@ -23,72 +23,111 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4InuclParticle.hh,v 1.22 2010/09/16 05:21:00 mkelsey Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100112 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
// 20100409 M. Kelsey -- Drop unused string argument from ctors.
// 20100519 M. Kelsey -- Add public access to G4DynamicParticle content
// 20100715 M. Kelsey -- Add setKineticEnergy() function
// 20100915 M. Kelsey -- Add constructor to copy G4DynamicParticle input
#ifndef G4INUCL_PARTICLE_HH
#define G4INUCL_PARTICLE_HH
#ifndef GLOB
#include "G4DynamicParticle.hh"
#include "G4LorentzVector.hh"
#include "globals.hh"
#endif
#include <iostream>
#include <vector>
#include "G4CascadeMomentum.hh"
// Notice: no cc-file for G4InuclParticle
class G4InuclParticle {
public:
G4InuclParticle() {
setModel(0); // default model
};
G4InuclParticle() : modelId(0) {}
virtual ~G4InuclParticle() { };
G4InuclParticle(const G4CascadeMomentum& mom) {
setMomentum(mom);
setModel(0);
};
explicit G4InuclParticle(const G4DynamicParticle& dynPart)
: pDP(dynPart), modelId(0) {}
void setMomentum(const G4CascadeMomentum& mom) {
momentum = mom;
};
explicit G4InuclParticle(const G4LorentzVector& mom) : modelId(0) {
pDP.Set4Momentum(mom*GeV/MeV); // From Bertini to G4 units
}
virtual ~G4InuclParticle() {}
const G4CascadeMomentum& getMomentum() const {
return momentum;
};
// Copy and assignment constructors for use with std::vector<>
G4InuclParticle(const G4InuclParticle& right)
: pDP(right.pDP), modelId(right.modelId) {}
G4double getMomModule() const {
return std::sqrt(momentum[1] * momentum[1] +
momentum[2] * momentum[2] +
momentum[3] * momentum[3]);
};
virtual void printParticle() const {
G4cout << " px " << momentum[1] << " py " << momentum[2] <<
" pz " << momentum[3] <<
" pmod " << std::sqrt(momentum[1] * momentum[1] +
momentum[2] * momentum[2] +
momentum[3] * momentum[3])
<< " E " << momentum[0]
<< " creator model " << modelId << G4endl;
};
G4InuclParticle& operator=(const G4InuclParticle& right);
void setModel(G4int model) {
modelId = model;
};
// This is no longer required, as setMomentum() handles mass adjustment
void setEnergy() { ; }
G4int getModel() {
return modelId;
};
// These are call-throughs to G4DynamicParticle
void setMomentum(const G4LorentzVector& mom);
void setKineticEnergy(G4double ekin) { pDP.SetKineticEnergy(ekin*GeV/MeV); }
void setMass(G4double mass) { pDP.SetMass(mass*GeV/MeV); }
G4double getMass() const {
return pDP.GetMass()*MeV/GeV; // From G4 to Bertini units
}
G4double getCharge() const {
return pDP.GetCharge();
}
G4double getKineticEnergy() const {
return pDP.GetKineticEnergy()*MeV/GeV; // From G4 to Bertini units
}
G4double getEnergy() const {
return pDP.GetTotalEnergy()*MeV/GeV; // From G4 to Bertini units
}
G4double getMomModule() const {
return pDP.GetTotalMomentum()*MeV/GeV; // From G4 to Bertini units
}
G4LorentzVector getMomentum() const {
return pDP.Get4Momentum()*MeV/GeV; // From G4 to Bertini units
}
virtual void printParticle() const;
void setModel(G4int model) { modelId = model; }
G4int getModel() const { return modelId; }
G4ParticleDefinition* getDefinition() const {
return pDP.GetDefinition();
}
const G4DynamicParticle& getDynamicParticle() const {
return pDP;
}
protected:
G4CascadeMomentum momentum;
// Special constructors for subclasses to set particle type correctly
explicit G4InuclParticle(G4ParticleDefinition* pd) : modelId(0) {
setDefinition(pd);
}
// FIXME: Bertini code doesn't pass valid 4-vectors, so force mass value
// from supplied PartDefn, with required unit conversions
G4InuclParticle(G4ParticleDefinition* pd, const G4LorentzVector& mom);
// NOTE: Momentum forced along Z direction
G4InuclParticle(G4ParticleDefinition* pd, G4double ekin)
: pDP(pd,G4ThreeVector(0.,0.,1.),ekin*GeV/MeV), modelId(0) {}
void setDefinition(G4ParticleDefinition* pd) { pDP.SetDefinition(pd); }
private:
G4int modelId; // used to indicate model that created instance of G4InuclParticle
G4DynamicParticle pDP; // Carries all the kinematics and info
G4int modelId;
// used to indicate model that created instance of G4InuclParticle
// 0 default
// 1 bullet
// 2 target
@@ -0,0 +1,53 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4InuclParticleNames.hh,v 1.3 2010/06/25 09:43:30 gunter Exp $
// Geant4 tag: $Name: geant4-09-04-beta-01 $
//
// Defines enums to map G4InuclElementaryParticle type codes to human
// readable names. Meant to replace similar local enums scattered through
// the code.
#ifndef G4INUCL_PARTICLE_NAMES_HH
#define G4INUCL_PARTICLE_NAMES_HH
namespace G4InuclParticleNames {
enum Long { nuclei=0, proton=1, neutron=2,
pionPlus=3, pionMinus=5, pionZero=7, photon=10,
kaonPlus=11, kaonMinus=13, kaonZero=15, kaonZeroBar=17,
lambda=21, sigmaPlus=23, sigmaZero=25, sigmaMinus=27,
xiZero=29, xiMinus=31, omegaMinus=33, antiProton=35,
antiNeutron=37, diproton=111, unboundPN=112, dineutron=122 };
// NOTE: "km" cannot be used as conflicts with "kilometers" unit!
enum Short { nuc=nuclei, pro=proton, neu=neutron,
pip=pionPlus, pim=pionMinus, pi0=pionZero, gam=photon,
kpl=kaonPlus, kmi=kaonMinus, k0=kaonZero, k0b=kaonZeroBar,
lam=lambda, sp=sigmaPlus, s0=sigmaZero, sm=sigmaMinus,
xi0=xiZero, xim=xiMinus, om=omegaMinus, ap=antiProton,
an=antiNeutron, pp=diproton, pn=unboundPN, nn=dineutron };
}
#endif /* G4INUCL_PARTICLE_NAMES_HH */
@@ -23,43 +23,46 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4InuclSpecialFunctions.hh,v 1.18 2010/09/14 17:51:36 mkelsey Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100114 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
// 20100319 M. Kelsey -- Add optional mass argument to generateWithFixedTheta;
// define new generateWithRandomAngles, encapsulating code; define
// cbrt() cube-root function (in math.h, but not in <math>!)
// 20100412 M. Kelsey -- Modify paraMaker[Truncated] to take buffer as argument
// 20100914 M. Kelsey -- Migrate to integer A and Z. Discard unused binding
// energy functions
#ifndef G4INUCL_SPECIAL_FUNC_HH
#define G4INUCL_SPECIAL_FUNC_HH
#include "globals.hh"
#include <cmath>
#include <algorithm>
#include <vector>
#include "G4CascadeMomentum.hh"
#include "G4LorentzVector.hh"
namespace G4InuclSpecialFunctions {
G4double bindingEnergy(G4int A, G4int Z);
G4double bindingEnergyExact(G4double A,
G4double Z);
// NOTE: Used only by G4Fissioner
G4double bindingEnergyAsymptotic(G4int A, G4int Z);
G4double bindingEnergyKummel(G4double A,
G4double Z);
G4double bindingEnergy(G4double A,
G4double Z);
G4double bindingEnergyAsymptotic(G4double A,
G4double Z);
G4double FermiEnergy(G4double A,
G4double Z,
G4int ntype);
G4double FermiEnergy(G4int A, G4int Z, G4int ntype);
std::pair<std::vector<G4double>, std::vector<G4double> > paraMaker(G4double Z);
// NOTE: Passing Z as double here, to be used as interpolation argument
void paraMaker(G4double Z, std::pair<std::vector<G4double>, std::vector<G4double> >& parms);
std::pair<G4double, G4double> paraMakerTruncated(G4double Z);
void paraMakerTruncated(G4double Z, std::pair<G4double, G4double>& parms);
G4double getAL(G4double A);
G4double getAL(G4int A);
G4double csNN(G4double e);
G4double csPN(G4double e);
G4double G4cbrt(G4double x); // Can't use "cbrt" name, clashes with <math.h>
G4double inuclRndm();
G4double randomGauss(G4double sigma);
@@ -68,9 +71,14 @@ namespace G4InuclSpecialFunctions {
std::pair<G4double, G4double> randomCOS_SIN();
G4double nucleiLevelDensity(G4double a);
G4double nucleiLevelDensity(G4int A);
G4CascadeMomentum generateWithFixedTheta(G4double ct,
G4double p);
// Optional mass argument will be used to fill G4LorentzVector correctly
G4LorentzVector generateWithFixedTheta(G4double ct, G4double p,
G4double m=0.);
G4LorentzVector generateWithRandomAngles(G4double p, G4double m=0.);
}
#endif
@@ -23,22 +23,18 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4CASCAD_SPECIAL_FUNC_HH
#define G4CASCAD_SPECIAL_FUNC_HH
// $Id: G4KaonHypSampler.hh,v 1.2 2010/06/25 09:43:34 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100512 M. Kelsey -- Replaces (old, untemplated) G4CascadeSampler
#include "globals.hh"
#ifndef G4_KAON_HYP_SAMPLER_HH
#define G4_KAON_HYP_SAMPLER_HH
#include <cmath>
#include <algorithm>
#include <vector>
namespace G4CascadSpecialFunctions {
#include "G4CascadeSampler.hh"
std::pair<G4int, G4double> getPositionInEnergyScale3(G4double e);
// Entire interface is inherited from base (struct makes default public:)
struct G4KaonHypSampler : public G4CascadeSampler<31,6> { G4KaonHypSampler(); };
G4double absorptionCrosSection(G4double e, G4int type);
G4double crossSection(G4double e, G4int is);
}
#endif
#endif /* G4_KAON_HYP_SAMPLER_HH */
@@ -23,120 +23,110 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LorentzConvertor.hh,v 1.18 2010/12/15 07:39:58 gunter Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100108 Michael Kelsey -- Use G4LorentzVector internally
// 20100120 M. Kelsey -- BUG FIX: scm_momentum should be G4ThreeVector
// 20100126 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
// 20100519 M. Kelsey -- Add interfaces to pass G4InuclParticles directly
// 20100616 M. Kelsey -- Report bullet and target four-momenta when set
// 20100915 M. Kelsey -- Move constructors to .cc file, add initializers
#ifndef G4LORENTZ_CONVERTOR_HH
#define G4LORENTZ_CONVERTOR_HH
#ifndef GLOB
#include "globals.hh"
#endif
#include "G4LorentzVector.hh"
#include "G4ThreeVector.hh"
#include <vector>
#include "G4CascadeMomentum.hh"
class G4InuclParticle;
class G4LorentzConvertor {
public:
G4LorentzConvertor();
G4LorentzConvertor(const G4CascadeMomentum& bmom,
G4double bmass,
const G4CascadeMomentum& tmom,
G4double tmass) {
G4LorentzConvertor(const G4LorentzVector& bmom, G4double bmass,
const G4LorentzVector& tmom, G4double tmass);
setBullet(bmom, bmass);
setTarget(tmom, tmass);
degenerated = false;
};
G4LorentzConvertor(const G4InuclParticle* bullet,
const G4InuclParticle* target);
void setBullet(const G4CascadeMomentum& bmom,
G4double bmass) {
void setVerbose(G4int vb=0) { verboseLevel = vb; }
void setBullet(const G4InuclParticle* bullet);
void setTarget(const G4InuclParticle* target);
void setBullet(const G4InuclParticle& bullet) { setBullet(&bullet); }
void setTarget(const G4InuclParticle& target) { setTarget(&target); }
// Use correct four-vectors as input
void setBullet(const G4LorentzVector& bmom) {
bullet_mom = bmom;
bullet_mass = bmass;
// G4cout << " bullet: e " << bmom[0] << " mass " << bmass << G4endl;
};
if (verboseLevel > 3) printBullet();
}
void setTarget(const G4CascadeMomentum& tmom,
G4double tmass) {
void setTarget(const G4LorentzVector& bmom) {
target_mom = bmom;
if (verboseLevel > 3) printTarget();
}
target_mom = tmom;
target_mass = tmass;
// G4cout << " target: e " << tmom[0] << " mass " << tmass << G4endl;
};
// These functions "repair" input 4-vectors using specified mass
void setBullet(const G4LorentzVector& bmom, G4double bmass) {
bullet_mom.setVectM(bmom.vect(), bmass);
if (verboseLevel > 3) printBullet();
}
void setTarget(const G4LorentzVector& tmom, G4double tmass) {
target_mom.setVectM(tmom.vect(), tmass);
if (verboseLevel > 3) printTarget();
}
void toTheCenterOfMass();
void toTheTargetRestFrame();
G4CascadeMomentum backToTheLab(const G4CascadeMomentum& mom) const;
G4LorentzVector backToTheLab(const G4LorentzVector& mom) const;
G4double getKinEnergyInTheTRS() const {
G4double pv = bullet_mom[1] * target_mom[1] +
bullet_mom[2] * target_mom[2] +
bullet_mom[3] * target_mom[3];
G4double ekin_trf = (target_mom[0] *
bullet_mom[0] - pv) / target_mass - bullet_mass;
return ekin_trf;
};
G4double getTotalSCMEnergy() const {
return ecm_tot;
};
G4double getSCMMomentum() const {
return pscm;
};
G4double getTRSMomentum() const {
return plab;
};
// Four-vectors of bullet and target in last chosen reference frame
const G4LorentzVector& getBullet() const { return bullet_mom; }
const G4LorentzVector& getTarget() const { return target_mom; }
G4CascadeMomentum rotate(const G4CascadeMomentum& mom) const;
G4double getKinEnergyInTheTRS() const;
G4double getTotalSCMEnergy() const { return ecm_tot; }
G4double getSCMMomentum() const { return scm_momentum.rho(); }
G4double getTRSMomentum() const;
G4CascadeMomentum rotate(const G4CascadeMomentum& mom1,
const G4CascadeMomentum& mom) const;
G4LorentzVector rotate(const G4LorentzVector& mom) const;
G4LorentzVector rotate(const G4LorentzVector& mom1,
const G4LorentzVector& mom) const;
G4bool reflectionNeeded() const;
G4bool trivial() const {
return degenerated;
};
G4bool trivial() const { return degenerated; }
// Reporting functions for diagnostics
void printBullet() const;
void printTarget() const;
private:
G4int verboseLevel;
G4CascadeMomentum bullet_mom;
G4double bullet_mass;
static const G4double small;
G4CascadeMomentum target_mom;
G4double target_mass;
G4int verboseLevel;
G4LorentzVector bullet_mom;
G4LorentzVector target_mom;
std::vector<G4double> velocity;
G4CascadeMomentum scm_momentum;
G4double ecm_tot;
G4double pscm;
G4double plab;
G4LorentzVector scm_momentum; // CM momentum relative to target/bullet
// Buffer variables for doing ::rotate() calculations
G4ThreeVector velocity;
G4double gamma;
G4double v2;
G4double ecm_tot;
G4double ga;
G4double gb;
G4double gbpp;
G4double gapp;
G4bool degenerated;
};
@@ -23,31 +23,35 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4NonEquilibriumEvaporator.hh,v 1.13 2010/09/14 17:51:36 mkelsey Exp $
// GEANT4 tag: $Name: geant4-09-04 $
//
// 20100315 M. Kelsey -- Remove "using" directive and unnecessary #includes.
// 20100413 M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
// 20100517 M. Kelsey -- Inherit from common base class
// 20100714 M. Kelsey -- Switch to new G4CascadeColliderBase class
// 20100914 M. Kelsey -- Migrate to integer A and Z
#ifndef G4NON_EQUILIBRIUM_EVAPORATOR_HH
#define G4NON_EQUILIBRIUM_EVAPORATOR_HH
#include "G4Collider.hh"
#include "G4InuclSpecialFunctions.hh"
#include "G4CascadeColliderBase.hh"
using namespace G4InuclSpecialFunctions;
class G4NonEquilibriumEvaporator {
class G4CollisionOutput;
class G4InuclParticle;
class G4NonEquilibriumEvaporator : public G4CascadeColliderBase {
public:
G4NonEquilibriumEvaporator();
virtual ~G4NonEquilibriumEvaporator() {}
G4CollisionOutput collide(G4InuclParticle* bullet,
G4InuclParticle* target);
void collide(G4InuclParticle* bullet, G4InuclParticle* target,
G4CollisionOutput& output);
private:
G4int verboseLevel;
G4double getMatrixElement(G4double A) const;
G4double getE0(G4double A) const;
G4double getParLev(G4double A, G4double Z) const;
G4double getMatrixElement(G4int A) const;
G4double getE0(G4int A) const;
G4double getParLev(G4int A, G4int Z) const;
};
#endif // G4NON_EQUILIBRIUM_EVAPORATOR_HH
#endif /* G4NON_EQUILIBRIUM_EVAPORATOR_HH */
@@ -23,259 +23,68 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4NuclWatcher.hh,v 1.15 2010/10/14 20:55:10 mkelsey Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100202 M. Kelsey -- Move most code into .cc file
// 20100405 M. Kelsey -- Pass const-ref std::vector<>
// 20101010 M. Kelsey -- Migrate to integer A and Z
#ifndef G4NUCL_WATCHER_HH
#define G4NUCL_WATCHER_HH
#ifndef GLOB
#include "globals.hh"
#endif
#include "G4Types.hh"
#include <algorithm>
#include <vector>
#include <cmath>
class G4NuclWatcher {
public:
G4NuclWatcher(G4double z,
std::vector<G4double> expa,
std::vector<G4double> expcs,
std::vector<G4double> experr,
G4NuclWatcher(G4int z,
const std::vector<G4double>& expa,
const std::vector<G4double>& expcs,
const std::vector<G4double>& experr,
G4bool check,
G4bool nucl)
: nuclz(z),
checkable(check),
nucleable(nucl) {
G4bool nucl);
exper_as = expa;
exper_cs = expcs;
exper_err = experr;
};
~G4NuclWatcher() {}
void watch(G4double a,
G4double z) {
void watch(G4int a, G4int z);
void setInuclCs(G4double csec, G4int nev);
const G4double small = 0.001;
G4double getChsq() const { return izotop_chsq; }
G4bool to_check() const { return checkable; }
G4bool look_forNuclei() const { return nucleable; }
G4double getLhood() const { return aver_lhood; }
G4double getNmatched() const { return aver_matched; }
if(std::fabs(z - nuclz) < small) {
G4bool here = false;
G4int simulatedAsSize = simulated_as.size();
for(G4int i = 0; i < simulatedAsSize; i++) {
if(std::fabs(simulated_as[i] - a) < small) {
simulated_cs[i] += 1.0;
here = true;
break;
};
};
if(!here) {
simulated_as.push_back(a);
simulated_cs.push_back(1.0);
};
};
};
void setInuclCs(G4double csec,
G4int nev) {
G4int simulatedAsSize = simulated_as.size();
for(G4int i = 0; i < simulatedAsSize ; i++) {
double err = std::sqrt(simulated_cs[i]) / simulated_cs[i];
simulated_prob.push_back(simulated_cs[i] / nev);
simulated_cs[i] *= csec / nev;
simulated_errors.push_back(simulated_cs[i] * err);
};
};
G4double getChsq() const {
return izotop_chsq;
};
std::pair<G4double, G4double> getExpCs() const;
std::pair<G4double, G4double> getInuclCs() const;
std::pair<G4double, G4double> getAverageRatio() const {
return std::pair<G4double, G4double>(average_ratio, aver_rat_err);
};
}
std::pair<G4double, G4double> getExpCs() const {
G4double cs = 0.0;
G4double err = 0.0;
G4int experAsSize = exper_as.size();
for(G4int iz = 0; iz < experAsSize; iz++) {
cs += exper_cs[iz];
err += exper_err[iz];
};
return std::pair<G4double, G4double>(cs, err);
};
G4bool to_check() const {
return checkable;
};
G4bool look_forNuclei() const {
return nucleable;
};
std::pair<G4double, G4double> getInuclCs() const {
G4double cs = 0.0;
G4double err = 0.0;
G4int simulatedAsSize = simulated_as.size();
for(G4int iz = 0; iz < simulatedAsSize; iz++) {
cs += simulated_cs[iz];
err += simulated_errors[iz];
};
return std::pair<G4double, G4double>(cs, err);
};
void print() {
const G4double small = 0.001;
G4cout << G4endl << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "
<< G4endl;
G4cout << " **** izotop Z **** " << nuclz << G4endl;
izotop_chsq = 0.0;
average_ratio = 0.0;
aver_rat_err = 0.0;
G4double exp_cs = 0.0;
G4double exp_cs_err = 0.0;
G4double inucl_cs = 0.0;
G4double inucl_cs_err = 0.0;
std::vector<G4bool> not_used(simulated_cs.size(), true);
G4int nmatched = exper_as.size();
G4int nused = simulated_cs.size();
G4double lhood = 0.0;
G4int experAsSize = exper_as.size();
for(G4int iz = 0; iz < experAsSize; iz++) {
G4double a = exper_as[iz];
exp_cs += exper_cs[iz];
exp_cs_err += exper_err[iz];
G4bool found = false;
G4int simulatedAsSize = simulated_as.size();
for(G4int i = 0; i < simulatedAsSize; i++) {
if(std::fabs(simulated_as[i] - a) < small) {
G4double rat = simulated_cs[i] / exper_cs[iz];
lhood += std::log10(rat) * std::log10(rat);
G4double rat_err = std::sqrt(simulated_errors[i] * simulated_errors[i] +
exper_err[iz] * exper_err[iz] * rat * rat) / exper_cs[iz];
average_ratio += rat;
aver_rat_err += rat_err;
G4cout << " A " << a << " exp.cs " << exper_cs[iz] << " err " <<
exper_err[iz] << G4endl <<
" sim. cs " << simulated_cs[i] << " err " << simulated_errors[i] << G4endl
<< " ratio " << rat << " err " << rat_err << G4endl;
G4cout << " simulated production rate " << simulated_prob[i] << G4endl;
not_used[i] = false;
izotop_chsq += (rat - 1.0) * (rat - 1.0) / rat_err / rat_err;
found = true;
nused--;
break;
};
};
if(!found) {
G4cout << " not found exper.: A " << a << " exp.cs " << exper_cs[iz]
<< " err " << exper_err[iz] << G4endl;
}
else {
nmatched--;
};
};
G4cout << " not found in simulations " << nmatched << G4endl;
G4cout << " not found in exper: " << nused << G4endl;
G4int simulatedAsSize = simulated_as.size();
for(G4int i = 0; i < simulatedAsSize; i++) {
inucl_cs += simulated_cs[i];
inucl_cs_err += simulated_errors[i];
if(not_used[i])
G4cout << " extra simul.: A " << simulated_as[i] <<
" sim. cs " << simulated_cs[i] << " err " << simulated_errors[i] << G4endl;
G4cout << " simulated production rate " << simulated_prob[i] << G4endl;
};
G4int matched = exper_as.size() - nmatched;
if(matched > 0) {
aver_lhood = lhood;
aver_matched = matched;
lhood = std::pow(10.0, std::sqrt(lhood / matched));
G4cout << " matched " << matched << " CHSQ " << std::sqrt(izotop_chsq) / matched
<< G4endl
<< " raw chsq " << izotop_chsq << G4endl
<< " average ratio " << average_ratio / matched
<< " err " << aver_rat_err / matched << G4endl
<< " lhood " << lhood << G4endl;
}
else {
izotop_chsq = 0.0;
aver_lhood = 0.0;
};
G4cout << " exper. cs " << exp_cs << " err " << exp_cs_err << G4endl
<< " inucl. cs " << inucl_cs << " err " << inucl_cs_err << G4endl;
G4cout << " ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ " << G4endl;
};
G4double getLhood() const {
return aver_lhood;
};
G4double getNmatched() const {
return aver_matched;
};
void print();
private:
G4double nuclz;
G4int nuclz;
G4double izotop_chsq;
G4double average_ratio;
G4double aver_rat_err;
G4double aver_lhood;
G4double aver_matched;
std::vector<G4double> exper_as;
std::vector<G4double> exper_cs;
std::vector<G4double> exper_err;
std::vector<G4double> simulated_as;
std::vector<G4double> simulated_cs;
std::vector<G4double> simulated_errors;
std::vector<G4double> simulated_prob;
G4bool checkable;
G4bool nucleable;
};
};
#endif // G4NUCL_WATCHER_HH
@@ -23,49 +23,63 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4NucleiModel.hh,v 1.36 2010/12/15 07:40:00 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04 $
//
// 20100319 M. Kelsey -- Remove "using" directory and unnecessary #includes,
// move ctor to .cc file
// 20100407 M. Kelsey -- Create "partners thePartners" data member to act
// as buffer between ::generateInteractionPartners() and
// ::generateParticleFate(), and make "outgoing_cparticles" a
// data member returned from the latter by const-ref. Replace
// return-by-value of initializeCascad() with an input buffer.
// 20100409 M. Kelsey -- Add function to sort list of partnerts by pathlen,
// move non-inlinable code to .cc.
// 20100421 M. Kelsey -- Move getFermiKinetic() to .cc, no hardwired masses.
// 20100517 M. Kelsey -- Change cross-section tables to static arrays. Move
// absorptionCrossSection() from SpecialFunc.
// 20100520 M. Kelsey -- Add function to separate momentum from nucleon
// 20100617 M. Kelsey -- Add setVerboseLevel() function, add generateModel()
// with particle input, and ctor with A/Z input.
// 20100715 M. Kelsey -- Add G4InuclNuclei object for use with balance checks
// 20100723 M. Kelsey -- Move G4CollisionOutput buffer, along with all
// std::vector<> buffers, here for reuse
// 20100914 M. Kelsey -- Migrate to integer A and Z
// 20101004 M. Kelsey -- Rename and create functions used to generate model
// 20101019 M. Kelsey -- CoVerity report: dtor leak; move dtor to .cc file
#ifndef G4NUCLEI_MODEL_HH
#define G4NUCLEI_MODEL_HH
#ifndef G4INUCL_ELEMENTARY_PARTICLE_HH
#include "G4InuclElementaryParticle.hh"
#endif
#include "G4CascadParticle.hh"
#include "G4InuclSpecialFunctions.hh"
#include "G4ElementaryParticleCollider.hh"
#include "G4CollisionOutput.hh"
#include <algorithm>
#include <vector>
class G4InuclNuclei;
using namespace G4InuclSpecialFunctions;
typedef std::pair<G4InuclElementaryParticle, G4double> partner;
typedef std::vector<partner> partners;
class G4ElementaryParticleCollider;
class G4NucleiModel {
public:
G4NucleiModel();
G4NucleiModel(G4int a, G4int z);
explicit G4NucleiModel(G4InuclNuclei* nuclei);
G4NucleiModel(G4InuclNuclei* nuclei) {
generateModel(nuclei->getA(), nuclei->getZ());
}
~G4NucleiModel();
void generateModel(G4double a, G4double z);
void setVerboseLevel(G4int verbose) { verboseLevel = verbose; }
void generateModel(G4InuclNuclei* nuclei);
void generateModel(G4int a, G4int z);
void reset() {
neutronNumberCurrent = neutronNumber;
protonNumberCurrent = protonNumber;
}
void printModel() const;
G4double getDensity(G4int ip, G4int izone) const {
return nucleon_densities[ip - 1][izone];
}
@@ -75,19 +89,7 @@ public:
return fermi_momenta[ip - 1][izone];
}
G4double getFermiKinetic(G4int ip, G4int izone) const {
G4double ekin = 0.0;
if(ip < 3 && izone < number_of_zones) {
G4double pf = fermi_momenta[ip - 1][izone];
G4double mass = ip == 1 ? 0.93827 : 0.93957;
ekin = std::sqrt(pf * pf + mass * mass) - mass;
}
return ekin;
}
G4double getFermiKinetic(G4int ip, G4int izone) const;
G4double getPotential(G4int ip, G4int izone) const {
G4int ip0 = ip < 3 ? ip - 1 : 2;
@@ -97,23 +99,23 @@ public:
}
std::vector<G4CascadParticle>
const std::vector<G4CascadParticle>&
generateParticleFate(G4CascadParticle& cparticle,
G4ElementaryParticleCollider* theElementaryParticleCollider);
G4double getNumberOfNeutrons() const {
G4int getNumberOfNeutrons() const {
return neutronNumberCurrent;
}
G4double getNumberOfProtons() const {
G4int getNumberOfProtons() const {
return protonNumberCurrent;
}
G4bool empty() const {
return neutronNumberCurrent < 1.0 && protonNumberCurrent < 1.0;
return neutronNumberCurrent < 1 && protonNumberCurrent < 1;
}
@@ -125,8 +127,10 @@ public:
G4CascadParticle initializeCascad(G4InuclElementaryParticle* particle);
std::pair<std::vector<G4CascadParticle>, std::vector<G4InuclElementaryParticle> >
initializeCascad(G4InuclNuclei* bullet, G4InuclNuclei* target);
typedef std::pair<std::vector<G4CascadParticle>, std::vector<G4InuclElementaryParticle> > modelLists;
void initializeCascad(G4InuclNuclei* bullet, G4InuclNuclei* target,
modelLists& output);
std::pair<G4int, G4int> getTypesOfNucleonsInvolved() const {
@@ -138,12 +142,13 @@ public:
G4InuclElementaryParticle generateNucleon(G4int type, G4int zone) const;
private:
G4int verboseLevel;
G4LorentzVector generateNucleonMomentum(G4int type, G4int zone) const;
void initTotalCrossSections();
G4double totalCrossSection(G4double e, G4int rtype) const;
G4double absorptionCrossSection(G4double e, G4int type) const;
G4double totalCrossSection(G4double ke, G4int rtype) const;
private:
G4int verboseLevel;
G4bool passFermi(const std::vector<G4InuclElementaryParticle>& particles,
G4int zone);
@@ -154,58 +159,101 @@ private:
G4int type2,
G4int zone) const;
partners generateInteractionPartners(G4CascadParticle& cparticle) const;
typedef std::pair<G4InuclElementaryParticle, G4double> partner;
G4double volNumInt(G4double r1, G4double r2, G4double cu,
G4double d1) const;
std::vector<partner> thePartners; // Buffer for output below
void generateInteractionPartners(G4CascadParticle& cparticle);
G4double volNumInt1(G4double r1, G4double r2, G4double cu2) const;
// Function for std::sort() to use in organizing partners by path length
static G4bool sortPartners(const partner& p1, const partner& p2) {
return (p2.second > p1.second);
}
// Functions used to generate model nuclear structure
void fillBindingEnergies();
void fillZoneRadii(G4double nuclearRadius);
G4double fillZoneVolumes(G4double nuclearRadius);
void fillPotentials(G4int type, G4double tot_vol);
G4double zoneIntegralWoodsSaxon(G4double ur1, G4double ur2,
G4double nuclearRadius) const;
G4double zoneIntegralGaussian(G4double ur1, G4double ur2,
G4double nuclearRadius) const;
G4double getRatio(G4int ip) const;
// Buffers for processing interactions on each cycle
std::vector<G4CascadParticle> outgoing_cparticles; // Return buffer
G4CollisionOutput EPCoutput; // For N-body inelastic collisions
std::vector<G4InuclElementaryParticle> qdeutrons; // For h+(NN) trials
std::vector<G4double> acsecs;
std::vector<G4ThreeVector> coordinates; // for initializeCascad()
std::vector<G4LorentzVector> momentums;
std::vector<G4InuclElementaryParticle> raw_particles;
// Temporary buffers for computing nuclear model
G4double ur[7]; // Number of skin depths for each zone
G4double v[6]; // Density integrals by zone
G4double v1[6]; // Pseudo-volume (delta r^3) by zone
std::vector<G4double> rod; // Nucleon density
std::vector<G4double> pf; // Fermi momentum
std::vector<G4double> vz; // Nucleo potential
// Nuclear model configuration
std::vector<std::vector<G4double> > nucleon_densities;
std::vector<std::vector<G4double> > zone_potentials;
std::vector<std::vector<G4double> > fermi_momenta;
std::vector<G4double> zone_radii;
std::vector<G4double> binding_energies;
G4double nuclei_radius;
G4int number_of_zones;
G4double A;
G4double Z;
G4int A;
G4int Z;
G4InuclNuclei* theNucleus;
G4double neutronNumber;
G4double protonNumber;
G4int neutronNumber;
G4int protonNumber;
G4double neutronNumberCurrent;
G4double protonNumberCurrent;
G4int neutronNumberCurrent;
G4int protonNumberCurrent;
G4int current_nucl1;
G4int current_nucl2;
// Total cross sections
// Symbolic names for nuclear potentials
enum PotentialType { WoodsSaxon=0, Gaussian=1 };
G4double PPtot[30];
G4double NPtot[30];
G4double pipPtot[30];
G4double pimPtot[30];
G4double pizPtot[30];
G4double kpPtot[30];
G4double kpNtot[30];
G4double kmPtot[30];
G4double kmNtot[30];
G4double lPtot[30];
G4double spPtot[30];
G4double smPtot[30];
G4double xi0Ptot[30];
G4double ximPtot[30];
// Parameters for nuclear structure
static const G4double skinDepth;
static const G4double radiusScale;
static const G4double radiusForSmall;
static const G4double fermiMomentum;
static const G4double alfa3[3], alfa6[6];
static const G4double pion_vp;
static const G4double pion_vp_small;
static const G4double kaon_vp;
static const G4double hyperon_vp;
// FIXME: We should not be using this!
static const G4double piTimes4thirds;
// Total cross sections (for kaons and hyperons only)
static const G4double kpPtot[30];
static const G4double kpNtot[30];
static const G4double kmPtot[30];
static const G4double kmNtot[30];
static const G4double lPtot[30];
static const G4double spPtot[30];
static const G4double smPtot[30];
static const G4double xi0Ptot[30];
static const G4double ximPtot[30];
};
#endif // G4NUCLEI_MODEL_HH
@@ -1,108 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4NucleonSampler.hh,v 1.1 2009/09/24 18:50:27 dennis Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// Author: D. H. Wright
// Date: 10 September 2009
//
#ifndef G4NucleonSampler_h
#define G4NucleonSampler_h 1
// Class Description:
// Samples partial cross sections, multiplicities and final state particle
// types required for p and n scattering within a nucleus
#include "G4FinalStateSampler.hh"
class G4NucleonSampler : public G4FinalStateSampler
{
public:
G4NucleonSampler();
~G4NucleonSampler()
{ }
void printCrossSections() const;
G4int GetMultiplicityT1(G4double KE) const; // pp, nn
G4int GetMultiplicityT0(G4double KE) const; // pn
std::vector<G4int>
GetFSPartTypesForT1(G4int mult, G4double KE, G4int tindex) const;
std::vector<G4int>
GetFSPartTypesForT0(G4int mult, G4double KE) const;
std::vector<G4int> GetFSPartTypesForPP(G4int mult, G4double KE) const
{return GetFSPartTypesForT1(mult, KE, 0); }
std::vector<G4int> GetFSPartTypesForNN(G4int mult, G4double KE) const
{return GetFSPartTypesForT1(mult, KE, 1); }
std::vector<G4int> GetFSPartTypesForNP(G4int mult, G4double KE) const
{return GetFSPartTypesForT0(mult, KE); }
protected:
G4int PPindex[8][2];
G4int NPindex[8][2];
G4int T1_2bfs[2][1][2];
G4int T1_3bfs[2][6][3];
G4int T1_4bfs[2][18][4];
G4int T1_5bfs[2][32][5];
G4int T1_6bfs[2][7][6];
G4int T1_7bfs[2][8][7];
G4int T1_8bfs[2][10][8];
G4int T1_9bfs[2][11][9];
G4int T0_2bfs[1][2];
G4int T0_3bfs[9][3];
G4int T0_4bfs[22][4];
G4int T0_5bfs[38][5];
G4int T0_6bfs[7][6];
G4int T0_7bfs[9][7];
G4int T0_8bfs[10][8];
G4int T0_9bfs[12][9];
G4double PPsummed[30];
G4double PPtot[30];
G4double NPsummed[30];
G4double NPtot[30];
G4double t1_dSigma_dMult[8][30];
G4double t0_dSigma_dMult[8][30];
G4float PPCrossSections[93][30];
G4float NPCrossSections[108][30];
private:
void initCrossSections();
};
#endif
@@ -23,24 +23,30 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ParticleLargerBeta.hh,v 1.7 2010/06/25 09:43:44 gunter Exp $
// Geant4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100112 M. Kelsey -- Add additional operator() which uses pointers,
// also fix bug which returns wrong result
#ifndef G4ParticleLargerBeta_h
#define G4ParticleLargerBeta_h
#ifndef G4INUCL_ELEMENTARY_PARTICLE_HH
#include "G4InuclElementaryParticle.hh"
#endif
class G4ParticleLargerBeta {
public:
G4bool operator() (const G4InuclElementaryParticle& part1,
const G4InuclElementaryParticle& part2) {
return part1.getMomModule()/part1.getEnergy() <=
part2.getMomModule()/part2.getEnergy();
return (part1.getMomModule()/part1.getEnergy() >=
part2.getMomModule()/part2.getEnergy()
);
}
G4bool operator() (const G4InuclElementaryParticle* part1,
const G4InuclElementaryParticle* part2) {
return (part1 && part2 && operator()(*part1, *part2));
}
};
#endif
#endif /* G4ParticleLargerBeta_h */
@@ -23,25 +23,41 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ParticleLargerEkin.hh,v 1.12 2010/06/25 09:43:46 gunter Exp $
// Geant4 tag: $Name: geant4-09-04-beta-01 $
//
// Implements a *reverse* sorting: std::sort expects a less-than operator
// which returns true if arg1<arg2. This function returns true if arg1>=arg2.
//
// 20091125 M. Kelsey -- Add additional operator() which uses pointers
#ifndef G4PARTICLE_LARGER_EKIN_HH
#define G4PARTICLE_LARGER_EKIN_HH
#ifndef G4INUCL_ELEMENTARY_PARTICLE_HH
#include "G4InuclElementaryParticle.hh"
#ifdef G4CASCADE_DEBUG_SORT
#include "G4ios.hh"
#endif
class G4ParticleLargerEkin {
public:
G4bool operator() (const G4InuclElementaryParticle& part1,
const G4InuclElementaryParticle& part2) {
return part1.getKineticEnergy() >= part2.getKineticEnergy();
// return part1.getEnergy() >= part2.getEnergy();
// return part1.getMomModule() >= part2.getMomModule();
};
#ifdef G4CASCADE_DEBUG_SORT
G4cout << "part1 @ " << &part1 << ": ";
part1.printParticle();
G4cout << "part2 @ " << &part2 << ": ";
part2.printParticle();
G4cout << G4endl;
#endif
return (part1.getKineticEnergy() >= part2.getKineticEnergy());
}
G4bool operator() (const G4InuclElementaryParticle* part1,
const G4InuclElementaryParticle* part2) {
return (part1 && part2 && operator()(*part1, *part2));
}
};
#endif // G4PARTICLE_LARGER_EKIN_HH
@@ -23,24 +23,17 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4COLLIDER_HH
#define G4COLLIDER_HH
// $Id: G4PionNucSampler.hh,v 1.2 2010/06/25 09:43:48 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100512 M. Kelsey -- Replaces G4FinalStateSampler
//#ifndef G4INUCL_PARTICLE_HH
#include "G4InuclParticle.hh"
//#endif
#ifndef G4_PION_NUC_SAMPLER_HH
#define G4_PION_NUC_SAMPLER_HH
#include "G4CollisionOutput.hh"
#include "G4CascadeSampler.hh"
// class G4Collider {
// Entire interface is inherited from base (struct makes default public:)
struct G4PionNucSampler : public G4CascadeSampler<30,8> { G4PionNucSampler(); };
// public:
// G4Collider() {};
// virtual G4CollisionOutput collide(G4InuclParticle* bullet,
// G4InuclParticle* target) = 0;
// };
#endif // G4COLLIDER_HH
#endif /* G4_PION NUC_SAMPLER_HH */
@@ -1,134 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PionSampler.hh,v 1.2 2009/09/17 18:10:44 dennis Exp $
// GEANT4 tag $Name: geant4-09-03 $
//
// Author: D. H. Wright
// Date: 26 March 2009
//
#ifndef G4PionSampler_h
#define G4PionSampler_h 1
// Class Description:
// Samples partial cross sections, multiplicities and final state particle
// types required for pi+, pi- and pi0 scattering within a nucleus
#include "G4FinalStateSampler.hh"
class G4PionSampler : public G4FinalStateSampler
{
public:
G4PionSampler();
~G4PionSampler()
{ }
void printCrossSections() const;
G4int GetMultiplicityT33(G4double KE) const; // pi+p, pi-n
G4int GetMultiplicityT31(G4double KE) const; // pi-p, pi+n
G4int GetMultiplicityT11(G4double KE) const; // pi0p, pi0n
std::vector<G4int>
GetFSPartTypesForT33(G4int mult, G4double KE, G4int tindex) const;
std::vector<G4int>
GetFSPartTypesForT31(G4int mult, G4double KE, G4int tindex) const;
std::vector<G4int>
GetFSPartTypesForT11(G4int mult, G4double KE, G4int tindex) const;
std::vector<G4int> GetFSPartTypesForPipP(G4int mult, G4double KE) const
{return GetFSPartTypesForT33(mult, KE, 0); }
std::vector<G4int> GetFSPartTypesForPimN(G4int mult, G4double KE) const
{return GetFSPartTypesForT33(mult, KE, 1); }
std::vector<G4int> GetFSPartTypesForPimP(G4int mult, G4double KE) const
{return GetFSPartTypesForT31(mult, KE, 0); }
std::vector<G4int> GetFSPartTypesForPipN(G4int mult, G4double KE) const
{return GetFSPartTypesForT31(mult, KE, 1); }
std::vector<G4int> GetFSPartTypesForPizP(G4int mult, G4double KE) const
{return GetFSPartTypesForT11(mult, KE, 0); }
std::vector<G4int> GetFSPartTypesForPizN(G4int mult, G4double KE) const
{return GetFSPartTypesForT11(mult, KE, 1); }
protected:
G4int pipPindex[8][2];
G4int pimPindex[8][2];
G4int pizPindex[8][2];
G4int T33_2bfs[2][2][2];
G4int T33_3bfs[2][7][3];
G4int T33_4bfs[2][15][4];
G4int T33_5bfs[2][24][5];
G4int T33_6bfs[2][5][6];
G4int T33_7bfs[2][6][7];
G4int T33_8bfs[2][7][8];
G4int T33_9bfs[2][8][9];
G4int T31_2bfs[2][5][2];
G4int T31_3bfs[2][13][3];
G4int T31_4bfs[2][22][4];
G4int T31_5bfs[2][31][5];
G4int T31_6bfs[2][6][6];
G4int T31_7bfs[2][7][7];
G4int T31_8bfs[2][8][8];
G4int T31_9bfs[2][9][9];
G4int T11_2bfs[2][5][2];
G4int T11_3bfs[2][13][3];
G4int T11_4bfs[2][21][4];
G4int T11_5bfs[2][30][5];
G4int T11_6bfs[2][6][6];
G4int T11_7bfs[2][7][7];
G4int T11_8bfs[2][8][8];
G4int T11_9bfs[2][9][9];
G4double pipPsummed[30];
G4double pipPtot[30];
G4double pimPsummed[30];
G4double pimPtot[30];
G4double pizPsummed[30];
G4double pizPtot[30];
G4double t31_dSigma_dMult[8][30];
G4double t33_dSigma_dMult[8][30];
G4double t11_dSigma_dMult[8][30];
G4float pipPCrossSections[74][30];
G4float pimPCrossSections[101][30];
G4float pizPCrossSections[99][30];
private:
void initCrossSections();
};
#endif
@@ -1,69 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4PreCompoundCascadeInterface.hh,v 1.1 2007/05/23 14:37:28 miheikki Exp $
// Defines an interface to Bertini (BERT) INC with exitons. Evaporation is NOT included
#ifndef G4PRECOMPOUNDCASCADEINTERFACE_H
#define G4PRECOMPOUNDCASCADEINTERFACE_H 1
#include "G4Nucleon.hh"
#include "G4Nucleus.hh"
#include "G4VIntraNuclearTransportModel.hh"
#include "G4KineticTrackVector.hh"
#include "G4FragmentVector.hh"
#include "G4ParticleChange.hh"
#include "G4ReactionProductVector.hh"
#include "G4ReactionProduct.hh"
class G4PreCompoundCascadeInterface : public G4VIntraNuclearTransportModel {
public:
G4PreCompoundCascadeInterface();
~G4PreCompoundCascadeInterface(){
}
G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus);
G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& theNucleus);
private:
G4int operator==(G4PreCompoundCascadeInterface& right) {
return (this == &right);
}
G4int operator!=(G4PreCompoundCascadeInterface& right) {
return (this != &right);
}
G4int verboseLevel;
private:
G4HadFinalState theResult;
};
#endif // G4PRECOMPOUNDCASCADEINTERFACE_H
@@ -23,56 +23,44 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4FinalStateSampler.hh,v 1.2 2009/09/17 18:11:57 dennis Exp $
// GEANT4 tag $Name: geant4-09-03 $
#ifndef G4PRECOMPOUND_DEEXCITATION_HH
#define G4PRECOMPOUND_DEEXCITATION_HH
// $Id: G4PreCompoundDeexcitation.hh,v 1.4 2010/12/15 07:40:02 gunter Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// Author: D. H. Wright
// Date: 26 March 2009
// Takes an arbitrary excited or unphysical nuclear state and produces
// a final state with evaporated particles and (possibly) a stable nucleus.
//
#ifndef G4FinalStateSampler_h
#define G4FinalStateSampler_h 1
// Class Description:
//
// Implementation base class for sampling partial cross sections and final
// states for inelastic hadron-nucleon interactions
// 20100922 M. Kelsey -- Remove convertFragment() function, pass buffer
// instead of copying
// 20100926 M. Kelsey -- Move to new G4VCascadeDeexcitation base class.
#include "G4VCascadeDeexcitation.hh"
#include "globals.hh"
#include <vector>
#include "G4FastVector.hh"
#include "G4ReactionProduct.hh"
class G4InuclNuclei;
class G4InuclParticle;
class G4ExcitationHandler;
class G4VPreCompoundModel;
class G4FinalStateSampler
{
public: // with description
G4FinalStateSampler()
{ }
virtual ~G4FinalStateSampler()
{ }
enum {pi0=7, pip=3, pim=5, kp=11, km=13, k0=15, k0b=17, pro=1, neu=2,
lam=21, sp=23, s0=25, sm=27, xi0=29, xim=31, om=33, ap=35, an=37};
class G4PreCompoundDeexcitation : public G4VCascadeDeexcitation {
protected: // with description
std::pair<G4int, G4double> interpolateEnergy(G4double ke) const;
public:
G4PreCompoundDeexcitation();
virtual ~G4PreCompoundDeexcitation();
G4int sampleFlat(std::vector<G4double> sigma) const;
// Standard Collider interface (bullet is not used in this case)
void collide(G4InuclParticle* /*bullet*/, G4InuclParticle* target,
G4CollisionOutput& globalOutput);
void CheckQnums(G4FastVector<G4ReactionProduct,256> &vec,
G4int &vecLen,
G4ReactionProduct &currentParticle,
G4ReactionProduct &targetParticle,
G4double Q, G4double B, G4double S);
private:
static const G4double energyScale[30];
// Interface specific to pre-compound (post-cascade) processing
virtual void deExcite(G4Fragment* fragment,
G4CollisionOutput& globalOutput);
private:
G4ExcitationHandler* theExcitationHandler;
G4VPreCompoundModel* theDeExcitation;
};
#endif
#endif /* G4PRECOMPOUND_DEEXCITATION_HH */
@@ -1,105 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4PRECOMPOUNDINUCL_COLLIDER_HH
#define G4PRECOMPOUNDINUCL_COLLIDER_HH
#include "G4Collider.hh"
#include "G4IntraNucleiCascader.hh"
#include "G4NonEquilibriumEvaporator.hh"
#include "G4BigBanger.hh"
#include "G4ElementaryParticleCollider.hh"
#include "G4InteractionCase.hh"
#include "G4InuclNuclei.hh"
#include "G4InuclSpecialFunctions.hh"
#include "G4Analyser.hh"
using namespace G4InuclSpecialFunctions;
class G4PreCompoundInuclCollider {
public:
G4PreCompoundInuclCollider();
G4PreCompoundInuclCollider(G4ElementaryParticleCollider* ecollider,
G4IntraNucleiCascader* incascader,
G4NonEquilibriumEvaporator* noeqevaporator,
G4BigBanger* bigbanger) {
setElementaryParticleCollider(ecollider);
setIntraNucleiCascader(incascader,ecollider);
setNonEquilibriumEvaporator(noeqevaporator);
setBigBanger(bigbanger);
};
void setElementaryParticleCollider(G4ElementaryParticleCollider* ecollider) {
theElementaryParticleCollider = ecollider;
};
void setIntraNucleiCascader(G4IntraNucleiCascader* incascader,
G4ElementaryParticleCollider* ecollider) {
theIntraNucleiCascader = incascader;
theIntraNucleiCascader->setElementaryParticleCollider(ecollider);
};
void setNonEquilibriumEvaporator(G4NonEquilibriumEvaporator* noeqevaporator) {
theNonEquilibriumEvaporator = noeqevaporator;
};
void setBigBanger(G4BigBanger* bigbanger) {
theBigBanger = bigbanger;
};
G4CollisionOutput collide(G4InuclParticle* bullet,
G4InuclParticle* target);
private:
G4int verboseLevel;
G4bool inelasticInteractionPossible(G4InuclParticle* bullet,
G4InuclParticle* target,
G4double ekin) const;
G4InteractionCase bulletTargetSetter(G4InuclParticle* bullet,
G4InuclParticle* target) const;
G4bool explosion(G4InuclNuclei* target) const;
G4ElementaryParticleCollider* theElementaryParticleCollider;
G4IntraNucleiCascader* theIntraNucleiCascader;
G4NonEquilibriumEvaporator* theNonEquilibriumEvaporator;
G4BigBanger* theBigBanger;
};
#endif // G4PRECOMPOUNDINUCL_COLLIDER_HH
@@ -23,48 +23,37 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Defines an development version for interface Bertini (BERT) cascade
// based on INUCL intra-nuclear transport.models
// with bullet hadron energy ~< 10 GeV
// $Id: G4UnboundPN.hh,v 1.4 2010/06/25 09:43:52 gunter Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
//
// ------------------------------------------------------------
// Bertini Cascade unboundPN class header file
//
// History: first implementation, inspired by G4Proton
// 17 Nov 2009: Michael Kelsey
// 06 Apr 2010: Reset theInstance in dtor, implement ctor in .cc.
// 13 Apr 2010: Per Kurashige, inherit from G4VShortLivedParticle.
// ----------------------------------------------------------------
#ifndef G4IBERTINI_H
#define G4IBERTINI_H 1
#ifndef G4UNBOUNDPN_HH
#define G4UNBOUNDPN_HH
#include "G4Nucleon.hh"
#include "G4Nucleus.hh"
#include "G4VIntraNuclearTransportModel.hh"
#include "G4KineticTrackVector.hh"
#include "G4FragmentVector.hh"
#include "G4ParticleChange.hh"
#include "G4ReactionProductVector.hh"
#include "G4ReactionProduct.hh"
#include "G4VShortLivedParticle.hh"
class G4IBertini : public G4VIntraNuclearTransportModel {
public:
G4IBertini();
~G4IBertini(){
}
G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus);
G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& theNucleus);
// ######################################################################
// ### UNBOUNDPN ###
// ######################################################################
class G4UnboundPN : public G4VShortLivedParticle {
private:
G4int operator==(G4IBertini& right) {
return (this == &right);
}
G4int operator!=(G4IBertini& right) {
return (this != &right);
}
G4int verboseLevel;
private:
G4HadFinalState theResult;
static G4UnboundPN* theInstance;
G4UnboundPN();
~G4UnboundPN() { theInstance = 0; }
public:
static G4UnboundPN* Definition();
static G4UnboundPN* UnboundPNDefinition();
static G4UnboundPN* UnboundPN();
};
#endif // G4IBERTINI_H
#endif /* G4UNBOUNDPN_HH */
@@ -23,40 +23,36 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Pekka Kaitaniemi, HIP
// Aatos Heikkinen
#ifndef G4V_CASCADE_COLLIDER_HH
#define G4V_CASCADE_COLLIDER_HH
// $Id: G4VCascadeCollider.hh,v 1.5 2010/12/15 07:40:04 gunter Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100615 M. Kelsey -- Split constructor to have verbose separately
// 20100711 M. Kelsey -- Allow name to be changed after ctor, by self
// 20100714 M. Kelsey -- Move concrete functions to G4CascadeColliderBase
#ifndef G4ELASTICCASCADEINTERFACE_H
#define G4ELASTICCASCADEINTERFACE_H 1
#include "globals.hh"
#include "G4Nucleon.hh"
#include "G4Nucleus.hh"
#include "G4VIntraNuclearTransportModel.hh"
#include "G4KineticTrackVector.hh"
#include "G4FragmentVector.hh"
#include "G4ParticleChange.hh"
#include "G4ReactionProductVector.hh"
#include "G4ReactionProduct.hh"
class G4InuclParticle;
class G4CollisionOutput;
class G4ElasticCascadeInterface : public G4VIntraNuclearTransportModel {
class G4VCascadeCollider {
public:
G4ElasticCascadeInterface();
~G4ElasticCascadeInterface(){}
G4VCascadeCollider(const char* name, G4int verbose=0);
G4ReactionProductVector* Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus);
G4HadFinalState* ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& theNucleus);
virtual ~G4VCascadeCollider() {}
private:
G4int operator==(G4ElasticCascadeInterface& right) {
return (this == &right);
}
virtual void collide(G4InuclParticle* bullet, G4InuclParticle* target,
G4CollisionOutput& output) = 0;
G4int operator!=(G4ElasticCascadeInterface& right) {
return (this != &right);
}
virtual void setVerboseLevel(G4int verbose=0) { verboseLevel=verbose; }
protected:
const char* theName;
G4int verboseLevel;
G4HadFinalState theResult;
};
#endif
virtual void setName(const char* name) { theName = name; }
};
#endif /* G4V_CASCADE_COLLIDER_HH */
@@ -0,0 +1,58 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#ifndef G4VCASCADE_DEEXCITATION_HH
#define G4VCASCADE_DEEXCITATION_HH
// $Id: G4VCascadeDeexcitation.hh,v 1.2 2010/12/15 07:40:06 gunter Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// Base class to define a common interface for post-cascade processing.
#include "G4CascadeColliderBase.hh"
#include "globals.hh"
#include "G4CollisionOutput.hh"
class G4InuclParticle;
class G4Fragment;
class G4VCascadeDeexcitation : public G4CascadeColliderBase {
public:
G4VCascadeDeexcitation(const char* name) : G4CascadeColliderBase(name) {}
virtual ~G4VCascadeDeexcitation() {}
// Standard Collider interface (bullet is not used in this case)
virtual void collide(G4InuclParticle* /*bullet*/, G4InuclParticle* target,
G4CollisionOutput& globalOutput) = 0;
// Interface specific to pre-compound (post-cascade) processing
virtual void deExcite(G4Fragment* fragment,
G4CollisionOutput& globalOutput) = 0;
protected:
G4CollisionOutput output; // Local buffer for de-excitation stages
};
#endif /* G4CASCADE_DEEXCITATION_HH */
@@ -23,6 +23,11 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4WatcherGun.hh,v 1.10 2010/06/25 09:43:56 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100407 M. Kelsey -- Return const-ref to avoid copy overhead.
#ifndef G4WATCHER_GUN_HH
#define G4WATCHER_GUN_HH
@@ -36,7 +41,7 @@ public:
G4WatcherGun();
void setWatchers();
std::vector<G4NuclWatcher> getWatchers() const {
const std::vector<G4NuclWatcher>& getWatchers() const {
return watchers;
};
@@ -0,0 +1,249 @@
#------------------------------------------------------------------------------
# sources.cmake
# Module : G4hadronic_bert_cascade
# Package: Geant4.src.G4processes.G4hadronic.G4hadronic_models.G4had_hetcpp.G4hadronic_bert_cascade
#
# Sources description for a library.
# Lists the sources and headers of the code explicitely.
# Lists include paths needed.
# Lists the internal granular and global dependencies of the library.
# Source specific properties should be added at the end.
#
# Generated on : 30/9/2010
#
# $Id: sources.cmake,v 1.4 2010/09/30 12:02:28 bmorgan Exp $
#
#------------------------------------------------------------------------------
# List external includes needed.
include_directories(${CLHEP_INCLUDE_DIRS})
# List internal includes needed.
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/geometry/volumes/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPGeometry/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPNumerics/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/HEPRandom/include)
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/materials/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/bosons/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/hadrons/barions/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/hadrons/ions/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/hadrons/mesons/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/leptons/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/particles/shortlived/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/cross_sections/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/cascade/cascade/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/cascade/utils/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/de_excitation/evaporation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/de_excitation/fermi_breakup/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/de_excitation/handler/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/de_excitation/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/de_excitation/multifragmentation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/de_excitation/photon_evaporation/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/de_excitation/util/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/pre_equilibrium/exciton_model/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/models/util/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/processes/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/hadronic/util/include)
include_directories(${CMAKE_SOURCE_DIR}/source/processes/management/include)
include_directories(${CMAKE_SOURCE_DIR}/source/track/include)
#
# Define the Geant4 Module.
#
include(Geant4MacroDefineModule)
GEANT4_DEFINE_MODULE(NAME G4hadronic_bert_cascade
HEADERS
G4Analyser.hh
G4BertiniElasticCollision.hh
G4BertiniHydrogenCollision.hh
G4BigBanger.hh
G4CascadeChannel.hh
G4CascadeCheckBalance.hh
G4CascadeColliderBase.hh
G4CascadeData.hh
G4CascadeData.icc
G4CascadeDeexcitation.hh
G4CascadeFunctions.hh
G4CascadeFunctions.icc
G4CascadeInterface.hh
G4CascadeInterpolator.hh
G4CascadeInterpolator.icc
G4CascadeKminusNChannel.hh
G4CascadeKminusPChannel.hh
G4CascadeKplusNChannel.hh
G4CascadeKplusPChannel.hh
G4CascadeKzeroBarNChannel.hh
G4CascadeKzeroBarPChannel.hh
G4CascadeKzeroNChannel.hh
G4CascadeKzeroPChannel.hh
G4CascadeLambdaNChannel.hh
G4CascadeLambdaPChannel.hh
G4CascadeNNChannel.hh
G4CascadeNPChannel.hh
G4CascadePiMinusNChannel.hh
G4CascadePiMinusPChannel.hh
G4CascadePiPlusNChannel.hh
G4CascadePiPlusPChannel.hh
G4CascadePiZeroNChannel.hh
G4CascadePiZeroPChannel.hh
G4CascadePPChannel.hh
G4CascadeRecoilMaker.hh
G4CascadeSampler.hh
G4CascadeSampler.icc
G4CascadeSigmaMinusNChannel.hh
G4CascadeSigmaMinusPChannel.hh
G4CascadeSigmaPlusNChannel.hh
G4CascadeSigmaPlusPChannel.hh
G4CascadeSigmaZeroNChannel.hh
G4CascadeSigmaZeroPChannel.hh
G4CascadeXiMinusNChannel.hh
G4CascadeXiMinusPChannel.hh
G4CascadeXiZeroNChannel.hh
G4CascadeXiZeroPChannel.hh
G4CascadParticle.hh
G4CollisionOutput.hh
G4Dineutron.hh
G4Diproton.hh
G4ElementaryParticleCollider.hh
G4EquilibriumEvaporator.hh
G4EvaporationInuclCollider.hh
G4ExitonConfiguration.hh
G4FissionConfiguration.hh
G4Fissioner.hh
G4FissionStore.hh
G4InteractionCase.hh
G4IntraNucleiCascader.hh
G4InuclCollider.hh
G4InuclElementaryParticle.hh
G4InuclEvaporation.hh
G4InuclNuclei.hh
G4InuclParticle.hh
G4InuclParticleNames.hh
G4InuclSpecialFunctions.hh
G4KaonHypSampler.hh
G4LorentzConvertor.hh
G4NonEquilibriumEvaporator.hh
G4NucleiModel.hh
G4NuclWatcher.hh
G4ParticleLargerBeta.hh
G4ParticleLargerEkin.hh
G4PionNucSampler.hh
G4PreCompoundDeexcitation.hh
G4RegionModel.hh
G4UnboundPN.hh
G4VCascadeCollider.hh
G4VCascadeDeexcitation.hh
G4WatcherGun.hh
SOURCES
bindingEnergyAsymptotic.cc
bindingEnergy.cc
G4Analyser.cc
G4BigBanger.cc
G4CascadeChannel.cc
G4CascadeCheckBalance.cc
G4CascadeColliderBase.cc
G4CascadeDeexcitation.cc
G4CascadeInterface.cc
G4CascadeKminusNChannel.cc
G4CascadeKminusPChannel.cc
G4CascadeKplusNChannel.cc
G4CascadeKplusPChannel.cc
G4CascadeKzeroBarNChannel.cc
G4CascadeKzeroBarPChannel.cc
G4CascadeKzeroNChannel.cc
G4CascadeKzeroPChannel.cc
G4CascadeLambdaNChannel.cc
G4CascadeLambdaPChannel.cc
G4CascadeRecoilMaker.cc
G4CascadeSigmaMinusNChannel.cc
G4CascadeSigmaMinusPChannel.cc
G4CascadeSigmaPlusNChannel.cc
G4CascadeSigmaPlusPChannel.cc
G4CascadeSigmaZeroNChannel.cc
G4CascadeSigmaZeroPChannel.cc
G4CascadeT0npChannel.cc
G4CascadeT11pizNChannel.cc
G4CascadeT1NNChannel.cc
G4CascadeT31piNChannel.cc
G4CascadeT33piNChannel.cc
G4CascadeXiMinusNChannel.cc
G4CascadeXiMinusPChannel.cc
G4CascadeXiZeroNChannel.cc
G4CascadeXiZeroPChannel.cc
G4CascadParticle.cc
G4CollisionOutput.cc
G4Dineutron.cc
G4Diproton.cc
G4ElementaryParticleCollider.cc
G4EquilibriumEvaporator.cc
G4EvaporationInuclCollider.cc
G4Fissioner.cc
G4FissionStore.cc
G4InteractionCase.cc
G4IntraNucleiCascader.cc
G4InuclCollider.cc
G4InuclElementaryParticle.cc
G4InuclEvaporation.cc
G4InuclNuclei.cc
G4InuclParticle.cc
G4InuclSpecialFunctions.cc
G4KaonHypSampler.cc
G4LorentzConvertor.cc
G4NonEquilibriumEvaporator.cc
G4NucleiModel.cc
G4NuclWatcher.cc
G4PionNucSampler.cc
G4PreCompoundDeexcitation.cc
G4RegionModel.cc
G4UnboundPN.cc
G4VCascadeCollider.cc
G4WatcherGun.cc
nucleiLevelDensity.cc
paraMaker.cc
GRANULAR_DEPENDENCIES
G4baryons
G4bosons
G4geometrymng
G4globman
G4had_mod_man
G4had_mod_util
G4had_preequ_exciton
G4hadronic_bert_cascade
G4hadronic_deex_evaporation
G4hadronic_deex_fermi_breakup
G4hadronic_deex_handler
G4hadronic_deex_management
G4hadronic_deex_multifragmentation
G4hadronic_deex_photon_evaporation
G4hadronic_deex_util
G4hadronic_hetcpp_utils
G4hadronic_mgt
G4hadronic_proc
G4hadronic_util
G4hadronic_xsect
G4hepnumerics
G4ions
G4leptons
G4materials
G4mesons
G4partman
G4procman
G4shortlived
G4track
G4volumes
GLOBAL_DEPENDENCIES
G4geometry
G4global
G4materials
G4particles
G4track
LINK_LIBRARIES
)
# List any source specific properties here
@@ -23,40 +23,31 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4Analyser.cc,v 1.24 2010/10/19 19:48:15 mkelsey Exp $
//
// 20100726 M. Kelsey -- Use references for fetched lists
// 20101010 M. Kelsey -- Migrate to integer A and Z
// 20101019 M. Kelsey -- CoVerity report, unitialized constructor
#include "G4Analyser.hh"
#include <cmath>
#include <iomanip>
G4Analyser::G4Analyser()
:verboseLevel(1) {
: verboseLevel(0), eventNumber(0.0), averageMultiplicity(0.0),
averageProtonNumber(0.0), averageNeutronNumber(0.0),
averagePionNumber(0.0), averageNucleonKinEnergy(0.0),
averageProtonKinEnergy(0.0), averageNeutronKinEnergy(0.0),
averagePionKinEnergy(0.0), averageExitationEnergy(0.0),
averageOutgoingNuclei(0.0), fissy_prob(0.0), averagePionPl(0.0),
averagePionMin(0.0), averagePion0(0.0), averageA(0.0), averageZ(0.0),
inel_csec(0.0), withNuclei(false) {
if (verboseLevel > 3) {
G4cout << " >>> G4Analyser::G4Analyser" << G4endl;
}
eventNumber = 0.0;
averageMultiplicity = 0.0;
averageNucleonKinEnergy = 0.0;
averageProtonKinEnergy = 0.0;
averageNeutronKinEnergy = 0.0;
averagePionKinEnergy = 0.0;
averageProtonNumber = 0.0;
averageNeutronNumber = 0.0;
averagePionNumber = 0.0;
averageExitationEnergy = 0.0;
averageNucleiFragments = 0.0;
averagePionPl = 0.0;
averagePionMin = 0.0;
averagePion0 = 0.0;
averageA = 0.0;
averageZ = 0.0;
withNuclei = false;
fissy_prob = 0.0;
}
void G4Analyser::setInelCsec(G4double csec,
G4bool withn) {
void G4Analyser::setInelCsec(G4double csec, G4bool withn) {
if (verboseLevel > 3) {
G4cout << " >>> G4Analyser::setInelCsec" << G4endl;
@@ -82,9 +73,7 @@ void G4Analyser::setWatchers(const std::vector<G4NuclWatcher>& watchers) {
}
}
void G4Analyser::try_watchers(G4double a,
G4double z,
G4bool if_nucl) {
void G4Analyser::try_watchers(G4int a, G4int z, G4bool if_nucl) {
if (verboseLevel > 3) {
G4cout << " >>> G4Analyser::try_watchers" << G4endl;
@@ -111,49 +100,50 @@ void G4Analyser::analyse(const G4CollisionOutput& output) {
}
if (withNuclei) {
std::vector<G4InuclNuclei> nucleus = output.getNucleiFragments();
const std::vector<G4InuclNuclei>& nucleus = output.getOutgoingNuclei();
// if (nucleus.size() >= 0) {
if (nucleus.size() > 0) {
G4int nbig = 0;
averageNucleiFragments += nucleus.size();
averageOutgoingNuclei += nucleus.size();
for (G4int in = 0; in < G4int(nucleus.size()); in++) {
averageExitationEnergy += nucleus[in].getExitationEnergy();
G4double a = nucleus[in].getA();
G4double z = nucleus[in].getZ();
G4int a = nucleus[in].getA();
G4int z = nucleus[in].getZ();
if (in == 0) {
averageA += a;
averageZ += z;
};
if (a > 10.0) nbig++;
if (a > 10) nbig++;
try_watchers(a, z, true);
};
if (nbig > 1) fissy_prob += 1.0;
eventNumber += 1.0;
std::vector<G4InuclElementaryParticle> particles = output.getOutgoingParticles();
const std::vector<G4InuclElementaryParticle>& particles =
output.getOutgoingParticles();
averageMultiplicity += particles.size();
for (G4int i = 0; i < G4int(particles.size()); i++) {
G4double ap = 0.0;
G4double zp = 0.0;
G4int ap = 0;
G4int zp = 0;
if (particles[i].nucleon()) {
averageNucleonKinEnergy += particles[i].getKineticEnergy();
if (particles[i].type() == 1) {
zp = 1.0;
ap = 1.0;
zp = 1;
ap = 1;
averageProtonNumber += 1.0;
averageProtonKinEnergy += particles[i].getKineticEnergy();
} else {
ap = 1.0;
zp = 0.0;
ap = 1;
zp = 0;
averageNeutronNumber += 1.0;
averageNeutronKinEnergy += particles[i].getKineticEnergy();
};
@@ -161,18 +151,18 @@ void G4Analyser::analyse(const G4CollisionOutput& output) {
} else if (particles[i].pion()) {
averagePionKinEnergy += particles[i].getKineticEnergy();
averagePionNumber += 1.0;
ap = 0.0;
ap = 0;
if (particles[i].type() == 3) {
zp = 1.0;
zp = 1;
averagePionPl += 1.0;
} else if (particles[i].type() == 5) {
zp = -1.0;
zp = -1;
averagePionMin += 1.0;
} else if (particles[i].type() == 7) {
zp = 0.0;
zp = 0;
averagePion0 += 1.0;
};
};
@@ -182,7 +172,8 @@ void G4Analyser::analyse(const G4CollisionOutput& output) {
} else {
eventNumber += 1.0;
std::vector<G4InuclElementaryParticle> particles = output.getOutgoingParticles();
const std::vector<G4InuclElementaryParticle>& particles =
output.getOutgoingParticles();
averageMultiplicity += particles.size();
for (G4int i = 0; i < G4int(particles.size()); i++) {
@@ -229,8 +220,8 @@ void G4Analyser::printResultsSimple() {
if (withNuclei) {
G4cout
<< " average Exitation Energy " <<
averageExitationEnergy / averageNucleiFragments << G4endl
<< " average num of fragments " << averageNucleiFragments / eventNumber << G4endl;
averageExitationEnergy / averageOutgoingNuclei << G4endl
<< " average num of fragments " << averageOutgoingNuclei / eventNumber << G4endl;
G4cout << " fission prob. " << fissy_prob / eventNumber << " c.sec " <<
inel_csec * fissy_prob / eventNumber << G4endl;
}
@@ -264,8 +255,8 @@ void G4Analyser::printResults() {
<< " average A " << averageA / eventNumber << G4endl
<< " average Z " << averageZ / eventNumber << G4endl
<< " average Exitation Energy " <<
averageExitationEnergy / averageNucleiFragments << G4endl
<< " average num of fragments " << averageNucleiFragments / eventNumber << G4endl;
averageExitationEnergy / averageOutgoingNuclei << G4endl
<< " average num of fragments " << averageOutgoingNuclei / eventNumber << G4endl;
G4cout << " fission prob. " << fissy_prob / eventNumber << " c.sec " <<
inel_csec * fissy_prob / eventNumber << G4endl;
handleWatcherStatistics();
File diff suppressed because it is too large Load Diff
@@ -1,147 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#include "G4BertiniRegionModel.hh"
#include "G4HadronicException.hh"
const G4double G4BertiniRegionModel::radius0 = 1.0E-15;
const G4double G4BertiniRegionModel::BE = 7;
G4BertiniRegionModel::G4BertiniRegionModel(const G4int numberOfLayers, const G4int A, const G4int Z)
{
//count the radiuses, densities and fermi momenta with A and Z
G4double oneThird = 1.0/3.0;
G4double r = radius0*std::pow(G4double(A), G4double(oneThird) );
if(numberOfLayers==1){
radius.push_back(r);
G4double rho = G4double(A) / (4.0/3.0*pi*std::pow(r,3));
density.push_back(rho);
G4double protonMass = G4Proton::Proton()->GetPDGMass();
G4double neutronMass = G4Neutron::Neutron()->GetPDGMass();
G4double protonDensity = G4double(Z) / (4.0/3.0*pi*std::pow(r,3));
G4double neutronDensity = G4double(A-Z) / (4.0/3.0*pi*std::pow(r,3));
protonFermiEnergy.push_back(GetFermiEnergy(protonDensity, protonMass));
neutronFermiEnergy.push_back(GetFermiEnergy(neutronDensity, neutronMass));
protonFermiMomentum.push_back(GetFermiMomentum(protonDensity, protonMass));
neutronFermiMomentum.push_back(GetFermiMomentum(neutronDensity, neutronMass));
G4double fermiEP = *protonFermiEnergy.begin();
G4double fermiEN = *neutronFermiEnergy.begin();
protonPotentialEnergy.push_back(-(fermiEP + BE));
neutronPotentialEnergy.push_back(-(fermiEN + BE));
}
else{
if(numberOfLayers==3){
radius.push_back(0.1*r);
radius.push_back(0.2*r);
radius.push_back(0.9*r);
}
}
}
G4BertiniRegionModel::~G4BertiniRegionModel(){}
G4double G4BertiniRegionModel::GetDensity(G4double r){
my_iterator j=density.begin();
for(my_iterator i=radius.begin(); i<radius.end(); i++){
if(r <= *i) return *j;
j++;
}
return 0;
}
G4double G4BertiniRegionModel::GetPotentialEnergy(G4double r, G4int particle){
if(particle == 0){ //proton
my_iterator j=protonPotentialEnergy.begin();
for(my_iterator i=radius.begin(); i<radius.end(); i++){
if(r <= *i) return *j;
j++;
}
return 0;
}
if(particle == 1){ //neutron
my_iterator j=neutronPotentialEnergy.begin();
for(my_iterator i=radius.begin(); i<radius.end(); i++){
if(r <= *i) return *j;
j++;
}
return 0;
}
return 0;
}
G4double G4BertiniRegionModel::GetMaximumNucleonMomentum(G4double r,
G4int nucleon){
if(nucleon == 0){
my_iterator j=protonFermiMomentum.begin();
for(my_iterator i=radius.begin(); i<radius.end(); i++){
if(r <= *i) return *j;
j++;
}
}
if(nucleon==1){
my_iterator j=neutronFermiMomentum.begin();
for(my_iterator i=radius.begin(); i<radius.end(); i++){
if(r <= *i) return *j;
j++;
}
}
throw G4HadronicException(__FILE__, __LINE__, "G4BertiniRegionModel::GetMaximumNucleonMomentum - return value undefined");
return 0;
}
G4double G4BertiniRegionModel::GetFermiMomentum(G4double aDensity,
G4double aMass){
return std::sqrt(2*aMass*GetFermiEnergy(aDensity, aMass));
}
G4double G4BertiniRegionModel::GetFermiEnergy(G4double aDensity,
G4double aMass){
G4double twoThirds = 2.0/3.0;
return (std::pow(hbar_Planck,2)/(2.0*aMass)*std::pow((3.0*pi2*aDensity), twoThirds));
}
@@ -23,116 +23,132 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4BigBanger.cc,v 1.40 2010/09/28 20:15:00 mkelsey Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100114 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
// 20100301 M. Kelsey -- In generateBangInSCM(), restore old G4CascMom calcs.
// for (N-1)th outgoing nucleon.
// 20100319 M. Kelsey -- Use new generateWithRandomAngles for theta,phi stuff
// 20100407 M. Kelsey -- Replace std::vector<> returns with data members.
// 20100413 M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
// 20100517 M. Kelsey -- Inherit from common base class, clean up code
// 20100628 M. Kelsey -- Use old "bindingEnergy" fn as wrapper, add balance
// checking after bang.
// 20100630 M. Kelsey -- Just do simple boost for target, instead of using
// G4LorentzConverter with dummy bullet.
// 20100701 M. Kelsey -- Re-throw momentum list, not just angles!
// 20100714 M. Kelsey -- Move conservation checking to base class
// 20100726 M. Kelsey -- Move std::vector<> buffer to .hh file
// 20100923 M. Kelsey -- Migrate to integer A and Z
#include "G4BigBanger.hh"
#include "G4CollisionOutput.hh"
#include "G4InuclNuclei.hh"
#include "G4InuclElementaryParticle.hh"
#include "G4InuclSpecialFunctions.hh"
#include "G4ParticleLargerEkin.hh"
#include "G4LorentzConvertor.hh"
#include <algorithm>
using namespace G4InuclSpecialFunctions;
typedef std::vector<G4InuclElementaryParticle>::iterator particleIterator;
G4BigBanger::G4BigBanger()
: verboseLevel(1) {
if (verboseLevel > 3) {
G4cout << " >>> G4BigBanger::G4BigBanger" << G4endl;
}
}
G4BigBanger::G4BigBanger() : G4CascadeColliderBase("G4BigBanger") {}
G4CollisionOutput G4BigBanger::collide(G4InuclParticle* /*bullet*/,
G4InuclParticle* target) {
void
G4BigBanger::collide(G4InuclParticle* /*bullet*/, G4InuclParticle* target,
G4CollisionOutput& output) {
if (verboseLevel > 3) {
G4cout << " >>> G4BigBanger::collide" << G4endl;
}
if (verboseLevel) G4cout << " >>> G4BigBanger::collide" << G4endl;
// primitive explosion model A -> nucleons to prevent too exotic evaporation
const G4double small_ekin = 1.0e-6;
G4CollisionOutput output;
G4CascadeMomentum totscm;
G4CascadeMomentum totlab;
if(G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target)) {
G4double A = nuclei_target->getA();
G4double Z = nuclei_target->getZ();
const G4CascadeMomentum& PEX = nuclei_target->getMomentum();
G4double EEXS = nuclei_target->getExitationEnergy();
G4InuclElementaryParticle dummy(small_ekin, 1);
G4LorentzConvertor toTheNucleiSystemRestFrame;
toTheNucleiSystemRestFrame.setBullet(dummy.getMomentum(), dummy.getMass());
toTheNucleiSystemRestFrame.setTarget(PEX, nuclei_target->getMass());
toTheNucleiSystemRestFrame.toTheTargetRestFrame();
G4double etot = 0.001 * (EEXS - bindingEnergy(A, Z));
if (verboseLevel > 2) {
G4cout << " BigBanger: target " << G4endl;
nuclei_target->printParticle();
G4cout << " BigBanger: a " << A << " z " << Z << " eexs " << EEXS << " etot " <<
etot << " nm " << nuclei_target->getMass() << G4endl;
}
std::vector<G4InuclElementaryParticle> particles =
generateBangInSCM(etot, A, Z, dummy.getParticleMass(1), dummy.getParticleMass(2));
if (verboseLevel > 2) {
G4cout << " particles " << particles.size() << G4endl;
for(G4int i = 0; i < G4int(particles.size()); i++)
particles[i].printParticle();
}
if(!particles.empty()) { // convert back to Lab
// if (verboseLevel > 2) {
// not used G4CascadeMomentum totscm;
// not used G4CascadeMomentum totlab;
// }
particleIterator ipart;
for(ipart = particles.begin(); ipart != particles.end(); ipart++) {
if (verboseLevel > 2) {
const G4CascadeMomentum& mom_scm = ipart->getMomentum();
for(G4int i = 0; i < 4; i++) totscm[i] += mom_scm[i];
}
G4CascadeMomentum mom =
toTheNucleiSystemRestFrame.backToTheLab(ipart->getMomentum());
ipart->setMomentum(mom);
if (verboseLevel > 2) {
mom = ipart->getMomentum();
for(G4int i = 0; i < 4; i++) totlab[i] += mom[i];
}
};
std::sort(particles.begin(), particles.end(), G4ParticleLargerEkin());
if (verboseLevel > 2) {
G4cout << " In SCM: total outgoing momentum " << G4endl
<< " E " << totscm[0] << " px " << totscm[1]
<< " py " << totscm[2] << " pz " << totscm[3] << G4endl;
G4cout << " In Lab: mom cons " << G4endl
<< " E " << PEX[0] + 0.001 * EEXS - totlab[0]
<< " px " << PEX[1] - totlab[1]
<< " py " << PEX[2] - totlab[2]
<< " pz " << PEX[3] - totlab[3] << G4endl;
}
};
output.addOutgoingParticles(particles);
G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target);
if (!nuclei_target) {
G4cerr << " BigBanger -> try to bang not nuclei " << G4endl;
return;
}
else {
G4cout << " BigBanger -> try to bang not nuclei " << G4endl;
};
return output;
G4int A = nuclei_target->getA();
G4int Z = nuclei_target->getZ();
G4LorentzVector PEX = nuclei_target->getMomentum();
G4double EEXS = nuclei_target->getExitationEnergy();
G4ThreeVector toTheLabFrame = PEX.boostVector(); // From rest to lab
// This "should" be difference between E-target and sum of m(nucleons)
G4double etot = (EEXS - bindingEnergy(A,Z)) * MeV/GeV; // To Bertini units
if (etot < 0.0) etot = 0.0;
if (verboseLevel > 2) {
G4cout << " BigBanger: target " << G4endl;
nuclei_target->printParticle();
G4cout << " etot " << etot << G4endl;
}
if (verboseLevel > 3) {
G4LorentzVector PEXrest = PEX;
PEXrest.boost(-toTheLabFrame);
G4cout << " target rest frame: px " << PEXrest.px() << " py "
<< PEXrest.py() << " pz " << PEXrest.pz() << " E " << PEXrest.e()
<< G4endl;
}
generateBangInSCM(etot, A, Z);
if (verboseLevel > 2) {
G4cout << " particles " << particles.size() << G4endl;
for(G4int i = 0; i < G4int(particles.size()); i++)
particles[i].printParticle();
}
if (particles.empty()) { // No bang! Don't know why...
G4cerr << " >>> G4BigBanger unable to process fragment "
<< nuclei_target->getDefinition()->GetParticleName() << G4endl;
// FIXME: This will violate baryon number, momentum, energy, etc.
return;
}
// convert back to Lab
G4LorentzVector totscm;
G4LorentzVector totlab;
if (verboseLevel > 2) G4cout << " BigBanger: boosting to lab" << G4endl;
particleIterator ipart;
for(ipart = particles.begin(); ipart != particles.end(); ipart++) {
G4LorentzVector mom = ipart->getMomentum();
if (verboseLevel > 2) totscm += mom;
mom.boost(toTheLabFrame);
if (verboseLevel > 2) totlab += mom;
ipart->setMomentum(mom);
if (verboseLevel > 2) ipart->printParticle();
}
std::sort(particles.begin(), particles.end(), G4ParticleLargerEkin());
validateOutput(0, target, particles); // Checks <vector> directly
if (verboseLevel > 2) {
G4cout << " In SCM: total outgoing momentum " << G4endl
<< " E " << totscm.e() << " px " << totscm.x()
<< " py " << totscm.y() << " pz " << totscm.z() << G4endl;
G4cout << " In Lab: mom cons " << G4endl
<< " E " << PEX.e() - totlab.e() // PEX now includes EEXS
<< " px " << PEX.x() - totlab.x()
<< " py " << PEX.y() - totlab.y()
<< " pz " << PEX.z() - totlab.z() << G4endl;
}
output.addOutgoingParticles(particles);
}
std::vector<G4InuclElementaryParticle>
G4BigBanger::generateBangInSCM(G4double etot,
G4double a,
G4double z,
G4double mp,
G4double mn) const {
void G4BigBanger::generateBangInSCM(G4double etot, G4int a, G4int z) {
if (verboseLevel > 3) {
G4cout << " >>> G4BigBanger::generateBangInSCM" << G4endl;
}
@@ -140,209 +156,166 @@ G4BigBanger::generateBangInSCM(G4double etot,
const G4double ang_cut = 0.9999;
const G4int itry_max = 1000;
G4int ia = int(a + 0.1);
G4int iz = int(z + 0.1);
if (verboseLevel > 2) {
G4cout << " ia " << ia << " iz " << iz << G4endl;
G4cout << " a " << a << " z " << z << G4endl;
}
std::vector<G4InuclElementaryParticle> particles;
particles.clear(); // Reset output vector before filling
if(ia == 1) {
// abnormal situation
G4double m = iz > 0 ? mp : mn;
G4double pmod = std::sqrt((etot + 2.0 * m) * etot);
G4CascadeMomentum mom;
std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
G4double FI = randomPHI();
G4double Pt = pmod * COS_SIN.second;
mom[1] = Pt * std::cos(FI);
mom[2] = Pt * std::sin(FI);
mom[3] = Pt * COS_SIN.first;
G4int knd = iz > 0 ? 1 : 2;
// particles.push_back(G4InuclElementaryParticle(mom, knd));
particles.push_back(G4InuclElementaryParticle(mom, knd, 8)); // modelId included
return particles;
};
if (a == 1) { // Special -- bare nucleon doesn't really "explode"
G4int knd = (z>0) ? 1 : 2;
particles.push_back(G4InuclElementaryParticle(knd)); // zero momentum
return;
}
std::vector<G4double> pmod = generateMomentumModules(etot, a, z, mp, mn);
// NOTE: If distribution fails, need to regenerate magnitudes and angles!
//*** generateMomentumModules(etot, a, z);
scm_momentums.reserve(a);
G4LorentzVector tot_mom;
G4bool bad = true;
G4int itry = 0;
while(bad && itry < itry_max) {
itry++;
std::vector<G4CascadeMomentum> scm_momentums;
G4CascadeMomentum tot_mom;
if(ia == 2) {
G4CascadeMomentum mom;
std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
double FI = randomPHI();
double Pt = pmod[0] * COS_SIN.second;
mom[1] = Pt * std::cos(FI);
mom[2] = Pt * std::sin(FI);
mom[3] = Pt * COS_SIN.first;
for(G4int j = 1; j < 4; j++) tot_mom[j] += mom[j];
scm_momentums.clear();
generateMomentumModules(etot, a, z);
if (a == 2) {
// This is only a three-vector, not a four-vector
G4LorentzVector mom = generateWithRandomAngles(momModules[0]);
scm_momentums.push_back(mom);
G4CascadeMomentum mom1;
for(G4int i = 1; i < 4; i++) mom1[i] = - mom[i];
scm_momentums.push_back(mom1);
scm_momentums.push_back(-mom); // Only safe since three-vector!
bad = false;
}
else {
for(G4int i = 0; i < ia - 2; i++) {
G4CascadeMomentum mom;
std::pair<G4double, G4double> COS_SIN = randomCOS_SIN();
G4double FI = randomPHI();
G4double Pt = pmod[i] * COS_SIN.second;
mom[1] = Pt * std::cos(FI);
mom[2] = Pt * std::sin(FI);
mom[3] = Pt * COS_SIN.first;
for(G4int j = 1; j < 4; j++) tot_mom[j] += mom[j];
} else {
tot_mom *= 0.; // Easy way to reset accumulator
for(G4int i = 0; i < a-2; i++) { // All but last two are thrown
// This is only a three-vector, not a four-vector
G4LorentzVector mom = generateWithRandomAngles(momModules[i]);
scm_momentums.push_back(mom);
tot_mom += mom;
};
// handle last two
G4double tot_mod = std::sqrt(tot_mom[1] * tot_mom[1] +
tot_mom[2] * tot_mom[2] +
tot_mom[3] * tot_mom[3]);
G4double ct = -0.5 * (tot_mod * tot_mod + pmod[ia - 2] * pmod[ia - 2] -
pmod[ia - 1] * pmod[ia - 1]) / tot_mod / pmod[ia - 2];
G4double tot_mod = tot_mom.rho();
G4double ct = -0.5*(tot_mod*tot_mod + momModules[a-2]*momModules[a-2]
- momModules[a-1]*momModules[a-1]) / tot_mod
/ momModules[a-2];
if (verboseLevel > 2) {
G4cout << " ct last " << ct << G4endl;
}
if (verboseLevel > 2) G4cout << " ct last " << ct << G4endl;
if(std::fabs(ct) < ang_cut) {
G4CascadeMomentum mom2 = generateWithFixedTheta(ct, pmod[ia - 2]);
// rotate to the normal system
G4CascadeMomentum apr = tot_mom;
G4int i;
for(i = 1; i < 4; i++) apr[i] /= tot_mod;
G4double a_tr = std::sqrt(apr[1] * apr[1] + apr[2] * apr[2]);
G4CascadeMomentum mom;
mom[1] = mom2[3] * apr[1] + ( mom2[1] * apr[2] + mom2[2] * apr[3] * apr[1]) / a_tr; // ::: replace with clhep tools?
mom[2] = mom2[3] * apr[2] + (-mom2[1] * apr[1] + mom2[2] * apr[3] * apr[2]) / a_tr;
mom[3] = mom2[3] * apr[3] - mom2[2] * a_tr;
// This is only a three-vector, not a four-vector
G4LorentzVector mom2 = generateWithFixedTheta(ct, momModules[a - 2]);
// rotate to the normal system
G4LorentzVector apr = tot_mom/tot_mod;
G4double a_tr = std::sqrt(apr.x()*apr.x() + apr.y()*apr.y());
G4LorentzVector mom;
mom.setX(mom2.z()*apr.x() + ( mom2.x()*apr.y() + mom2.y()*apr.z()*apr.x())/a_tr);
mom.setY(mom2.z()*apr.y() + (-mom2.x()*apr.x() + mom2.y()*apr.z()*apr.y())/a_tr);
mom.setZ(mom2.z()*apr.z() - mom2.y()*a_tr);
scm_momentums.push_back(mom);
// and the last one
G4CascadeMomentum mom1;
for(i = 1; i < 4; i++) mom1[i] = - mom[i] - tot_mom[i];
// and the last one (again, not actually a four-vector!)
G4LorentzVector mom1 = -mom - tot_mom;
scm_momentums.push_back(mom1);
bad = false;
};
};
if(!bad) {
for(G4int i = 0; i < ia; i++) {
G4int knd = i < iz ? 1 : 2;
} // if (abs(ct) < ang_cut)
} // (a > 2)
} // while (bad && itry<itry_max)
particles.push_back(G4InuclElementaryParticle(scm_momentums[i], knd));
};
if (!bad) {
for(G4int i = 0; i < a; i++) {
G4int knd = i < z ? 1 : 2;
particles.push_back(G4InuclElementaryParticle(scm_momentums[i], knd, 8));
};
};
};
if (verboseLevel > 2) {
if(itry == itry_max) G4cout << " BigBanger -> can not generate bang " << G4endl;
if (itry == itry_max) G4cout << " BigBanger -> can not generate bang " << G4endl;
}
return particles;
return;
}
std::vector<G4double> G4BigBanger::generateMomentumModules(G4double etot,
G4double a,
G4double z,
G4double mp,
G4double mn) const {
void G4BigBanger::generateMomentumModules(G4double etot, G4int a, G4int z) {
if (verboseLevel > 3) {
G4cout << " >>> G4BigBanger::generateMomentumModules" << G4endl;
}
G4int ia = int(a + 0.1);
G4int iz = int(z + 0.1);
std::vector<G4double> pmod;
// Proton and neutron masses
const G4double mp = G4InuclElementaryParticle::getParticleMass(1);
const G4double mn = G4InuclElementaryParticle::getParticleMass(2);
momModules.clear(); // Reset buffer for filling
G4double xtot = 0.0;
G4double promax = maxProbability(a);
G4int i;
for(i = 0; i < ia; i++) {
G4double x = generateX(ia, a, promax);
if (verboseLevel > 2) {
G4cout << " i " << i << " x " << x << G4endl;
if (a > 2) { // For "large" nuclei, energy is distributed
G4double promax = maxProbability(a);
for(G4int i = 0; i < a; i++) {
G4double x = generateX(a, promax);
if (verboseLevel > 2) {
G4cout << " i " << i << " x " << x << G4endl;
}
momModules.push_back(x);
xtot += x;
}
pmod.push_back(x);
xtot += x;
};
for(i = 0; i < ia; i++) {
G4double m = i < iz ? mp : mn;
pmod[i] = pmod[i] * etot / xtot;
pmod[i] = std::sqrt(pmod[i] * (pmod[i] + 2.0 * m));
if (verboseLevel > 2) {
G4cout << " i " << i << " pmod " << pmod[i] << G4endl;
}
};
return pmod;
}
G4double G4BigBanger::xProbability(G4double x,
G4int ia) const {
if (verboseLevel > 3) {
G4cout << " >>> G4BigBanger::xProbability" << G4endl;
} else { // Two-body case is special, must be 50%
xtot = 1.;
momModules.push_back(0.5);
momModules.push_back(0.5);
}
G4int ihalf = ia / 2;
for(G4int i = 0; i < a; i++) {
G4double m = i < z ? mp : mn;
momModules[i] = momModules[i] * etot / xtot;
momModules[i] = std::sqrt(momModules[i] * (momModules[i] + 2.0 * m));
if (verboseLevel > 2) {
G4cout << " i " << i << " pmod " << momModules[i] << G4endl;
}
};
return;
}
G4double G4BigBanger::xProbability(G4double x, G4int a) const {
if (verboseLevel > 3) G4cout << " >>> G4BigBanger::xProbability" << G4endl;
G4double ekpr = 0.0;
if(x < 1.0 || x > 0.0) {
ekpr = x * x;
if(2 * ihalf == ia) { // even A
ekpr *= std::sqrt(1.0 - x) * std::pow((1.0 - x), G4int(G4double(3 * ia - 6) / 2.0));
if (a%2 == 0) { // even A
ekpr *= std::sqrt(1.0 - x) * std::pow((1.0 - x), (3*a-6)/2);
}
else {
ekpr *= std::pow((1.0 - x), G4int(G4double(3 * ia - 5) / 2.0));
ekpr *= std::pow((1.0 - x), (3*a-5)/2);
};
};
return ekpr;
}
G4double G4BigBanger::maxProbability(G4double a) const {
G4double G4BigBanger::maxProbability(G4int a) const {
if (verboseLevel > 3) {
G4cout << " >>> G4BigBanger::maxProbability" << G4endl;
}
return xProbability(1.0 / (a - 1.0) / 1.5, G4int(a + 0.1));
return xProbability(2./3./(a-1.0), a);
}
G4double G4BigBanger::generateX(G4int ia,
G4double a,
G4double promax) const {
if (verboseLevel > 3) {
G4cout << " >>> G4BigBanger::generateX" << G4endl;
}
G4double G4BigBanger::generateX(G4int a, G4double promax) const {
if (verboseLevel > 3) G4cout << " >>> G4BigBanger::generateX" << G4endl;
const G4int itry_max = 1000;
G4int itry = 0;
@@ -352,7 +325,7 @@ G4double G4BigBanger::generateX(G4int ia,
itry++;
x = inuclRndm();
if(xProbability(x, ia) >= promax * inuclRndm()) return x;
if(xProbability(x, a) >= promax * inuclRndm()) return x;
};
if (verboseLevel > 2) {
G4cout << " BigBanger -> can not generate x " << G4endl;
@@ -23,11 +23,20 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadParticle.cc,v 1.18 2010/10/20 14:34:26 mkelsey Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100112 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
// 20100114 M. Kelsey -- Replace vector<G4Double> position with G4ThreeVector
// 20101012 M. Kelsey -- Check for negative d2 in getPathToTheNextZone()
#include "G4CascadParticle.hh"
#include "G4ios.hh"
#include <cmath>
G4CascadParticle::G4CascadParticle()
: verboseLevel(2) {
: verboseLevel(0), current_zone(-1), current_path(-1.), movingIn(false),
reflectionCounter(0), reflected(false), generation(-1) {
if (verboseLevel > 3) {
G4cout << " >>> G4CascadParticle::G4CascadParticle" << G4endl;
}
@@ -35,49 +44,51 @@ G4CascadParticle::G4CascadParticle()
G4double G4CascadParticle::getPathToTheNextZone(G4double rz_in,
G4double rz_out) {
verboseLevel = 2;
if (verboseLevel > 3) {
G4cout << " >>> G4CascadParticle::getPathToTheNextZone" << G4endl;
G4cout << " >>> G4CascadParticle::getPathToTheNextZone rz_in " << rz_in
<< " rz_out " << rz_out << G4endl;
}
G4double path = -1.0;
G4double rp = 0.0;
G4double rr = 0.0;
G4double pp = 0.0;
const G4CascadeMomentum& mom = theParticle.getMomentum();
const G4LorentzVector& mom = getMomentum();
for (G4int i = 1; i < 4; i++) {
rp += mom[i] * position[i - 1];
rr += position[i - 1] * position[i - 1];
pp += mom[i] * mom[i];
};
G4double path = -1.0;
G4double rp = mom.vect().dot(position);
G4double rr = position.mag2();
G4double pp = mom.vect().mag2();
G4double ra = rr - rp * rp / pp;
pp = std::sqrt(pp);
G4double ds;
G4double d2;
if (verboseLevel > 3) {
G4cout << " current_zone " << current_zone << " rr " << rr
<< " rp " << rp << " pp " << pp << " ra " << ra << G4endl;
}
if (current_zone == 0 || rp > 0.0) {
d2 = rz_out * rz_out - ra;
ds = 1.0;
movingIn = false;
if (d2 > 0.0) {
ds = 1.0;
movingIn = false;
} else {
d2 = rz_in * rz_in - ra;
ds = -1.0;
movingIn = true;
}
} else {
d2 = rz_in * rz_in - ra;
if (d2 > 0.0) {
ds = -1.0;
movingIn = true;
} else {
d2 = rz_out * rz_out - ra;
ds = 1.0;
movingIn = false;
};
};
}
}
if (verboseLevel > 3) G4cout << " ds " << ds << " d2 " << d2 << G4endl;
path = ds * std::sqrt(d2) - rp / pp;
@@ -85,14 +96,18 @@ G4double G4CascadParticle::getPathToTheNextZone(G4double rz_in,
}
void G4CascadParticle::propagateAlongThePath(G4double path) {
if (verboseLevel > 3) {
G4cout << " >>> G4CascadParticle::propagateAlongThePath" << G4endl;
}
const G4CascadeMomentum& mom = theParticle.getMomentum();
G4double pmod = theParticle.getMomModule();
for(G4int i = 0; i < 3; i++) position[i] += mom[i + 1] * path / pmod;
position += getMomentum().vect().unit()*path;
}
void G4CascadParticle::print() const {
theParticle.printParticle();
G4cout << " zone " << current_zone << " current_path " << current_path
<< " reflectionCounter " << reflectionCounter << G4endl
<< " x " << position.x() << " y " << position.y()
<< " z " << position.z() << G4endl;
}
@@ -1,242 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#include "G4CascadSpecialFunctions.hh"
std::pair<G4int, G4double>
G4CascadSpecialFunctions::getPositionInEnergyScale3(G4double e)
{
const G4double EMT3[30] = {
0.0, 0.01, 0.013, 0.018, 0.024, 0.032, 0.042, 0.056, 0.075, 0.1,
0.13, 0.18, 0.24, 0.32, 0.42, 0.56, 0.75, 1.0, 1.3, 1.8,
2.4, 3.2, 4.2, 5.6, 7.5, 10.0, 13.0, 18.0, 24.0, 32.0};
G4int ik = 29;
G4double sk = 1.0;
for (G4int i = 1; i < 30; i++) {
if (e <= EMT3[i]) {
ik = i;
sk = (e - EMT3[ik - 1]) / (EMT3[ik] - EMT3[ik - 1]);
break;
}
}
return std::pair<G4int, G4double>(ik, sk);
}
G4double
G4CascadSpecialFunctions::absorptionCrosSection(G4double e, G4int type)
{
G4int verboseLevel = 2;
if (verboseLevel > 3) {
G4cout << " >>> G4CascadSpecialFunctions::absorptionCrosSection type:" << type <<G4endl;
}
// was 0.2 since the beginning
const G4double corr_fac = 1.0;
G4double csec = 0.0;
if (e < 0.3) {
csec = 0.1106 / std::sqrt(e) - 0.8 + 0.08 / ((e - 0.123) * (e - 0.123) + 0.0056);
} else if (e < 1.0) {
csec = 3.6735 * (1.0 - e) * (1.0 - e);
};
if (csec < 0.0) csec = 0.0;
if (verboseLevel > 2) {
G4cout << " ekin " << e << " abs. csec " << corr_fac * csec << G4endl;
}
return corr_fac * csec;
}
G4double
G4CascadSpecialFunctions::crossSection(G4double e, G4int is)
{
//
// Total cross sections (mbarns)
//
const G4double PPtot[30] = {
17613.0, 302.9, 257.1, 180.6, 128.4, 90.5, 66.1, 49.4, 36.9, 29.6,
26.0, 23.1, 22.6, 23.0, 27.0, 32.0, 44.0, 47.04, 44.86, 46.03,
44.09, 41.81, 41.17, 40.65, 40.15, 40.18, 39.26, 38.36, 38.39, 38.41};
const G4double NPtot[30] = {
20357.0, 912.6, 788.6, 582.1, 415.0, 272.0, 198.8, 145.0, 100.4, 71.1,
58.8, 45.7, 38.9, 34.4, 34.0, 35.0, 37.5, 39.02, 40.29, 40.72,
42.36, 41.19, 42.04, 41.67, 40.96, 39.48, 39.79, 39.39, 39.36, 39.34};
const G4double pipPtot[30] = {
0.0, 1.2, 2.5, 3.8, 5.0, 7.0, 9.0, 15.0, 30.0, 64.0,
130.0, 190.0, 130.0, 56.0, 28.0, 17.14, 19.28, 27.4, 40.05, 32.52,
30.46, 29.0, 27.26, 25.84, 25.5, 24.5, 24.0, 23.5, 23.0, 23.0};
const G4double pimPtot[30] = {
0.0, 3.5, 4.0, 4.7, 6.0, 7.5, 8.3, 12.0, 14.4, 24.0,
44.0, 67.0, 45.06, 28.82, 28.98, 41.66, 37.32, 51.37, 35.67, 33.25,
31.84, 31.0, 29.32, 27.5, 26.5, 25.9, 25.5, 25.2, 25.0, 24.8};
const G4double pizPtot[30] = {
0.0, 3.55, 4.65, 5.9, 7.75, 10.1, 11.8, 18.0, 27.7, 52.5,
102.0, 150.0, 102.64, 51.03, 34.94, 34.52, 32.45, 44.05, 40.2, 34.93,
32.0, 30.0, 28.29, 26.91, 26.25, 25.25, 24.75, 24.35, 24.0, 23.9};
const G4double kpPtot[30] = {
10.0, 10.34, 10.44, 10.61, 10.82, 11.09, 11.43, 11.71, 11.75, 11.8,
11.98, 12.28, 12.56, 12.48, 12.67, 14.48, 15.92, 17.83, 17.93, 17.88,
17.46, 17.3, 17.3, 17.4, 17.4, 17.4, 17.4, 17.5, 17.7, 17.8};
const G4double kpNtot[30] = {
6.64, 6.99, 7.09, 7.27, 7.48, 7.75, 8.1, 8.49, 8.84, 9.31,
9.8, 10.62, 11.64, 13.08, 14.88, 16.60, 17.5, 18.68, 18.68, 18.29,
17.81, 17.6, 17.6, 17.6, 17.6, 17.6, 17.7, 17.8, 17.9, 18.0};
const G4double kmPtot[30] = {
1997.0, 1681.41, 1586.74, 1428.95, 1239.59, 987.12, 671.54, 377.85, 247.30, 75.54,
71.08, 54.74, 44.08, 44.38, 45.45, 45.07, 41.04, 35.75, 33.22, 30.08,
27.61, 26.5, 25.2, 24.0, 23.4, 22.8, 22.0, 21.3, 21.0, 20.9};
const G4double kmNtot[30] = {
6.15, 6.93, 7.16, 7.55, 8.02, 8.65, 9.43, 10.36, 11.34, 12.64,
14.01, 16.45, 19.32, 23.0, 27.6, 30.92, 29.78, 28.28, 25.62, 23.1,
22.31, 21.9, 21.73, 21.94, 21.23, 20.5, 20.4, 20.2, 20.1, 20.0};
const G4double lPtot[30] = {
300.0, 249.07, 233.8, 208.33, 177.78, 137.04, 86.11, 41.41, 28.86, 12.35,
13.82, 16.76, 20.68, 25.9, 30.37, 31.56, 32.83, 34.5, 34.91, 35.11,
35.03, 36.06, 35.13, 35.01, 35.0, 35.0, 35.0, 35.0, 35.0, 35.0};
const G4double spPtot[30] = {
150.0, 146.0, 144.8, 142.8, 140.4, 137.2, 133.2, 127.6, 120.0, 110.0,
98.06, 84.16, 72.28, 56.58, 43.22, 40.44, 36.14, 30.48, 31.53, 31.92,
29.25, 28.37, 29.81, 33.15, 33.95, 34.0, 34.0, 34.0, 34.0, 34.0};
const G4double smPtot[30] = {
937.0, 788.14, 743.48, 669.05, 579.74, 460.65, 311.79, 183.33, 153.65, 114.6,
105.18, 89.54, 70.58, 45.5, 32.17, 32.54, 32.95, 33.49, 33.55, 33.87,
34.02, 34.29, 33.93, 33.88, 34.0, 34.0, 34.0, 34.0, 34.0, 34.0};
const G4double xi0Ptot[30] = {
16.0, 14.72, 14.34, 13.7, 12.93, 11.9, 10.62, 9.29, 8.3, 7.0,
7.96, 9.56, 11.48, 14.04, 19.22, 25.29, 29.4, 34.8, 34.32, 33.33,
31.89, 29.55, 27.89, 21.43, 17.0, 16.0, 16.0, 16.0, 16.0, 16.0};
const G4double ximPtot[30] = {
33.0, 32.5, 32.35, 32.1, 31.8, 31.4, 30.9, 30.2, 29.25, 28.0,
26.5, 24.6, 22.8, 20.78, 18.22, 19.95, 21.7, 24.0, 24.74, 25.95,
27.59, 27.54, 23.16, 17.43, 12.94, 12.0, 12.0, 12.0, 12.0, 12.0};
G4double csec = 0.0;
G4int l = is;
if (l == 4) {
l = 1;
} else if (l == 10) {
l = 3;
} else if (l == 5 || l == 6) {
l = 4;
} else if (l == 7 || l == 14) {
l = 5;
};
std::pair<G4int, G4double> iksk = getPositionInEnergyScale3(e);
G4int ik = iksk.first;
G4double sk = iksk.second;
// pp, nn
if (l == 1) {
csec = PPtot[ik - 1] + sk * (PPtot[ik] - PPtot[ik - 1]);
// np
} else if (l == 2) {
csec = NPtot[ik - 1] + sk * (NPtot[ik] - NPtot[ik - 1]);
// pi+p, pi-n
} else if (l == 3) {
csec = pipPtot[ik - 1] + sk * (pipPtot[ik] - pipPtot[ik - 1]);
// pi-p, pi+n
} else if (l == 4) {
csec = pimPtot[ik - 1] + sk * (pimPtot[ik] - pimPtot[ik - 1]);
// pi0p, pi0n
} else if (l == 5) {
csec = pizPtot[ik - 1] + sk * (pizPtot[ik] - pizPtot[ik - 1]);
// k+ p, k0 n
} else if (l == 11 || l == 30) {
csec = kpPtot[ik - 1] + sk * (kpPtot[ik] - kpPtot[ik - 1]);
// k- p, k0b n
} else if (l == 13 || l == 34) {
csec = kmPtot[ik - 1] + sk * (kmPtot[ik] - kmPtot[ik - 1]);
// k+ n, k0 p
} else if (l == 22 || l == 15) {
csec = kpNtot[ik - 1] + sk * (kpNtot[ik] - kpNtot[ik - 1]);
// k- n, k0b p
} else if (l == 26 || l == 17) {
csec = kmNtot[ik - 1] + sk * (kmNtot[ik] - kmNtot[ik - 1]);
// L p, L n, S0 p, S0 n
} else if (l == 21 || l == 25 || l == 42 || l == 50) {
csec = lPtot[ik - 1] + sk * (lPtot[ik] - lPtot[ik - 1]);
// Sp p, Sm n
} else if (l == 23 || l == 54) {
csec = spPtot[ik - 1] + sk * (spPtot[ik] - spPtot[ik - 1]);
// Sm p, Sp n
} else if (l == 27 || l == 46) {
csec = smPtot[ik - 1] + sk * (smPtot[ik] - smPtot[ik - 1]);
// Xi0 p, Xi- n
} else if (l == 29 || l == 62) {
csec = xi0Ptot[ik - 1] + sk * (xi0Ptot[ik] - xi0Ptot[ik - 1]);
// Xi- p, Xi0 n
} else if (l == 31 || l == 58) {
csec = ximPtot[ik - 1] + sk * (ximPtot[ik] - ximPtot[ik - 1]);
} else {
G4cout << " unknown collison type = " << l << G4endl;
csec = 0.0;
}
return csec;
}
@@ -23,53 +23,18 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeChannel.cc,v 1.8 2010/06/25 09:44:02 gunter Exp $
// GEANT4 tag: $Name: geant4-09-04-beta-01 $
//
// 20100514 M. Kelsey -- All functionality removed except quantum-number
// validation functions.
#include "G4CascadeChannel.hh"
#include "Randomize.hh"
std::pair<G4int, G4double>
G4CascadeChannel::interpolateEnergy(G4double e)
{
G4int index = 30;
G4double fraction = 0.0;
for (G4int i = 1; i < 31; i++) {
if (e < energyScale[i]) {
index = i-1;
fraction = (e - energyScale[index]) / (energyScale[i] - energyScale[index]);
break;
}
}
return std::pair<G4int, G4double>(index, fraction);
}
#include "G4ParticleDefinition.hh"
#include <vector>
G4int
G4CascadeChannel::sampleFlat(std::vector<G4double> const& sigma)
{
G4int i;
G4double sum(0.);
for (i = 0; i < G4int(sigma.size()); i++) sum += sigma[i];
G4double fsum = sum*G4UniformRand();
G4double partialSum = 0.0;
G4int channel = 0;
for (i = 0; i < G4int(sigma.size()); i++) {
partialSum += sigma[i];
if (fsum < partialSum) {
channel = i;
break;
}
}
return channel;
}
std::vector<G4int>
G4CascadeChannel::getQnums(G4int type)
{
std::vector<G4int> G4CascadeChannel::getQnums(G4int type) {
G4int bary=0, str=0, ch=0;
std::vector<G4int> Qnums(3);
@@ -159,9 +124,51 @@ G4CascadeChannel::getQnums(G4int type)
return Qnums;
}
void
G4CascadeChannel::CheckQnums(const G4FastVector<G4ReactionProduct,256> &vec,
G4int &vecLen,
G4ReactionProduct &currentParticle,
G4ReactionProduct &targetParticle,
G4double Q, G4double B, G4double S) {
G4ParticleDefinition* projDef = currentParticle.GetDefinition();
G4ParticleDefinition* targDef = targetParticle.GetDefinition();
G4double chargeSum = projDef->GetPDGCharge() + targDef->GetPDGCharge();
G4double baryonSum = projDef->GetBaryonNumber() + targDef->GetBaryonNumber();
G4double strangenessSum = projDef->GetQuarkContent(3) -
projDef->GetAntiQuarkContent(3) +
targDef->GetQuarkContent(3) -
targDef->GetAntiQuarkContent(3);
G4ParticleDefinition* secDef = 0;
for (G4int i = 0; i < vecLen; i++) {
secDef = vec[i]->GetDefinition();
chargeSum += secDef->GetPDGCharge();
baryonSum += secDef->GetBaryonNumber();
strangenessSum += secDef->GetQuarkContent(3)
- secDef->GetAntiQuarkContent(3);
}
const G4double G4CascadeChannel::energyScale[31] =
{ 0.0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45,
0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0,
5.5, 6.0, 6.5, 7.0, 7.5, 8.0, 8.5, 9.0, 9.5, 10.0, 15.0 };
G4bool OK = true;
if (chargeSum != Q) {
G4cout << " Charge not conserved " << G4endl;
OK = false;
}
if (baryonSum != B) {
G4cout << " Baryon number not conserved " << G4endl;
OK = false;
}
if (strangenessSum != S) {
G4cout << " Strangeness not conserved " << G4endl;
OK = false;
}
if (!OK) {
G4cout << " projectile: " << projDef->GetParticleName()
<< " target: " << targDef->GetParticleName() << G4endl;
for (G4int i = 0; i < vecLen; i++) {
secDef = vec[i]->GetDefinition();
G4cout << secDef->GetParticleName() << " " ;
}
G4cout << G4endl;
}
}
@@ -0,0 +1,250 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeCheckBalance.cc,v 1.19 2010/10/19 19:48:32 mkelsey Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// Verify and report four-momentum conservation for collision output; uses
// same interface as collision generators.
//
// 20100624 M. Kelsey -- Add baryon number, charge, and kinetic energy
// 20100624 M. Kelsey -- Bug fix: All checks should be |delta| !
// 20100627 M. Kelsey -- Always report violations on cerr, regardless of
// verbosity.
// 20100628 M. Kelsey -- Add interface to take list of particles directly,
// bug fix reporting of charge conservation error.
// 20100630 M. Kelsey -- for nuclei, include excitation energies in total.
// 20100701 M. Kelsey -- Undo previous change, handled by G4InuclNuclei.
// 20100711 M. Kelsey -- Use name of parent collider for reporting messages
// 20100713 M. kelsey -- Hide conservation errors behind verbosity
// 20100715 M. Kelsey -- Use new G4CollisionOutput totals instead of loops,
// move temporary buffer to be data member
// 20100719 M. Kelsey -- Change zero tolerance to 10 keV instead of 1 keV.
// 20100909 M. Kelsey -- Add interface for both kinds of particle lists
// 20101019 M. Kelsey -- CoVerity report: unitialized constructor
#include "G4CascadeCheckBalance.hh"
#include "globals.hh"
#include "G4CascadParticle.hh"
#include "G4InuclElementaryParticle.hh"
#include "G4InuclNuclei.hh"
#include "G4InuclParticle.hh"
#include "G4CollisionOutput.hh"
#include "G4LorentzVector.hh"
#include <vector>
// Constructor sets acceptance limits
const G4double G4CascadeCheckBalance::tolerance = 1e-6; // How small is zero?
G4CascadeCheckBalance::G4CascadeCheckBalance(G4double relative,
G4double absolute,
const char* owner)
: G4VCascadeCollider(owner), relativeLimit(relative),
absoluteLimit(absolute), initialBaryon(0), finalBaryon(0),
initialCharge(0), finalCharge(0) {}
// Pseudo-collision just computes input and output four-vectors
void G4CascadeCheckBalance::collide(G4InuclParticle* bullet,
G4InuclParticle* target,
G4CollisionOutput& output) {
if (verboseLevel > 1)
G4cout << " >>> G4CascadeCheckBalance(" << theName << ")::collide"
<< G4endl;
initial *= 0.; // Fast reset; some colliders only have one pointer
if (bullet) initial += bullet->getMomentum();
if (target) initial += target->getMomentum();
// Baryon number and charge must be computed "by hand"
initialCharge = 0;
if (bullet) initialCharge += G4int(bullet->getCharge());
if (target) initialCharge += G4int(target->getCharge());
G4InuclElementaryParticle* pbullet =
dynamic_cast<G4InuclElementaryParticle*>(bullet);
G4InuclElementaryParticle* ptarget =
dynamic_cast<G4InuclElementaryParticle*>(target);
G4InuclNuclei* nbullet = dynamic_cast<G4InuclNuclei*>(bullet);
G4InuclNuclei* ntarget = dynamic_cast<G4InuclNuclei*>(target);
initialBaryon =
((pbullet ? pbullet->baryon() : nbullet ? nbullet->getA() : 0) +
(ptarget ? ptarget->baryon() : ntarget ? ntarget->getA() : 0) );
// Final state totals are computed for us
final = output.getTotalOutputMomentum();
finalBaryon = output.getTotalBaryonNumber();
finalCharge = output.getTotalCharge();
// Report results
if (verboseLevel > 2) {
G4cout << " initial px " << initial.px() << " py " << initial.py()
<< " pz " << initial.pz() << " E " << initial.e()
<< " baryon " << initialBaryon << " charge " << initialCharge
<< "\n final px " << final.px() << " py " << final.py()
<< " pz " << final.pz() << " E " << final.e()
<< " baryon " << finalBaryon << " charge " << finalCharge << G4endl;
}
}
// Take list of output particles directly (e.g., from G4EPCollider internals)
void G4CascadeCheckBalance::collide(G4InuclParticle* bullet,
G4InuclParticle* target,
const std::vector<G4InuclElementaryParticle>& particles) {
if (verboseLevel > 1)
G4cout << " >>> G4CascadeCheckBalance(" << theName << ")::collide(<vector>)"
<< G4endl;
tempOutput.reset(); // Buffer for processing
tempOutput.addOutgoingParticles(particles);
collide(bullet, target, tempOutput);
}
// Take list of nuclear fragments directly (e.g., from G4Fissioner internals)
void G4CascadeCheckBalance::collide(G4InuclParticle* bullet,
G4InuclParticle* target,
const std::vector<G4InuclNuclei>& fragments) {
if (verboseLevel > 1)
G4cout << " >>> G4CascadeCheckBalance(" << theName << ")::collide(<vector>)"
<< G4endl;
tempOutput.reset(); // Buffer for processing
tempOutput.addOutgoingNuclei(fragments);
collide(bullet, target, tempOutput);
}
// Take list of "cparticles" (e.g., from G4NucleiModel internals)
void G4CascadeCheckBalance::collide(G4InuclParticle* bullet,
G4InuclParticle* target,
const std::vector<G4CascadParticle>& particles) {
if (verboseLevel > 1)
G4cout << " >>> G4CascadeCheckBalance(" << theName
<< ")::collide(<cparticles>)" << G4endl;
tempOutput.reset(); // Buffer for processing
tempOutput.addOutgoingParticles(particles);
collide(bullet, target, tempOutput);
}
// Take lists of both G4InuclEP & G4CP (e.g., from G4IntraNucleiCascader)
void G4CascadeCheckBalance::collide(G4InuclParticle* bullet,
G4InuclParticle* target,
const std::vector<G4InuclElementaryParticle>& particles,
const std::vector<G4CascadParticle>& cparticles) {
if (verboseLevel > 1)
G4cout << " >>> G4CascadeCheckBalance(" << theName
<< ")::collide(<EP>,<CP>)" << G4endl;
tempOutput.reset(); // Buffer for processing
tempOutput.addOutgoingParticles(particles);
tempOutput.addOutgoingParticles(cparticles);
collide(bullet, target, tempOutput);
}
// Compare relative and absolute violations to limits, and report
G4bool G4CascadeCheckBalance::energyOkay() const {
G4bool relokay = (std::abs(relativeE()) < relativeLimit);
G4bool absokay = (std::abs(deltaE()) < absoluteLimit);
if (verboseLevel && (!relokay || !absokay)) {
G4cerr << theName << ": Energy conservation: relative " << relativeE()
<< (relokay ? " conserved" : " VIOLATED")
<< " absolute " << deltaE()
<< (absokay ? " conserved" : " VIOLATED") << G4endl;
} else if (verboseLevel > 2) {
G4cout << theName << ": Energy conservation: relative " << relativeE()
<< " conserved absolute " << deltaE() << " conserved" << G4endl;
}
return (relokay && absokay);
}
G4bool G4CascadeCheckBalance::ekinOkay() const {
G4bool relokay = (std::abs(relativeKE()) < relativeLimit);
G4bool absokay = (std::abs(deltaKE()) < absoluteLimit);
if (verboseLevel && (!relokay || !absokay)) {
G4cerr << theName << ": Kinetic energy balance: relative "
<< relativeKE() << (relokay ? " conserved" : " VIOLATED")
<< " absolute " << deltaKE()
<< (absokay ? " conserved" : " VIOLATED") << G4endl;
} else if (verboseLevel > 2) {
G4cout << theName << ": Kinetic energy balance: relative "
<< relativeKE() << " conserved absolute " << deltaKE()
<< " conserved" << G4endl;
}
return (relokay && absokay);
}
G4bool G4CascadeCheckBalance::momentumOkay() const {
G4bool relokay = (std::abs(relativeP()) < relativeLimit);
G4bool absokay = (std::abs(deltaP()) < absoluteLimit);
if (verboseLevel && (!relokay || !absokay)) {
G4cerr << theName << ": Momentum conservation: relative " << relativeP()
<< (relokay ? " conserved" : " VIOLATED")
<< " absolute " << deltaP()
<< (absokay ? " conserved" : " VIOLATED") << G4endl;
} else if (verboseLevel > 2) {
G4cout << theName << ": Momentum conservation: relative " << relativeP()
<< " conserved absolute " << deltaP() << " conserved" << G4endl;
}
return (relokay && absokay);
}
G4bool G4CascadeCheckBalance::baryonOkay() const {
G4bool bokay = (deltaB() == 0); // Must be perfect!
if (verboseLevel && !bokay)
G4cerr << theName << ": Baryon number VIOLATED " << deltaB() << G4endl;
return bokay;
}
G4bool G4CascadeCheckBalance::chargeOkay() const {
G4bool qokay = (deltaQ() == 0); // Must be perfect!
if (verboseLevel && !qokay)
G4cerr << theName << ": Charge conservation VIOLATED " << deltaQ()
<< G4endl;
return qokay;
}
@@ -0,0 +1,184 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeColliderBase.cc,v 1.6 2010/12/15 07:40:08 gunter Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100714 M. Kelsey -- Move functionality from G4VCascadeCollider, and
// provide conservation-checking here, with wrapper function
// and control flag.
// 20100721 M. Kelsey -- Use G4CASCADE_CHECK_ECONS to set default control
// flag for validations.
// 20100923 M. Kelsey -- Migrate to integer A and Z
// 20100925 M. Kelsey -- Add explosion() interfaces for G4Fragment and for
// (A,Z,E). Move implementation to latter. Add Z==0 condition.
#include "G4CascadeColliderBase.hh"
#include "G4CascadeCheckBalance.hh"
#include "G4CollisionOutput.hh"
#include "G4Fragment.hh"
#include "G4InteractionCase.hh"
#include "G4InuclElementaryParticle.hh"
#include "G4InuclNuclei.hh"
#include "G4InuclSpecialFunctions.hh"
#include "G4ios.hh"
using namespace G4InuclSpecialFunctions;
// Constructor and destructor
G4CascadeColliderBase::G4CascadeColliderBase(const char* name, G4int verbose)
: G4VCascadeCollider(name, verbose),
#ifdef G4CASCADE_CHECK_ECONS
doConservationChecks(true),
#else
doConservationChecks(false),
#endif
balance(new G4CascadeCheckBalance(0.001, 0.001, name)) {}
G4CascadeColliderBase::~G4CascadeColliderBase() {
delete balance;
}
// Both bullet and target must be hadrons or leptons for this to work
G4bool G4CascadeColliderBase::useEPCollider(G4InuclParticle* bullet,
G4InuclParticle* target) const {
return (dynamic_cast<G4InuclElementaryParticle*>(bullet) &&
dynamic_cast<G4InuclElementaryParticle*>(target));
}
// Decide wether nuclear fragment is candidate for G4BigBanger
G4bool G4CascadeColliderBase::explosion(G4InuclNuclei* target) const {
return target && explosion(target->getA(), target->getZ(),
target->getExitationEnergy()); // in MeV
}
G4bool G4CascadeColliderBase::explosion(G4Fragment* fragment) const {
return fragment && explosion(fragment->GetA_asInt(), fragment->GetZ_asInt(),
fragment->GetExcitationEnergy()); // in MeV
}
G4bool
G4CascadeColliderBase::explosion(G4int A, G4int Z,
G4double excitation) const {
if (verboseLevel) G4cout << " >>> " << theName << "::explosion ?" << G4endl;
const G4int a_cut = 20;
const G4double be_cut = 3.0;
// Neutron balls, or small fragments with high excitations can explode
return ((A <= a_cut || Z==0) &&
(excitation >= be_cut * bindingEnergy(A,Z))
);
}
// Decide whether bullet-target interaction is candidate for cascade
G4bool
G4CascadeColliderBase::inelasticInteractionPossible(G4InuclParticle* bullet,
G4InuclParticle* target,
G4double ekin) const {
if (verboseLevel) {
G4cout << " >>> " << theName << "::inelasticInteractionPossible" << G4endl;
}
// If hadron-hadron collision, defer to ElementaryParticleCollider
if (useEPCollider(bullet, target)) return true;
// See which one of the two (or both) is a nucleus, get properties
// FIXME: Should set a = baryon() for both, but that's not in base
G4InuclNuclei* nuclei_bullet = dynamic_cast<G4InuclNuclei*>(bullet);
G4double ab = nuclei_bullet ? nuclei_bullet->getA() : 1; // FIXME
G4double zb = nuclei_bullet ? nuclei_bullet->getZ() : bullet->getCharge();
G4InuclNuclei* nuclei_target = dynamic_cast<G4InuclNuclei*>(target);
G4double at = nuclei_target ? nuclei_target->getA() : 1; // FIXME
G4double zt = nuclei_target ? nuclei_target->getZ() : target->getCharge();
// VCOL (Coulomb barrier) used for testing if elastic collision necessary
const G4double coeff = 0.001 * 1.2;
G4double VCOL = coeff * zt * zb / (G4cbrt(at) + G4cbrt(ab));
G4bool possible = true; // Force inelastic; should be (ekin >= VCOL)
if (verboseLevel > 3) {
G4cout << " VCOL: " << VCOL << " ekin: " << ekin << " inelastic possible: "
<< possible << G4endl;
}
return possible;
}
// Validate output for energy, momentum conservation, etc.
G4bool G4CascadeColliderBase::validateOutput(G4InuclParticle* bullet,
G4InuclParticle* target,
G4CollisionOutput& output) {
if (!doConservationChecks) return true; // Skip checks if requested
if (verboseLevel > 1)
G4cout << " >>> " << theName << "::validateOutput" << G4endl;
// Show final state particles
if (verboseLevel > 2) output.printCollisionOutput();
balance->setVerboseLevel(verboseLevel);
balance->collide(bullet, target, output);
return balance->okay(); // Returns false if violations
}
G4bool G4CascadeColliderBase::validateOutput(G4InuclParticle* bullet,
G4InuclParticle* target,
const std::vector<G4InuclElementaryParticle>& particles) {
if (!doConservationChecks) return true; // Skip checks if requested
if (verboseLevel > 1)
G4cout << " >>> " << theName << "::validateOutput" << G4endl;
balance->setVerboseLevel(verboseLevel);
balance->collide(bullet, target, particles);
return balance->okay(); // Returns false if violations
}
G4bool G4CascadeColliderBase::validateOutput(G4InuclParticle* bullet,
G4InuclParticle* target,
const std::vector<G4InuclNuclei>& fragments) {
if (!doConservationChecks) return true; // Skip checks if requested
if (verboseLevel > 1)
G4cout << " >>> " << theName << "::validateOutput" << G4endl;
balance->setVerboseLevel(verboseLevel);
balance->collide(bullet, target, fragments);
return balance->okay(); // Returns false if violations
}
@@ -0,0 +1,135 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeDeexcitation.cc,v 1.4 2010/12/15 07:40:10 gunter Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// Takes an arbitrary excited or unphysical nuclear state and produces
// a final state with evaporated particles and (possibly) a stable nucleus.
//
// 20100926 M. Kelsey -- Move to new G4VCascadeDeexcitation base class.
#include "G4CascadeDeexcitation.hh"
#include "globals.hh"
#include "G4BigBanger.hh"
#include "G4EquilibriumEvaporator.hh"
#include "G4NonEquilibriumEvaporator.hh"
#include "G4InuclNuclei.hh"
#include "G4InuclParticle.hh"
// Constructor and destructor
G4CascadeDeexcitation::G4CascadeDeexcitation()
: G4VCascadeDeexcitation("G4CascadeDeexcitation"),
theBigBanger(new G4BigBanger),
theNonEquilibriumEvaporator(new G4NonEquilibriumEvaporator),
theEquilibriumEvaporator(new G4EquilibriumEvaporator) {}
G4CascadeDeexcitation::~G4CascadeDeexcitation() {
delete theBigBanger;
delete theNonEquilibriumEvaporator;
delete theEquilibriumEvaporator;
}
// Convert generic G4Fragment into Bertini particle
void G4CascadeDeexcitation::deExcite(G4Fragment* fragment,
G4CollisionOutput& globalOutput) {
if (verboseLevel > 1) {
G4cout << " >>> G4CascadeDeexcitation::deExcite" << G4endl;
}
if (!fragment) {
if (verboseLevel > 1) G4cerr << " NULL pointer fragment" << G4endl;
return;
}
if (verboseLevel > 1) G4cout << *fragment << G4endl;
G4InuclNuclei target(*fragment);
collide(0, &target, globalOutput);
}
// Main processing
void G4CascadeDeexcitation::collide(G4InuclParticle* /*bullet*/,
G4InuclParticle* target,
G4CollisionOutput& globalOutput) {
if (verboseLevel > 1) {
G4cout << " >>> G4CascadeDeexcitation::collide" << G4endl;
}
// Initialize colliders verbosity
theBigBanger->setVerboseLevel(verboseLevel);
theNonEquilibriumEvaporator->setVerboseLevel(verboseLevel);
theEquilibriumEvaporator->setVerboseLevel(verboseLevel);
// Ensure that input state is sensible
G4InuclNuclei* ntarget = dynamic_cast<G4InuclNuclei*>(target);
if (!ntarget) {
G4cerr << " G4CascadeDeexcitation ERROR: target must be G4InuclNuclei"
<< G4endl;
return;
}
// Check if fragment should be broken up
if (explosion(ntarget)) {
if (verboseLevel > 1) G4cout << " big bang after cascade " << G4endl;
// Add result of explosion diretly to output and exit
theBigBanger->collide(0, target, globalOutput);
return;
}
// Fragment is unstable nucleus
output.reset();
theNonEquilibriumEvaporator->collide(0, target, output);
if (verboseLevel > 1) {
G4cout << " After NonEquilibriumEvaporator " << G4endl;
}
// Copy evaporated particles (not nuclear fragment) to output
globalOutput.addOutgoingParticles(output.getOutgoingParticles());
// Use nuclear fragment left from non-equilibrium for next step
// NOT: Must make a copy before reset occurs below
G4InuclNuclei exciton = output.getOutgoingNuclei()[0];
output.reset();
theEquilibriumEvaporator->collide(0, &exciton, output);
if (verboseLevel > 1) {
G4cout << " After EquilibriumEvaporator " << G4endl;
}
validateOutput(0, target, output); // Check conservation
globalOutput.add(output); // Evaporated particles and nucleus
}
@@ -1,398 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#include "G4CascadeElasticInterface.hh"
#include "globals.hh"
#include "G4DynamicParticleVector.hh"
#include "G4IonTable.hh"
#include "G4InuclCollider.hh"
#include "G4IntraNucleiCascader.hh"
#include "G4ElementaryParticleCollider.hh"
#include "G4NonEquilibriumEvaporator.hh"
#include "G4EquilibriumEvaporator.hh"
#include "G4Fissioner.hh"
#include "G4BigBanger.hh"
#include "G4InuclElementaryParticle.hh"
#include "G4InuclNuclei.hh"
#include "G4InuclParticle.hh"
#include "G4CollisionOutput.hh"
#include "G4V3DNucleus.hh"
#include "G4Track.hh"
#include "G4Nucleus.hh"
#include "G4NucleiModel.hh"
#include "G4LorentzRotation.hh"
typedef std::vector<G4InuclElementaryParticle>::iterator particleIterator;
typedef std::vector<G4InuclNuclei>::iterator nucleiIterator;
G4CascadeElasticInterface::G4CascadeElasticInterface()
:verboseLevel(0) {
if (verboseLevel > 3) {
G4cout << " >>> G4CascadeElasticInterface::G4CascadeElasticInterface" << G4endl;
}
}
G4ReactionProductVector* G4CascadeElasticInterface::Propagate(G4KineticTrackVector* ,
G4V3DNucleus* ) {
return 0;
}
// #define debug_G4CascadeElasticInterface
G4HadFinalState* G4CascadeElasticInterface::ApplyYourself(const G4HadProjectile& aTrack,
G4Nucleus& theNucleus) {
#ifdef debug_G4CascadeElasticInterface
static G4int counter(0);
counter++;
G4cerr << "Reaction number "<< counter << " "<<aTrack.GetDynamicParticle()->GetDefinition()->GetParticleName()<<" "<< aTrack.GetDynamicParticle()->GetKineticEnergy()<<G4endl;
#endif
theResult.Clear();
if (verboseLevel > 3) {
G4cout << " >>> G4CascadeElasticInterface::ApplyYourself" << G4endl;
};
G4double eInit = 0.0;
G4double eTot = 0.0;
G4double sumBaryon = 0.0;
G4double sumEnergy = 0.0;
// Make conversion between native Geant4 and Bertini cascade classes.
// NOTE: Geant4 units are MeV = 1 and GeV = 1000. Cascade code by default use GeV = 1.
enum particleType { nuclei = 0, proton = 1, neutron = 2, pionPlus = 3, pionMinus = 5, pionZero = 7, photon = 10 };
G4int bulletType = 0;
// Coding particles
if (aTrack.GetDefinition() == G4Proton::Proton() ) bulletType = proton;
if (aTrack.GetDefinition() == G4Neutron::Neutron() ) bulletType = neutron;
if (aTrack.GetDefinition() == G4PionPlus::PionPlus() ) bulletType = pionPlus;
if (aTrack.GetDefinition() == G4PionMinus::PionMinus() ) bulletType = pionMinus;
if (aTrack.GetDefinition() == G4PionZero::PionZero() ) bulletType = pionZero;
if (aTrack.GetDefinition() == G4Gamma::Gamma() ) bulletType = photon;
// Code momentum and energy.
G4double px,py,pz;
px=aTrack.Get4Momentum().px() / GeV;
py=aTrack.Get4Momentum().py() / GeV;
pz=aTrack.Get4Momentum().pz() / GeV;
G4LorentzVector projectileMomentum = aTrack.Get4Momentum();
G4LorentzRotation toZ;
toZ.rotateZ(-projectileMomentum.phi());
toZ.rotateY(-projectileMomentum.theta());
G4LorentzRotation toLabFrame = toZ.inverse();
G4CascadeMomentum momentumBullet;
momentumBullet[0] =0.;
momentumBullet[1] =0;
momentumBullet[2] =0;
momentumBullet[3] =std::sqrt(px*px+py*py+pz*pz);
G4InuclElementaryParticle * bullet = new G4InuclElementaryParticle(momentumBullet, bulletType);
sumEnergy = bullet->getKineticEnergy(); // In GeV
if (bulletType == proton || bulletType == neutron) {
sumBaryon += 1;
}
// Set target
G4InuclNuclei* target = 0;
G4InuclParticle* targetH = 0;
// and outcoming particles
G4DynamicParticle* cascadeParticle = 0;
G4CascadeMomentum targetMomentum;
G4double theNucleusA = theNucleus.GetN();
if ( !(G4int(theNucleusA) == 1) ) {
target = new G4InuclNuclei(targetMomentum,
theNucleusA,
theNucleus.GetZ());
target->setEnergy();
const G4CascadeMomentum& bmom = bullet->getMomentum();
eInit = std::sqrt(bmom[0] * bmom[0]);
const G4CascadeMomentum& tmom = target->getMomentum();
eInit += std::sqrt(tmom[0] * tmom[0]);
sumBaryon += theNucleusA;
if (verboseLevel > 2) {
G4cout << "Bullet: " << G4endl;
bullet->printParticle();
}
if (verboseLevel > 2) {
G4cout << "Target: " << G4endl;
target->printParticle();
}
}
G4CollisionOutput output;
// Colliders initialisation
G4ElementaryParticleCollider* colep = new G4ElementaryParticleCollider;
G4IntraNucleiCascader* inc = new G4IntraNucleiCascader; // the actual cascade
inc->setInteractionCase(1); // Interaction type is particle with nuclei.
G4NonEquilibriumEvaporator* noneq = new G4NonEquilibriumEvaporator;
G4EquilibriumEvaporator* eqil = new G4EquilibriumEvaporator;
G4Fissioner* fiss = new G4Fissioner;
G4BigBanger* bigb = new G4BigBanger;
G4InuclCollider* collider = new G4InuclCollider(colep, inc, noneq, eqil, fiss, bigb);
G4int maxTries = 10; // maximum tries for inelastic collision to avoid infinite loop
G4int nTries = 0; // try counter
if (G4int(theNucleusA) == 1) { // special treatment for target H(1,1) (proton)
targetH = new G4InuclElementaryParticle(targetMomentum, 1);
G4float cutElastic[8];
cutElastic[proton ] = 1.0; // GeV
cutElastic[neutron ] = 1.0;
cutElastic[pionPlus ] = 0.6;
cutElastic[pionMinus] = 0.2;
cutElastic[pionZero ] = 0.2;
if (momentumBullet[3] > cutElastic[bulletType]) { // inelastic collision possible
do { // we try to create inelastic interaction
output = collider->collide(bullet, targetH);
nTries++;
} while(
(nTries < maxTries) &&
(output.getOutgoingParticles().size() == 2 && // elastic: bullet + p = H(1,1) coming out
(output.getOutgoingParticles().begin()->type() == bulletType ||
output.getOutgoingParticles().begin()->type() == proton)
)
);
} else { // only elastic collision is energetically possible
output = collider->collide(bullet, targetH);
}
sumBaryon += 1;
const G4CascadeMomentum& bmom = bullet->getMomentum();
eInit = std::sqrt(bmom[0] * bmom[0]);
const G4CascadeMomentum& tmom = targetH->getMomentum();
eInit += std::sqrt(tmom[0] * tmom[0]);
if (verboseLevel > 2) {
G4cout << "Target: " << G4endl;
targetH->printParticle();
}
} else { // treat all other targets excepet H(1,1)
do // we try to create inelastic interaction
{
output = collider->collide(bullet, target );
nTries++;
} while(
(nTries < maxTries) &&
(output.getOutgoingParticles().size() + output.getNucleiFragments().size() < 2.5) &&
(output.getOutgoingParticles().size()!=0) &&
(output.getOutgoingParticles().begin()->type()==bullet->type())
);
}
if (verboseLevel > 1)
{
G4cout << " Cascade output: " << G4endl;
output.printCollisionOutput();
}
// Convert cascade data to use hadronics interface
std::vector<G4InuclNuclei> nucleiFragments = output.getNucleiFragments();
std::vector<G4InuclElementaryParticle> particles = output.getOutgoingParticles();
theResult.SetStatusChange(stopAndKill);
if (!particles.empty()) {
particleIterator ipart;
G4int outgoingParticle;
for (ipart = particles.begin(); ipart != particles.end(); ipart++) {
outgoingParticle = ipart->type();
const G4CascadeMomentum& mom = ipart->getMomentum();
eTot += std::sqrt(mom[0] * mom[0]);
G4double ekin = ipart->getKineticEnergy() * GeV;
G4ThreeVector aMom(mom[1], mom[2], mom[3]);
aMom = aMom.unit();
if (outgoingParticle == proton || outgoingParticle == neutron) {
sumBaryon -= 1;
}
sumEnergy -= ekin / GeV;
switch(outgoingParticle) {
case proton:
#ifdef debug_G4CascadeElasticInterface
G4cerr << "proton " << counter << " " << aMom << " " << ekin << G4endl;
#endif
cascadeParticle =
new G4DynamicParticle(G4Proton::ProtonDefinition(), aMom, ekin);
break;
case neutron:
#ifdef debug_G4CascadeElasticInterface
G4cerr << "neutron "<< counter<<" "<<aMom<<" "<< ekin<<G4endl;
#endif
cascadeParticle =
new G4DynamicParticle(G4Neutron::NeutronDefinition(), aMom, ekin);
break;
case pionPlus:
cascadeParticle =
new G4DynamicParticle(G4PionPlus::PionPlusDefinition(), aMom, ekin);
#ifdef debug_G4CascadeElasticInterface
G4cerr << "pionPlus "<< counter<<" "<<aMom<<" "<< ekin<<G4endl;
#endif
break;
case pionMinus:
cascadeParticle =
new G4DynamicParticle(G4PionMinus::PionMinusDefinition(), aMom, ekin);
#ifdef debug_G4CascadeElasticInterface
G4cerr << "pionMinus "<< counter<<" "<<aMom<<" "<< ekin<<G4endl;
#endif
break;
case pionZero:
cascadeParticle =
new G4DynamicParticle(G4PionZero::PionZeroDefinition(), aMom, ekin);
#ifdef debug_G4CascadeElasticInterface
G4cerr << "pionZero "<< counter<<" "<<aMom<<" "<< ekin<<G4endl;
#endif
break;
case photon:
cascadeParticle =
new G4DynamicParticle(G4Gamma::Gamma(), aMom, ekin);
#ifdef debug_G4CascadeElasticInterface
G4cerr << "photon "<< counter<<" "<<aMom<<" "<< ekin<<G4endl;
#endif
break;
default:
G4cout << " ERROR: G4CascadeElasticInterface::Propagate undefined particle type"
<< G4endl;
}
cascadeParticle->Set4Momentum(cascadeParticle->Get4Momentum()*=toLabFrame);
theResult.AddSecondary(cascadeParticle);
}
}
// get nuclei fragments
G4DynamicParticle * aFragment = 0;
G4ParticleDefinition * aIonDef = 0;
G4ParticleTable *theTableOfParticles = G4ParticleTable::GetParticleTable();
if (!nucleiFragments.empty()) {
nucleiIterator ifrag;
for (ifrag = nucleiFragments.begin(); ifrag != nucleiFragments.end(); ifrag++)
{
G4double eKin = ifrag->getKineticEnergy() * GeV;
const G4CascadeMomentum& mom = ifrag->getMomentum();
eTot += std::sqrt(mom[0] * mom[0]);
G4ThreeVector aMom(mom[1], mom[2], mom[3]);
aMom = aMom.unit();
// hpw @@@ ==> Should be zero: G4double fragmentExitation = ifrag->getExitationEnergyInGeV();
if (verboseLevel > 2) {
G4cout << " Nuclei fragment: " << G4endl;
ifrag->printParticle();
}
G4int A = G4int(ifrag->getA());
G4int Z = G4int(ifrag->getZ());
aIonDef = theTableOfParticles->FindIon(Z, A, 0, Z);
aFragment = new G4DynamicParticle(aIonDef, aMom, eKin);
sumBaryon -= A;
sumEnergy -= eKin / GeV;
aFragment->Set4Momentum(aFragment->Get4Momentum()*=toLabFrame);
theResult.AddSecondary(aFragment);
}
}
if (verboseLevel > 2) {
if (sumBaryon != 0) {
G4cout << "ERROR: no baryon number conservation, sum of baryons = "
<< sumBaryon << G4endl;
}
if (sumEnergy > 0.01 ) {
G4cout << "Kinetic energy conservation violated by "
<< sumEnergy << " GeV" << G4endl;
}
G4cout << "Total energy conservation at level ~"
<< (eInit - eTot) * GeV << " MeV" << G4endl;
if (sumEnergy < -5.0e-5 ) { // 0.05 MeV
G4cout << "FATAL ERROR: energy created "
<< sumEnergy * GeV << " MeV" << G4endl;
}
}
delete bullet;
delete colep;
delete inc;
delete noneq;
delete fiss;
delete eqil;
delete bigb;
delete collider;
if(target != 0) delete target;
if(targetH != 0) delete targetH;
// if(cascadeParticle != 0) delete cascadeParticle;
// if(aFragment != 0) delete aFragment;
return &theResult;
}
@@ -23,503 +23,462 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeInterface.cc,v 1.105 2010/12/15 07:40:15 gunter Exp $
// Geant4 tag: $Name: geant4-09-04 $
//
// 20100114 M. Kelsey -- Remove G4CascadeMomentum, use G4LorentzVector directly
// 20100413 M. Kelsey -- Pass G4CollisionOutput by ref to ::collide()
// 20100414 M. Kelsey -- Check for K0L/K0S before using G4InuclElemPart::type
// 20100418 M. Kelsey -- Reference output particle lists via const-ref, use
// const_iterator for both.
// 20100428 M. Kelsey -- Use G4InuclParticleNames enum
// 20100429 M. Kelsey -- Change "case gamma:" to "case photon:"
// 20100517 M. Kelsey -- Follow new ctors for G4*Collider family.
// 20100520 M. Kelsey -- Simplify collision loop, move momentum rotations to
// G4CollisionOutput, copy G4DynamicParticle directly from
// G4InuclParticle, no switch-block required.
// 20100615 M. Kelsey -- Bug fix: For K0's need ekin in GEANT4 units
// 20100617 M. Kelsey -- Rename "debug_" preprocessor flag to G4CASCADE_DEBUG,
// and "BERTDEV" to "G4CASCADE_COULOMB_DEV"
// 20100617 M. Kelsey -- Make G4InuclCollider a local data member
// 20100618 M. Kelsey -- Deploy energy-conservation test on final state, with
// preprocessor flag G4CASCADE_SKIP_ECONS to skip test.
// 20100620 M. Kelsey -- Use new energy-conservation pseudo-collider
// 20100621 M. Kelsey -- Fix compiler warning from GCC 4.5
// 20100624 M. Kelsey -- Fix cascade loop to check nTries every time (had
// allowed for infinite loop on E-violation); dump event data
// to output if E-violation exceeds maxTries; use CheckBalance
// for baryon and charge conservation.
// 20100701 M. Kelsey -- Pass verbosity through to G4CollisionOutput
// 20100714 M. Kelsey -- Report number of iterations before success
// 20100720 M. Kelsey -- Use G4CASCADE_SKIP_ECONS flag for reporting
// 20100723 M. Kelsey -- Move G4CollisionOutput to .hh file for reuse
// 20100914 M. Kelsey -- Migrate to integer A and Z
// 20100916 M. Kelsey -- Simplify ApplyYourself() by encapsulating code blocks
// into numerous functions; make data-member colliders pointers;
// provide support for projectile nucleus
// 20100919 M. Kelsey -- Fix incorrect logic in retryInelasticNucleus()
// 20100922 M. Kelsey -- Add functions to select de-excitation method
// 20100924 M. Kelsey -- Migrate to "OutgoingNuclei" names in CollisionOutput
#include "G4CascadeInterface.hh"
#include "globals.hh"
#include "G4DynamicParticleVector.hh"
#include "G4IonTable.hh"
#include "G4CascadeCheckBalance.hh"
#include "G4CollisionOutput.hh"
#include "G4DynamicParticle.hh"
#include "G4HadronicException.hh"
#include "G4InuclCollider.hh"
// #include "G4IntraNucleiCascader.hh"
#include "G4InuclElementaryParticle.hh"
#include "G4InuclNuclei.hh"
#include "G4InuclParticle.hh"
#include "G4CollisionOutput.hh"
#include "G4V3DNucleus.hh"
#include "G4Track.hh"
#include "G4InuclParticleNames.hh"
#include "G4KaonZeroLong.hh"
#include "G4KaonZeroShort.hh"
#include "G4Nucleus.hh"
#include "G4NucleiModel.hh"
#include "G4LorentzRotation.hh"
#include "G4ParticleDefinition.hh"
#include "G4Track.hh"
#include "G4V3DNucleus.hh"
#include <cmath>
using namespace G4InuclParticleNames;
typedef std::vector<G4InuclElementaryParticle>::const_iterator particleIterator;
typedef std::vector<G4InuclNuclei>::const_iterator nucleiIterator;
//#define BERTDEV 1 // A flag to activate a development version of Bertini cascade
// Maximum number of iterations allowed for inelastic collision attempts
typedef std::vector<G4InuclElementaryParticle>::iterator particleIterator;
typedef std::vector<G4InuclNuclei>::iterator nucleiIterator;
const G4int G4CascadeInterface::maximumTries = 100;
G4CascadeInterface::G4CascadeInterface(const G4String& nam)
:G4VIntraNuclearTransportModel(nam), verboseLevel(0)
{
if (verboseLevel > 3) {
G4cout << " >>> G4CascadeInterface::G4CascadeInterface" << G4endl;
}
// Constructor and destrutor
G4CascadeInterface::G4CascadeInterface(const G4String& name)
: G4VIntraNuclearTransportModel(name),
verboseLevel(0), numberOfTries(0),
collider(new G4InuclCollider),
balance(new G4CascadeCheckBalance(0.05, 0.1, name)),
bullet(0), target(0), output(new G4CollisionOutput) {
initializeElasticCuts();
}
G4CascadeInterface::~G4CascadeInterface() {
delete collider; collider=0;
delete balance; balance=0;
delete bullet; bullet=0;
delete target; target=0;
delete output; output=0;
}
// Fill sparse array with minimum momenta for inelastic on hydrogen
void G4CascadeInterface::initializeElasticCuts() {
cutElastic[proton ] = 1.0; // Bertini uses GeV for everything
cutElastic[neutron ] = 1.0;
cutElastic[pionPlus ] = 0.6;
cutElastic[pionMinus] = 0.2;
cutElastic[pionZero ] = 0.2;
cutElastic[kaonPlus ] = 0.5;
cutElastic[kaonMinus] = 0.5;
cutElastic[kaonZero] = 0.5;
cutElastic[kaonZeroBar] = 0.5;
cutElastic[lambda] = 1.0;
cutElastic[sigmaPlus] = 1.0;
cutElastic[sigmaZero] = 1.0;
cutElastic[sigmaMinus] = 1.0;
cutElastic[xiZero] = 1.0;
cutElastic[xiMinus] = 1.0;
}
G4CascadeInterface::~G4CascadeInterface()
{}
G4ReactionProductVector* G4CascadeInterface::Propagate(G4KineticTrackVector* ,
G4V3DNucleus* ) {
// Select post-cascade processing (default will be CascadeDeexcitation)
// NOTE: Currently just calls through to Collider, in future will do something
void G4CascadeInterface::useCascadeDeexcitation() {
collider->useCascadeDeexcitation();
}
void G4CascadeInterface::usePreCompoundDeexcitation() {
collider->usePreCompoundDeexcitation();
}
// Main Actions
G4ReactionProductVector*
G4CascadeInterface::Propagate(G4KineticTrackVector*, G4V3DNucleus* ) {
return 0;
}
// #define debug_G4CascadeInterface
G4HadFinalState*
G4CascadeInterface::ApplyYourself(const G4HadProjectile& aTrack,
G4Nucleus& theNucleus) {
if (verboseLevel)
G4cout << " >>> G4CascadeInterface::ApplyYourself" << G4endl;
G4HadFinalState* G4CascadeInterface::ApplyYourself(const G4HadProjectile& aTrack,
G4Nucleus& theNucleus) {
#ifdef debug_G4CascadeInterface
#ifdef G4CASCADE_DEBUG_INTERFACE
static G4int counter(0);
counter++;
G4cerr << "Reaction number "<< counter << " "<<aTrack.GetDynamicParticle()->GetDefinition()->GetParticleName()<<" "<< aTrack.GetDynamicParticle()->GetKineticEnergy()<<G4endl;
G4cerr << "Reaction number "<< counter << " "
<< aTrack.GetDefinition()->GetParticleName() << " "
<< aTrack.GetKineticEnergy() << G4endl;
#endif
theResult.Clear();
if (verboseLevel > 3) {
G4cout << " >>> G4CascadeInterface::ApplyYourself" << G4endl;
};
G4double eInit = 0.0;
G4double eTot = 0.0;
G4double sumBaryon = 0.0;
G4double sumEnergy = 0.0;
// Make conversion between native Geant4 and Bertini cascade classes.
// NOTE: Geant4 units are MeV = 1 and GeV = 1000. Cascade code by default use GeV = 1.
enum particleType { nuclei = 0, proton = 1, neutron = 2, pionPlus = 3,
pionMinus = 5, pionZero = 7, photon = 10,
kaonPlus = 11, kaonMinus = 13, kaonZero = 15,
kaonZeroBar = 17, lambda = 21, sigmaPlus = 23,
sigmaZero = 25, sigmaMinus = 27, xiZero = 29, xiMinus = 31 };
createBullet(aTrack);
createTarget(theNucleus);
G4int bulletType = 0;
// Coding particles
if (aTrack.GetDefinition() == G4Proton::Proton() ) bulletType = proton;
if (aTrack.GetDefinition() == G4Neutron::Neutron() ) bulletType = neutron;
if (aTrack.GetDefinition() == G4PionPlus::PionPlus() ) bulletType = pionPlus;
if (aTrack.GetDefinition() == G4PionMinus::PionMinus() ) bulletType = pionMinus;
if (aTrack.GetDefinition() == G4PionZero::PionZero() ) bulletType = pionZero;
if (aTrack.GetDefinition() == G4Gamma::Gamma() ) bulletType = photon;
if (aTrack.GetDefinition() == G4KaonPlus::KaonPlus() ) bulletType = kaonPlus;
if (aTrack.GetDefinition() == G4KaonMinus::KaonMinus() ) bulletType = kaonMinus;
if (aTrack.GetDefinition() == G4Lambda::Lambda() ) bulletType = lambda;
if (aTrack.GetDefinition() == G4SigmaPlus::SigmaPlus() ) bulletType = sigmaPlus;
if (aTrack.GetDefinition() == G4SigmaZero::SigmaZero() ) bulletType = sigmaZero;
if (aTrack.GetDefinition() == G4SigmaMinus::SigmaMinus() ) bulletType = sigmaMinus;
if (aTrack.GetDefinition() == G4XiZero::XiZero() ) bulletType = xiZero;
if (aTrack.GetDefinition() == G4XiMinus::XiMinus() ) bulletType = xiMinus;
if (aTrack.GetDefinition() == G4KaonZeroLong::KaonZeroLong() ||
aTrack.GetDefinition() == G4KaonZeroShort::KaonZeroShort() ) {
if (G4UniformRand() > 0.5) {
bulletType = kaonZero;
} else {
bulletType = kaonZeroBar;
}
if (verboseLevel > 2) {
G4cout << "Bullet: " << G4endl;
bullet->printParticle();
G4cout << "Target: " << G4endl;
target->printParticle();
}
// Code momentum and energy.
G4double px,py,pz;
px=aTrack.Get4Momentum().px() / GeV;
py=aTrack.Get4Momentum().py() / GeV;
pz=aTrack.Get4Momentum().pz() / GeV;
G4LorentzVector projectileMomentum = aTrack.Get4Momentum();
G4LorentzRotation toZ;
toZ.rotateZ(-projectileMomentum.phi());
toZ.rotateY(-projectileMomentum.theta());
G4LorentzRotation toLabFrame = toZ.inverse();
G4CascadeMomentum momentumBullet;
momentumBullet[0] =0.;
momentumBullet[1] =0;
momentumBullet[2] =0;
momentumBullet[3] =std::sqrt(px*px+py*py+pz*pz);
G4InuclElementaryParticle * bullet = new G4InuclElementaryParticle(momentumBullet, bulletType);
sumEnergy = bullet->getKineticEnergy(); // In GeV
if (bulletType == proton || bulletType == neutron || bulletType == lambda ||
bulletType == sigmaPlus || bulletType == sigmaZero || bulletType == sigmaMinus ||
bulletType == xiZero || bulletType == xiMinus) {
sumBaryon += 1;
}
// Set target
G4InuclNuclei* target = 0;
G4InuclParticle* targetH = 0;
// and outcoming particles
G4DynamicParticle* cascadeParticle = 0;
G4CascadeMomentum targetMomentum;
G4double theNucleusA = theNucleus.GetN();
if ( !(G4int(theNucleusA) == 1) ) {
target = new G4InuclNuclei(targetMomentum,
theNucleusA,
theNucleus.GetZ());
target->setEnergy();
const G4CascadeMomentum& bmom = bullet->getMomentum();
eInit = std::sqrt(bmom[0] * bmom[0]);
const G4CascadeMomentum& tmom = target->getMomentum();
eInit += std::sqrt(tmom[0] * tmom[0]);
sumBaryon += theNucleusA;
if (verboseLevel > 2) {
G4cout << "Bullet: " << G4endl;
bullet->printParticle();
}
if (verboseLevel > 2) {
G4cout << "Target: " << G4endl;
target->printParticle();
}
}
G4CollisionOutput output;
// Colliders initialisation
// G4ElementaryParticleCollider* colep = new G4ElementaryParticleCollider;
// G4IntraNucleiCascader* inc = new G4IntraNucleiCascader; // the actual cascade
// inc->setInteractionCase(1); // Interaction type is particle with nuclei.
inc.setInteractionCase(1); // Interaction type is particle with nuclei.
collider->setVerboseLevel(verboseLevel);
balance->setVerboseLevel(verboseLevel);
output->setVerboseLevel(verboseLevel);
// G4NonEquilibriumEvaporator* noneq = new G4NonEquilibriumEvaporator;
// G4EquilibriumEvaporator* eqil = new G4EquilibriumEvaporator;
// G4Fissioner* fiss = new G4Fissioner;
// G4BigBanger* bigb = new G4BigBanger;
G4InuclCollider* collider = new G4InuclCollider(&colep, &inc, &noneq, &eqil, &fiss, &bigb);
numberOfTries = 0;
G4int maxTries = 100; // maximum tries for inelastic collision to avoid infinite loop
G4int nTries = 0; // try counter
// special treatment for target H(1,1) (proton)
if (theNucleus.GetA_asInt() == 1) {
G4int btype = dynamic_cast<G4InuclElementaryParticle*>(bullet)->type();
#ifdef BERTDEV
G4int coulombOK =0; // flag for correct Coulomb barrier
#endif
if (G4int(theNucleusA) == 1) { // special treatment for target H(1,1) (proton)
if (bullet->getMomModule() <= cutElastic[btype]) {
collider->collide(bullet, target, *output); // Only elastic
} else {
do { // we try to create inelastic interaction
if (verboseLevel > 1)
G4cout << " Generating cascade attempt " << numberOfTries << G4endl;
targetH = new G4InuclElementaryParticle(targetMomentum, 1);
output->reset();
collider->collide(bullet, target, *output);
balance->collide(bullet, target, *output);
G4float cutElastic[32];
cutElastic[proton ] = 1.0; // GeV
cutElastic[neutron ] = 1.0;
cutElastic[pionPlus ] = 0.6;
cutElastic[pionMinus] = 0.2;
cutElastic[pionZero ] = 0.2;
cutElastic[kaonPlus ] = 0.5;
cutElastic[kaonMinus] = 0.5;
cutElastic[kaonMinus] = 0.5;
cutElastic[kaonZero] = 0.5;
cutElastic[kaonZeroBar] = 0.5;
cutElastic[lambda] = 1.0;
cutElastic[sigmaPlus] = 1.0;
cutElastic[sigmaZero] = 1.0;
cutElastic[sigmaMinus] = 1.0;
cutElastic[xiZero] = 1.0;
cutElastic[xiMinus] = 1.0;
if (momentumBullet[3] > cutElastic[bulletType]) { // inelastic collision possible
do { // we try to create inelastic interaction
output = collider->collide(bullet, targetH);
nTries++;
} while(
(nTries < maxTries) &&
(output.getOutgoingParticles().size() == 2 && // elastic: bullet + p = H(1,1) coming out
(output.getOutgoingParticles().begin()->type() == bulletType ||
output.getOutgoingParticles().begin()->type() == proton)
)
);
} else { // only elastic collision is energetically possible
output = collider->collide(bullet, targetH);
}
sumBaryon += 1;
const G4CascadeMomentum& bmom = bullet->getMomentum();
eInit = std::sqrt(bmom[0] * bmom[0]);
const G4CascadeMomentum& tmom = targetH->getMomentum();
eInit += std::sqrt(tmom[0] * tmom[0]);
if (verboseLevel > 2) {
G4cout << "Target: " << G4endl;
targetH->printParticle();
}
} else { // treat all other targets excepet H(1,1)
do // we try to create inelastic interaction
{
#ifdef BERTDEV
coulombOK=0; // by default coulomb analysis is OK
#endif
output = collider->collide(bullet, target );
nTries++;
#ifdef BERTDEV
G4double coulumbBarrier = 8.7 * MeV;
std::vector<G4InuclElementaryParticle> p= output.getOutgoingParticles();
if(!p.empty()) {
for( particleIterator ipart = p.begin(); ipart != p.end(); ipart++) {
if (ipart->type() == proton) {
G4double e = ipart->getKineticEnergy()*GeV;
if (e < coulumbBarrier) coulombOK= 1; // If event with coulomb barrier violation detected -> retry
// G4cout << "///AH "<< e << "" << coulumbBarrier <<G4endl;
}
}
}
} while(
(nTries < maxTries) && // conditions for next try
(coulombOK==1) &&
((output.getOutgoingParticles().size() + output.getNucleiFragments().size()) > 2.5) &&
(output.getOutgoingParticles().size()!=0)
);
#else
} while(
(nTries < maxTries) &&
(output.getOutgoingParticles().size() + output.getNucleiFragments().size() < 2.5) &&
(output.getOutgoingParticles().size()!=0) &&
(output.getOutgoingParticles().begin()->type()==bullet->type())
);
#endif
}
if (verboseLevel > 1)
{
G4cout << " Cascade output: " << G4endl;
output.printCollisionOutput();
numberOfTries++;
} while(retryInelasticProton());
}
} else { // treat all other targets excepet H(1,1)
do { // we try to create inelastic interaction
if (verboseLevel > 1)
G4cout << " Generating cascade attempt " << numberOfTries << G4endl;
output->reset();
collider->collide(bullet, target, *output);
balance->collide(bullet, target, *output);
numberOfTries++;
} while (retryInelasticNucleus());
}
// Check whether repeated attempts have all failed; report and exit
if (numberOfTries >= maximumTries && !balance->okay()) {
throwNonConservationFailure(); // This terminates the job
}
// Successful cascade -- clean up and return
if (verboseLevel) {
G4cout << " Cascade output after trials " << numberOfTries << G4endl;
if (verboseLevel > 1) output->printCollisionOutput();
}
// Rotate event to put Z axis along original projectile direction
output->rotateEvent(bulletInLabFrame);
copyOutputToHadronicResult();
// Report violations of conservation laws in original frame
balance->collide(bullet, target, *output);
if (verboseLevel > 2) {
if (!balance->baryonOkay()) {
G4cerr << "ERROR: no baryon number conservation, sum of baryons = "
<< balance->deltaB() << G4endl;
}
if (!balance->chargeOkay()) {
G4cerr << "ERROR: no charge conservation, sum of charges = "
<< balance->deltaQ() << G4endl;
}
if (std::abs(balance->deltaKE()) > 0.01 ) { // GeV
G4cerr << "Kinetic energy conservation violated by "
<< balance->deltaKE() << " GeV" << G4endl;
}
G4double eInit = bullet->getEnergy() + target->getEnergy();
G4double eFinal = eInit + balance->deltaE();
G4cout << "Initial energy " << eInit << " final energy " << eFinal
<< "\nTotal energy conservation at level "
<< balance->deltaE() * GeV << " MeV" << G4endl;
if (balance->deltaKE() > 5.0e-5 ) { // 0.05 MeV
G4cerr << "FATAL ERROR: kinetic energy created "
<< balance->deltaKE() * GeV << " MeV" << G4endl;
}
}
delete bullet; bullet=0;
delete target; target=0;
return &theResult;
}
// Convert input projectile to Bertini internal object
void G4CascadeInterface::createBullet(const G4HadProjectile& aTrack) {
const G4ParticleDefinition* trkDef = aTrack.GetDefinition();
G4int bulletType = 0; // For elementary particles
G4int bulletA = 0, bulletZ = 0; // For nucleus projectile
if (trkDef->GetAtomicMass() <= 1) {
if (trkDef == G4KaonZeroLong::KaonZeroLong() ||
trkDef == G4KaonZeroShort::KaonZeroShort() )
bulletType = (G4UniformRand() > 0.5) ? kaonZero : kaonZeroBar;
else
bulletType = G4InuclElementaryParticle::type(trkDef);
} else {
bulletA = trkDef->GetAtomicMass();
bulletZ = trkDef->GetAtomicNumber();
}
// Code momentum and energy -- Bertini wants z-axis and GeV units
G4LorentzVector projectileMomentum = aTrack.Get4Momentum()/GeV;
// Convert cascade data to use hadronics interface
std::vector<G4InuclNuclei> nucleiFragments = output.getNucleiFragments();
std::vector<G4InuclElementaryParticle> particles = output.getOutgoingParticles();
// Rrotation/boost to get from z-axis back to original frame
bulletInLabFrame = G4LorentzRotation::IDENTITY; // Initialize
bulletInLabFrame.rotateZ(-projectileMomentum.phi());
bulletInLabFrame.rotateY(-projectileMomentum.theta());
bulletInLabFrame.invert();
G4LorentzVector momentumBullet(0., 0., projectileMomentum.rho(),
projectileMomentum.e());
if (bulletType > 0)
bullet = new G4InuclElementaryParticle(momentumBullet, bulletType);
else
bullet = new G4InuclNuclei(momentumBullet, bulletA, bulletZ);
return;
}
// Convert input nuclear target to Bertini internal object
void G4CascadeInterface::createTarget(G4Nucleus& theNucleus) {
G4int theNucleusA = theNucleus.GetA_asInt();
G4int theNucleusZ = theNucleus.GetZ_asInt();
if (theNucleusA == 1)
target = new G4InuclElementaryParticle((theNucleusZ==1)?proton:neutron);
else
target = new G4InuclNuclei(theNucleusA, theNucleusZ);
return;
}
// Transfer Bertini internal final state to hadronics interface
void G4CascadeInterface::copyOutputToHadronicResult() {
const std::vector<G4InuclNuclei>& outgoingNuclei = output->getOutgoingNuclei();
const std::vector<G4InuclElementaryParticle>& particles = output->getOutgoingParticles();
theResult.SetStatusChange(stopAndKill);
// Get outcoming particles
G4DynamicParticle* cascadeParticle = 0;
if (!particles.empty()) {
particleIterator ipart;
G4int outgoingParticle;
particleIterator ipart = particles.begin();
for (; ipart != particles.end(); ipart++) {
G4int outgoingType = ipart->type();
for (ipart = particles.begin(); ipart != particles.end(); ipart++) {
outgoingParticle = ipart->type();
const G4CascadeMomentum& mom = ipart->getMomentum();
eTot += std::sqrt(mom[0] * mom[0]);
G4double ekin = ipart->getKineticEnergy() * GeV;
G4ThreeVector aMom(mom[1], mom[2], mom[3]);
aMom = aMom.unit();
if (ipart->baryon() ) {
sumBaryon -= 1;
if (!ipart->valid() || ipart->quasi_deutron()) {
G4cerr << " ERROR: G4CascadeInterface::ApplyYourself incompatible"
<< " particle type " << outgoingType << G4endl;
continue;
}
sumEnergy -= ekin / GeV;
// Copy local G4DynPart to public output (handle kaon mixing specially)
if (outgoingType == kaonZero || outgoingType == kaonZeroBar) {
G4ThreeVector momDir = ipart->getMomentum().vect().unit();
G4double ekin = ipart->getKineticEnergy()*GeV; // Bertini -> G4 units
switch(outgoingParticle) {
G4ParticleDefinition* pd = G4KaonZeroShort::Definition();
if (G4UniformRand() > 0.5) pd = G4KaonZeroLong::Definition();
case proton:
#ifdef debug_G4CascadeInterface
G4cerr << "proton " << counter << " " << aMom << " " << ekin << G4endl;
#endif
cascadeParticle =
new G4DynamicParticle(G4Proton::ProtonDefinition(), aMom, ekin);
break;
case neutron:
#ifdef debug_G4CascadeInterface
G4cerr << "neutron "<< counter<<" "<<aMom<<" "<< ekin<<G4endl;
#endif
cascadeParticle =
new G4DynamicParticle(G4Neutron::NeutronDefinition(), aMom, ekin);
break;
case pionPlus:
cascadeParticle =
new G4DynamicParticle(G4PionPlus::PionPlusDefinition(), aMom, ekin);
#ifdef debug_G4CascadeInterface
G4cerr << "pionPlus "<< counter<<" "<<aMom<<" "<< ekin<<G4endl;
#endif
break;
case pionMinus:
cascadeParticle =
new G4DynamicParticle(G4PionMinus::PionMinusDefinition(), aMom, ekin);
#ifdef debug_G4CascadeInterface
G4cerr << "pionMinus "<< counter<<" "<<aMom<<" "<< ekin<<G4endl;
#endif
break;
case pionZero:
cascadeParticle =
new G4DynamicParticle(G4PionZero::PionZeroDefinition(), aMom, ekin);
#ifdef debug_G4CascadeInterface
G4cerr << "pionZero "<< counter<<" "<<aMom<<" "<< ekin<<G4endl;
#endif
break;
case photon:
cascadeParticle =
new G4DynamicParticle(G4Gamma::Gamma(), aMom, ekin);
#ifdef debug_G4CascadeInterface
G4cerr << "photon "<< counter<<" "<<aMom<<" "<< ekin<<G4endl;
#endif
break;
case kaonPlus:
cascadeParticle =
new G4DynamicParticle(G4KaonPlus::KaonPlusDefinition(), aMom, ekin);
break;
case kaonMinus:
cascadeParticle =
new G4DynamicParticle(G4KaonMinus::KaonMinusDefinition(), aMom, ekin);
break;
case kaonZero:
if (G4UniformRand() > 0.5) {
cascadeParticle = new G4DynamicParticle(
G4KaonZeroLong::KaonZeroLongDefinition(),
aMom, ekin);
} else {
cascadeParticle = new G4DynamicParticle(
G4KaonZeroShort::KaonZeroShortDefinition(),
aMom, ekin);
}
break;
case kaonZeroBar:
if (G4UniformRand() > 0.5) {
cascadeParticle = new G4DynamicParticle(
G4KaonZeroLong::KaonZeroLongDefinition(),
aMom, ekin);
} else {
cascadeParticle = new G4DynamicParticle(
G4KaonZeroShort::KaonZeroShortDefinition(),
aMom, ekin);
}
break;
case lambda:
cascadeParticle =
new G4DynamicParticle(G4Lambda::LambdaDefinition(), aMom, ekin);
break;
case sigmaPlus:
cascadeParticle =
new G4DynamicParticle(G4SigmaPlus::SigmaPlusDefinition(), aMom, ekin);
break;
case sigmaZero:
cascadeParticle =
new G4DynamicParticle(G4SigmaZero::SigmaZeroDefinition(), aMom, ekin);
break;
case sigmaMinus:
cascadeParticle =
new G4DynamicParticle(G4SigmaMinus::SigmaMinusDefinition(), aMom, ekin);
break;
case xiZero:
cascadeParticle =
new G4DynamicParticle(G4XiZero::XiZeroDefinition(), aMom, ekin);
break;
case xiMinus:
cascadeParticle =
new G4DynamicParticle(G4XiMinus::XiMinusDefinition(), aMom, ekin);
break;
default:
G4cout << " ERROR: G4CascadeInterface::Propagate undefined particle type"
<< G4endl;
cascadeParticle = new G4DynamicParticle(pd, momDir, ekin);
} else {
cascadeParticle = new G4DynamicParticle(ipart->getDynamicParticle());
}
cascadeParticle->Set4Momentum(cascadeParticle->Get4Momentum()*=toLabFrame);
theResult.AddSecondary(cascadeParticle);
}
}
// get nuclei fragments
G4DynamicParticle * aFragment = 0;
G4ParticleDefinition * aIonDef = 0;
G4ParticleTable *theTableOfParticles = G4ParticleTable::GetParticleTable();
if (!nucleiFragments.empty()) {
nucleiIterator ifrag;
for (ifrag = nucleiFragments.begin(); ifrag != nucleiFragments.end(); ifrag++)
{
G4double eKin = ifrag->getKineticEnergy() * GeV;
const G4CascadeMomentum& mom = ifrag->getMomentum();
eTot += std::sqrt(mom[0] * mom[0]);
G4ThreeVector aMom(mom[1], mom[2], mom[3]);
aMom = aMom.unit();
// hpw @@@ ==> Should be zero: G4double fragmentExitation = ifrag->getExitationEnergyInGeV();
if (verboseLevel > 2) {
G4cout << " Nuclei fragment: " << G4endl;
ifrag->printParticle();
}
G4int A = G4int(ifrag->getA());
G4int Z = G4int(ifrag->getZ());
aIonDef = theTableOfParticles->FindIon(Z, A, 0, Z);
aFragment = new G4DynamicParticle(aIonDef, aMom, eKin);
sumBaryon -= A;
sumEnergy -= eKin / GeV;
aFragment->Set4Momentum(aFragment->Get4Momentum()*=toLabFrame);
theResult.AddSecondary(aFragment);
if (!outgoingNuclei.empty()) {
nucleiIterator ifrag = outgoingNuclei.begin();
for (; ifrag != outgoingNuclei.end(); ifrag++) {
if (verboseLevel > 2) {
G4cout << " Nuclei fragment: " << G4endl;
ifrag->printParticle();
}
}
if (verboseLevel > 2) {
if (sumBaryon != 0) {
G4cout << "ERROR: no baryon number conservation, sum of baryons = "
<< sumBaryon << G4endl;
}
if (sumEnergy > 0.01 ) {
G4cout << "Kinetic energy conservation violated by "
<< sumEnergy << " GeV" << G4endl;
}
G4cout << "Total energy conservation at level ~"
<< (eInit - eTot) * GeV << " MeV" << G4endl;
if (sumEnergy < -5.0e-5 ) { // 0.05 MeV
G4cout << "FATAL ERROR: energy created "
<< sumEnergy * GeV << " MeV" << G4endl;
// Copy local G4DynPart to public output
aFragment = new G4DynamicParticle(ifrag->getDynamicParticle());
theResult.AddSecondary(aFragment);
}
}
delete bullet;
// delete inc;
delete collider;
if(target != 0) delete target;
if(targetH != 0) delete targetH;
// if(cascadeParticle != 0) delete cascadeParticle;
// if(aFragment != 0) delete aFragment;
return &theResult;
}
// Evaluate whether any outgoing particles penetrated Coulomb barrier
G4bool G4CascadeInterface::coulombBarrierViolation() const {
G4bool violated = false; // by default coulomb analysis is OK
const G4double coulumbBarrier = 8.7 * MeV/GeV; // Bertini uses GeV
const std::vector<G4InuclElementaryParticle>& p =
output->getOutgoingParticles();
for (particleIterator ipart=p.begin(); ipart != p.end(); ipart++) {
if (ipart->type() == proton) {
violated |= (ipart->getKineticEnergy() < coulumbBarrier);
}
}
return violated;
}
// Check whether inelastic collision on proton failed
G4bool G4CascadeInterface::retryInelasticProton() const {
const std::vector<G4InuclElementaryParticle>& out =
output->getOutgoingParticles();
return ( (numberOfTries < maximumTries) &&
(out.size() == 2) &&
(out[0].getDefinition() == bullet->getDefinition() ||
out[1].getDefinition() == bullet->getDefinition())
);
}
// Check whether generic inelastic collision failed
// NOTE: some conditions are set by compiler flags
G4bool G4CascadeInterface::retryInelasticNucleus() const {
// Quantities necessary for conditional block below
G4int npart = output->numberOfOutgoingParticles();
G4int nfrag = output->numberOfOutgoingNuclei();
const G4ParticleDefinition* firstOut = (npart == 0) ? 0 :
output->getOutgoingParticles().begin()->getDefinition();
return ( ((numberOfTries < maximumTries) &&
(npart != 0) &&
#ifdef G4CASCADE_COULOMB_DEV
(coulombBarrierViolation() && npart+nfrag > 2)
#else
(npart+nfrag < 3 && firstOut == bullet->getDefinition())
#endif
)
#ifndef G4CASCADE_SKIP_ECONS
|| (!balance->okay())
#endif
);
}
// Terminate job in case of persistent non-conservation
void G4CascadeInterface::throwNonConservationFailure() {
G4cerr << " >>> G4CascadeInterface::ApplyYourself()\n has non-conserving"
<< " cascade after " << numberOfTries << " attempts." << G4endl;
G4String throwMsg = "G4CascadeInterface::ApplyYourself() - ";
if (!balance->energyOkay()) {
throwMsg += "Energy";
G4cerr << " Energy conservation violated by " << balance->deltaE()
<< " GeV (" << balance->relativeE() << ")" << G4endl;
}
if (!balance->momentumOkay()) {
throwMsg += "Momentum";
G4cerr << " Momentum conservation violated by " << balance->deltaP()
<< " GeV/c (" << balance->relativeP() << ")" << G4endl;
}
if (!balance->baryonOkay()) {
throwMsg += "Baryon number";
G4cerr << " Baryon number violated by " << balance->deltaB() << G4endl;
}
if (!balance->chargeOkay()) {
throwMsg += "Charge";
G4cerr << " Charge conservation violated by " << balance->deltaB()
<< G4endl;
}
G4cout << "\n Final event output, for debugging:"
<< "\n Bullet: " << G4endl;
bullet->printParticle();
G4cout << "\n Target: " << G4endl;
target->printParticle();
output->printCollisionOutput();
throwMsg += " non-conservation. More info in output.";
throw G4HadronicException(__FILE__, __LINE__, throwMsg); // Job ends here!
}
@@ -23,32 +23,24 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeKminusNChannel.cc,v 1.6 2010/12/15 07:40:17 gunter Exp $
//
// 20100804 M. Kelsey -- Add name string to ctor
#include "G4CascadeKminusNChannel.hh"
namespace {
// Total cross section as a function of kinetic energy
G4double kmntot[31];
// Multiplicities as a function of kinetic energy
G4double kmnMultiplicities[6][31];
const G4int kmnindex[6][2] =
{{0, 5}, {5, 20}, {20, 48}, {48, 90}, {90, 110}, {110, 121}};
// Outgoing particle types of a given multiplicity
const G4int kmn2bfs[5][2] =
static const G4int kmn2bfs[5][2] =
{{2, 13}, {5, 21}, {5, 25}, {7, 27}, {15, 31} };
const G4int kmn3bfs[15][3] =
static const G4int kmn3bfs[15][3] =
{{1,5,13}, {2,7,13}, {2,5,17}, {5,7,21}, {5,5,23},
{5,7,25}, {7,7,27}, {3,5,27}, {13,15,21}, {13,15,25},
{15,17,27}, {11,13,27}, {5,15,29}, {7,15,31}, {5,11,31} };
const G4int kmn4bfs[28][4] =
static const G4int kmn4bfs[28][4] =
{{1,5,7,13}, {1,5,5,17}, {2,7,7,13}, {2,3,5,13},
{2,5,7,17}, {5,7,7,21}, {3,5,5,21}, {5,5,7,23},
{7,7,7,27}, {3,5,7,27}, {7,13,15,21}, {5,15,17,21},
@@ -57,7 +49,7 @@ namespace {
{7,11,13,27}, {5,11,17,27}, {3,13,15,27}, {5,7,15,29},
{5,5,11,29}, {7,7,15,31}, {3,5,15,31}, {5,7,11,31} };
const G4int kmn5bfs[42][5] =
static const G4int kmn5bfs[42][5] =
{{1,5,7,7,13}, {1,3,5,5,13}, {1,5,5,7,17}, {2,7,7,7,13},
{2,3,5,7,13}, {2,5,7,7,17}, {2,3,5,5,17}, {5,7,7,7,21},
{3,5,5,7,21}, {7,7,13,15,21}, {3,5,13,15,21}, {5,7,15,17,21},
@@ -70,14 +62,14 @@ namespace {
{3,5,5,15,29}, {5,5,7,11,29}, {7,7,7,15,31}, {3,5,7,15,31},
{5,7,7,11,31}, {3,5,5,11,31} };
const G4int kmn6bfs[20][6] =
static const G4int kmn6bfs[20][6] =
{{1,5,7,7,7,13}, {1,3,5,5,7,13}, {1,5,5,7,7,17}, {1,3,5,5,5,17},
{2,7,7,7,7,13}, {2,3,5,7,7,13}, {2,3,3,5,5,13}, {2,5,7,7,7,17},
{2,3,5,5,7,17}, {5,7,7,7,7,21}, {3,5,5,7,7,21}, {3,3,5,5,5,21},
{5,5,7,7,7,23}, {3,5,5,5,7,23}, {5,7,7,7,7,25}, {3,5,5,7,7,25},
{3,3,5,5,5,25}, {7,7,7,7,7,27}, {3,5,7,7,7,27}, {3,3,5,5,7,27} };
const G4int kmn7bfs[11][7] =
static const G4int kmn7bfs[11][7] =
{{1,5,7,7,7,7,13}, {1,3,5,5,7,7,13}, {1,3,3,5,5,5,13},
{1,5,5,7,7,7,17}, {1,3,5,5,5,7,17}, {2,7,7,7,7,7,13},
{2,3,5,7,7,7,13}, {2,3,3,5,5,7,13}, {2,5,7,7,7,7,17},
@@ -94,7 +86,7 @@ namespace {
//
// second index: kinetic energy
//
const G4float kmnCrossSections[121][31] = {
static const G4double kmnCrossSections[121][31] = {
//
// multiplicity 2 (5 channels)
//
@@ -720,22 +712,6 @@ namespace {
}
G4CascadeKminusNChannelData::data_t
G4CascadeKminusNChannelData::data = { kmntot,
kmnMultiplicities,
kmnindex,
kmn2bfs,
kmn3bfs,
kmn4bfs,
kmn5bfs,
kmn6bfs,
kmn7bfs,
kmnCrossSections };
namespace {
struct initializer
{
initializer() { G4CascadeKminusNChannelData::data.initialize(); }
};
initializer init;
}
G4CascadeKminusNChannelData::data(kmn2bfs, kmn3bfs, kmn4bfs,
kmn5bfs, kmn6bfs, kmn7bfs,
kmnCrossSections, "KminusN");
@@ -23,34 +23,26 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4CascadeKminusPChannel.cc,v 1.6 2010/12/15 07:40:19 gunter Exp $
//
// 20100804 M. Kelsey -- Add name string to ctor
#include "G4CascadeKminusPChannel.hh"
namespace {
// Total cross section as a function of kinetic energy
G4double kmptot[31];
// Multiplicities as a function of kinetic energy
G4double kmpMultiplicities[6][31];
const G4int kmpindex[6][2] =
{{0, 8}, {8, 28}, {28, 62}, {62, 110}, {110, 132}, {132, 148}};
// Outgoing particle types of a given multiplicity
const G4int kmp2bfs[8][2] =
static const G4int kmp2bfs[8][2] =
{{1, 13}, {2, 17}, {7, 21}, {5, 23},
{7, 25}, {3, 27}, {15, 29}, {11, 31} };
const G4int kmp3bfs[20][3] =
static const G4int kmp3bfs[20][3] =
{{1,7,13}, {1,5,17}, {2,3,13}, {2,7,17}, {7,7,21},
{3,5,21}, {11,13,21}, {15,17,21}, {5,7,23}, {13,15,23},
{7,7,25}, {3,5,25}, {11,13,25}, {15,17,25}, {3,7,27},
{11,17,27}, {7,15,29}, {5,11,29}, {3,15,31}, {7,11,31} };
const G4int kmp4bfs[34][4] =
static const G4int kmp4bfs[34][4] =
{{1,7,7,13}, {1,3,5,13}, {1,5,7,17}, {2,3,7,13},
{2,7,7,17}, {2,3,5,17}, {7,7,7,21}, {3,5,7,21},
{3,13,15,21}, {5,11,17,21}, {7,11,13,21}, {7,15,17,21},
@@ -61,7 +53,7 @@ namespace {
{7,7,15,29}, {3,5,15,29}, {5,7,11,29}, {3,7,15,31},
{7,7,11,31}, {3,5,11,31} };
const G4int kmp5bfs[48][5] =
static const G4int kmp5bfs[48][5] =
{{1,7,7,7,13}, {1,3,5,7,13}, {1,5,7,7,17}, {1,3,5,5,17},
{2,3,7,7,13}, {2,3,3,5,13}, {2,7,7,7,17}, {2,3,5,7,17},
{7,7,7,7,21}, {3,5,7,7,21}, {3,3,5,5,21}, {3,7,13,15,21},
@@ -75,7 +67,7 @@ namespace {
{7,7,7,15,29}, {3,5,7,15,29}, {5,7,7,11,29}, {3,5,5,11,29},
{7,7,7,11,31}, {3,5,7,11,31}, {3,7,7,15,31}, {3,3,5,15,31} };
const G4int kmp6bfs[22][6] =
static const G4int kmp6bfs[22][6] =
{{1,7,7,7,7,13}, {1,3,5,7,7,13}, {1,3,3,5,5,13}, {1,5,7,7,7,17},
{1,3,5,5,7,17}, {2,3,7,7,7,13}, {2,3,3,5,7,13}, {2,7,7,7,7,17},
{2,3,5,7,7,17}, {2,3,3,5,5,17}, {7,7,7,7,7,21}, {3,5,7,7,7,21},
@@ -83,7 +75,7 @@ namespace {
{7,7,7,7,7,25}, {3,5,7,7,7,25}, {3,3,5,5,7,25}, {3,7,7,7,7,27},
{3,3,5,7,7,27}, {3,3,3,5,5,27} };
const G4int kmp7bfs[16][7] =
static const G4int kmp7bfs[16][7] =
{{1,7,7,7,7,7,13}, {1,3,5,7,7,7,13}, {1,3,3,5,5,7,13},
{1,5,7,7,7,7,17}, {1,3,5,5,7,7,17}, {1,3,3,5,5,5,17},
{2,3,7,7,7,7,13}, {2,3,3,5,7,7,13}, {2,3,3,3,5,5,13},
@@ -102,7 +94,7 @@ namespace {
//
// second index: kinetic energy
//
const G4float kmpCrossSections[148][31] = {
static const G4double kmpCrossSections[148][31] = {
//
// multiplicity 2 (8 channels)
//
@@ -863,22 +855,6 @@ namespace {
}
G4CascadeKminusPChannelData::data_t
G4CascadeKminusPChannelData::data = { kmptot,
kmpMultiplicities,
kmpindex,
kmp2bfs,
kmp3bfs,
kmp4bfs,
kmp5bfs,
kmp6bfs,
kmp7bfs,
kmpCrossSections };
namespace {
struct initializer
{
initializer() { G4CascadeKminusPChannelData::data.initialize(); }
};
initializer init;
}
G4CascadeKminusPChannelData::data(kmp2bfs, kmp3bfs, kmp4bfs,
kmp5bfs, kmp6bfs, kmp7bfs,
kmpCrossSections, "KminusP");

Some files were not shown because too many files have changed in this diff Show More