Geant4-11
Public Member Functions | Private Member Functions | Private Attributes
G4EmConfigurator Class Reference

#include <G4EmConfigurator.hh>

Public Member Functions

void AddModels ()
 
void Clear ()
 
 G4EmConfigurator (const G4EmConfigurator &)=delete
 
 G4EmConfigurator (G4int verboseLevel=1)
 
G4EmConfiguratoroperator= (const G4EmConfigurator &right)=delete
 
void PrepareModels (const G4ParticleDefinition *aParticle, G4VEmProcess *p)
 
void PrepareModels (const G4ParticleDefinition *aParticle, G4VEnergyLossProcess *p)
 
void PrepareModels (const G4ParticleDefinition *aParticle, G4VMultipleScattering *p)
 
void SetExtraEmModel (const G4String &particleName, const G4String &processName, G4VEmModel *, const G4String &regionName="", G4double emin=0.0, G4double emax=DBL_MAX, G4VEmFluctuationModel *fm=nullptr)
 
void SetVerbose (G4int value)
 
 ~G4EmConfigurator ()
 

Private Member Functions

const G4RegionFindRegion (const G4String &)
 
void SetModelForRegion (G4VEmModel *model, G4VEmFluctuationModel *fm, const G4Region *reg, const G4String &particleName, const G4String &processName, G4double emin, G4double emax)
 
G4bool UpdateModelEnergyRange (G4VEmModel *mod, G4double emin, G4double emax)
 

Private Attributes

std::vector< G4VEmFluctuationModel * > flucModels
 
std::vector< G4doublehighEnergy
 
G4int index
 
std::vector< G4doublelowEnergy
 
std::vector< G4VEmModel * > models
 
std::vector< G4Stringparticles
 
std::vector< G4Stringprocesses
 
std::vector< G4Stringregions
 
G4int verbose
 

Detailed Description

Definition at line 62 of file G4EmConfigurator.hh.

Constructor & Destructor Documentation

◆ G4EmConfigurator() [1/2]

G4EmConfigurator::G4EmConfigurator ( G4int  verboseLevel = 1)
explicit

Definition at line 64 of file G4EmConfigurator.cc.

64 :verbose(val)
65{
66 index = -10;
67}

References index.

◆ ~G4EmConfigurator()

G4EmConfigurator::~G4EmConfigurator ( )

Definition at line 71 of file G4EmConfigurator.cc.

72{}

◆ G4EmConfigurator() [2/2]

G4EmConfigurator::G4EmConfigurator ( const G4EmConfigurator )
delete

Member Function Documentation

◆ AddModels()

void G4EmConfigurator::AddModels ( )

Definition at line 110 of file G4EmConfigurator.cc.

111{
112 size_t n = models.size();
113 if(0 < verbose) {
114 G4cout << "### G4EmConfigurator::AddModels n= " << n << G4endl;
115 }
116 if(n > 0) {
117 for(size_t i=0; i<n; ++i) {
118 if(nullptr != models[i]) {
119 const G4Region* reg = FindRegion(regions[i]);
120 if(nullptr != reg) {
121 --index;
123 particles[i],processes[i],
124 lowEnergy[i],highEnergy[i]);
125 }
126 }
127 }
128 }
129 Clear();
130}
static const G4double reg
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
const G4Region * FindRegion(const G4String &)
std::vector< G4String > processes
std::vector< G4double > lowEnergy
std::vector< G4String > particles
void SetModelForRegion(G4VEmModel *model, G4VEmFluctuationModel *fm, const G4Region *reg, const G4String &particleName, const G4String &processName, G4double emin, G4double emax)
std::vector< G4VEmModel * > models
std::vector< G4String > regions
std::vector< G4VEmFluctuationModel * > flucModels
std::vector< G4double > highEnergy

References Clear(), FindRegion(), flucModels, G4cout, G4endl, highEnergy, index, lowEnergy, models, CLHEP::detail::n, particles, processes, reg, regions, SetModelForRegion(), and verbose.

◆ Clear()

void G4EmConfigurator::Clear ( )

Definition at line 344 of file G4EmConfigurator.cc.

345{
346 particles.clear();
347 processes.clear();
348 models.clear();
349 flucModels.clear();
350 regions.clear();
351 lowEnergy.clear();
352 highEnergy.clear();
353}

References flucModels, highEnergy, lowEnergy, models, particles, processes, and regions.

Referenced by AddModels(), G4LossTableManager::BuildPhysicsTable(), and G4LossTableManager::LocalPhysicsTables().

◆ FindRegion()

const G4Region * G4EmConfigurator::FindRegion ( const G4String regionName)
private

Definition at line 357 of file G4EmConfigurator.cc.

358{
359 // search for region
360 const G4Region* reg = nullptr;
362 G4String r = regionName;
363 if(r == "" || r == "world" || r == "World") {
364 r = "DefaultRegionForTheWorld";
365 }
366 reg = regStore->GetRegion(r, true);
367 if(nullptr == reg) {
368 G4cout << "### G4EmConfigurator WARNING: fails to find a region <"
369 << r << G4endl;
370 } else if(verbose > 1) {
371 G4cout << "### G4EmConfigurator finds out G4Region <" << r << ">"
372 << G4endl;
373 }
374 return reg;
375}
static G4RegionStore * GetInstance()
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const

References G4cout, G4endl, G4RegionStore::GetInstance(), G4RegionStore::GetRegion(), reg, and verbose.

Referenced by AddModels(), and PrepareModels().

◆ operator=()

G4EmConfigurator & G4EmConfigurator::operator= ( const G4EmConfigurator right)
delete

◆ PrepareModels() [1/3]

void G4EmConfigurator::PrepareModels ( const G4ParticleDefinition aParticle,
G4VEmProcess p 
)

Definition at line 266 of file G4EmConfigurator.cc.

268{
269 size_t n = particles.size();
270 if(1 < verbose) {
271 G4cout << " G4EmConfigurator::PrepareModels for EM process n= "
272 << n << G4endl;
273 }
274 if(n > 0) {
275 G4String particleName = aParticle->GetParticleName();
276 G4String processName = p->GetProcessName();
277 //G4cout << particleName << " " << particleName << G4endl;
278 for(size_t i=0; i<n; ++i) {
279 if(processName == processes[i]) {
280 if((particleName == particles[i]) ||
281 (particles[i] == "all") ||
282 (particles[i] == "charged" && aParticle->GetPDGCharge() != 0.0)) {
283 const G4Region* reg = FindRegion(regions[i]);
284 //G4cout << "Region " << reg << G4endl;
285 if(nullptr != reg) {
286 --index;
287 G4VEmModel* mod = models[i];
288 if(nullptr != mod) {
290 p->AddEmModel(index,mod,reg);
291 if(1 < verbose) {
292 G4cout << "### Added em model order= " << index << " for "
293 << particleName << " and " << processName << G4endl;
294 }
295 }
296 }
297 }
298 }
299 }
300 }
301 }
302}
G4bool UpdateModelEnergyRange(G4VEmModel *mod, G4double emin, G4double emax)
G4double GetPDGCharge() const
const G4String & GetParticleName() const
void AddEmModel(G4int, G4VEmModel *, const G4Region *region=nullptr)
const G4String & GetProcessName() const
Definition: G4VProcess.hh:382

References G4VEmProcess::AddEmModel(), FindRegion(), G4cout, G4endl, G4ParticleDefinition::GetParticleName(), G4ParticleDefinition::GetPDGCharge(), G4VProcess::GetProcessName(), highEnergy, index, lowEnergy, models, CLHEP::detail::n, particles, processes, reg, regions, UpdateModelEnergyRange(), and verbose.

◆ PrepareModels() [2/3]

void G4EmConfigurator::PrepareModels ( const G4ParticleDefinition aParticle,
G4VEnergyLossProcess p 
)

Definition at line 220 of file G4EmConfigurator.cc.

222{
223 size_t n = particles.size();
224 if(1 < verbose) {
225 G4cout << " G4EmConfigurator::PrepareModels for EnergyLoss n= "
226 << n << G4endl;
227 }
228 if(n > 0) {
229 G4String particleName = aParticle->GetParticleName();
230 G4String processName = p->GetProcessName();
231 //G4cout << particleName << " " << processName << G4endl;
232 for(size_t i=0; i<n; ++i) {
233 //G4cout << particles[i] << " " << processes[i] << G4endl;
234 if(processName == processes[i]) {
235 if((particleName == particles[i]) ||
236 (particles[i] == "all") ||
237 (particles[i] == "charged" && aParticle->GetPDGCharge() != 0.0)) {
238 const G4Region* reg = FindRegion(regions[i]);
239 //G4cout << "Region " << reg << G4endl;
240 if(nullptr != reg) {
241 --index;
242 G4VEmModel* mod = models[i];
244 if(nullptr != mod) {
246 p->AddEmModel(index,mod,fm,reg);
247 if(1 < verbose) {
248 G4cout << "### Added eloss model order= " << index << " for "
249 << particleName << " and " << processName
250 << " for " << reg->GetName() << G4endl;
251 }
252 }
253 } else if(nullptr != fm) {
254 p->SetFluctModel(fm);
255 }
256 }
257 }
258 }
259 }
260 }
261}
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *fluc=nullptr, const G4Region *region=nullptr)
void SetFluctModel(G4VEmFluctuationModel *)

References G4VEnergyLossProcess::AddEmModel(), FindRegion(), flucModels, G4cout, G4endl, G4ParticleDefinition::GetParticleName(), G4ParticleDefinition::GetPDGCharge(), G4VProcess::GetProcessName(), highEnergy, index, lowEnergy, models, CLHEP::detail::n, particles, processes, reg, regions, G4VEnergyLossProcess::SetFluctModel(), UpdateModelEnergyRange(), and verbose.

Referenced by G4LossTableManager::PreparePhysicsTable().

◆ PrepareModels() [3/3]

void G4EmConfigurator::PrepareModels ( const G4ParticleDefinition aParticle,
G4VMultipleScattering p 
)

Definition at line 307 of file G4EmConfigurator.cc.

309{
310 size_t n = particles.size();
311 if(1 < verbose) {
312 G4cout << " G4EmConfigurator::PrepareModels for MSC process n= "
313 << n << G4endl;
314 }
315
316 if(n > 0) {
317 G4String particleName = aParticle->GetParticleName();
318 G4String processName = p->GetProcessName();
319 for(size_t i=0; i<n; ++i) {
320 if(processName == processes[i]) {
321 if((particleName == particles[i]) ||
322 (particles[i] == "all") ||
323 (particles[i] == "charged" && aParticle->GetPDGCharge() != 0.0)) {
324 const G4Region* reg = FindRegion(regions[i]);
325 if(nullptr != reg) {
326 --index;
327 G4VEmModel* mod = models[i];
328 if(nullptr != mod) {
330 p->AddEmModel(index,mod,reg);
331 //G4cout << "### Added msc model order= " << index << " for "
332 // << particleName << " and " << processName << G4endl;
333 }
334 }
335 }
336 }
337 }
338 }
339 }
340}
void AddEmModel(G4int order, G4VEmModel *, const G4Region *region=nullptr)

References G4VMultipleScattering::AddEmModel(), FindRegion(), G4cout, G4endl, G4ParticleDefinition::GetParticleName(), G4ParticleDefinition::GetPDGCharge(), G4VProcess::GetProcessName(), highEnergy, index, lowEnergy, models, CLHEP::detail::n, particles, processes, reg, regions, UpdateModelEnergyRange(), and verbose.

◆ SetExtraEmModel()

void G4EmConfigurator::SetExtraEmModel ( const G4String particleName,
const G4String processName,
G4VEmModel mod,
const G4String regionName = "",
G4double  emin = 0.0,
G4double  emax = DBL_MAX,
G4VEmFluctuationModel fm = nullptr 
)

Definition at line 76 of file G4EmConfigurator.cc.

83{
84 if(nullptr == mod) { return; }
85 if(1 < verbose) {
86 G4cout << " G4EmConfigurator::SetExtraEmModel " << mod->GetName()
87 << " for " << particleName
88 << " and " << processName
89 << " in the region <" << regionName
90 << "> Emin(MeV)= " << emin/MeV
91 << " Emax(MeV)= " << emax/MeV
92 << G4endl;
93 }
94
95 models.push_back(mod);
96 flucModels.push_back(fm);
97 G4double emin0 = std::max(emin, mod->LowEnergyLimit());
98 G4double emax0 = std::min(emax, mod->HighEnergyLimit());
100
101 particles.push_back(particleName);
102 processes.push_back(processName);
103 regions.push_back(regionName);
104 lowEnergy.push_back(emin0);
105 highEnergy.push_back(emax0);
106}
static const G4double emax
static constexpr double MeV
Definition: G4SIunits.hh:200
double G4double
Definition: G4Types.hh:83
G4double LowEnergyLimit() const
Definition: G4VEmModel.hh:662
G4double HighEnergyLimit() const
Definition: G4VEmModel.hh:655
void SetActivationHighEnergyLimit(G4double)
Definition: G4VEmModel.hh:781
const G4String & GetName() const
Definition: G4VEmModel.hh:837
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

References emax, flucModels, G4cout, G4endl, G4VEmModel::GetName(), highEnergy, G4VEmModel::HighEnergyLimit(), lowEnergy, G4VEmModel::LowEnergyLimit(), G4INCL::Math::max(), MeV, G4INCL::Math::min(), models, particles, processes, regions, G4VEmModel::SetActivationHighEnergyLimit(), and verbose.

Referenced by G4EmModelActivator::ActivateEmOptions(), G4EmModelActivator::ActivateMicroElec(), G4EmDNAPhysicsActivator::AddElectronModels0(), G4EmDNAPhysicsActivator::AddElectronModels2(), G4EmDNAPhysicsActivator::AddElectronModels4(), G4EmDNAPhysicsActivator::AddElectronModels4a(), G4EmDNAPhysicsActivator::AddElectronModels6(), G4EmDNAPhysicsActivator::AddElectronModels6a(), G4EmDNAPhysicsActivator::AddElectronModels7(), G4EmDNAPhysicsActivator::AddGenericIonModels0(), G4EmDNAPhysicsActivator::AddHeliumModels0(), G4EmDNAPhysicsActivator::AddProtonModels0(), and G4EmModelActivator::AddStandardScattering().

◆ SetModelForRegion()

void G4EmConfigurator::SetModelForRegion ( G4VEmModel model,
G4VEmFluctuationModel fm,
const G4Region reg,
const G4String particleName,
const G4String processName,
G4double  emin,
G4double  emax 
)
private

Definition at line 134 of file G4EmConfigurator.cc.

140{
141 if(nullptr == mod) { return; }
142 if(1 < verbose) {
143 G4cout << " G4EmConfigurator::SetModelForRegion: " << mod->GetName()
144 << G4endl;
145 G4cout << " For " << particleName
146 << " and " << processName
147 << " in the region <" << reg->GetName()
148 << " Emin(MeV)= " << emin/MeV
149 << " Emax(MeV)= " << emax/MeV;
150 if(nullptr != fm) { G4cout << " FLmodel " << fm->GetName(); }
151 G4cout << G4endl;
152 }
153
154 // Loop checking, 03-Aug-2015, Vladimir Ivanchenko
155 auto myParticleIterator = G4ParticleTable::GetParticleTable()->GetIterator();
156 myParticleIterator->reset();
157 while( (*myParticleIterator)() ) {
158 const G4ParticleDefinition* part = myParticleIterator->value();
159
160 if((part->GetParticleName() == particleName) ||
161 (particleName == "all") ||
162 (particleName == "charged" && part->GetPDGCharge() != 0.0)) {
163
164 // search for process
165 G4ProcessManager* pmanager = part->GetProcessManager();
166 G4ProcessVector* plist = pmanager->GetProcessList();
167 G4int np = pmanager->GetProcessListLength();
168
169 if(1 < verbose) {
170 G4cout << "Check process <" << processName << "> for "
171 << particleName << " in list of " << np << " processes"
172 << G4endl;
173 }
174 G4VProcess* proc = nullptr;
175 for(G4int i=0; i<np; ++i) {
176 if(processName == (*plist)[i]->GetProcessName()) {
177 proc = (*plist)[i];
178 break;
179 }
180 }
181 if(nullptr == proc) {
182 G4cout << "### G4EmConfigurator WARNING: fails to find a process <"
183 << processName << "> for " << particleName << G4endl;
184 return;
185 }
186
187 if(!UpdateModelEnergyRange(mod, emin, emax)) { return; }
188 // classify process
189 G4int ii = proc->GetProcessSubType();
190 if(10 == ii) {
191 G4VMultipleScattering* p = static_cast<G4VMultipleScattering*>(proc);
192 p->AddEmModel(index,mod,reg);
193 if(1 < verbose) {
194 G4cout << "### Added msc model order= " << index << " for "
195 << particleName << " and " << processName << G4endl;
196 }
197 } else if(2 <= ii && 4 >= ii) {
198 G4VEnergyLossProcess* p = static_cast<G4VEnergyLossProcess*>(proc);
199 p->AddEmModel(index,mod,fm,reg);
200 if(1 < verbose) {
201 G4cout << "### Added eloss model order= " << index << " for "
202 << particleName << " and " << processName << G4endl;
203 }
204 } else {
205 G4VEmProcess* p = static_cast<G4VEmProcess*>(proc);
206 p->AddEmModel(index,mod,reg);
207 if(1 < verbose) {
208 G4cout << "### Added em model order= " << index << " for "
209 << particleName << " and " << processName << G4endl;
210 }
211 }
212 return;
213 }
214 }
215}
int G4int
Definition: G4Types.hh:85
G4ProcessManager * GetProcessManager() const
void reset(G4bool ifSkipIon=true)
G4PTblDicIterator * GetIterator() const
static G4ParticleTable * GetParticleTable()
G4int GetProcessListLength() const
G4ProcessVector * GetProcessList() const
const G4String & GetName() const
G4int GetProcessSubType() const
Definition: G4VProcess.hh:400

References G4VMultipleScattering::AddEmModel(), G4VEmProcess::AddEmModel(), G4VEnergyLossProcess::AddEmModel(), emax, G4cout, G4endl, G4ParticleTable::GetIterator(), G4VEmFluctuationModel::GetName(), G4VEmModel::GetName(), G4ParticleDefinition::GetParticleName(), G4ParticleTable::GetParticleTable(), G4ParticleDefinition::GetPDGCharge(), G4ProcessManager::GetProcessList(), G4ProcessManager::GetProcessListLength(), G4ParticleDefinition::GetProcessManager(), G4VProcess::GetProcessSubType(), index, MeV, reg, G4ParticleTableIterator< K, V >::reset(), UpdateModelEnergyRange(), and verbose.

Referenced by AddModels().

◆ SetVerbose()

void G4EmConfigurator::SetVerbose ( G4int  value)
inline

Definition at line 135 of file G4EmConfigurator.hh.

136{
137 verbose = value;
138}

References verbose.

Referenced by G4LossTableManager::ResetParameters().

◆ UpdateModelEnergyRange()

G4bool G4EmConfigurator::UpdateModelEnergyRange ( G4VEmModel mod,
G4double  emin,
G4double  emax 
)
private

Definition at line 379 of file G4EmConfigurator.cc.

381{
382 // energy limits
383 G4double e1 = std::max(emin,mod->LowEnergyLimit());
385 if(e2 <= e1) {
386 G4cout << "### G4EmConfigurator WARNING: empty energy interval"
387 << " for <" << mod->GetName()
388 << "> Emin(MeV)= " << e1/CLHEP::MeV
389 << "> Emax(MeV)= " << e2/CLHEP::MeV
390 << G4endl;
391 return false;
392 }
393 mod->SetLowEnergyLimit(e1);
395 if(verbose > 1) {
396 G4cout << "### G4EmConfigurator for " << mod->GetName()
397 << " Emin(MeV)= " << e1/MeV << " Emax(MeV)= " << e2/MeV
398 << G4endl;
399 }
400 return true;
401}
static const G4double e1[44]
static const G4double e2[44]
void SetHighEnergyLimit(G4double)
Definition: G4VEmModel.hh:767
void SetLowEnergyLimit(G4double)
Definition: G4VEmModel.hh:774
static constexpr double MeV

References e1, e2, emax, G4cout, G4endl, G4VEmModel::GetName(), G4VEmModel::HighEnergyLimit(), G4VEmModel::LowEnergyLimit(), G4INCL::Math::max(), CLHEP::MeV, MeV, G4INCL::Math::min(), G4VEmModel::SetHighEnergyLimit(), G4VEmModel::SetLowEnergyLimit(), and verbose.

Referenced by PrepareModels(), and SetModelForRegion().

Field Documentation

◆ flucModels

std::vector<G4VEmFluctuationModel*> G4EmConfigurator::flucModels
private

Definition at line 122 of file G4EmConfigurator.hh.

Referenced by AddModels(), Clear(), PrepareModels(), and SetExtraEmModel().

◆ highEnergy

std::vector<G4double> G4EmConfigurator::highEnergy
private

Definition at line 127 of file G4EmConfigurator.hh.

Referenced by AddModels(), Clear(), PrepareModels(), and SetExtraEmModel().

◆ index

G4int G4EmConfigurator::index
private

Definition at line 129 of file G4EmConfigurator.hh.

Referenced by AddModels(), G4EmConfigurator(), PrepareModels(), and SetModelForRegion().

◆ lowEnergy

std::vector<G4double> G4EmConfigurator::lowEnergy
private

Definition at line 126 of file G4EmConfigurator.hh.

Referenced by AddModels(), Clear(), PrepareModels(), and SetExtraEmModel().

◆ models

std::vector<G4VEmModel*> G4EmConfigurator::models
private

Definition at line 121 of file G4EmConfigurator.hh.

Referenced by AddModels(), Clear(), PrepareModels(), and SetExtraEmModel().

◆ particles

std::vector<G4String> G4EmConfigurator::particles
private

Definition at line 123 of file G4EmConfigurator.hh.

Referenced by AddModels(), Clear(), PrepareModels(), and SetExtraEmModel().

◆ processes

std::vector<G4String> G4EmConfigurator::processes
private

Definition at line 124 of file G4EmConfigurator.hh.

Referenced by AddModels(), Clear(), PrepareModels(), and SetExtraEmModel().

◆ regions

std::vector<G4String> G4EmConfigurator::regions
private

Definition at line 125 of file G4EmConfigurator.hh.

Referenced by AddModels(), Clear(), PrepareModels(), and SetExtraEmModel().

◆ verbose

G4int G4EmConfigurator::verbose
private

The documentation for this class was generated from the following files: