56G4int G4EmSaturation::nMaterials = 0;
57std::vector<G4double> G4EmSaturation::massFactors;
58std::vector<G4double> G4EmSaturation::effCharges;
59std::vector<G4double> G4EmSaturation::g4MatData;
60std::vector<G4String> G4EmSaturation::g4MatNames;
66 nWarnings = nG4Birks = 0;
88 if(edep <= 0.0) {
return 0.0; }
92 if(length <= 0.0) {
return edep; }
102 evis /= (1.0 + bfactor*edep/
109 G4double nloss = std::max(niel, 0.0);
119 eloss /= (1.0 + bfactor*eloss/length);
124 G4double escaled = nloss*massFactors[idx];
132 ->
GetRange(proton,escaled,couple)/effCharges[idx];
133 nloss /= (1.0 + bfactor*nloss/range);
135 evis = eloss + nloss;
146 massFactors.resize(nMaterials, 1.0);
147 effCharges.resize(nMaterials, 1.0);
149 if(0 == nG4Birks) { InitialiseG4materials(); }
151 for(
G4int i=0; i<nMaterials; ++i) {
161 if(0 == nG4Birks) { InitialiseG4materials(); }
166 for(
G4int j=0; j<nG4Birks; ++j) {
167 if(name == g4MatNames[j]) {
169 G4cout <<
"### G4EmSaturation::FindG4BirksCoefficient for "
170 << name <<
" is " << g4MatData[j]*MeV/mm <<
" mm/MeV "
180void G4EmSaturation::InitialiseBirksCoefficient(
const G4Material* mat)
186 if(!electron || !proton) {
187 G4Exception(
"G4EmSaturation::InitialiseBirksCoefficient",
"em0001",
198 if(curBirks == 0.0) {
199 for(
G4int j=0; j<nG4Birks; ++j) {
200 if(name == g4MatNames[j]) {
202 curBirks = g4MatData[j];
208 if(curBirks == 0.0) {
return; }
217 for (
size_t i=0; i<nelm; ++i) {
218 const G4Element* elm = (*theElementVector)[i];
220 G4double w = Z*Z*theAtomNumDensityVector[i];
225 curRatio *= proton_mass_c2/norm;
230 massFactors[idx] = curRatio;
231 effCharges[idx] = curChargeSq;
238 G4cout <<
"### Birks coefficients used in run time" <<
G4endl;
240 for(
G4int i=0; i<nMaterials; ++i) {
245 << br*MeV/mm <<
" mm/MeV" <<
" "
247 <<
" g/cm^2/MeV massFactor= " << massFactors[i]
248 <<
" effCharge= " << effCharges[i] <<
G4endl;
258 G4cout <<
"### Birks coefficients for Geant4 materials" <<
G4endl;
259 for(
G4int i=0; i<nG4Birks; ++i) {
260 G4cout <<
" " << g4MatNames[i] <<
" "
261 << g4MatData[i]*MeV/mm <<
" mm/MeV" <<
G4endl;
268void G4EmSaturation::InitialiseG4materials()
271 g4MatData.reserve(nG4Birks);
275 g4MatNames.push_back(
"G4_POLYSTYRENE");
276 g4MatData.push_back(0.07943*mm/MeV);
280 g4MatNames.push_back(
"G4_BGO");
281 g4MatData.push_back(0.008415*mm/MeV);
291 g4MatNames.push_back(
"G4_lAr");
292 g4MatData.push_back(0.032*mm/MeV);
304 g4MatNames.push_back(
"G4_PbWO4");
305 g4MatData.push_back(0.0333333*mm/MeV);
std::vector< 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
static size_t GetNumberOfMaterials()
G4IonisParamMat * GetIonisation() const
size_t GetNumberOfElements() const
const G4double * GetVecNbOfAtomsPerVolume() const
static G4MaterialTable * GetMaterialTable()
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)