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= "
237 G4cout <<
"G4EmModelManager::Initialise() for "
245 G4Exception(
"G4EmModelManager::Initialise",
"em0002",
254 regionStore->
GetRegion(
"DefaultRegionForTheWorld",
false);
258 std::vector<const G4Region*> setr;
259 setr.push_back(world);
264 if ( r == 0 || r == world) {
271 if ( r == setr[j] ) { newRegion =
false; }
283 ed <<
"No models defined for the World volume for "
285 G4Exception(
"G4EmModelManager::Initialise",
"em0002",
303 std::vector<G4int> modelAtRegion(nEmModels);
304 std::vector<G4int> modelOrd(nEmModels);
310 <<
" Nmodels= " << nEmModels <<
G4endl;
332 <<
" <" << model->
GetName() <<
"> for region <";
335 <<
" tmin(MeV)= " << tmin/
MeV
336 <<
"; tmax(MeV)= " << tmax/
MeV
337 <<
"; order= " << ord
349 if( tmax - tmin <=
eV) push =
false;
351 else if (tmax == eLow[0]) {
356 }
else if(tmin < eHigh[n-1]) {
358 for(
G4int k=0; k<
n; ++k) {
360 if(ord >= modelOrd[k]) {
361 if(tmin < eHigh[k] && tmin >= eLow[k]) tmin = eHigh[k];
362 if(tmax <= eHigh[k] && tmax > eLow[k]) tmax = eLow[k];
363 if(tmax > eHigh[k] && tmin < eLow[k]) {
364 if(tmax - eHigh[k] > eLow[k] - tmin) tmin = eHigh[k];
367 if( tmax - tmin <=
eV) {
376 if (tmax == eLow[0]) {
381 }
else if(tmin < eHigh[n-1]) {
383 if(tmin > eLow[n-1] && tmax >= eHigh[n-1]) {
386 }
else if(tmin <= eLow[0] && tmax < eHigh[0]) {
393 for(
G4int k=0; k<
n; ++k) {
394 if(tmin <= eLow[k] && tmax >= eHigh[k]) {
396 modelAtRegion[k] = ii;
407 for(
G4int k=n-1; k>=idx; --k) {
408 modelAtRegion[k+1] = modelAtRegion[k];
409 modelOrd[k+1] = modelOrd[k];
411 eHigh[k+1] = eHigh[k];
416 if (push || insert) {
418 modelAtRegion[idx] = ii;
427 eLow[
n] = eHigh[n-1];
430 G4cout <<
"New G4RegionModels set with " << n <<
" models for region <";
432 G4cout <<
"> Elow(MeV)= ";
439 if(1 == nEmModels) {
break; }
447 if(secondaryParticle) {
460 if(minSubRange < 1.0) {
467 for(
size_t i=0; i<numOfCouples; ++i) {
475 if(nRegions > 1 && nEmModels > 1) {
478 do {--
reg;}
while (reg>0 && pcuts != (setr[reg]->GetProductionCuts()));
482 G4cout <<
"G4EmModelManager::Initialise() for "
484 <<
" indexOfCouple= " << i
485 <<
" indexOfRegion= " << reg
490 if(secondaryParticle) {
493 if( cut <
DBL_MAX && minSubRange < 1.0) {
500 if(tcutmax < subcut) { subcut = tcutmax; }
501 (*theSubCuts)[i] = subcut;
507 if(nRegions > 1 && nEmModels > 1) {
517 for(
G4int jj=0; jj<nnm; ++jj) {
524 (*theCutsNew)[i] = cutlim;
552 G4cout <<
"G4EmModelManager for " << partname
553 <<
" is initialised; nRegions= " << nRegions
578 G4cout <<
"G4EmModelManager::FillDEDXVector() for "
580 <<
" cut(MeV)= " << cut
581 <<
" emin(MeV)= " << emin
599 for(
size_t j=0; j<totBinsLoss; ++j) {
608 do {--k;}
while (k>0 && e <= regModels->LowEdgeEnergy(k));
610 if(k > 0 && k != k0) {
614 couple,elow,cut,emin);
616 couple,elow,cut,emin);
618 if(dedx2 > 0.0) { del = (dedx1/dedx2 - 1.0)*elow; }
625 dedx *= (1.0 + del/e);
628 G4cout <<
"Material= " << couple->GetMaterial()->GetName()
629 <<
" E(MeV)= " << e/
MeV
630 <<
" dEdx(MeV/mm)= " << dedx*
mm/
MeV
631 <<
" del= " << del*
mm/
MeV<<
" k= " << k
635 if(dedx < 0.0) { dedx = 0.0; }
660 G4cout <<
"G4EmModelManager::FillLambdaVector() for "
663 <<
" 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) {
695 if(xs2 > 0.0) { del = (xs1/xs2 - 1.0)*elow; }
701 cross *= (1.0 + del/e);
704 if(j==0 && startFromNull) { cross = 0.0; }
707 G4cout <<
"FillLambdaVector: " << j <<
". e(MeV)= " << e/
MeV
708 <<
" cross(1/mm)= " << cross*
mm
709 <<
" del= " << del*
mm <<
" k= " << k
713 if(cross < 0.0) { cross = 0.0; }
722 if(verb == 0) {
return; }
728 G4cout <<
" ===== EM models for the G4Region " << reg->
GetName()
730 for(
G4int j=0; j<
n; ++j) {
743 size_t kk = table->size();
744 for(
size_t k=0; k<kk; ++k) {
748 G4cout <<
" Table with " << nn <<
" bins Emin= "
767 G4cout <<
" ===== Limit on energy threshold has been applied "
G4double LowEnergyActivationLimit() const
G4double HighEnergyActivationLimit() const
G4double * lowKineticEnergy
G4double LowEnergyLimit() const
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
const G4String & GetName() const
const std::vector< G4double > * GetEnergyCutsVector(size_t pcIdx) const
std::vector< G4int > idxOfRegionModels
G4double GetMaxEnergy() const
void UpdateEmModel(const G4String &, G4double, G4double)
std::ostringstream G4ExceptionDescription
G4double HighEnergyLimit() const
G4VEmModel * GetModel(G4int, G4bool ver=false)
G4double GetProductionCut(G4int index) const
virtual void DefineForRegion(const G4Region *)
const G4String & GetName() const
G4double LowEdgeEnergy(G4int n) const
G4VEmAngularDistribution * GetAngularDistribution()
const G4DataVector * theCuts
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *, const G4Region *)
G4PhysicsTable * GetCrossSectionTable()
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
size_t GetVectorLength() const
virtual G4double MinEnergyCut(const G4ParticleDefinition *, const G4MaterialCutsCouple *)
void FillLambdaVector(G4PhysicsVector *, const G4MaterialCutsCouple *, G4bool startFromNull=true, G4EmTableType t=fRestricted)
std::vector< G4int > orderOfModels
const G4String & GetParticleName() const
static const G4double reg
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)=0
G4int ModelIndex(G4int n) const
static G4RegionStore * GetInstance()
G4int NumberOfModels() const
G4GLOB_DLL std::ostream G4cout
void FillDEDXVector(G4PhysicsVector *, const G4MaterialCutsCouple *, G4EmTableType t=fRestricted)
size_t GetTableSize() const
std::vector< G4int > isUsed
G4RegionModels(G4int nMod, std::vector< G4int > &indx, G4DataVector &lowE, const G4Region *reg)
G4double CrossSection(const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
const G4ParticleDefinition * particle
void PutValue(size_t index, G4double theValue)
G4double Energy(size_t index) const
void DumpModelList(G4int verb)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
const G4DataVector * Initialise(const G4ParticleDefinition *part, const G4ParticleDefinition *secPart, G4double minSubRange, G4int verb)
static const G4double emax
G4DataVector * theSubCuts
std::vector< G4VEmModel * > models
static G4ProductionCutsTable * GetProductionCutsTable()
G4bool DeexcitationFlag() const
static G4Positron * Positron()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4double maxSubCutInRange
G4double ComputeDEDX(G4VEmModel *model, const G4MaterialCutsCouple *, G4double kinEnergy, G4double cutEnergy, G4double minEnergy)
std::vector< const G4Region * > regions
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
static G4Electron * Electron()
G4RegionModels * currRegionModel
const G4String & GetName() const
G4double ConvertRangeToEnergy(const G4ParticleDefinition *particle, const G4Material *material, G4double range)
const G4Region * theRegion
const G4Region * Region() const
G4int * theListOfModelIndexes
G4ProductionCuts * GetProductionCuts() const
std::vector< G4VEmFluctuationModel * > flucModels
const G4String & GetName() const
const G4Material * GetMaterial() const
G4DataVector * theCutsNew
std::vector< G4RegionModels * > setOfRegionModels