56std::size_t G4EmSaturation::nMaterials = 0;
57std::vector<G4double> G4EmSaturation::massFactors;
58std::vector<G4double> G4EmSaturation::effCharges;
59std::vector<G4double> G4EmSaturation::g4MatData;
60std::vector<G4String> G4EmSaturation::g4MatNames;
65 nWarnings = nG4Birks = 0;
87 if(edep <= 0.0) {
return 0.0; }
91 if(length <= 0.0) {
return edep; }
101 evis /= (1.0 + bfactor*edep/
108 G4double nloss = std::max(niel, 0.0);
118 eloss /= (1.0 + bfactor*eloss/length);
123 G4double escaled = nloss*massFactors[idx];
132 ->
GetRange(proton,escaled,couple)/effCharges[idx];
133 nloss /= (1.0 + bfactor*nloss/range);
135 evis = eloss + nloss;
147 massFactors.resize(nMaterials, 1.0);
148 effCharges.resize(nMaterials, 1.0);
150 if(0 == nG4Birks) { InitialiseG4materials(); }
152 for(std::size_t i=0; i<nMaterials; ++i) {
162 if(0 == nG4Birks) { InitialiseG4materials(); }
167 for(
G4int j=0; j<nG4Birks; ++j) {
168 if(name == g4MatNames[j]) {
170 G4cout <<
"### G4EmSaturation::FindG4BirksCoefficient for "
171 << name <<
" is " << g4MatData[j]*MeV/mm <<
" mm/MeV "
181void G4EmSaturation::InitialiseBirksCoefficient(
const G4Material* mat)
184 if(
nullptr == electron) {
187 if(
nullptr == electron) {
188 G4Exception(
"G4EmSaturation::InitialiseBirksCoefficient",
"em0001",
199 if(curBirks == 0.0) {
200 for(
G4int j=0; j<nG4Birks; ++j) {
201 if(name == g4MatNames[j]) {
203 curBirks = g4MatData[j];
209 if(curBirks == 0.0) {
return; }
218 for (std::size_t i=0; i<nelm; ++i) {
219 const G4Element* elm = (*theElementVector)[i];
221 G4double w = theAtomNumDensityVector[i];
222 curRatio += w/nist->GetAtomicMassAmu(Z);
223 curChargeSq += (Z*Z)*w;
226 if ( norm > 0.0) { norm = 1.0/norm; }
227 curRatio *= (CLHEP::proton_mass_c2*norm);
232 massFactors[idx] = curRatio;
233 effCharges[idx] = curChargeSq;
240 G4cout <<
"### Birks coefficients used in run time" <<
G4endl;
242 for(std::size_t i=0; i<nMaterials; ++i) {
247 << br*MeV/mm <<
" mm/MeV" <<
" "
249 <<
" g/cm^2/MeV massFactor= " << massFactors[i]
250 <<
" effCharge= " << effCharges[i] <<
G4endl;
260 G4cout <<
"### Birks coefficients for Geant4 materials" <<
G4endl;
261 for(
G4int i=0; i<nG4Birks; ++i) {
262 G4cout <<
" " << g4MatNames[i] <<
" "
263 << g4MatData[i]*MeV/mm <<
" mm/MeV" <<
G4endl;
270void G4EmSaturation::InitialiseG4materials()
273 g4MatData.reserve(nG4Birks);
277 g4MatNames.push_back(
"G4_POLYSTYRENE");
278 g4MatData.push_back(0.07943*mm/MeV);
282 g4MatNames.push_back(
"G4_BGO");
283 g4MatData.push_back(0.008415*mm/MeV);
293 g4MatNames.push_back(
"G4_lAr");
294 g4MatData.push_back(0.032*mm/MeV);
306 g4MatNames.push_back(
"G4_PbWO4");
307 g4MatData.push_back(0.0333333*mm/MeV);
std::vector< const G4Element * > G4ElementVector
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::vector< G4Material * > G4MaterialTable
G4GLOB_DLL std::ostream G4cout
virtual ~G4EmSaturation()
virtual G4double VisibleEnergyDeposition(const G4ParticleDefinition *, const G4MaterialCutsCouple *, G4double length, G4double edepTotal, G4double edepNIEL=0.0) const
G4double FindG4BirksCoefficient(const G4Material *)
void DumpBirksCoefficients()
void InitialiseG4Saturation()
void DumpG4BirksCoefficients()
G4EmSaturation(G4int verb)
void SetBirksConstant(G4double value)
G4double GetBirksConstant() const
static G4LossTableManager * Instance()
G4double GetRange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
const G4Material * GetMaterial() const
G4double GetDensity() const
const G4ElementVector * GetElementVector() const
G4IonisParamMat * GetIonisation() const
static std::size_t GetNumberOfMaterials()
const G4double * GetVecNbOfAtomsPerVolume() const
std::size_t GetIndex() const
static G4MaterialTable * GetMaterialTable()
std::size_t GetNumberOfElements() const
const G4String & GetName() const
static G4NistManager * Instance()
G4int GetPDGEncoding() const
G4double GetPDGCharge() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
const char * name(G4int ptype)