123 for(
size_t i=0; i<
n; ++i) {
135 G4cout <<
"G4EmModelManager::AddEmModel WARNING: no model defined."
155 if(nam ==
models[i]->GetName()) {
156 models[i]->SetLowEnergyLimit(emin);
162 G4cout <<
"G4EmModelManager::UpdateEmModel WARNING: no model <"
163 << nam <<
"> is found out"
174 G4cout <<
"G4EmModelManager::GetModel WARNING: "
175 <<
"index " << i <<
" is wrong Nmodels= "
210 G4cout <<
"G4EmModelManager::Initialise() for "
218 G4Exception(
"G4EmModelManager::Initialise",
"em0002",
227 regionStore->
GetRegion(
"DefaultRegionForTheWorld",
false);
231 std::vector<const G4Region*> setr;
232 setr.push_back(world);
237 if ( r ==
nullptr || r == world) {
244 if ( r == setr[j] ) { newRegion =
false; }
256 ed <<
"No models defined for the World volume for "
258 G4Exception(
"G4EmModelManager::Initialise",
"em0002",
276 std::vector<G4int> modelAtRegion(
nEmModels);
305 <<
" <" << model->
GetName() <<
"> for region <";
308 <<
" tmin(MeV)= " << tmin/
MeV
309 <<
"; tmax(MeV)= " << tmax/
MeV
310 <<
"; order= " << ord
325 if( tmax - tmin <= limitdelta) { push =
false; }
327 else if (tmax == eLow[0]) {
332 }
else if(tmin < eHigh[
n-1]) {
334 for(
G4int k=0; k<
n; ++k) {
338 if(ord >= modelOrd[k]) {
339 if(tmin < eHigh[k] && tmin >= eLow[k]) { tmin = eHigh[k]; }
340 if(tmax <= eHigh[k] && tmax > eLow[k]) { tmax = eLow[k]; }
341 if(tmax > eHigh[k] && tmin < eLow[k]) {
342 if(tmax - eHigh[k] > eLow[k] - tmin) { tmin = eHigh[k]; }
343 else { tmax = eLow[k]; }
345 if( tmax - tmin <= limitdelta) {
356 if (tmax <= eLow[0]) {
361 }
else if(tmin < eHigh[
n-1]) {
363 if(tmin > eLow[
n-1] && tmax >= eHigh[
n-1]) {
366 }
else if(tmin <= eLow[0] && tmax < eHigh[0]) {
373 for(
G4int k=
n-1; k>=0; --k) {
374 if(tmin <= eLow[k] && tmax >= eHigh[k]) {
376 isUsed[modelAtRegion[k]] = 0;
380 for(
G4int kk=k; kk<
n-1; ++kk) {
381 modelAtRegion[kk] = modelAtRegion[kk+1];
382 modelOrd[kk] = modelOrd[kk+1];
383 eLow[kk] = eLow[kk+1];
384 eHigh[kk] = eHigh[kk+1];
391 if(tmin <= eLow[k] && tmax > eLow[k]) {
396 }
else if(tmin < eHigh[k] && tmax >= eHigh[k]) {
403 }
else if(tmin > eLow[k] && tmax < eHigh[k]) {
404 if(eHigh[k] - tmax > tmin - eLow[k]) {
426 for(
G4int k=
n-1; k>=idx; --k) {
427 modelAtRegion[k+1] = modelAtRegion[k];
428 modelOrd[k+1] = modelOrd[k];
430 eHigh[k+1] = eHigh[k];
436 if (push || insert) {
438 modelAtRegion[idx] = ii;
445 for(
G4int k=
n-1; k>=0; --k) {
446 if(eHigh[k] - eLow[k] <= limitdelta) {
447 isUsed[modelAtRegion[k]] = 0;
449 for(
G4int kk=k; kk<
n-1; ++kk) {
450 modelAtRegion[kk] = modelAtRegion[kk+1];
451 modelOrd[kk] = modelOrd[kk+1];
452 eLow[kk] = eLow[kk+1];
453 eHigh[kk] = eHigh[kk+1];
462 eLow[
n] = eHigh[
n-1];
465 G4cout <<
"### New G4RegionModels set with " <<
n
466 <<
" models for region <";
468 G4cout <<
"> Elow(MeV)= ";
483 if(
nullptr != secondaryParticle) {
498 for(
size_t i=0; i<numOfCouples; ++i) {
509 do {--
reg;}
while (
reg>0 && pcuts != (setr[
reg]->GetProductionCuts()));
513 G4cout <<
"G4EmModelManager::Initialise() for "
515 <<
" indexOfCouple= " << i
516 <<
" indexOfRegion= " <<
reg
521 if(
nullptr != secondaryParticle) {
536 for(
G4int jj=0; jj<nnm; ++jj) {
543 (*theCutsNew)[i] = cutlim;
572 <<
" is initialised; nRegions= " <<
nRegions
589 G4cout <<
"G4EmModelManager::FillDEDXVector() for "
591 <<
" cut(MeV)= " << cut
607 for(
size_t j=0; j<totBinsLoss; ++j) {
615 do {--k;}
while (k>0 && e <= regModels->LowEdgeEnergy(k));
617 if(k > 0 && k !=
k0) {
624 del = (dedx2 > 0.0) ? (dedx1/dedx2 - 1.0)*elow : 0.0;
634 <<
" E(MeV)= " << e/
MeV
635 <<
" dEdx(MeV/mm)= " << dedx*
mm/
MeV
636 <<
" del= " << del*
mm/
MeV<<
" k= " << k
661 G4cout <<
"G4EmModelManager::FillLambdaVector() for "
664 <<
" Emin(MeV)= " << aVector->
Energy(0)
678 for(
size_t j=0; j<totBinsLambda; ++j) {
686 do {--k;}
while (k>0 && e <= regModels->LowEdgeEnergy(k));
687 if(k > 0 && k !=
k0) {
694 del = (xs2 > 0.0) ? (xs1/xs2 - 1.0)*elow : 0.0;
702 if(j==0 && startFromNull) { cross = 0.0; }
705 G4cout <<
"FillLambdaVector: " << j <<
". e(MeV)= " << e/
MeV
706 <<
" cross(1/mm)= " << cross*
mm
707 <<
" del= " << del*
mm <<
" k= " << k
720 if(verb == 0) {
return; }
726 out <<
" ===== EM models for the G4Region " <<
reg->GetName()
728 for(
G4int j=0; j<
n; ++j) {
735 out << std::setw(20);
736 out << model->
GetName() <<
" : Emin="
742 size_t kk = table->size();
743 for(
size_t k=0; k<kk; ++k) {
747 out <<
" Nbins=" <<
nn <<
" "
756 if(
an) { out <<
" " <<
an->GetName(); }
769 out <<
" ===== Limit on energy threshold has been applied " <<
G4endl;
static const G4double emax
static const G4double reg
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
static constexpr double mm
static constexpr double eV
static constexpr double MeV
G4GLOB_DLL std::ostream G4cout
static G4Electron * Electron()
std::vector< G4int > orderOfModels
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *fm, const G4Region *r)
G4DataVector * theCutsNew
std::vector< G4VEmFluctuationModel * > flucModels
void UpdateEmModel(const G4String &model_name, G4double emin, G4double emax)
void DumpModelList(std::ostream &out, G4int verb)
std::vector< G4RegionModels * > setOfRegionModels
G4int NumberOfModels() const
const G4DataVector * theCuts
std::vector< const G4Region * > regions
std::vector< G4int > isUsed
std::vector< G4int > idxOfRegionModels
const G4DataVector * Initialise(const G4ParticleDefinition *part, const G4ParticleDefinition *secPart, G4double, G4int verb)
void FillLambdaVector(G4PhysicsVector *, const G4MaterialCutsCouple *, G4bool startFromNull=true, G4EmTableType t=fRestricted)
void FillDEDXVector(G4PhysicsVector *, const G4MaterialCutsCouple *, G4EmTableType t=fRestricted)
G4int NumberOfRegionModels(size_t index_couple) const
G4RegionModels * currRegionModel
const G4ParticleDefinition * particle
G4VEmModel * GetRegionModel(G4int idx, size_t index_couple)
G4VEmModel * GetModel(G4int idx, G4bool ver=false)
std::vector< G4VEmModel * > models
const G4Material * GetMaterial() const
G4ProductionCuts * GetProductionCuts() const
const G4String & GetName() const
const G4String & GetParticleName() const
void PutValue(const std::size_t index, const G4double value)
G4double GetMaxEnergy() const
G4double Energy(const std::size_t index) const
std::size_t GetVectorLength() const
static G4Positron * Positron()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
std::size_t GetTableSize() const
const std::vector< G4double > * GetEnergyCutsVector(std::size_t pcIdx) const
static G4ProductionCutsTable * GetProductionCutsTable()
G4RegionModels(G4int nMod, std::vector< G4int > &indx, G4DataVector &lowE, const G4Region *reg)
const G4Region * theRegion
G4int * theListOfModelIndexes
const G4Region * Region() const
G4double * lowKineticEnergy
G4int ModelIndex(G4int n) const
G4int NumberOfModels() const
G4double LowEdgeEnergy(G4int n) const
static G4RegionStore * GetInstance()
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
const G4String & GetName() const
G4VEmAngularDistribution * GetAngularDistribution()
G4double LowEnergyLimit() const
G4double HighEnergyLimit() const
virtual void DefineForRegion(const G4Region *)
G4double HighEnergyActivationLimit() const
G4double CrossSection(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
G4bool DeexcitationFlag() const
const G4String & GetName() const
G4PhysicsTable * GetCrossSectionTable()
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)=0
G4double LowEnergyActivationLimit() const
virtual G4double MinEnergyCut(const G4ParticleDefinition *, const G4MaterialCutsCouple *)
void DumpParameters(std::ostream &out) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
T min(const T t1, const T t2)
brief Return the smallest of the two arguments