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) {
477 do {--
reg;}
while (reg>0 && pcuts != (setr[reg]->GetProductionCuts()));
481 G4cout <<
"G4EmModelManager::Initialise() for "
483 <<
" indexOfCouple= " << i
484 <<
" indexOfRegion= " << reg
489 if(secondaryParticle) {
492 if( cut <
DBL_MAX && minSubRange < 1.0) {
499 if(tcutmax < subcut) { subcut = tcutmax; }
500 (*theSubCuts)[i] = subcut;
506 if(nRegions > 1 && nEmModels > 1) {
516 for(
G4int jj=0; jj<nnm; ++jj) {
523 (*theCutsNew)[i] = cutlim;
551 G4cout <<
"G4EmModelManager for " << partname
552 <<
" is initialised; nRegions= " << nRegions
577 G4cout <<
"G4EmModelManager::FillDEDXVector() for "
579 <<
" cut(MeV)= " << cut
580 <<
" emin(MeV)= " << emin
598 for(
size_t j=0; j<totBinsLoss; ++j) {
606 do {--k;}
while (k>0 && e <= regModels->LowEdgeEnergy(k));
608 if(k > 0 && k != k0) {
612 couple,elow,cut,emin);
614 couple,elow,cut,emin);
616 if(dedx2 > 0.0) { del = (dedx1/dedx2 - 1.0)*elow; }
623 dedx *= (1.0 + del/e);
626 G4cout <<
"Material= " << couple->GetMaterial()->GetName()
627 <<
" E(MeV)= " << e/
MeV
628 <<
" dEdx(MeV/mm)= " << dedx*
mm/
MeV
629 <<
" del= " << del*
mm/
MeV<<
" k= " << k
633 if(dedx < 0.0) { dedx = 0.0; }
658 G4cout <<
"G4EmModelManager::FillLambdaVector() for "
661 <<
" Emin(MeV)= " << aVector->
Energy(0)
676 for(
size_t j=0; j<totBinsLambda; ++j) {
683 do {--k;}
while (k>0 && e <= regModels->LowEdgeEnergy(k));
684 if(k > 0 && k != k0) {
692 if(xs2 > 0.0) { del = (xs1/xs2 - 1.0)*elow; }
698 cross *= (1.0 + del/e);
701 if(j==0 && startFromNull) { cross = 0.0; }
704 G4cout <<
"FillLambdaVector: " << j <<
". e(MeV)= " << e/
MeV
705 <<
" cross(1/mm)= " << cross*
mm
706 <<
" del= " << del*
mm <<
" k= " << k
710 if(cross < 0.0) { cross = 0.0; }
719 if(verb == 0) {
return; }
725 G4cout <<
" ===== EM models for the G4Region " << reg->
GetName()
727 for(
G4int j=0; j<
n; ++j) {
740 size_t kk = table->size();
741 for(
size_t k=0; k<kk; ++k) {
745 G4cout <<
" Table with " << nn <<
" bins Emin= "
764 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)
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