163 for(
size_t i=0; i<
n; ++i) {
176 G4cout <<
"G4EmModelManager::AddEmModel WARNING: no model defined."
196 if(nam ==
models[i]->GetName()) {
197 models[i]->SetLowEnergyLimit(emin);
198 models[i]->SetHighEnergyLimit(emax);
203 G4cout <<
"G4EmModelManager::UpdateEmModel WARNING: no model <"
204 << nam <<
"> is found out"
215 G4cout <<
"G4EmModelManager::GetModel WARNING: "
216 <<
"index " << i <<
" is wrong Nmodels= "
252 G4cout <<
"G4EmModelManager::Initialise() for "
260 G4Exception(
"G4EmModelManager::Initialise",
"em0002",
269 regionStore->
GetRegion(
"DefaultRegionForTheWorld",
false);
273 std::vector<const G4Region*> setr;
274 setr.push_back(world);
279 if ( r == 0 || r == world) {
286 if ( r == setr[j] ) { newRegion =
false; }
298 ed <<
"No models defined for the World volume for "
300 G4Exception(
"G4EmModelManager::Initialise",
"em0002",
318 std::vector<G4int> modelAtRegion(nEmModels);
319 std::vector<G4int> modelOrd(nEmModels);
325 <<
" Nmodels= " << nEmModels <<
G4endl;
347 <<
" <" << model->
GetName() <<
"> for region <";
350 <<
" tmin(MeV)= " << tmin/
MeV
351 <<
"; tmax(MeV)= " << tmax/
MeV
352 <<
"; order= " << ord
367 if( tmax - tmin <= limitdelta) { push =
false; }
369 else if (tmax == eLow[0]) {
374 }
else if(tmin < eHigh[n-1]) {
376 for(
G4int k=0; k<
n; ++k) {
380 if(ord >= modelOrd[k]) {
381 if(tmin < eHigh[k] && tmin >= eLow[k]) { tmin = eHigh[k]; }
382 if(tmax <= eHigh[k] && tmax > eLow[k]) { tmax = eLow[k]; }
383 if(tmax > eHigh[k] && tmin < eLow[k]) {
384 if(tmax - eHigh[k] > eLow[k] - tmin) { tmin = eHigh[k]; }
385 else { tmax = eLow[k]; }
387 if( tmax - tmin <= limitdelta) {
402 if (tmax <= eLow[0]) {
407 }
else if(tmin < eHigh[n-1]) {
409 if(tmin > eLow[n-1] && tmax >= eHigh[n-1]) {
412 }
else if(tmin <= eLow[0] && tmax < eHigh[0]) {
419 for(
G4int k=n-1; k>=0; --k) {
420 if(tmin <= eLow[k] && tmax >= eHigh[k]) {
422 isUsed[modelAtRegion[k]] = 0;
426 for(
G4int kk=k; kk<n-1; ++kk) {
427 modelAtRegion[kk] = modelAtRegion[kk+1];
428 modelOrd[kk] = modelOrd[kk+1];
429 eLow[kk] = eLow[kk+1];
430 eHigh[kk] = eHigh[kk+1];
437 if(tmin <= eLow[k] && tmax > eLow[k]) {
442 }
else if(tmin < eHigh[k] && tmax >= eHigh[k]) {
449 }
else if(tmin > eLow[k] && tmax < eHigh[k]) {
450 if(eHigh[k] - tmax > tmin - eLow[k]) {
472 for(
G4int k=n-1; k>=idx; --k) {
473 modelAtRegion[k+1] = modelAtRegion[k];
474 modelOrd[k+1] = modelOrd[k];
476 eHigh[k+1] = eHigh[k];
482 if (push || insert) {
484 modelAtRegion[idx] = ii;
491 for(
G4int k=n-1; k>=0; --k) {
492 if(eHigh[k] - eLow[k] <= limitdelta) {
493 isUsed[modelAtRegion[k]] = 0;
495 for(
G4int kk=k; kk<n-1; ++kk) {
496 modelAtRegion[kk] = modelAtRegion[kk+1];
497 modelOrd[kk] = modelOrd[kk+1];
498 eLow[kk] = eLow[kk+1];
499 eHigh[kk] = eHigh[kk+1];
508 eLow[
n] = eHigh[n-1];
511 G4cout <<
"### New G4RegionModels set with " << n <<
" models for region <";
513 G4cout <<
"> Elow(MeV)= ";
520 if(1 == nEmModels) {
break; }
528 if(secondaryParticle) {
541 if(minSubRange < 1.0) {
548 for(
size_t i=0; i<numOfCouples; ++i) {
556 if(nRegions > 1 && nEmModels > 1) {
559 do {--
reg;}
while (reg>0 && pcuts != (setr[reg]->GetProductionCuts()));
563 G4cout <<
"G4EmModelManager::Initialise() for "
565 <<
" indexOfCouple= " << i
566 <<
" indexOfRegion= " << reg
571 if(secondaryParticle) {
574 if( cut <
DBL_MAX && minSubRange < 1.0) {
581 if(tcutmax < subcut) { subcut = tcutmax; }
582 (*theSubCuts)[i] = subcut;
588 if(nRegions > 1 && nEmModels > 1) {
598 for(
G4int jj=0; jj<nnm; ++jj) {
605 (*theCutsNew)[i] = cutlim;
633 G4cout <<
"G4EmModelManager for " << partname
634 <<
" is initialised; nRegions= " << nRegions
659 G4cout <<
"G4EmModelManager::FillDEDXVector() for "
661 <<
" cut(MeV)= " << cut
662 <<
" emin(MeV)= " << emin
680 for(
size_t j=0; j<totBinsLoss; ++j) {
689 do {--k;}
while (k>0 && e <= regModels->LowEdgeEnergy(k));
691 if(k > 0 && k != k0) {
695 couple,elow,cut,emin);
697 couple,elow,cut,emin);
699 if(dedx2 > 0.0) { del = (dedx1/dedx2 - 1.0)*elow; }
706 dedx *= (1.0 + del/
e);
709 G4cout <<
"Material= " << couple->GetMaterial()->GetName()
710 <<
" E(MeV)= " << e/
MeV
711 <<
" dEdx(MeV/mm)= " << dedx*
mm/
MeV
712 <<
" del= " << del*
mm/
MeV<<
" k= " << k
716 if(dedx < 0.0) { dedx = 0.0; }
741 G4cout <<
"G4EmModelManager::FillLambdaVector() for "
744 <<
" Emin(MeV)= " << aVector->
Energy(0)
759 for(
size_t j=0; j<totBinsLambda; ++j) {
767 do {--k;}
while (k>0 && e <= regModels->LowEdgeEnergy(k));
768 if(k > 0 && k != k0) {
776 if(xs2 > 0.0) { del = (xs1/xs2 - 1.0)*elow; }
782 cross *= (1.0 + del/
e);
785 if(j==0 && startFromNull) { cross = 0.0; }
788 G4cout <<
"FillLambdaVector: " << j <<
". e(MeV)= " << e/
MeV
789 <<
" cross(1/mm)= " << cross*
mm
790 <<
" del= " << del*
mm <<
" k= " << k
794 if(cross < 0.0) { cross = 0.0; }
811 if(verb == 0) {
return; }
817 out <<
" ===== EM models for the G4Region " << reg->
GetName()
818 <<
" ======" << endOfLine;
819 for(
G4int j=0; j<
n; ++j) {
826 out << std::setw(20);
827 out << model->
GetName() <<
" : Emin= "
833 size_t kk = table->size();
834 for(
size_t k=0; k<kk; ++k) {
838 out <<
" Table with " << nn <<
" bins Emin= "
847 if(an) { out <<
" " << an->
GetName(); }
849 out <<
" FluoActive";
858 out <<
" ===== Limit on energy threshold has been applied "
G4double Energy(size_t index) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
void FillDEDXVector(G4PhysicsVector *, const G4MaterialCutsCouple *, G4EmTableType t=fRestricted)
std::ostringstream G4ExceptionDescription
G4double ConvertRangeToEnergy(const G4ParticleDefinition *particle, const G4Material *material, G4double range)
std::vector< const G4Region * > regions
static constexpr double MeV
const G4Region * theRegion
const G4DataVector * Initialise(const G4ParticleDefinition *part, const G4ParticleDefinition *secPart, G4double minSubRange, G4int verb)
static constexpr double mm
const G4String & GetName() const
std::vector< G4VEmModel * > models
const G4String & GetParticleName() const
G4DataVector * theCutsNew
std::vector< G4int > orderOfModels
static const G4double emax
G4int * theListOfModelIndexes
const G4ParticleDefinition * particle
const G4Region * Region() const
G4VEmModel * GetRegionModel(G4int idx, size_t index_couple)
virtual void DefineForRegion(const G4Region *)
G4VEmModel * GetModel(G4int idx, G4bool ver=false)
void DumpModelList(std::ostream &out, G4int verb)
G4double LowEnergyActivationLimit() const
const std::vector< G4double > * GetEnergyCutsVector(size_t pcIdx) const
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
G4double GetProductionCut(G4int index) const
G4double LowEnergyLimit() const
G4double CrossSection(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
std::vector< G4int > isUsed
const G4String & GetName() const
G4int ModelIndex(G4int n) const
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *, const G4Region *)
G4PhysicsTable * GetCrossSectionTable()
const G4String & GetName() const
G4bool DeexcitationFlag() const
void UpdateEmModel(const G4String &model_name, G4double emin, G4double emax)
static G4Positron * Positron()
static constexpr double eV
const G4DataVector * theCuts
G4RegionModels(G4int nMod, std::vector< G4int > &indx, G4DataVector &lowE, const G4Region *reg)
G4DataVector * theSubCuts
static G4Electron * Electron()
size_t GetTableSize() const
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)=0
G4double ComputeDEDX(G4VEmModel *model, const G4MaterialCutsCouple *, G4double kinEnergy, G4double cutEnergy, G4double minEnergy)
G4double maxSubCutInRange
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
G4int NumberOfRegionModels(size_t index_couple) const
static G4ProductionCutsTable * GetProductionCutsTable()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4double GetMaxEnergy() const
static G4RegionStore * GetInstance()
const G4String & GetName() const
void FillLambdaVector(G4PhysicsVector *, const G4MaterialCutsCouple *, G4bool startFromNull=true, G4EmTableType t=fRestricted)
G4GLOB_DLL std::ostream G4cout
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
G4ProductionCuts * GetProductionCuts() const
G4double HighEnergyActivationLimit() const
std::vector< G4VEmFluctuationModel * > flucModels
G4VEmAngularDistribution * GetAngularDistribution()
std::vector< G4int > idxOfRegionModels
const G4Material * GetMaterial() const
G4RegionModels * currRegionModel
static const G4double reg
G4double * lowKineticEnergy
G4double HighEnergyLimit() const
const XML_Char XML_Content * model
virtual G4double MinEnergyCut(const G4ParticleDefinition *, const G4MaterialCutsCouple *)
G4double LowEdgeEnergy(G4int n) const
void PutValue(size_t index, G4double theValue)
G4int NumberOfModels() const
size_t GetVectorLength() const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
std::vector< G4RegionModels * > setOfRegionModels