Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4EmTableUtil Class Reference

#include <G4EmTableUtil.hh>

Static Public Member Functions

static const G4DataVectorPrepareEmProcess (G4VEmProcess *proc, const G4ParticleDefinition *part, const G4ParticleDefinition *secPart, G4EmModelManager *modelManager, const G4double &maxKinEnergy, G4int &secID, G4int &tripletID, G4int &mainSec, const G4int &verb, const G4bool &master)
 
static void BuildEmProcess (G4VEmProcess *proc, const G4VEmProcess *masterProc, const G4ParticleDefinition *firstPart, const G4ParticleDefinition *part, const G4int nModels, const G4int verb, const G4bool master, const G4bool isLocked, const G4bool toBuild, G4bool &baseMat)
 
static void BuildLambdaTable (G4VEmProcess *proc, const G4ParticleDefinition *part, G4EmModelManager *modelManager, G4LossTableBuilder *bld, G4PhysicsTable *theLambdaTable, G4PhysicsTable *theLambdaTablePrim, const G4double minKinEnergy, const G4double minKinEnergyPrim, const G4double maxKinEnergy, const G4double scale, const G4int verbose, const G4bool startFromNull, const G4bool splineFlag)
 
static void BuildLambdaTable (G4VEnergyLossProcess *proc, const G4ParticleDefinition *part, G4EmModelManager *modelManager, G4LossTableBuilder *bld, G4PhysicsTable *theLambdaTable, const G4DataVector *theCuts, const G4double minKinEnergy, const G4double maxKinEnergy, const G4double scale, const G4int verbose, const G4bool splineFlag)
 
static const G4ParticleDefinitionCheckIon (G4VEnergyLossProcess *proc, const G4ParticleDefinition *part, const G4ParticleDefinition *particle, const G4int verboseLevel, G4bool &isIon)
 
static void UpdateModels (G4VEnergyLossProcess *proc, G4EmModelManager *modelManager, const G4double maxKinEnergy, const G4int nModels, G4int &secID, G4int &biasID, G4int &mainSecondaries, const G4bool baseMat, const G4bool isMaster, const G4bool useAGen)
 
static void BuildLocalElossProcess (G4VEnergyLossProcess *proc, const G4VEnergyLossProcess *masterProc, const G4ParticleDefinition *part, const G4int nModels)
 
static void BuildDEDXTable (G4VEnergyLossProcess *proc, const G4ParticleDefinition *part, G4EmModelManager *modelManager, G4LossTableBuilder *bld, G4PhysicsTable *table, const G4double minKinEnergy, const G4double maxKinEnergy, const G4int nbins, const G4int verbose, const G4EmTableType tType, const G4bool splineFlag)
 
static void PrepareMscProcess (G4VMultipleScattering *proc, const G4ParticleDefinition &part, G4EmModelManager *modelManager, G4MscStepLimitType &stepLimit, G4double &facrange, G4bool &latDisplacement, G4bool &master, G4bool &isIon, G4bool &baseMat)
 
static void BuildMscProcess (G4VMultipleScattering *proc, const G4VMultipleScattering *masterProc, const G4ParticleDefinition &part, const G4ParticleDefinition *firstPart, G4int nModels, G4bool master)
 
static G4bool StoreMscTable (G4VMultipleScattering *proc, const G4ParticleDefinition *part, const G4String &directory, const G4int nModels, const G4int verb, const G4bool ascii)
 
static G4bool StoreTable (G4VProcess *, const G4ParticleDefinition *, G4PhysicsTable *, const G4String &dir, const G4String &tname, G4int verb, G4bool ascii)
 
static G4bool RetrieveTable (G4VProcess *ptr, const G4ParticleDefinition *part, G4PhysicsTable *aTable, const G4String &dir, const G4String &tname, const G4int verb, const G4bool ascii, const G4bool spline)
 

Detailed Description

Definition at line 48 of file G4EmTableUtil.hh.

Member Function Documentation

◆ BuildDEDXTable()

void G4EmTableUtil::BuildDEDXTable ( G4VEnergyLossProcess * proc,
const G4ParticleDefinition * part,
G4EmModelManager * modelManager,
G4LossTableBuilder * bld,
G4PhysicsTable * table,
const G4double minKinEnergy,
const G4double maxKinEnergy,
const G4int nbins,
const G4int verbose,
const G4EmTableType tType,
const G4bool splineFlag )
static

Definition at line 444 of file G4EmTableUtil.cc.

455{
456 // Access to materials
457 const G4ProductionCutsTable* theCoupleTable=
459 std::size_t numOfCouples = theCoupleTable->GetTableSize();
460
461 if(1 < verbose) {
462 G4cout << numOfCouples << " couples" << " minKinEnergy(MeV)= " << emin
463 << " maxKinEnergy(MeV)= " << emax << " nbins= " << nbins << G4endl;
464 }
465 G4PhysicsLogVector* aVector = nullptr;
466 G4PhysicsLogVector* bVector = nullptr;
467
468 for(std::size_t i=0; i<numOfCouples; ++i) {
469
470 if(1 < verbose) {
471 G4cout << "G4EmTableUtil::BuildDEDXVector idx= " << i
472 << " flagTable=" << table->GetFlag(i)
473 << " flagBuilder=" << bld->GetFlag(i) << G4endl;
474 }
475 if(bld->GetFlag(i)) {
476
477 // create physics vector and fill it
478 const G4MaterialCutsCouple* couple =
479 theCoupleTable->GetMaterialCutsCouple((G4int)i);
480 delete (*table)[i];
481 if(nullptr != bVector) {
482 aVector = new G4PhysicsLogVector(*bVector);
483 } else {
484 bVector = new G4PhysicsLogVector(emin, emax, nbins, spline);
485 aVector = bVector;
486 }
487
488 modelManager->FillDEDXVector(aVector, couple, tType);
489 if(spline) { aVector->FillSecondDerivatives(); }
490
491 // Insert vector for this material into the table
493 }
494 }
495
496 if(1 < verbose) {
497 G4cout << "G4EmTableUtil::BuildDEDXTable(): table is built for "
498 << part->GetParticleName()
499 << " and process " << proc->GetProcessName()
500 << G4endl;
501 if(2 < verbose) G4cout << (*table) << G4endl;
502 }
503}
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
void FillDEDXVector(G4PhysicsVector *, const G4MaterialCutsCouple *, G4EmTableType t=fRestricted)
G4bool GetFlag(size_t idx)
const G4String & GetParticleName() const
static void SetPhysicsVector(G4PhysicsTable *physTable, std::size_t idx, G4PhysicsVector *vec)
G4bool GetFlag(std::size_t i) const
void FillSecondDerivatives(const G4SplineType=G4SplineType::Base, const G4double dir1=0.0, const G4double dir2=0.0)
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
static G4ProductionCutsTable * GetProductionCutsTable()
const G4String & GetProcessName() const

Referenced by G4VEnergyLossProcess::BuildDEDXTable().

◆ BuildEmProcess()

void G4EmTableUtil::BuildEmProcess ( G4VEmProcess * proc,
const G4VEmProcess * masterProc,
const G4ParticleDefinition * firstPart,
const G4ParticleDefinition * part,
const G4int nModels,
const G4int verb,
const G4bool master,
const G4bool isLocked,
const G4bool toBuild,
G4bool & baseMat )
static

Definition at line 111 of file G4EmTableUtil.cc.

118{
119 G4String num = part->GetParticleName();
120 if(1 < verb) {
121 G4cout << "### G4EmTableUtil::BuildPhysicsTable() for "
122 << proc->GetProcessName() << " and particle " << num
123 << " buildLambdaTable=" << toBuild << " master= " << master
124 << G4endl;
125 }
126
127 if(firstPart == part) {
128
129 // worker initialisation
130 if(!master) {
131 proc->SetLambdaTable(masterProc->LambdaTable());
132 proc->SetLambdaTablePrim(masterProc->LambdaTablePrim());
133 proc->SetCrossSectionType(masterProc->CrossSectionType());
135
136 // local initialisation of models
137 baseMat = masterProc->UseBaseMaterial();
138 G4bool printing = true;
139 for(G4int i=0; i<nModels; ++i) {
140 G4VEmModel* mod = proc->GetModelByIndex(i, printing);
141 G4VEmModel* mod0= masterProc->GetModelByIndex(i, printing);
142 mod->SetUseBaseMaterials(baseMat);
143 mod->InitialiseLocal(part, mod0);
144 }
145 // master thread
146 } else {
147 if(toBuild) { proc->BuildLambdaTable(); }
148 auto fXSType = proc->CrossSectionType();
149 auto v = proc->EnergyOfCrossSectionMax();
150 delete v;
151 v = nullptr;
152 if(fXSType == fEmOnePeak) {
153 auto table = proc->LambdaTable();
154 if(nullptr == table) {
155 v = G4EmUtility::FindCrossSectionMax(proc, part);
156 } else {
158 }
159 if(nullptr == v) { proc->SetCrossSectionType(fEmIncreasing); }
160 }
162 }
163 }
164 // protection against double printout
165 if(isLocked) { return; }
166
167 // explicitly defined printout by particle name
168 if(1 < verb || (0 < verb && (num == "gamma" || num == "e-" ||
169 num == "e+" || num == "mu+" ||
170 num == "mu-" || num == "proton"||
171 num == "pi+" || num == "pi-" ||
172 num == "kaon+" || num == "kaon-" ||
173 num == "alpha" || num == "anti_proton" ||
174 num == "GenericIon" ||
175 num == "alpha+" || num == "helium" ||
176 num == "hydrogen"))) {
177 proc->StreamInfo(G4cout, *part);
178 }
179
180 if(1 < verb) {
181 G4cout << "### G4EmTableUtil::BuildPhysicsTable() done for "
182 << proc->GetProcessName() << " and particle " << num
183 << " baseMat=" << baseMat << G4endl;
184 }
185}
@ fEmOnePeak
@ fEmIncreasing
bool G4bool
Definition G4Types.hh:86
static std::vector< G4double > * FindCrossSectionMax(G4PhysicsTable *)
void SetUseBaseMaterials(G4bool val)
virtual void InitialiseLocal(const G4ParticleDefinition *, G4VEmModel *masterModel)
G4CrossSectionType CrossSectionType() const
G4VEmModel * GetModelByIndex(G4int idx=0, G4bool ver=false) const
void SetLambdaTablePrim(G4PhysicsTable *)
void SetEnergyOfCrossSectionMax(std::vector< G4double > *)
G4PhysicsTable * LambdaTable() const
void StreamInfo(std::ostream &outFile, const G4ParticleDefinition &, G4bool rst=false) const
std::vector< G4double > * EnergyOfCrossSectionMax() const
G4bool UseBaseMaterial() const
void SetCrossSectionType(G4CrossSectionType val)
G4PhysicsTable * LambdaTablePrim() const
void SetLambdaTable(G4PhysicsTable *)
void BuildLambdaTable()

Referenced by G4VEmProcess::BuildPhysicsTable().

◆ BuildLambdaTable() [1/2]

void G4EmTableUtil::BuildLambdaTable ( G4VEmProcess * proc,
const G4ParticleDefinition * part,
G4EmModelManager * modelManager,
G4LossTableBuilder * bld,
G4PhysicsTable * theLambdaTable,
G4PhysicsTable * theLambdaTablePrim,
const G4double minKinEnergy,
const G4double minKinEnergyPrim,
const G4double maxKinEnergy,
const G4double scale,
const G4int verbose,
const G4bool startFromNull,
const G4bool splineFlag )
static

Definition at line 189 of file G4EmTableUtil.cc.

202{
203 if(1 < verboseLevel) {
204 G4cout << "G4EmTableUtil::BuildLambdaTable() for process "
205 << proc->GetProcessName() << " and particle "
206 << part->GetParticleName() << G4endl;
207 }
208
209 // Access to materials
210 const G4ProductionCutsTable* theCoupleTable=
212 std::size_t numOfCouples = theCoupleTable->GetTableSize();
213
214 G4PhysicsLogVector* aVector = nullptr;
215 G4PhysicsLogVector* aVectorPrim = nullptr;
216 G4PhysicsLogVector* bVectorPrim = nullptr;
217
218 G4double emax1 = std::min(maxKinEnergy, minKinEnergyPrim);
219
220 for(std::size_t i=0; i<numOfCouples; ++i) {
221
222 if (bld->GetFlag(i)) {
223 // create physics vector and fill it
224 const G4MaterialCutsCouple* couple =
225 theCoupleTable->GetMaterialCutsCouple((G4int)i);
226
227 // build main table
228 if(nullptr != theLambdaTable) {
229 delete (*theLambdaTable)[i];
230
231 // if start from zero then change the scale
232 G4double emin = minKinEnergy;
233 G4bool startNull = false;
234 if(startFromNull) {
235 G4double e = proc->MinPrimaryEnergy(part, couple->GetMaterial());
236 if(e >= emin) {
237 emin = e;
238 startNull = true;
239 }
240 }
241 G4double emax = emax1;
242 if(emax <= emin) { emax = 2*emin; }
243 G4int bin = G4lrint(scale*G4Log(emax/emin));
244 bin = std::max(bin, 5);
245 aVector = new G4PhysicsLogVector(emin, emax, bin, splineFlag);
246 modelManager->FillLambdaVector(aVector, couple, startNull);
247 if(splineFlag) { aVector->FillSecondDerivatives(); }
248 G4PhysicsTableHelper::SetPhysicsVector(theLambdaTable, i, aVector);
249 }
250 // build high energy table
251 if(nullptr != theLambdaTablePrim) {
252 delete (*theLambdaTablePrim)[i];
253
254 // start not from zero and always use spline
255 if(nullptr == bVectorPrim) {
256 G4int bin = G4lrint(scale*G4Log(maxKinEnergy/minKinEnergyPrim));
257 bin = std::max(bin, 5);
258 aVectorPrim =
259 new G4PhysicsLogVector(minKinEnergyPrim, maxKinEnergy, bin, true);
260 bVectorPrim = aVectorPrim;
261 } else {
262 aVectorPrim = new G4PhysicsLogVector(*bVectorPrim);
263 }
264 modelManager->FillLambdaVector(aVectorPrim, couple, false,
266 aVectorPrim->FillSecondDerivatives();
267 G4PhysicsTableHelper::SetPhysicsVector(theLambdaTablePrim, i,
268 aVectorPrim);
269 }
270 }
271 }
272
273 if(1 < verboseLevel) {
274 G4cout << "Lambda table is built for " << part->GetParticleName() << G4endl;
275 }
276}
@ fIsCrossSectionPrim
G4double G4Log(G4double x)
Definition G4Log.hh:227
double G4double
Definition G4Types.hh:83
void FillLambdaVector(G4PhysicsVector *, const G4MaterialCutsCouple *, G4bool startFromNull=true, G4EmTableType t=fRestricted)
const G4Material * GetMaterial() const
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition *, const G4Material *)
int G4lrint(double ad)
Definition templates.hh:134

Referenced by G4VEmProcess::BuildLambdaTable(), and G4VEnergyLossProcess::BuildLambdaTable().

◆ BuildLambdaTable() [2/2]

void G4EmTableUtil::BuildLambdaTable ( G4VEnergyLossProcess * proc,
const G4ParticleDefinition * part,
G4EmModelManager * modelManager,
G4LossTableBuilder * bld,
G4PhysicsTable * theLambdaTable,
const G4DataVector * theCuts,
const G4double minKinEnergy,
const G4double maxKinEnergy,
const G4double scale,
const G4int verbose,
const G4bool splineFlag )
static

Definition at line 280 of file G4EmTableUtil.cc.

291{
292 if(1 < verboseLevel) {
293 G4cout << "G4EmTableUtil::BuildLambdaTable() for process "
294 << proc->GetProcessName() << " and particle "
295 << part->GetParticleName() << G4endl;
296 }
297
298 const G4ProductionCutsTable* theCoupleTable=
300 std::size_t numOfCouples = theCoupleTable->GetTableSize();
301
302 G4PhysicsLogVector* aVector = nullptr;
303 for(std::size_t i=0; i<numOfCouples; ++i) {
304 if (bld->GetFlag(i)) {
305 // create physics vector and fill it
306 const G4MaterialCutsCouple* couple =
307 theCoupleTable->GetMaterialCutsCouple((G4int)i);
308
309 delete (*theLambdaTable)[i];
310 G4bool startNull = true;
311 G4double emin =
312 proc->MinPrimaryEnergy(part, couple->GetMaterial(), (*theCuts)[i]);
313 if(minKinEnergy > emin) {
314 emin = minKinEnergy;
315 startNull = false;
316 }
317
318 G4double emax = maxKinEnergy;
319 if(emax <= emin) { emax = 2*emin; }
320 G4int bin = G4lrint(scale*G4Log(emax/emin));
321 bin = std::max(bin, 5);
322 aVector = new G4PhysicsLogVector(emin, emax, bin, splineFlag);
323 modelManager->FillLambdaVector(aVector, couple, startNull, fRestricted);
324 if(splineFlag) { aVector->FillSecondDerivatives(); }
325 G4PhysicsTableHelper::SetPhysicsVector(theLambdaTable, i, aVector);
326 }
327 }
328
329 if(1 < verboseLevel) {
330 G4cout << "Lambda table is built for " << part->GetParticleName() << G4endl;
331 }
332}
@ fRestricted
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition *, const G4Material *, G4double cut)

◆ BuildLocalElossProcess()

void G4EmTableUtil::BuildLocalElossProcess ( G4VEnergyLossProcess * proc,
const G4VEnergyLossProcess * masterProc,
const G4ParticleDefinition * part,
const G4int nModels )
static

Definition at line 413 of file G4EmTableUtil.cc.

417{
418 // copy table pointers from master thread
419 proc->SetDEDXTable(masterProc->DEDXTable(),fRestricted);
420 proc->SetDEDXTable(masterProc->DEDXunRestrictedTable(),fTotal);
421 proc->SetDEDXTable(masterProc->IonisationTable(),fIsIonisation);
422 proc->SetRangeTableForLoss(masterProc->RangeTableForLoss());
423 proc->SetCSDARangeTable(masterProc->CSDARangeTable());
424 proc->SetInverseRangeTable(masterProc->InverseRangeTable());
425 proc->SetLambdaTable(masterProc->LambdaTable());
426 proc->SetCrossSectionType(masterProc->CrossSectionType());
428 proc->SetTwoPeaksXS(masterProc->TwoPeaksXS());
429 proc->SetIonisation(masterProc->IsIonisationProcess());
430 G4bool baseMat = masterProc->UseBaseMaterial();
431
432 // local initialisation of models
433 G4bool printing = true;
434 for(G4int i=0; i<nModels; ++i) {
435 G4VEmModel* mod = proc->GetModelByIndex(i, printing);
436 G4VEmModel* mod0= masterProc->GetModelByIndex(i, printing);
437 mod->SetUseBaseMaterials(baseMat);
438 mod->InitialiseLocal(part, mod0);
439 }
440}
@ fTotal
@ fIsIonisation
G4PhysicsTable * RangeTableForLoss() const
std::vector< G4double > * EnergyOfCrossSectionMax() const
G4PhysicsTable * InverseRangeTable() const
G4PhysicsTable * CSDARangeTable() const
void SetRangeTableForLoss(G4PhysicsTable *p)
G4VEmModel * GetModelByIndex(std::size_t idx=0, G4bool ver=false) const
void SetTwoPeaksXS(std::vector< G4TwoPeaksXS * > *)
std::vector< G4TwoPeaksXS * > * TwoPeaksXS() const
void SetCrossSectionType(G4CrossSectionType val)
void SetInverseRangeTable(G4PhysicsTable *p)
G4CrossSectionType CrossSectionType() const
void SetEnergyOfCrossSectionMax(std::vector< G4double > *)
void SetDEDXTable(G4PhysicsTable *p, G4EmTableType tType)
void SetLambdaTable(G4PhysicsTable *p)
G4PhysicsTable * IonisationTable() const
G4PhysicsTable * LambdaTable() const
void SetCSDARangeTable(G4PhysicsTable *pRange)
G4PhysicsTable * DEDXunRestrictedTable() const
G4PhysicsTable * DEDXTable() const

Referenced by G4VEnergyLossProcess::BuildPhysicsTable().

◆ BuildMscProcess()

void G4EmTableUtil::BuildMscProcess ( G4VMultipleScattering * proc,
const G4VMultipleScattering * masterProc,
const G4ParticleDefinition & part,
const G4ParticleDefinition * firstPart,
G4int nModels,
G4bool master )
static

Definition at line 560 of file G4EmTableUtil.cc.

565{
566 auto param = G4EmParameters::Instance();
567 G4int verb = param->Verbose();
568
569 if(!master && firstPart == &part) {
570 // initialisation of models
571 G4bool baseMat = masterProc->UseBaseMaterial();
572 for(G4int i=0; i<nModels; ++i) {
573 G4VMscModel* msc = proc->GetModelByIndex(i);
574 G4VMscModel* msc0 = masterProc->GetModelByIndex(i);
575 msc->SetUseBaseMaterials(baseMat);
576 msc->SetCrossSectionTable(msc0->GetCrossSectionTable(), false);
577 msc->InitialiseLocal(&part, msc0);
578 }
579 }
580 if(!param->IsPrintLocked()) {
581 const G4String& num = part.GetParticleName();
582
583 // explicitly defined printout by particle name
584 if(1 < verb || (0 < verb && (num == "e-" ||
585 num == "e+" || num == "mu+" ||
586 num == "mu-" || num == "proton"||
587 num == "pi+" || num == "pi-" ||
588 num == "kaon+" || num == "kaon-" ||
589 num == "alpha" || num == "anti_proton" ||
590 num == "GenericIon" || num == "alpha+" ||
591 num == "alpha" ))) {
592 proc->StreamInfo(G4cout, part);
593 }
594 }
595 if(1 < verb) {
596 G4cout << "### G4EmTableUtil::BuildPhysicsTable() done for "
597 << proc->GetProcessName()
598 << " and particle " << part.GetParticleName() << G4endl;
599 }
600}
static G4EmParameters * Instance()
void SetCrossSectionTable(G4PhysicsTable *, G4bool isLocal)
G4PhysicsTable * GetCrossSectionTable()
G4VMscModel * GetModelByIndex(G4int idx, G4bool ver=false) const
void StreamInfo(std::ostream &outFile, const G4ParticleDefinition &, G4bool rst=false) const

Referenced by G4VMultipleScattering::BuildPhysicsTable().

◆ CheckIon()

const G4ParticleDefinition * G4EmTableUtil::CheckIon ( G4VEnergyLossProcess * proc,
const G4ParticleDefinition * part,
const G4ParticleDefinition * particle,
const G4int verboseLevel,
G4bool & isIon )
static

Definition at line 337 of file G4EmTableUtil.cc.

341{
342 if(1 < verb) {
343 G4cout << "G4EmTableUtil::CheckIon for "
344 << proc->GetProcessName() << " for " << part->GetParticleName()
345 << " should be called from G4VEnergyLossProcess::PreparePhysicsTable"
346 << G4endl;
347 }
348 const G4ParticleDefinition* particle = partLocal;
349
350 // Are particle defined?
351 if(nullptr == particle) { particle = part; }
352 if(part->GetParticleType() == "nucleus") {
353 G4String pname = part->GetParticleName();
354 if(pname != "deuteron" && pname != "triton" &&
355 pname != "alpha+" && pname != "alpha") {
356
358 isIon = true;
359
360 // this is a loop to compare pointers of G4GenericIon processes in order
361 // to confirm that for given particle the G4GenericIon physics is used
362 if(particle != theGIon) {
363 G4ProcessManager* pm = theGIon->GetProcessManager();
365 G4int n = (G4int)v->size();
366 for(G4int j=0; j<n; ++j) {
367 if((*v)[j] == proc) {
368 particle = theGIon;
369 break;
370 }
371 }
372 }
373 }
374 }
375 return particle;
376}
static G4GenericIon * GenericIon()
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleType() const
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
std::size_t size() const

Referenced by G4VEnergyLossProcess::PreparePhysicsTable().

◆ PrepareEmProcess()

const G4DataVector * G4EmTableUtil::PrepareEmProcess ( G4VEmProcess * proc,
const G4ParticleDefinition * part,
const G4ParticleDefinition * secPart,
G4EmModelManager * modelManager,
const G4double & maxKinEnergy,
G4int & secID,
G4int & tripletID,
G4int & mainSec,
const G4int & verb,
const G4bool & master )
static

Definition at line 51 of file G4EmTableUtil.cc.

59{
61
62 // initialisation of models
63 G4double plimit = param->MscThetaLimit();
64 G4int nModels = modelManager->NumberOfModels();
65 for(G4int i=0; i<nModels; ++i) {
66 G4VEmModel* mod = modelManager->GetModel(i);
67 if(nullptr == mod) { continue; }
68 mod->SetPolarAngleLimit(plimit);
69 mod->SetMasterThread(master);
70 if(mod->HighEnergyLimit() > maxKinEnergy) {
71 mod->SetHighEnergyLimit(maxKinEnergy);
72 }
73 proc->SetEmModel(mod);
74 }
75
76 // defined ID of secondary particles and verbosity
77 G4int stype = proc->GetProcessSubType();
78 if(stype == fAnnihilation) {
79 secID = _Annihilation;
80 tripletID = _TripletGamma;
81 } else if(stype == fGammaConversion) {
82 secID = _PairProduction;
83 mainSec = 2;
84 } else if(stype == fPhotoElectricEffect) {
85 secID = _PhotoElectron;
86 } else if(stype == fComptonScattering) {
87 secID = _ComptonElectron;
88 } else if(stype >= fLowEnergyElastic) {
89 secID = fDNAUnknownModel;
90 }
91 if(master) {
92 proc->SetVerboseLevel(param->Verbose());
93 } else {
94 proc->SetVerboseLevel(param->WorkerVerbose());
95 }
96
97 // model initialisation
98 const G4DataVector* cuts = modelManager->Initialise(part, secPart, verb);
99
100 if(1 < verb) {
101 G4cout << "### G4EmTableUtil::PreparePhysicsTable() done for "
102 << proc->GetProcessName()
103 << " and particle " << part->GetParticleName()
104 << G4endl;
105 }
106 return cuts;
107}
@ fDNAUnknownModel
@ fGammaConversion
@ fComptonScattering
@ fAnnihilation
@ fPhotoElectricEffect
const G4DataVector * Initialise(const G4ParticleDefinition *part, const G4ParticleDefinition *secPart, G4int verb)
G4int NumberOfModels() const
G4VEmModel * GetModel(G4int idx, G4bool ver=false) const
G4double MscThetaLimit() const
G4int Verbose() const
G4int WorkerVerbose() const
void SetPolarAngleLimit(G4double)
void SetHighEnergyLimit(G4double)
void SetMasterThread(G4bool val)
G4double HighEnergyLimit() const
void SetEmModel(G4VEmModel *, G4int index=0)
void SetVerboseLevel(G4int value)
G4int GetProcessSubType() const

Referenced by G4VEmProcess::PreparePhysicsTable().

◆ PrepareMscProcess()

void G4EmTableUtil::PrepareMscProcess ( G4VMultipleScattering * proc,
const G4ParticleDefinition & part,
G4EmModelManager * modelManager,
G4MscStepLimitType & stepLimit,
G4double & facrange,
G4bool & latDisplacement,
G4bool & master,
G4bool & isIon,
G4bool & baseMat )
static

Definition at line 507 of file G4EmTableUtil.cc.

514{
515 auto param = G4EmParameters::Instance();
516 G4int verb = (master) ? param->Verbose() : param->WorkerVerbose();
517 proc->SetVerboseLevel(verb);
518
519 if(part.GetPDGMass() > CLHEP::GeV ||
520 part.GetParticleName() == "GenericIon") { isIon = true; }
521
522 if(1 < verb) {
523 G4cout << "### G4EmTableUtil::PrepearPhysicsTable() for "
524 << proc->GetProcessName()
525 << " and particle " << part.GetParticleName()
526 << " isIon: " << isIon << " isMaster: " << master
527 << G4endl;
528 }
529
530 // initialise process
531 proc->InitialiseProcess(&part);
532
533 // heavy particles
534 if(part.GetPDGMass() > CLHEP::MeV) {
535 stepLimit = param->MscMuHadStepLimitType();
536 facrange = param->MscMuHadRangeFactor();
537 latDisplacement = param->MuHadLateralDisplacement();
538 } else {
539 stepLimit = param->MscStepLimitType();
540 facrange = param->MscRangeFactor();
541 latDisplacement = param->LateralDisplacement();
542 }
543
544 // initialisation of models
545 auto numberOfModels = modelManager->NumberOfModels();
546 for(G4int i=0; i<numberOfModels; ++i) {
547 G4VMscModel* msc = proc->GetModelByIndex(i);
548 msc->SetIonisation(nullptr, &part);
549 msc->SetMasterThread(master);
550 msc->SetPolarAngleLimit(param->MscThetaLimit());
551 G4double emax = std::min(msc->HighEnergyLimit(),param->MaxKinEnergy());
552 msc->SetHighEnergyLimit(emax);
553 msc->SetUseBaseMaterials(baseMat);
554 }
555 modelManager->Initialise(&part, nullptr, verb);
556}
void SetIonisation(G4VEnergyLossProcess *, const G4ParticleDefinition *part)
virtual void InitialiseProcess(const G4ParticleDefinition *)=0

Referenced by G4VMultipleScattering::PreparePhysicsTable().

◆ RetrieveTable()

G4bool G4EmTableUtil::RetrieveTable ( G4VProcess * ptr,
const G4ParticleDefinition * part,
G4PhysicsTable * aTable,
const G4String & dir,
const G4String & tname,
const G4int verb,
const G4bool ascii,
const G4bool spline )
static

Definition at line 665 of file G4EmTableUtil.cc.

671{
672 G4bool res = true;
673 if (nullptr == aTable) { return res; }
674 if (0 < verb) {
675 G4cout << tname << " table for " << part->GetParticleName()
676 << " will be retrieved " << G4endl;
677 }
678 const G4String& name =
679 ptr->GetPhysicsTableFileName(part, dir, tname, ascii);
680 if(G4PhysicsTableHelper::RetrievePhysicsTable(aTable, name, ascii, spline)) {
681 if(spline) {
682 for(auto & v : *aTable) {
683 if(nullptr != v) { v->FillSecondDerivatives(); }
684 }
685 }
686 if (0 < verb) {
687 G4cout << tname << " table for " << part->GetParticleName()
688 << " is Retrieved from <" << name << ">"
689 << G4endl;
690 }
691 } else {
692 res = false;
693 G4cout << "G4EmTableUtil::RetrieveTable fail to retrieve: " << tname
694 << " from " << name << " for " << part->GetParticleName() << G4endl;
695 }
696 return res;
697}
static G4bool RetrievePhysicsTable(G4PhysicsTable *physTable, const G4String &fileName, G4bool ascii, G4bool spline)
const G4String & GetPhysicsTableFileName(const G4ParticleDefinition *, const G4String &directory, const G4String &tableName, G4bool ascii=false)
const char * name(G4int ptype)

Referenced by G4VEmProcess::RetrievePhysicsTable(), and G4VEnergyLossProcess::RetrievePhysicsTable().

◆ StoreMscTable()

G4bool G4EmTableUtil::StoreMscTable ( G4VMultipleScattering * proc,
const G4ParticleDefinition * part,
const G4String & directory,
const G4int nModels,
const G4int verb,
const G4bool ascii )
static

Definition at line 604 of file G4EmTableUtil.cc.

609{
610 G4bool ok = true;
611 for(G4int i=0; i<nModels; ++i) {
612 G4VMscModel* msc = proc->GetModelByIndex(i);
613 G4PhysicsTable* table = msc->GetCrossSectionTable();
614 if (nullptr != table) {
616 G4String name =
617 proc->GetPhysicsTableFileName(part, dir, "LambdaMod"+ss, ascii);
618 G4bool yes = table->StorePhysicsTable(name,ascii);
619
620 if ( yes ) {
621 if ( verb > 0 ) {
622 G4cout << "Physics table are stored for "
623 << part->GetParticleName()
624 << " and process " << proc->GetProcessName()
625 << " with a name <" << name << "> " << G4endl;
626 }
627 } else {
628 G4cout << "Fail to store Physics Table for "
629 << part->GetParticleName()
630 << " and process " << proc->GetProcessName()
631 << " in the directory <" << dir
632 << "> " << G4endl;
633 ok = false;
634 }
635 }
636 }
637 return ok;
638}
G4bool StorePhysicsTable(const G4String &filename, G4bool ascii=false)
static G4String ConvertToString(G4bool boolVal)

Referenced by G4VMultipleScattering::StorePhysicsTable().

◆ StoreTable()

G4bool G4EmTableUtil::StoreTable ( G4VProcess * ptr,
const G4ParticleDefinition * part,
G4PhysicsTable * aTable,
const G4String & dir,
const G4String & tname,
G4int verb,
G4bool ascii )
static

Definition at line 642 of file G4EmTableUtil.cc.

648{
649 G4bool res = true;
650 if (nullptr != aTable) {
651 const G4String& name =
652 ptr->GetPhysicsTableFileName(part, dir, tname, ascii);
653 if ( aTable->StorePhysicsTable(name, ascii) ) {
654 if (1 < verb) G4cout << "Stored: " << name << G4endl;
655 } else {
656 res = false;
657 G4cout << "G4EmTableUtil::StoreTable fail to store: " << name << G4endl;
658 }
659 }
660 return res;
661}

Referenced by G4VEmProcess::StorePhysicsTable(), and G4VEnergyLossProcess::StorePhysicsTable().

◆ UpdateModels()

void G4EmTableUtil::UpdateModels ( G4VEnergyLossProcess * proc,
G4EmModelManager * modelManager,
const G4double maxKinEnergy,
const G4int nModels,
G4int & secID,
G4int & biasID,
G4int & mainSecondaries,
const G4bool baseMat,
const G4bool isMaster,
const G4bool useAGen )
static

Definition at line 380 of file G4EmTableUtil.cc.

387{
388 // defined ID of secondary particles
389 G4int stype = proc->GetProcessSubType();
390 if(stype == fBremsstrahlung) {
391 secID = _Bremsstrahlung;
392 biasID = _SplitBremsstrahlung;
393 } else if(stype == fPairProdByCharged) {
394 secID = _PairProduction;
395 mainSec = 2;
396 }
397
398 // initialisation of models
399 for(G4int i=0; i<nModels; ++i) {
400 G4VEmModel* mod = modelManager->GetModel(i);
401 mod->SetMasterThread(isMaster);
402 mod->SetAngularGeneratorFlag(useAGen);
403 if(mod->HighEnergyLimit() > maxKinEnergy) {
404 mod->SetHighEnergyLimit(maxKinEnergy);
405 }
406 mod->SetUseBaseMaterials(baseMat);
407 }
408}
@ fBremsstrahlung
@ fPairProdByCharged
void SetAngularGeneratorFlag(G4bool)

Referenced by G4VEnergyLossProcess::PreparePhysicsTable().


The documentation for this class was generated from the following files: