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];
223 curChargeSq += (Z*Z)*w;
226 curRatio *= (CLHEP::proton_mass_c2/norm);
231 massFactors[idx] = curRatio;
232 effCharges[idx] = curChargeSq;
239 G4cout <<
"### Birks coefficients used in run time" <<
G4endl;
241 for(std::size_t i=0; i<nMaterials; ++i) {
246 << br*MeV/mm <<
" mm/MeV" <<
" "
248 <<
" g/cm^2/MeV massFactor= " << massFactors[i]
249 <<
" effCharge= " << effCharges[i] <<
G4endl;
259 G4cout <<
"### Birks coefficients for Geant4 materials" <<
G4endl;
260 for(
G4int i=0; i<nG4Birks; ++i) {
261 G4cout <<
" " << g4MatNames[i] <<
" "
262 << g4MatData[i]*MeV/mm <<
" mm/MeV" <<
G4endl;
269void G4EmSaturation::InitialiseG4materials()
272 g4MatData.reserve(nG4Birks);
276 g4MatNames.push_back(
"G4_POLYSTYRENE");
277 g4MatData.push_back(0.07943*mm/MeV);
281 g4MatNames.push_back(
"G4_BGO");
282 g4MatData.push_back(0.008415*mm/MeV);
292 g4MatNames.push_back(
"G4_lAr");
293 g4MatData.push_back(0.032*mm/MeV);
305 g4MatNames.push_back(
"G4_PbWO4");
306 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()
G4double GetAtomicMassAmu(const G4String &symb) const
G4int GetPDGEncoding() const
G4double GetPDGCharge() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
const char * name(G4int ptype)