57 G4int G4EmSaturation::nMaterials = 0;
58 std::vector<G4double> G4EmSaturation::massFactors;
59 std::vector<G4double> G4EmSaturation::effCharges;
60 std::vector<G4double> G4EmSaturation::g4MatData;
61 std::vector<G4String> G4EmSaturation::g4MatNames;
67 nWarnings = nG4Birks = 0;
88 if(edep <= 0.0) {
return 0.0; }
98 evis /= (1.0 + bfactor*edep/
109 if(0.0 == p->
GetPDGCharge() || eloss < 0.0 || length <= 0.0) {
115 eloss /= (1.0 + bfactor*eloss/length);
120 G4double escaled = nloss*massFactors[idx];
128 ->
GetRange(proton,escaled,couple)/effCharges[idx];
129 nloss /= (1.0 + bfactor*nloss/
range);
131 evis = eloss + nloss;
142 massFactors.resize(nMaterials, 1.0);
143 effCharges.resize(nMaterials, 1.0);
145 if(0 == nG4Birks) { InitialiseG4materials(); }
147 for(
G4int i=0; i<nMaterials; ++i) {
157 if(0 == nG4Birks) { InitialiseG4materials(); }
162 for(
G4int j=0; j<nG4Birks; ++j) {
163 if(name == g4MatNames[j]) {
165 G4cout <<
"### G4EmSaturation::FindG4BirksCoefficient for "
166 << name <<
" is " << g4MatData[j]*
MeV/
mm <<
" mm/MeV "
176 void G4EmSaturation::InitialiseBirksCoefficient(
const G4Material* mat)
182 if(!electron || !proton) {
183 G4Exception(
"G4EmSaturation::InitialiseBirksCoefficient",
"em0001",
194 if(curBirks == 0.0) {
195 for(
G4int j=0; j<nG4Birks; ++j) {
196 if(name == g4MatNames[j]) {
198 curBirks = g4MatData[j];
204 if(curBirks == 0.0) {
return; }
213 for (
size_t i=0; i<nelm; ++i) {
214 const G4Element* elm = (*theElementVector)[i];
216 G4double w = Z*Z*theAtomNumDensityVector[i];
226 massFactors[idx] = curRatio;
227 effCharges[idx] = curChargeSq;
234 G4cout <<
"### Birks coefficients used in run time" <<
G4endl;
236 for(
G4int i=0; i<nMaterials; ++i) {
241 << br*
MeV/
mm <<
" mm/MeV" <<
" "
243 <<
" g/cm^2/MeV massFactor= " << massFactors[i]
244 <<
" effCharge= " << effCharges[i] <<
G4endl;
254 G4cout <<
"### Birks coefficients for Geant4 materials" <<
G4endl;
255 for(
G4int i=0; i<nG4Birks; ++i) {
256 G4cout <<
" " << g4MatNames[i] <<
" "
264 void G4EmSaturation::InitialiseG4materials()
267 g4MatData.reserve(nG4Birks);
271 g4MatNames.push_back(
"G4_POLYSTYRENE");
272 g4MatData.push_back(0.07943*
mm/
MeV);
276 g4MatNames.push_back(
"G4_BGO");
277 g4MatData.push_back(0.008415*
mm/
MeV);
287 g4MatNames.push_back(
"G4_lAr");
288 g4MatData.push_back(0.032*
mm/
MeV);
300 g4MatNames.push_back(
"G4_PbWO4");
301 g4MatData.push_back(0.0333333*
mm/
MeV);
G4IonisParamMat * GetIonisation() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4LossTableManager * Instance()
static constexpr double mm
std::vector< G4Element * > G4ElementVector
static constexpr double cm2
const G4String & GetName() const
void SetBirksConstant(G4double value)
virtual ~G4EmSaturation()
static G4MaterialTable * GetMaterialTable()
std::vector< G4Material * > G4MaterialTable
G4double GetDensity() const
G4int GetPDGEncoding() const
virtual G4double VisibleEnergyDeposition(const G4ParticleDefinition *, const G4MaterialCutsCouple *, G4double length, G4double edepTotal, G4double edepNIEL=0.0) const
void DumpBirksCoefficients()
const G4ElementVector * GetElementVector() const
static G4NistManager * Instance()
G4double GetBirksConstant() const
const G4double * GetVecNbOfAtomsPerVolume() const
G4GLOB_DLL std::ostream G4cout
const G4ParticleDefinition const G4Material *G4double range
void InitialiseG4Saturation()
G4double FindG4BirksCoefficient(const G4Material *)
static size_t GetNumberOfMaterials()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void DumpG4BirksCoefficients()
static G4ParticleTable * GetParticleTable()
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double GetAtomicMassAmu(const G4String &symb) const
static constexpr double MeV
size_t GetNumberOfElements() const
G4EmSaturation(G4int verb)
G4double GetPDGCharge() const
G4double GetRange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
const G4Material * GetMaterial() const