65 for(
G4int i=0; i<nModels; ++i) {
67 if(
nullptr == mod) {
continue; }
100 G4cout <<
"### G4EmTableUtil::PreparePhysicsTable() done for "
120 G4cout <<
"### G4EmTableUtil::BuildPhysicsTable() for "
122 <<
" buildLambdaTable=" << toBuild <<
" master= " << master
126 if(firstPart == part) {
138 for(
G4int i=0; i<nModels; ++i) {
153 if(
nullptr == table) {
164 if(isLocked) {
return; }
167 if(1 < verb || (0 < verb && (num ==
"gamma" || num ==
"e-" ||
168 num ==
"e+" || num ==
"mu+" ||
169 num ==
"mu-" || num ==
"proton"||
170 num ==
"pi+" || num ==
"pi-" ||
171 num ==
"kaon+" || num ==
"kaon-" ||
172 num ==
"alpha" || num ==
"anti_proton" ||
173 num ==
"GenericIon" ||
174 num ==
"alpha+" || num ==
"helium" ||
175 num ==
"hydrogen"))) {
180 G4cout <<
"### G4EmTableUtil::BuildPhysicsTable() done for "
182 <<
" baseMat=" << baseMat <<
G4endl;
198 const G4int verboseLevel,
199 const G4bool startFromNull,
202 if(1 < verboseLevel) {
203 G4cout <<
"G4EmTableUtil::BuildLambdaTable() for process "
211 std::size_t numOfCouples = theCoupleTable->
GetTableSize();
217 G4double emax1 = std::min(maxKinEnergy, minKinEnergyPrim);
219 for(std::size_t i=0; i<numOfCouples; ++i) {
227 if(
nullptr != theLambdaTable) {
228 delete (*theLambdaTable)[i];
241 if(emax <= emin) { emax = 2*emin; }
243 bin = std::max(bin, 5);
250 if(
nullptr != theLambdaTablePrim && minKinEnergyPrim < maxKinEnergy) {
251 delete (*theLambdaTablePrim)[i];
254 if(
nullptr == bVectorPrim) {
256 bin = std::max(bin, 5);
259 bVectorPrim = aVectorPrim;
272 if(1 < verboseLevel) {
288 const G4int verboseLevel,
291 if(1 < verboseLevel) {
292 G4cout <<
"G4EmTableUtil::BuildLambdaTable() for process "
299 std::size_t numOfCouples = theCoupleTable->
GetTableSize();
302 for(std::size_t i=0; i<numOfCouples; ++i) {
308 delete (*theLambdaTable)[i];
312 if(minKinEnergy > emin) {
318 if(emax <= emin) { emax = 2*emin; }
320 bin = std::max(bin, 5);
328 if(1 < verboseLevel) {
342 G4cout <<
"G4EmTableUtil::CheckIon for "
344 <<
" should be called from G4VEnergyLossProcess::PreparePhysicsTable"
350 if(
nullptr == particle) { particle = part; }
353 if(pname !=
"deuteron" && pname !=
"triton" &&
354 pname !=
"He3" && pname !=
"alpha+" && pname !=
"alpha") {
361 if(particle != theGIon) {
365 for(
G4int j=0; j<n; ++j) {
366 if((*v)[j] == proc) {
398 for(
G4int i=0; i<nModels; ++i) {
432 for(
G4int i=0; i<nModels; ++i) {
457 std::size_t numOfCouples = theCoupleTable->
GetTableSize();
460 G4cout << numOfCouples <<
" couples" <<
" minKinEnergy(MeV)= " << emin
461 <<
" maxKinEnergy(MeV)= " << emax <<
" nbins= " << nbins <<
G4endl;
466 for(std::size_t i=0; i<numOfCouples; ++i) {
469 G4cout <<
"G4EmTableUtil::BuildDEDXVector idx= " << i
470 <<
" flagTable=" << table->
GetFlag(i)
479 if(
nullptr != bVector) {
495 G4cout <<
"G4EmTableUtil::BuildDEDXTable(): table is built for "
514 G4int verb = (master) ? param->Verbose() : param->WorkerVerbose();
521 G4cout <<
"### G4EmTableUtil::PrepearPhysicsTable() for "
524 <<
" isIon: " << isIon <<
" isMaster: " << master
533 stepLimit = param->MscMuHadStepLimitType();
534 facrange = param->MscMuHadRangeFactor();
535 latDisplacement = param->MuHadLateralDisplacement();
537 stepLimit = param->MscStepLimitType();
538 facrange = param->MscRangeFactor();
539 latDisplacement = param->LateralDisplacement();
544 for(
G4int i=0; i<numberOfModels; ++i) {
552 modelManager->
Initialise(&part,
nullptr, verb);
564 G4int verb = param->Verbose();
566 if (firstPart == &part) {
570 for (
G4int i=0; i<nModels; ++i) {
580 emin = std::max(emin, param->MinKinEnergy());
581 emax = std::min(emax, param->MaxKinEnergy());
584 msc, &part, emin, emax,
true);
590 for (
G4int i=0; i<nModels; ++i) {
599 if(!param->IsPrintLocked()) {
603 if(1 < verb || (0 < verb && (num ==
"e-" ||
604 num ==
"e+" || num ==
"mu+" ||
605 num ==
"mu-" || num ==
"proton"||
606 num ==
"pi+" || num ==
"pi-" ||
607 num ==
"kaon+" || num ==
"kaon-" ||
608 num ==
"alpha" || num ==
"anti_proton" ||
609 num ==
"GenericIon" || num ==
"alpha+" ||
615 G4cout <<
"### G4EmTableUtil::BuildPhysicsTable() done for "
630 for(
G4int i=0; i<nModels; ++i) {
633 if (
nullptr != table) {
641 G4cout <<
"Physics table are stored for "
644 <<
" with a name <" << name <<
"> " <<
G4endl;
647 G4cout <<
"Fail to store Physics Table for "
650 <<
" in the directory <" << dir
669 if (
nullptr != aTable) {
676 G4cout <<
"G4EmTableUtil::StoreTable fail to store: " << name <<
G4endl;
692 if (
nullptr == aTable) {
return res; }
695 <<
" will be retrieved " <<
G4endl;
701 for(
auto & v : *aTable) {
702 if(
nullptr != v) { v->FillSecondDerivatives(); }
707 <<
" is retrieved from <" << name <<
">"
712 G4cout <<
"G4EmTableUtil::RetrieveTable fail to retrieve: " << tname
G4double G4Log(G4double x)
G4GLOB_DLL std::ostream G4cout
const G4DataVector * Initialise(const G4ParticleDefinition *part, const G4ParticleDefinition *secPart, G4int verb)
G4int NumberOfModels() const
G4VEmModel * GetModel(G4int idx, G4bool ver=false) const
void FillLambdaVector(G4PhysicsVector *, const G4MaterialCutsCouple *, G4bool startFromNull=true, G4EmTableType t=fRestricted)
void FillDEDXVector(G4PhysicsVector *, const G4MaterialCutsCouple *, G4EmTableType t=fRestricted)
static G4EmParameters * Instance()
G4double MscThetaLimit() const
G4int WorkerVerbose() const
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 G4bool RetrieveTable(G4VProcess *ptr, const G4ParticleDefinition *part, G4PhysicsTable *aTable, const G4String &dir, const G4String &tname, const G4int verb, const G4bool ascii, const G4bool spline)
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 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 const G4DataVector * 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 void BuildLocalElossProcess(G4VEnergyLossProcess *proc, const G4VEnergyLossProcess *masterProc, const G4ParticleDefinition *part, const G4int nModels)
static G4bool StoreTable(G4VProcess *, const G4ParticleDefinition *, G4PhysicsTable *, const G4String &dir, const G4String &tname, G4int verb, G4bool ascii)
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 const G4ParticleDefinition * CheckIon(G4VEnergyLossProcess *proc, const G4ParticleDefinition *part, const G4ParticleDefinition *particle, const G4int verboseLevel, G4bool &isIon)
static G4bool StoreMscTable(G4VMultipleScattering *proc, const G4ParticleDefinition *part, const G4String &directory, const G4int nModels, const G4int verb, const G4bool ascii)
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 std::vector< G4double > * FindCrossSectionMax(G4PhysicsTable *)
static G4GenericIon * GenericIon()
static G4bool GetBaseMaterialFlag()
G4PhysicsTable * BuildTableForModel(G4PhysicsTable *table, G4VEmModel *model, const G4ParticleDefinition *, G4double emin, G4double emax, G4bool spline)
static G4bool GetFlag(std::size_t idx)
static G4LossTableManager * Instance()
G4LossTableBuilder * GetTableBuilder()
const G4Material * GetMaterial() const
G4ProcessManager * GetProcessManager() const
const G4String & GetParticleType() const
G4double GetPDGMass() const
const G4String & GetParticleName() const
static G4bool RetrievePhysicsTable(G4PhysicsTable *physTable, const G4String &fileName, G4bool ascii, G4bool spline)
static void SetPhysicsVector(G4PhysicsTable *physTable, std::size_t idx, G4PhysicsVector *vec)
G4bool GetFlag(std::size_t i) const
G4bool StorePhysicsTable(const G4String &filename, G4bool ascii=false)
void FillSecondDerivatives(const G4SplineType=G4SplineType::Base, const G4double dir1=0.0, const G4double dir2=0.0)
G4ProcessVector * GetAlongStepProcessVector(G4ProcessVectorTypeIndex typ=typeGPIL) const
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
static G4ProductionCutsTable * GetProductionCutsTable()
static G4String ConvertToString(G4bool boolVal)
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition *, const G4Material *)
void SetCrossSectionTable(G4PhysicsTable *, G4bool isLocal)
void SetPolarAngleLimit(G4double)
void SetHighEnergyLimit(G4double)
G4double LowEnergyLimit() const
void SetAngularGeneratorFlag(G4bool)
G4double HighEnergyLimit() const
G4double HighEnergyActivationLimit() const
G4PhysicsTable * GetCrossSectionTable()
void SetUseBaseMaterials(G4bool val)
G4double LowEnergyActivationLimit() const
virtual void InitialiseLocal(const G4ParticleDefinition *, G4VEmModel *masterModel)
G4bool ForceBuildTableFlag() const
G4CrossSectionType CrossSectionType() const
G4VEmModel * GetModelByIndex(G4int idx=0, G4bool ver=false) const
void SetLambdaTablePrim(G4PhysicsTable *)
void SetEnergyOfCrossSectionMax(std::vector< G4double > *)
G4PhysicsTable * LambdaTable() const
void SetEmModel(G4VEmModel *, G4int index=0)
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 *)
G4PhysicsTable * RangeTableForLoss() const
G4bool UseBaseMaterial() 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 * > *)
virtual G4double MinPrimaryEnergy(const G4ParticleDefinition *, const G4Material *, G4double cut)
std::vector< G4TwoPeaksXS * > * TwoPeaksXS() const
void SetCrossSectionType(G4CrossSectionType val)
void SetInverseRangeTable(G4PhysicsTable *p)
G4CrossSectionType CrossSectionType() const
G4bool IsIonisationProcess() const
void SetEnergyOfCrossSectionMax(std::vector< G4double > *)
void SetDEDXTable(G4PhysicsTable *p, G4EmTableType tType)
void SetIonisation(G4bool val)
void SetLambdaTable(G4PhysicsTable *p)
G4PhysicsTable * IonisationTable() const
G4PhysicsTable * LambdaTable() const
void SetCSDARangeTable(G4PhysicsTable *pRange)
G4PhysicsTable * DEDXunRestrictedTable() const
G4PhysicsTable * DEDXTable() const
void SetIonisation(G4VEnergyLossProcess *, const G4ParticleDefinition *part)
G4VMscModel * GetModelByIndex(G4int idx, G4bool ver=false) const
virtual void InitialiseProcess(const G4ParticleDefinition *)=0
void StreamInfo(std::ostream &outFile, const G4ParticleDefinition &, G4bool rst=false) const
void SetVerboseLevel(G4int value)
G4int GetProcessSubType() const
const G4String & GetPhysicsTableFileName(const G4ParticleDefinition *, const G4String &directory, const G4String &tableName, G4bool ascii=false)
const G4String & GetProcessName() const