Import Geant4 9.2.0 source tree
This commit is contained in:
@@ -23,8 +23,8 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VEmModel.cc,v 1.8 2007/09/25 10:19:07 vnivanch Exp $
|
||||
// GEANT4 tag $Name: geant4-09-01 $
|
||||
// $Id: G4VEmModel.cc,v 1.20 2008/11/13 23:13:18 schaelic Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
//
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
@@ -50,35 +50,55 @@
|
||||
//
|
||||
|
||||
#include "G4VEmModel.hh"
|
||||
#include "G4LossTableManager.hh"
|
||||
#include "G4ProductionCutsTable.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VEmModel::G4VEmModel(const G4String& nam):
|
||||
lowLimit(0.1*keV), highLimit(100.0*TeV), fluc(0), name(nam), pParticleChange(0)
|
||||
{}
|
||||
fluc(0), name(nam), lowLimit(0.1*keV), highLimit(100.0*TeV),
|
||||
polarAngleLimit(0.0),secondaryThreshold(DBL_MAX),theLPMflag(false),
|
||||
pParticleChange(0),nuclearStopping(false),nsec(5)
|
||||
{
|
||||
xsec.resize(nsec);
|
||||
nSelectors = 0;
|
||||
G4LossTableManager::Instance()->Register(this);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4VEmModel::~G4VEmModel()
|
||||
{}
|
||||
{
|
||||
G4LossTableManager::Instance()->DeRegister(this);
|
||||
G4int n = elmSelectors.size();
|
||||
if(n > 0) {
|
||||
for(G4int i=0; i<n; i++) {
|
||||
delete elmSelectors[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4VEmModel::CrossSectionPerVolume(const G4Material* material,
|
||||
const G4ParticleDefinition* p,
|
||||
G4double ekin,
|
||||
G4double emin,
|
||||
G4double emax)
|
||||
G4double ekin,
|
||||
G4double emin,
|
||||
G4double emax)
|
||||
{
|
||||
SetupForMaterial(p, material, ekin);
|
||||
G4double cross = 0.0;
|
||||
const G4ElementVector* theElementVector = material->GetElementVector();
|
||||
const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
|
||||
size_t nelm = material->GetNumberOfElements();
|
||||
for (size_t i=0; i<nelm; i++) {
|
||||
const G4Element* elm = (*theElementVector)[i];
|
||||
G4int nelm = material->GetNumberOfElements();
|
||||
if(nelm > nsec) {
|
||||
xsec.resize(nelm);
|
||||
nsec = nelm;
|
||||
}
|
||||
for (G4int i=0; i<nelm; i++) {
|
||||
cross += theAtomNumDensityVector[i]*
|
||||
ComputeCrossSectionPerAtom(p,ekin,elm->GetZ(),elm->GetN(),emin,emax);
|
||||
ComputeCrossSectionPerAtom(p,(*theElementVector)[i],ekin,emin,emax);
|
||||
xsec[i] = cross;
|
||||
}
|
||||
return cross;
|
||||
@@ -87,10 +107,10 @@ G4double G4VEmModel::CrossSectionPerVolume(const G4Material* material,
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4VEmModel::ComputeMeanFreePath(const G4ParticleDefinition* p,
|
||||
G4double ekin,
|
||||
G4double ekin,
|
||||
const G4Material* material,
|
||||
G4double emin,
|
||||
G4double emax)
|
||||
G4double emin,
|
||||
G4double emax)
|
||||
{
|
||||
G4double mfp = DBL_MAX;
|
||||
G4double cross = CrossSectionPerVolume(material,p,ekin,emin,emax);
|
||||
@@ -100,4 +120,45 @@ G4double G4VEmModel::ComputeMeanFreePath(const G4ParticleDefinition* p,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4VEmModel::InitialiseElementSelectors(const G4ParticleDefinition* p,
|
||||
const G4DataVector& cuts)
|
||||
{
|
||||
G4int nbins = G4int(std::log10(highLimit/lowLimit) + 0.5);
|
||||
if(nbins < 3) nbins = 3;
|
||||
G4bool spline = G4LossTableManager::Instance()->SplineFlag();
|
||||
|
||||
G4ProductionCutsTable* theCoupleTable=
|
||||
G4ProductionCutsTable::GetProductionCutsTable();
|
||||
G4int numOfCouples = theCoupleTable->GetTableSize();
|
||||
|
||||
// prepare vector
|
||||
if(numOfCouples > nSelectors) {
|
||||
elmSelectors.resize(numOfCouples);
|
||||
nSelectors = numOfCouples;
|
||||
}
|
||||
|
||||
// initialise vector
|
||||
for(G4int i=0; i<numOfCouples; i++) {
|
||||
const G4MaterialCutsCouple* couple =
|
||||
theCoupleTable->GetMaterialCutsCouple(i);
|
||||
const G4Material* material = couple->GetMaterial();
|
||||
G4int idx = couple->GetIndex();
|
||||
|
||||
// selector already exist check if should be deleted
|
||||
G4bool create = true;
|
||||
if(elmSelectors[i]) {
|
||||
if(material == elmSelectors[i]->GetMaterial()) create = false;
|
||||
else delete elmSelectors[i];
|
||||
}
|
||||
if(create) {
|
||||
elmSelectors[i] = new G4EmElementSelector(this,material,nbins,
|
||||
lowLimit,highLimit,spline);
|
||||
}
|
||||
elmSelectors[i]->Initialise(p, cuts[idx]);
|
||||
//elmSelectors[i]->Dump(p);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user