Import Geant4 10.2.0 source tree
This commit is contained in:
+392
@@ -0,0 +1,392 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 "G4DiscreteScatteringModel.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4AtomicShells.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
#include "G4ParticleChangeForGamma.hh"
|
||||
#include "G4ElementData.hh"
|
||||
#include "G4Exp.hh"
|
||||
#include "G4Log.hh"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
using namespace std;
|
||||
using namespace CLHEP;
|
||||
|
||||
G4ElementData* G4DiscreteScatteringModel::fCdf = nullptr;
|
||||
G4ElementData* G4DiscreteScatteringModel::fTcs = nullptr;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4DiscreteScatteringModel::G4DiscreteScatteringModel(G4int iNumAngles)
|
||||
: G4VEmModel("DiscrScat"), fParticleChange(nullptr),fAnalogModel("pwe"),
|
||||
fNumAngles(iNumAngles), fLowEnergyLimit(2*keV)
|
||||
{
|
||||
SetHighEnergyLimit(100.*MeV);
|
||||
SetLowEnergyLimit(fLowEnergyLimit);
|
||||
if(IsMaster() && fCdf == nullptr) {
|
||||
fCdf = new G4ElementData();
|
||||
fTcs = new G4ElementData();
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4DiscreteScatteringModel::~G4DiscreteScatteringModel()
|
||||
{
|
||||
if(IsMaster()) {
|
||||
delete fCdf;
|
||||
delete fTcs;
|
||||
fCdf = nullptr;
|
||||
fTcs = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4DiscreteScatteringModel::Initialise(const G4ParticleDefinition*,
|
||||
const G4DataVector&)
|
||||
{
|
||||
if(nullptr == fParticleChange) {
|
||||
fParticleChange = GetParticleChangeForGamma();
|
||||
}
|
||||
if(!IsMaster()) { return; }
|
||||
|
||||
G4cout << "G4DiscreteScatteringModel::Initialise start"<<G4endl;
|
||||
|
||||
const G4int maxZ = 100;
|
||||
|
||||
char *path = getenv("G4GBFPDATA");
|
||||
if (!path)
|
||||
{
|
||||
G4Exception("G4DiscreteScatteringModel::Initialise","em0006",
|
||||
FatalException,"G4GBFPDATA environment variable not set.");
|
||||
return;
|
||||
}
|
||||
|
||||
std::ostringstream eFullFileName;
|
||||
eFullFileName << path;
|
||||
|
||||
G4ProductionCutsTable* theCoupleTable =
|
||||
G4ProductionCutsTable::GetProductionCutsTable();
|
||||
|
||||
G4int numOfCouples = theCoupleTable->GetTableSize();
|
||||
|
||||
for(G4int i=0; i<numOfCouples; ++i)
|
||||
{
|
||||
const G4Material* material =
|
||||
theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial();
|
||||
const G4ElementVector* theElementVector = material->GetElementVector();
|
||||
G4int nelm = material->GetNumberOfElements();
|
||||
|
||||
for (G4int j=0; j<nelm; ++j)
|
||||
{
|
||||
G4int Z = G4lrint((*theElementVector)[j]->GetZ());
|
||||
if(Z < 1) { Z = 1; }
|
||||
else if(Z > maxZ) { Z = maxZ; }
|
||||
if(!fTcs->GetElementData(Z)) { ReadData(Z, path); }
|
||||
}
|
||||
}
|
||||
G4cout << "G4DiscreteScatteringModel::Initialise completed"<<G4endl;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4DiscreteScatteringModel::ReadData(G4int Z, const G4String& argFileName)
|
||||
{
|
||||
|
||||
// Set strings with paths to tcs data file. Currently not a variable but this
|
||||
// this will change
|
||||
G4String fullFileName(argFileName);
|
||||
|
||||
stringstream ss1;//create a stringstream
|
||||
ss1 << Z;//add number to the stream
|
||||
stringstream ss2;//create a stringstream
|
||||
ss2 << fNumAngles;
|
||||
G4String tcsPath = fullFileName+"/log_gbfp_"+fAnalogModel
|
||||
+"_tcs_"+ss1.str()+"_"+ss2.str()+".dat";
|
||||
|
||||
// Do some error checking and exiting if data does not exist
|
||||
std::ifstream in(tcsPath, std::ifstream::binary|std::ifstream::in);
|
||||
if (!in.is_open())
|
||||
{
|
||||
G4String message("Data file \"");
|
||||
message+=tcsPath;
|
||||
message+="\" not found";
|
||||
G4Exception("G4DiscreteScatteringModel::LoadData","em0003",
|
||||
FatalException,message);
|
||||
return;
|
||||
}
|
||||
//G4cout<<"Reading in data file "<< tcsPath<<G4endl;
|
||||
|
||||
// Create a temporary G4PhysicsVector object pointer
|
||||
G4PhysicsVector* tempData = new G4PhysicsVector(false);
|
||||
|
||||
// Use retrieve to read in the total cross section (tcs) data
|
||||
tempData->Retrieve(in,true);
|
||||
|
||||
// Convert tcs from cm^2 to mm^2
|
||||
//tempData->ScaleVector(1.0, 100.0);
|
||||
|
||||
// store pass this data to the tcs object and initialise for current element
|
||||
fTcs->InitialiseForElement(Z,tempData);
|
||||
in.close();
|
||||
|
||||
// Set strings with paths to cdf data files. Currently not a variable
|
||||
// but this this will change
|
||||
G4String cdfPath = fullFileName+"/gbfp_"+fAnalogModel+"_cdf_"
|
||||
+ss1.str()+"_"+ss2.str()+".dat";
|
||||
|
||||
// Do some error checking and exiting if data does not exist
|
||||
std::ifstream in2(cdfPath, std::ifstream::binary|std::ifstream::in);
|
||||
if (!in2.is_open())
|
||||
{
|
||||
G4String message("Data file \"");
|
||||
message+=cdfPath;
|
||||
message+="\" not found";
|
||||
G4Exception("G4DiscreteScatteringModel::LoadData","em0003",
|
||||
FatalException,message);
|
||||
return;
|
||||
}
|
||||
|
||||
//G4cout<<"Reading in data file "<< cdfPath<<G4endl;
|
||||
|
||||
// The cumulative distribution functions (CDF) for energy E_j and X_i
|
||||
// on (0,1) is C(E_j,X_i) and read-in/stored at this time.
|
||||
// For the purposes of this model, each energy grid point where the CDF
|
||||
// is evaluated is considered a component. The number of energy grid
|
||||
// points is consistent with the fTcs data, so the following int is set
|
||||
// by calling G4PhysicsVector::GetVectorLength().
|
||||
G4int numEnergies = fTcs->GetElementData(Z)->GetVectorLength();
|
||||
|
||||
// The ElementData object pointer is then initialized by
|
||||
fCdf->InitialiseForComponent(Z, numEnergies);
|
||||
|
||||
// Now the data files are read in for all energies. At each energy,
|
||||
// there are fNumAngles angles and fNumAngles CDF values.
|
||||
|
||||
std::vector<G4PhysicsVector*> tempDataCDF;
|
||||
// Loop through each energy
|
||||
for (int j=0; j<numEnergies; j++)
|
||||
{
|
||||
// Push back a new G4PhysicsVector for the jth energy
|
||||
tempDataCDF.push_back(new G4PhysicsVector(false));
|
||||
|
||||
// For use with David's PhysicsVector class
|
||||
//tempDataCDF.push_back(new G4PhysicsVector(false,false,true));
|
||||
|
||||
//tempDataCDF.push_back(new G4PhysicsVector(false,false,false));
|
||||
//tempDataCDF.push_back(new G4PhysicsVector());
|
||||
}
|
||||
|
||||
// Open a temporary stream. The data for the jth energy group is copied
|
||||
// to the temp file and then the temp file is sent to
|
||||
// G4PhysicsVector::Retrieve(). Once the data is stored in the
|
||||
// G4PhysicsVector, tempDataCDF, it is then passed to the ElementData, cdf,
|
||||
// which is the container for all of the data for each element and energy.
|
||||
|
||||
//static G4Mutex m = G4MUTEX_INITIALIZER;
|
||||
//G4AutoLock l(&m);
|
||||
|
||||
// Open the stream and call file "tempDataFile.dat"
|
||||
std::ofstream file("tempDataFile.dat",
|
||||
std::fstream::out | std::fstream::trunc);
|
||||
|
||||
// Write to file the lower/upper bounds and the number of grid points
|
||||
// for each column of data. The data in tempfile is 2xfNumAngles,
|
||||
// hence fNumAngles fNumAngles.
|
||||
// file<<lowerBound<<" "<<upperBound<<" "<<fNumAngles<<" "
|
||||
// <<fNumAngles<<G4endl;
|
||||
file<<"-1. 1. "<<fNumAngles<<" "<<fNumAngles<<G4endl;
|
||||
|
||||
// Start while loop over the entire data file opened above
|
||||
// e.g. pwe_cdf_79.dat. This data contains all of the data for each energy
|
||||
G4int cntr = 0;
|
||||
G4int j = 0;
|
||||
G4double temp1, temp2;
|
||||
while(in2>>temp1>>temp2)
|
||||
{
|
||||
// Write data to temporary file
|
||||
file<<setprecision(16)<<temp1<<" "<<temp2<<G4endl;
|
||||
cntr++;
|
||||
|
||||
// When the first fNumAngles data points are copied to tempDataFile.dat,
|
||||
// store data in tempDataCDF[j]. Then increment the energy index, j,
|
||||
// close and clear the streams, and then reopen the streams such that
|
||||
// the next fNumAngles data points are copied to tempDataFile.dat.
|
||||
if (cntr==fNumAngles)
|
||||
{
|
||||
cntr=0;
|
||||
std::ifstream inTemp("tempDataFile.dat",
|
||||
std::ifstream::binary|std::ifstream::in);
|
||||
tempDataCDF[j]->Retrieve(inTemp,true);
|
||||
fCdf->AddComponent(Z,j,tempDataCDF[j]);
|
||||
j++;
|
||||
inTemp.close(), inTemp.clear(), file.close(), file.clear();
|
||||
file.open("tempDataFile.dat",std::fstream::out | std::fstream::trunc);
|
||||
file<<"-1. 1. "<<fNumAngles<<" "<<fNumAngles<<G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
in2.close();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4DiscreteScatteringModel::SampleSecondaries(
|
||||
std::vector<G4DynamicParticle*>*,
|
||||
const G4MaterialCutsCouple* couple,
|
||||
const G4DynamicParticle* p,
|
||||
G4double cutEnergy,
|
||||
G4double)
|
||||
{
|
||||
G4double E = p->GetKineticEnergy();
|
||||
|
||||
if(E < fLowEnergyLimit) return;
|
||||
|
||||
// Select random atom
|
||||
G4int Z = G4lrint(SelectRandomAtom(couple,p->GetDefinition(),
|
||||
E,cutEnergy,E)->GetZ());
|
||||
|
||||
// Determine the energy bin
|
||||
G4double logE = G4Log(E);
|
||||
G4ThreeVector dir = p->GetMomentumDirection(); //old direction
|
||||
G4int j = fTcs->GetElementData(Z)->FindBin(logE,0);
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// it would be nice to have the following block of code in G4PhysicsVector.
|
||||
// it could be a simple function.
|
||||
|
||||
// v.GetVectorLength() - number of points
|
||||
// v.Energy(size_t idx) - value x(i)
|
||||
// v[i] - value y(i)
|
||||
|
||||
// This is a monte carlo interpolation scheme
|
||||
G4double e1 = fTcs->GetElementData(Z)->Energy(j);
|
||||
G4double e2 = fTcs->GetElementData(Z)->Energy(j+1);
|
||||
|
||||
// This is a monte carlo interpolation scheme
|
||||
G4double pie1 = (logE-e1)/(e2-e1);
|
||||
G4double r = G4UniformRand();
|
||||
if (r<pie1){ ++j; }
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// it would be nice to have the following block of code in G4PhysicsVector.
|
||||
//---------------
|
||||
// Given the energy grid value associated with the DCS,
|
||||
// sample a deflection cosine
|
||||
r = G4UniformRand();
|
||||
G4int k = -1;
|
||||
// First test if the angle is the most probable angle
|
||||
if (r>(*fCdf->GetComponentDataByIndex(Z,j)).Energy(fNumAngles-2))
|
||||
{ k = fNumAngles-1; }
|
||||
// or the least probable... not sure why I do this (maybe because
|
||||
// it is a simple check)
|
||||
else if (r<=(*fCdf->GetComponentDataByIndex(Z,j)).Energy(0)) { k = 0; }
|
||||
// if neither then loop through remaining angles, break when locating angle
|
||||
else {
|
||||
for (G4int i=fNumAngles-2; i>0; --i) {
|
||||
if ( (r>(*fCdf->GetComponentDataByIndex(Z,j)).Energy(i-1))
|
||||
&& (r<= (*fCdf->GetComponentDataByIndex(Z,j)).Energy(i)) )
|
||||
{ k=i; break;}
|
||||
}
|
||||
}
|
||||
// Throw an error if an angle was not sampled, data is probably no good
|
||||
if(k<0)
|
||||
{
|
||||
G4cout << "G4DiscreteScatteringModel::SampleSecondaries():"
|
||||
<< " CDF was not inverted properly "<<k<<G4endl;
|
||||
for (G4int i=0;i<fNumAngles;++i) {
|
||||
G4cout<<i<<" "<<(*fCdf->GetComponentDataByIndex(Z,j)).Energy(i)<<" "<<r<<G4endl;
|
||||
}
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
// Otherwise, go get the angle and pass it too local method GetNewDirection.
|
||||
// Then do transformation and update fParticleChange.
|
||||
|
||||
//G4cout<<"------------------"<<G4endl;
|
||||
//G4cout<<"Sample Secondaries"<<G4endl;
|
||||
//G4cout<<G4Exp(e1)<<" "<<E<<" "<<G4Exp(e2)<<" "<<pie1<<" "
|
||||
// <<(*fCdf->GetComponentDataByIndex(Z,j)).Energy(k)<<G4endl;
|
||||
//G4cout<<"------------------"<<G4endl;
|
||||
//G4cout<<" "<<G4endl;
|
||||
|
||||
G4ThreeVector newDirection =
|
||||
GetNewDirection((*fCdf->GetComponentDataByIndex(Z,j))[k]);
|
||||
newDirection.rotateUz(dir);
|
||||
fParticleChange->ProposeMomentumDirection(newDirection);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4DiscreteScatteringModel::ComputeCrossSectionPerAtom(
|
||||
const G4ParticleDefinition*,G4double E, G4double Z, G4double,
|
||||
G4double, G4double)
|
||||
{
|
||||
// super simple, very compact look-up for total cross section
|
||||
if (E==0.) {return 1e30;}
|
||||
//G4cout<<"------------------"<<G4endl;
|
||||
//G4cout<<"ComputeCrossSectionPerAtom"<<G4endl;
|
||||
//G4cout<< E<<" "<<G4Log(E)<<" "<< G4Exp(fTcs->GetValueForElement(Z,log(E)))
|
||||
//<<" "<<fTcs->GetValueForElement(Z,log(E))<<G4endl;
|
||||
//G4cout<<"------------------"<<G4endl;
|
||||
//G4cout<<" "<<G4endl;
|
||||
|
||||
//G4cout<< E<<" "<<G4Exp(fTcs->GetValueForElement(Z,log(E)))<<G4endl;
|
||||
|
||||
return G4Exp(fTcs->GetValueForElement(Z,G4Log(E)));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ThreeVector G4DiscreteScatteringModel::GetNewDirection(G4double z1)
|
||||
{
|
||||
G4ThreeVector dir(0.0,0.0,1.0);
|
||||
|
||||
G4double sint = sin(acos(z1));
|
||||
G4double cost = sqrt(1.0 - sint*sint);
|
||||
G4double phi = twopi* G4UniformRand();
|
||||
G4double dirx = sint*cos(phi);
|
||||
G4double diry = sint*sin(phi);
|
||||
G4double dirz = cost;
|
||||
|
||||
dir.set(dirx,diry,dirz);
|
||||
return dir;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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 "G4DiscreteScatteringProcess.hh"
|
||||
#include "G4DiscreteScatteringModel.hh"
|
||||
#include "G4Electron.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4DiscreteScatteringProcess::G4DiscreteScatteringProcess(G4int iNumAngles)
|
||||
: G4VEmProcess("DiscreteScattering", fElectromagnetic),
|
||||
fIsInitialised(false), fNumAngles(iNumAngles)
|
||||
{
|
||||
SetBuildTableFlag(true);
|
||||
SetStartFromNullFlag(false);
|
||||
SetMinKinEnergy(2*CLHEP::keV);
|
||||
SetMaxKinEnergy(100*CLHEP::MeV);
|
||||
SetIntegral(false);
|
||||
SetSplineFlag(false);
|
||||
SetProcessSubType(1);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4DiscreteScatteringProcess::~G4DiscreteScatteringProcess(){
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
bool G4DiscreteScatteringProcess::IsApplicable(const G4ParticleDefinition& p){
|
||||
return (&p == G4Electron::Definition());
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4DiscreteScatteringProcess::PrintInfo(){}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void
|
||||
G4DiscreteScatteringProcess::InitialiseProcess(const G4ParticleDefinition*)
|
||||
{
|
||||
if(fIsInitialised) { return; }
|
||||
fIsInitialised = true;
|
||||
G4VEmModel* model = new G4DiscreteScatteringModel(fNumAngles);
|
||||
AddEmModel(1, model);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: PhysListEmStandard.cc 85273 2014-10-27 09:10:59Z gcosmo $
|
||||
// $Id: PhysListEmStandard.cc 94269 2015-11-10 07:55:24Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -64,13 +64,22 @@
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4UAtomicDeexcitation.hh"
|
||||
|
||||
#include "G4BuilderType.hh"
|
||||
#include "G4EmModelActivator.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysListEmStandard::PhysListEmStandard(const G4String& name)
|
||||
: G4VPhysicsConstructor(name)
|
||||
{}
|
||||
{
|
||||
G4EmParameters* param = G4EmParameters::Instance();
|
||||
param->SetDefaults();
|
||||
param->SetFluo(true);
|
||||
param->SetMscStepLimitType(fUseSafetyPlus);
|
||||
SetPhysicsType(bElectromagnetic);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -92,12 +101,12 @@ void PhysListEmStandard::ConstructProcess()
|
||||
|
||||
if (particleName == "gamma") {
|
||||
|
||||
////ph->RegisterProcess(new G4RayleighScattering, particle);
|
||||
ph->RegisterProcess(new G4PhotoElectricEffect, particle);
|
||||
G4ComptonScattering* cs = new G4ComptonScattering;
|
||||
cs->SetEmModel(new G4KleinNishinaModel());
|
||||
ph->RegisterProcess(cs, particle);
|
||||
ph->RegisterProcess(new G4GammaConversion, particle);
|
||||
////ph->RegisterProcess(new G4RayleighScattering, particle);
|
||||
|
||||
} else if (particleName == "e-") {
|
||||
|
||||
@@ -170,31 +179,13 @@ void PhysListEmStandard::ConstructProcess()
|
||||
}
|
||||
}
|
||||
|
||||
// Em options
|
||||
//
|
||||
// Main options and setting parameters are shown here.
|
||||
// Several of them have default values.
|
||||
//
|
||||
G4EmProcessOptions emOptions;
|
||||
|
||||
//physics tables
|
||||
//
|
||||
emOptions.SetMinEnergy(10*eV); //default 100 eV
|
||||
emOptions.SetMaxEnergy(10*TeV); //default 100 TeV
|
||||
emOptions.SetDEDXBinning(12*10); //default=12*7
|
||||
emOptions.SetLambdaBinning(12*10); //default=12*7
|
||||
|
||||
//multiple coulomb scattering
|
||||
//
|
||||
emOptions.SetMscStepLimitation(fUseSafetyPlus); //default=fUseSafety
|
||||
|
||||
// Deexcitation
|
||||
//
|
||||
G4VAtomDeexcitation* de = new G4UAtomicDeexcitation();
|
||||
de->SetFluo(true);
|
||||
de->SetAuger(false);
|
||||
de->SetPIXE(false);
|
||||
G4LossTableManager::Instance()->SetAtomDeexcitation(de);
|
||||
|
||||
G4EmModelActivator mact;
|
||||
mact.ConstructProcess();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -0,0 +1,197 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: PhysListEmStandardMP.cc 85273 2014-10-27 09:10:59Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "PhysListEmStandardMP.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4PhysicsListHelper.hh"
|
||||
|
||||
#include "G4ComptonScattering.hh"
|
||||
#include "G4GammaConversion.hh"
|
||||
#include "G4PhotoElectricEffect.hh"
|
||||
#include "G4RayleighScattering.hh"
|
||||
#include "G4KleinNishinaModel.hh"
|
||||
|
||||
#include "G4eMultipleScattering.hh"
|
||||
#include "G4eIonisation.hh"
|
||||
#include "G4eBremsstrahlung.hh"
|
||||
#include "G4eplusAnnihilation.hh"
|
||||
|
||||
#include "G4MuMultipleScattering.hh"
|
||||
#include "G4MuIonisation.hh"
|
||||
#include "G4MuBremsstrahlung.hh"
|
||||
#include "G4MuPairProduction.hh"
|
||||
|
||||
#include "G4hMultipleScattering.hh"
|
||||
#include "G4hIonisation.hh"
|
||||
#include "G4hBremsstrahlung.hh"
|
||||
#include "G4hPairProduction.hh"
|
||||
|
||||
#include "G4ionIonisation.hh"
|
||||
#include "G4IonParametrisedLossModel.hh"
|
||||
#include "G4NuclearStopping.hh"
|
||||
|
||||
#include "G4EmProcessOptions.hh"
|
||||
#include "G4MscStepLimitType.hh"
|
||||
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4UAtomicDeexcitation.hh"
|
||||
|
||||
#include "G4BuilderType.hh"
|
||||
#include "G4EmModelActivator.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#include "G4DiscreteScatteringProcess.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysListEmStandardMP::PhysListEmStandardMP(G4int iNumAngles)
|
||||
: G4VPhysicsConstructor("G4EmStandardMP"), fNumAngles(iNumAngles)
|
||||
{
|
||||
G4EmParameters* param = G4EmParameters::Instance();
|
||||
param->SetDefaults();
|
||||
param->SetFluo(true);
|
||||
param->SetMscStepLimitType(fUseSafetyPlus);
|
||||
SetPhysicsType(bElectromagnetic);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysListEmStandardMP::~PhysListEmStandardMP()
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void PhysListEmStandardMP::ConstructProcess()
|
||||
{
|
||||
G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
|
||||
|
||||
// Add standard EM Processes
|
||||
//
|
||||
aParticleIterator->reset();
|
||||
while( (*aParticleIterator)() ){
|
||||
G4ParticleDefinition* particle = aParticleIterator->value();
|
||||
G4String particleName = particle->GetParticleName();
|
||||
|
||||
if (particleName == "gamma") {
|
||||
|
||||
ph->RegisterProcess(new G4PhotoElectricEffect, particle);
|
||||
G4ComptonScattering* cs = new G4ComptonScattering;
|
||||
cs->SetEmModel(new G4KleinNishinaModel());
|
||||
ph->RegisterProcess(cs, particle);
|
||||
ph->RegisterProcess(new G4GammaConversion, particle);
|
||||
////ph->RegisterProcess(new G4RayleighScattering, particle);
|
||||
|
||||
} else if (particleName == "e-") {
|
||||
|
||||
ph->RegisterProcess(new G4DiscreteScatteringProcess(fNumAngles),
|
||||
particle);
|
||||
|
||||
// ph->RegisterProcess(new G4eMultipleScattering(), particle);
|
||||
//
|
||||
G4eIonisation* eIoni = new G4eIonisation();
|
||||
eIoni->SetStepFunction(0.1, 100*um);
|
||||
ph->RegisterProcess(eIoni, particle);
|
||||
//
|
||||
ph->RegisterProcess(new G4eBremsstrahlung(), particle);
|
||||
|
||||
} else if (particleName == "e+") {
|
||||
|
||||
ph->RegisterProcess(new G4eMultipleScattering(), particle);
|
||||
//
|
||||
G4eIonisation* eIoni = new G4eIonisation();
|
||||
eIoni->SetStepFunction(0.1, 100*um);
|
||||
ph->RegisterProcess(eIoni, particle);
|
||||
//
|
||||
ph->RegisterProcess(new G4eBremsstrahlung(), particle);
|
||||
//
|
||||
ph->RegisterProcess(new G4eplusAnnihilation(), particle);
|
||||
|
||||
} else if (particleName == "mu+" ||
|
||||
particleName == "mu-" ) {
|
||||
|
||||
ph->RegisterProcess(new G4MuMultipleScattering(), particle);
|
||||
G4MuIonisation* muIoni = new G4MuIonisation();
|
||||
muIoni->SetStepFunction(0.1, 50*um);
|
||||
ph->RegisterProcess(muIoni, particle);
|
||||
ph->RegisterProcess(new G4MuBremsstrahlung(), particle);
|
||||
ph->RegisterProcess(new G4MuPairProduction(), particle);
|
||||
|
||||
} else if( particleName == "proton" ||
|
||||
particleName == "pi-" ||
|
||||
particleName == "pi+" ) {
|
||||
|
||||
ph->RegisterProcess(new G4hMultipleScattering(), particle);
|
||||
G4hIonisation* hIoni = new G4hIonisation();
|
||||
hIoni->SetStepFunction(0.1, 20*um);
|
||||
ph->RegisterProcess(hIoni, particle);
|
||||
ph->RegisterProcess(new G4hBremsstrahlung(), particle);
|
||||
ph->RegisterProcess(new G4hPairProduction(), particle);
|
||||
|
||||
} else if( particleName == "alpha" ||
|
||||
particleName == "He3" ) {
|
||||
|
||||
ph->RegisterProcess(new G4hMultipleScattering(), particle);
|
||||
G4ionIonisation* ionIoni = new G4ionIonisation();
|
||||
ionIoni->SetStepFunction(0.1, 1*um);
|
||||
ph->RegisterProcess(ionIoni, particle);
|
||||
ph->RegisterProcess(new G4NuclearStopping(), particle);
|
||||
|
||||
} else if( particleName == "GenericIon" ) {
|
||||
|
||||
ph->RegisterProcess(new G4hMultipleScattering(), particle);
|
||||
G4ionIonisation* ionIoni = new G4ionIonisation();
|
||||
ionIoni->SetEmModel(new G4IonParametrisedLossModel());
|
||||
ionIoni->SetStepFunction(0.1, 1*um);
|
||||
ph->RegisterProcess(ionIoni, particle);
|
||||
ph->RegisterProcess(new G4NuclearStopping(), particle);
|
||||
|
||||
} else if ((!particle->IsShortLived()) &&
|
||||
(particle->GetPDGCharge() != 0.0) &&
|
||||
(particle->GetParticleName() != "chargedgeantino")) {
|
||||
|
||||
//all others charged particles except geantino
|
||||
ph->RegisterProcess(new G4hMultipleScattering(), particle);
|
||||
ph->RegisterProcess(new G4hIonisation(), particle);
|
||||
}
|
||||
}
|
||||
|
||||
// Deexcitation
|
||||
//
|
||||
G4VAtomDeexcitation* de = new G4UAtomicDeexcitation();
|
||||
G4LossTableManager::Instance()->SetAtomDeexcitation(de);
|
||||
|
||||
G4EmModelActivator mact;
|
||||
mact.ConstructProcess();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/// \file electromagnetic/TestEm11/src/PhysicsList.cc
|
||||
/// \brief Implementation of the PhysicsList class
|
||||
//
|
||||
// $Id: PhysicsList.cc 85029 2014-10-23 10:00:33Z gcosmo $
|
||||
// $Id: PhysicsList.cc 94269 2015-11-10 07:55:24Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "PhysicsListMessenger.hh"
|
||||
|
||||
#include "PhysListEmStandard.hh"
|
||||
#include "PhysListEmStandardMP.hh"
|
||||
|
||||
#include "G4EmStandardPhysics.hh"
|
||||
#include "G4EmStandardPhysics_option1.hh"
|
||||
@@ -42,8 +43,11 @@
|
||||
#include "G4EmStandardPhysics_option3.hh"
|
||||
#include "G4EmStandardPhysics_option4.hh"
|
||||
#include "G4EmStandardPhysicsSS.hh"
|
||||
#include "G4EmStandardPhysicsGS.hh"
|
||||
#include "G4EmStandardPhysicsWVI.hh"
|
||||
#include "G4EmLivermorePhysics.hh"
|
||||
#include "G4EmPenelopePhysics.hh"
|
||||
#include "G4EmLowEPPhysics.hh"
|
||||
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
@@ -63,8 +67,7 @@ G4ThreadLocal StepMax* PhysicsList::fStepMaxProcess = 0;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysicsList::PhysicsList() : G4VModularPhysicsList(),
|
||||
fEmPhysicsList(0), fMessenger(0)
|
||||
PhysicsList::PhysicsList() : G4VModularPhysicsList(), fNumAngles(1)
|
||||
{
|
||||
fMessenger = new PhysicsListMessenger(this);
|
||||
|
||||
@@ -149,47 +152,55 @@ void PhysicsList::AddPhysicsList(const G4String& name)
|
||||
if (name == fEmName) return;
|
||||
|
||||
if (name == "local") {
|
||||
|
||||
fEmName = name;
|
||||
delete fEmPhysicsList;
|
||||
fEmPhysicsList = new PhysListEmStandard(name);
|
||||
|
||||
} else if (name == "emstandard_opt0") {
|
||||
|
||||
fEmName = name;
|
||||
delete fEmPhysicsList;
|
||||
fEmPhysicsList = new G4EmStandardPhysics();
|
||||
|
||||
} else if (name == "emstandard_opt1") {
|
||||
|
||||
fEmName = name;
|
||||
delete fEmPhysicsList;
|
||||
fEmPhysicsList = new G4EmStandardPhysics_option1();
|
||||
|
||||
} else if (name == "emstandard_opt2") {
|
||||
|
||||
fEmName = name;
|
||||
delete fEmPhysicsList;
|
||||
fEmPhysicsList = new G4EmStandardPhysics_option2();
|
||||
|
||||
} else if (name == "emstandard_opt3") {
|
||||
|
||||
fEmName = name;
|
||||
delete fEmPhysicsList;
|
||||
fEmPhysicsList = new G4EmStandardPhysics_option3();
|
||||
|
||||
} else if (name == "emstandard_opt4") {
|
||||
|
||||
fEmName = name;
|
||||
delete fEmPhysicsList;
|
||||
fEmPhysicsList = new G4EmStandardPhysics_option4();
|
||||
|
||||
} else if (name == "emstandardSS") {
|
||||
|
||||
fEmName = name;
|
||||
delete fEmPhysicsList;
|
||||
fEmPhysicsList = new G4EmStandardPhysicsSS();
|
||||
|
||||
} else if (name == "emstandardGS") {
|
||||
fEmName = name;
|
||||
delete fEmPhysicsList;
|
||||
fEmPhysicsList = new G4EmStandardPhysicsGS();
|
||||
|
||||
} else if (name == "emstandardWVI") {
|
||||
fEmName = name;
|
||||
delete fEmPhysicsList;
|
||||
fEmPhysicsList = new G4EmStandardPhysicsWVI();
|
||||
|
||||
} else if (name == "emlowenergy") {
|
||||
fEmName = name;
|
||||
delete fEmPhysicsList;
|
||||
fEmPhysicsList = new G4EmLowEPPhysics();
|
||||
|
||||
} else if (name == "emlivermore") {
|
||||
fEmName = name;
|
||||
delete fEmPhysicsList;
|
||||
@@ -200,6 +211,11 @@ void PhysicsList::AddPhysicsList(const G4String& name)
|
||||
delete fEmPhysicsList;
|
||||
fEmPhysicsList = new G4EmPenelopePhysics();
|
||||
|
||||
} else if (name == "emstandardMP") {
|
||||
fEmName = name;
|
||||
delete fEmPhysicsList;
|
||||
fEmPhysicsList = new PhysListEmStandardMP(fNumAngles);
|
||||
|
||||
} else {
|
||||
|
||||
G4cout << "PhysicsList::AddPhysicsList: <" << name << ">"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/// \file electromagnetic/TestEm11/src/PhysicsListMessenger.cc
|
||||
/// \brief Implementation of the PhysicsListMessenger class
|
||||
//
|
||||
// $Id: PhysicsListMessenger.cc 82462 2014-06-23 10:45:28Z gcosmo $
|
||||
// $Id: PhysicsListMessenger.cc 94269 2015-11-10 07:55:24Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -36,12 +36,12 @@
|
||||
#include "PhysicsList.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
|
||||
:G4UImessenger(),fPhysicsList(pPhys),
|
||||
fPhysDir(0), fListCmd(0)
|
||||
: G4UImessenger(),fPhysicsList(pPhys)
|
||||
{
|
||||
fPhysDir = new G4UIdirectory("/testem/phys/");
|
||||
fPhysDir->SetGuidance("physics list commands");
|
||||
@@ -50,7 +50,13 @@ PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
|
||||
fListCmd->SetGuidance("Add modula physics list.");
|
||||
fListCmd->SetParameterName("PList",false);
|
||||
fListCmd->AvailableForStates(G4State_PreInit);
|
||||
fListCmd->SetToBeBroadcasted(false);
|
||||
fListCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fNumAngs = new G4UIcmdWithAnInteger("/testem/phys/setNumberOfAngles",this);
|
||||
fNumAngs->SetGuidance("Set the Number of Discrete Angles.");
|
||||
fNumAngs->SetParameterName("numAngles",false);
|
||||
fNumAngs->AvailableForStates(G4State_PreInit);
|
||||
fNumAngs->SetToBeBroadcasted(false);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -58,7 +64,8 @@ PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys)
|
||||
PhysicsListMessenger::~PhysicsListMessenger()
|
||||
{
|
||||
delete fListCmd;
|
||||
delete fPhysDir;
|
||||
delete fPhysDir;
|
||||
delete fNumAngs;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -66,9 +73,10 @@ PhysicsListMessenger::~PhysicsListMessenger()
|
||||
void PhysicsListMessenger::SetNewValue(G4UIcommand* command,
|
||||
G4String newValue)
|
||||
{
|
||||
|
||||
if( command == fListCmd )
|
||||
{ fPhysicsList->AddPhysicsList(newValue);}
|
||||
if( command == fNumAngs )
|
||||
{ fPhysicsList->SetNumAngles(fNumAngs->GetNewIntValue(newValue));}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -288,7 +288,8 @@ void Run::EndOfRun()
|
||||
//
|
||||
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
|
||||
G4int ih = 1;
|
||||
G4double binWidth = analysisManager->GetH1Width(ih);
|
||||
G4double binWidth = analysisManager->GetH1Width(ih)
|
||||
*analysisManager->GetH1Unit(ih);
|
||||
G4double fac = (1./(numberOfEvent*binWidth))*(mm/MeV);
|
||||
analysisManager->ScaleH1(ih,fac);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
/// \file electromagnetic/TestEm11/src/RunAction.cc
|
||||
/// \brief Implementation of the RunAction class
|
||||
//
|
||||
// $Id: RunAction.cc 78560 2014-01-07 10:06:52Z gcosmo $
|
||||
// $Id: RunAction.cc 93562 2015-10-26 14:44:24Z gcosmo $
|
||||
//
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -103,7 +103,8 @@ void RunAction::BeginOfRunAction(const G4Run*)
|
||||
G4double stepMax = DBL_MAX;
|
||||
G4int ih = 1;
|
||||
if (analysisManager->GetH1Activation(ih)) {
|
||||
stepMax = analysisManager->GetH1Width(ih);
|
||||
stepMax = analysisManager->GetH1Width(ih)
|
||||
*analysisManager->GetH1Unit(ih);
|
||||
}
|
||||
|
||||
ih = 8;
|
||||
|
||||
Reference in New Issue
Block a user