164 for(
size_t i=0; i<
n; ++i) {
177 G4cout <<
"G4EmModelManager::AddEmModel WARNING: no model defined."
197 if(nam ==
models[i]->GetName()) {
198 models[i]->SetLowEnergyLimit(emin);
199 models[i]->SetHighEnergyLimit(emax);
204 G4cout <<
"G4EmModelManager::UpdateEmModel WARNING: no model <"
205 << nam <<
"> is found out"
216 G4cout <<
"G4EmModelManager::GetModel WARNING: "
217 <<
"index " << i <<
" is wrong Nmodels= "
238 G4cout <<
"G4EmModelManager::Initialise() for "
246 G4Exception(
"G4EmModelManager::Initialise",
"em0002",
255 regionStore->
GetRegion(
"DefaultRegionForTheWorld",
false);
259 std::vector<const G4Region*> setr;
260 setr.push_back(world);
265 if ( r == 0 || r == world) {
272 if ( r == setr[j] ) { newRegion =
false; }
284 ed <<
"No models defined for the World volume for "
286 G4Exception(
"G4EmModelManager::Initialise",
"em0002",
304 std::vector<G4int> modelAtRegion(nEmModels);
305 std::vector<G4int> modelOrd(nEmModels);
311 <<
" Nmodels= " << nEmModels <<
G4endl;
333 <<
" <" << model->
GetName() <<
"> for region <";
336 <<
" tmin(MeV)= " << tmin/
MeV
337 <<
"; tmax(MeV)= " << tmax/
MeV
338 <<
"; order= " << ord
350 if( tmax - tmin <=
eV) push =
false;
352 else if (tmax == eLow[0]) {
357 }
else if(tmin < eHigh[n-1]) {
359 for(
G4int k=0; k<
n; ++k) {
361 if(ord >= modelOrd[k]) {
362 if(tmin < eHigh[k] && tmin >= eLow[k]) tmin = eHigh[k];
363 if(tmax <= eHigh[k] && tmax > eLow[k]) tmax = eLow[k];
364 if(tmax > eHigh[k] && tmin < eLow[k]) {
365 if(tmax - eHigh[k] > eLow[k] - tmin) tmin = eHigh[k];
368 if( tmax - tmin <=
eV) {
377 if (tmax == eLow[0]) {
382 }
else if(tmin < eHigh[n-1]) {
384 if(tmin > eLow[n-1] && tmax >= eHigh[n-1]) {
387 }
else if(tmin <= eLow[0] && tmax < eHigh[0]) {
394 for(
G4int k=0; k<
n; ++k) {
395 if(tmin <= eLow[k] && tmax >= eHigh[k]) {
397 modelAtRegion[k] = ii;
408 for(
G4int k=n-1; k>=idx; --k) {
409 modelAtRegion[k+1] = modelAtRegion[k];
410 modelOrd[k+1] = modelOrd[k];
412 eHigh[k+1] = eHigh[k];
417 if (push || insert) {
419 modelAtRegion[idx] = ii;
428 eLow[
n] = eHigh[n-1];
431 G4cout <<
"New G4RegionModels set with " << n <<
" models for region <";
433 G4cout <<
"> Elow(MeV)= ";
440 if(1 == nEmModels) {
break; }
448 if(secondaryParticle) {
459 if(minSubRange < 1.0) {
466 for(
size_t i=0; i<numOfCouples; ++i) {
474 if(nRegions > 1 && nEmModels > 1) {
476 do {--
reg;}
while (reg>0 && pcuts != (setr[reg]->GetProductionCuts()));
480 G4cout <<
"G4EmModelManager::Initialise() for "
482 <<
" indexOfCouple= " << i
483 <<
" indexOfRegion= " << reg
488 if(secondaryParticle) {
491 if( cut <
DBL_MAX && minSubRange < 1.0) {
498 if(tcutmax < subcut) { subcut = tcutmax; }
499 (*theSubCuts)[i] = subcut;
505 if(nRegions > 1 && nEmModels > 1) {
515 for(
G4int jj=0; jj<nnm; ++jj) {
522 (*theCutsNew)[i] = cutlim;
550 G4cout <<
"G4EmModelManager for " << partname
551 <<
" is initialised; nRegions= " << nRegions
576 G4cout <<
"G4EmModelManager::FillDEDXVector() for "
578 <<
" cut(MeV)= " << cut
579 <<
" emin(MeV)= " << emin
597 for(
size_t j=0; j<totBinsLoss; ++j) {
605 do {--k;}
while (k>0 && e <= regModels->LowEdgeEnergy(k));
607 if(k > 0 && k != k0) {
611 couple,elow,cut,emin);
613 couple,elow,cut,emin);
615 if(dedx2 > 0.0) { del = (dedx1/dedx2 - 1.0)*elow; }
622 dedx *= (1.0 + del/e);
625 G4cout <<
"Material= " << couple->GetMaterial()->GetName()
626 <<
" E(MeV)= " << e/
MeV
627 <<
" dEdx(MeV/mm)= " << dedx*
mm/
MeV
628 <<
" del= " << del*
mm/
MeV<<
" k= " << k
632 if(dedx < 0.0) { dedx = 0.0; }
657 G4cout <<
"G4EmModelManager::FillLambdaVector() for "
660 <<
" Emin(MeV)= " << aVector->
Energy(0)
673 for(
size_t j=0; j<totBinsLambda; ++j) {
680 do {--k;}
while (k>0 && e <= regModels->LowEdgeEnergy(k));
681 if(k > 0 && k != k0) {
689 if(xs2 > 0.0) { del = (xs1/xs2 - 1.0)*elow; }
695 cross *= (1.0 + del/e);
698 if(j==0 && startFromNull) { cross = 0.0; }
701 G4cout <<
"FillLambdaVector: " << j <<
". e(MeV)= " << e/
MeV
702 <<
" cross(1/mm)= " << cross*
mm
703 <<
" del= " << del*
mm <<
" k= " << k
707 if(cross < 0.0) { cross = 0.0; }
716 if(verb == 0) {
return; }
722 G4cout <<
" ===== EM models for the G4Region " << reg->
GetName()
724 for(
G4int j=0; j<
n; ++j) {
737 size_t kk = table->size();
738 for(
size_t k=0; k<kk; ++k) {
742 G4cout <<
" Table with " << nn <<
" bins Emin= "
761 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
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