Geant4  10.02.p03
G4EmConfigurator Class Reference

#include <G4EmConfigurator.hh>

Collaboration diagram for G4EmConfigurator:

Public Member Functions

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

Private Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 63 of file G4EmConfigurator.hh.

Constructor & Destructor Documentation

◆ G4EmConfigurator() [1/2]

G4EmConfigurator::G4EmConfigurator ( G4int  verboseLevel = 1)

Definition at line 65 of file G4EmConfigurator.cc.

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

◆ ~G4EmConfigurator()

G4EmConfigurator::~G4EmConfigurator ( )

Definition at line 72 of file G4EmConfigurator.cc.

73 {}

◆ G4EmConfigurator() [2/2]

G4EmConfigurator::G4EmConfigurator ( const G4EmConfigurator )
private

Member Function Documentation

◆ AddModels()

void G4EmConfigurator::AddModels ( )

Definition at line 113 of file G4EmConfigurator.cc.

114 {
115  size_t n = models.size();
116  if(0 < verbose) {
117  G4cout << "### G4EmConfigurator::AddModels n= " << n << G4endl;
118  }
119  if(n > 0) {
120  for(size_t i=0; i<n; ++i) {
121  if(models[i]) {
123  if(reg) {
124  --index;
126  particles[i],processes[i],
127  lowEnergy[i],highEnergy[i]);
128  }
129  }
130  }
131  }
132  Clear();
133 }
void SetModelForRegion(G4VEmModel *model, G4VEmFluctuationModel *fm, G4Region *reg, const G4String &particleName, const G4String &processName, G4double emin, G4double emax)
std::vector< G4double > lowEnergy
std::vector< G4VEmModel * > models
std::vector< G4String > processes
static const G4double reg
G4Region * FindRegion(const G4String &)
Char_t n[5]
G4GLOB_DLL std::ostream G4cout
std::vector< G4String > regions
std::vector< G4VEmFluctuationModel * > flucModels
#define G4endl
Definition: G4ios.hh:61
std::vector< G4String > particles
std::vector< G4double > highEnergy
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Clear()

void G4EmConfigurator::Clear ( )

Definition at line 355 of file G4EmConfigurator.cc.

356 {
357  particles.clear();
358  processes.clear();
359  models.clear();
360  flucModels.clear();
361  regions.clear();
362  lowEnergy.clear();
363  highEnergy.clear();
364 }
std::vector< G4double > lowEnergy
std::vector< G4VEmModel * > models
std::vector< G4String > processes
std::vector< G4String > regions
std::vector< G4VEmFluctuationModel * > flucModels
std::vector< G4String > particles
std::vector< G4double > highEnergy
Here is the caller graph for this function:

◆ FindRegion()

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

Definition at line 368 of file G4EmConfigurator.cc.

369 {
370  // search for region
371  G4Region* reg = 0;
373  G4String r = regionName;
374  if(r == "" || r == "world" || r == "World") {
375  r = "DefaultRegionForTheWorld";
376  }
377  reg = regStore->GetRegion(r, true);
378  if(!reg) {
379  G4cout << "### G4EmConfigurator WARNING: fails to find a region <"
380  << r << G4endl;
381  } else if(verbose > 1) {
382  G4cout << "### G4EmConfigurator finds out G4Region <" << r << ">"
383  << G4endl;
384  }
385  return reg;
386 }
static const G4double reg
static G4RegionStore * GetInstance()
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

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

◆ PrepareModels() [1/3]

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

Definition at line 232 of file G4EmConfigurator.cc.

234 {
235  size_t n = particles.size();
236  if(1 < verbose) {
237  G4cout << " G4EmConfigurator::PrepareModels for EnergyLoss n= "
238  << n << G4endl;
239  }
240  if(n > 0) {
241  G4String particleName = aParticle->GetParticleName();
242  G4String processName = p->GetProcessName();
243  //G4cout << particleName << " " << processName << G4endl;
244  for(size_t i=0; i<n; ++i) {
245  //G4cout << particles[i] << " " << processes[i] << G4endl;
246  if(processName == processes[i]) {
247  if((particleName == particles[i]) ||
248  (particles[i] == "all") ||
249  (particles[i] == "charged" && aParticle->GetPDGCharge() != 0.0)) {
251  //G4cout << "Region " << reg << G4endl;
252  if(reg) {
253  --index;
254  G4VEmModel* mod = models[i];
256  if(mod) {
257  if(UpdateModelEnergyRange(mod, lowEnergy[i], highEnergy[i])) {
258  p->AddEmModel(index,mod,fm,reg);
259  if(1 < verbose) {
260  G4cout << "### Added eloss model order= " << index << " for "
261  << particleName << " and " << processName << G4endl;
262  }
263  }
264  } else if(fm) {
265  p->SetFluctModel(fm);
266  }
267  }
268  }
269  }
270  }
271  }
272 }
std::vector< G4double > lowEnergy
std::vector< G4VEmModel * > models
void SetFluctModel(G4VEmFluctuationModel *)
G4bool UpdateModelEnergyRange(G4VEmModel *mod, G4double emin, G4double emax)
std::vector< G4String > processes
static const G4double reg
G4Region * FindRegion(const G4String &)
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
Char_t n[5]
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *fluc=0, const G4Region *region=0)
std::vector< G4String > regions
std::vector< G4VEmFluctuationModel * > flucModels
#define G4endl
Definition: G4ios.hh:61
std::vector< G4String > particles
G4double GetPDGCharge() const
std::vector< G4double > highEnergy
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrepareModels() [2/3]

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

Definition at line 277 of file G4EmConfigurator.cc.

279 {
280  size_t n = particles.size();
281  if(1 < verbose) {
282  G4cout << " G4EmConfigurator::PrepareModels for EM process n= "
283  << n << G4endl;
284  }
285  if(n > 0) {
286  G4String particleName = aParticle->GetParticleName();
287  G4String processName = p->GetProcessName();
288  //G4cout << particleName << " " << particleName << G4endl;
289  for(size_t i=0; i<n; ++i) {
290  if(processName == processes[i]) {
291  if((particleName == particles[i]) ||
292  (particles[i] == "all") ||
293  (particles[i] == "charged" && aParticle->GetPDGCharge() != 0.0)) {
295  //G4cout << "Region " << reg << G4endl;
296  if(reg) {
297  --index;
298  G4VEmModel* mod = models[i];
299  if(mod) {
300  if(UpdateModelEnergyRange(mod, lowEnergy[i], highEnergy[i])) {
301  p->AddEmModel(index,mod,reg);
302  if(1 < verbose) {
303  G4cout << "### Added em model order= " << index << " for "
304  << particleName << " and " << processName << G4endl;
305  }
306  }
307  }
308  }
309  }
310  }
311  }
312  }
313 }
std::vector< G4double > lowEnergy
std::vector< G4VEmModel * > models
G4bool UpdateModelEnergyRange(G4VEmModel *mod, G4double emin, G4double emax)
std::vector< G4String > processes
static const G4double reg
G4Region * FindRegion(const G4String &)
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
Char_t n[5]
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
std::vector< G4String > regions
void AddEmModel(G4int, G4VEmModel *, const G4Region *region=0)
#define G4endl
Definition: G4ios.hh:61
std::vector< G4String > particles
G4double GetPDGCharge() const
std::vector< G4double > highEnergy
Here is the call graph for this function:

◆ PrepareModels() [3/3]

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

Definition at line 318 of file G4EmConfigurator.cc.

320 {
321  size_t n = particles.size();
322  if(1 < verbose) {
323  G4cout << " G4EmConfigurator::PrepareModels for MSC process n= "
324  << n << G4endl;
325  }
326 
327  if(n > 0) {
328  G4String particleName = aParticle->GetParticleName();
329  G4String processName = p->GetProcessName();
330  for(size_t i=0; i<n; ++i) {
331  if(processName == processes[i]) {
332  if((particleName == particles[i]) ||
333  (particles[i] == "all") ||
334  (particles[i] == "charged" && aParticle->GetPDGCharge() != 0.0)) {
336  if(reg) {
337  --index;
338  G4VEmModel* mod = models[i];
339  if(mod) {
340  if(UpdateModelEnergyRange(mod, lowEnergy[i], highEnergy[i])) {
341  p->AddEmModel(index,mod,reg);
342  //G4cout << "### Added msc model order= " << index << " for "
343  // << particleName << " and " << processName << G4endl;
344  }
345  }
346  }
347  }
348  }
349  }
350  }
351 }
std::vector< G4double > lowEnergy
std::vector< G4VEmModel * > models
G4bool UpdateModelEnergyRange(G4VEmModel *mod, G4double emin, G4double emax)
std::vector< G4String > processes
static const G4double reg
G4Region * FindRegion(const G4String &)
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
Char_t n[5]
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
std::vector< G4String > regions
void AddEmModel(G4int order, G4VEmModel *, const G4Region *region=0)
#define G4endl
Definition: G4ios.hh:61
std::vector< G4String > particles
G4double GetPDGCharge() const
std::vector< G4double > highEnergy
Here is the call graph for this function:

◆ 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 = 0 
)

Definition at line 77 of file G4EmConfigurator.cc.

84 {
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  if(mod) {
95  models.push_back(mod);
96  flucModels.push_back(fm);
97  emax = std::min(emax, mod->HighEnergyLimit());
99  } else {
100  models.push_back(new G4DummyModel());
101  flucModels.push_back(0);
102  }
103 
104  particles.push_back(particleName);
105  processes.push_back(processName);
106  regions.push_back(regionName);
107  lowEnergy.push_back(emin);
108  highEnergy.push_back(emax);
109 }
void SetActivationHighEnergyLimit(G4double)
Definition: G4VEmModel.hh:739
const G4String & GetName() const
Definition: G4VEmModel.hh:795
static const double MeV
Definition: G4SIunits.hh:211
std::vector< G4double > lowEnergy
std::vector< G4VEmModel * > models
std::vector< G4String > processes
G4GLOB_DLL std::ostream G4cout
G4double HighEnergyLimit() const
Definition: G4VEmModel.hh:634
static const G4double emax
std::vector< G4String > regions
std::vector< G4VEmFluctuationModel * > flucModels
#define G4endl
Definition: G4ios.hh:61
std::vector< G4String > particles
std::vector< G4double > highEnergy
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetModelForRegion()

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

Definition at line 137 of file G4EmConfigurator.cc.

143 {
144  if(1 < verbose) {
145  G4cout << " G4EmConfigurator::SetModelForRegion: " << mod->GetName()
146  << G4endl;
147  G4cout << " For " << particleName
148  << " and " << processName
149  << " in the region <" << reg->GetName()
150  << " Emin(MeV)= " << emin/MeV
151  << " Emax(MeV)= " << emax/MeV;
152  if(fm) { G4cout << " FLmodel " << fm->GetName(); }
153  G4cout << G4endl;
154  }
157 
158  // Loop checking, 03-Aug-2015, Vladimir Ivanchenko
159  theParticleIterator->reset();
160  while( (*theParticleIterator)() ) {
161  const G4ParticleDefinition* part = theParticleIterator->value();
162 
163  //G4cout << particleName << " " << part->GetParticleName() << G4endl;
164 
165  if((part->GetParticleName() == particleName) ||
166  (particleName == "all") ||
167  (particleName == "charged" && part->GetPDGCharge() != 0.0)) {
168 
169  // search for process
170  G4ProcessManager* pmanager = part->GetProcessManager();
171  G4ProcessVector* plist = pmanager->GetProcessList();
172  G4int np = pmanager->GetProcessListLength();
173 
174  //G4cout << processName << " in list of " << np << G4endl;
175 
176  G4VProcess* proc = 0;
177  for(G4int i=0; i<np; ++i) {
178  if(processName == (*plist)[i]->GetProcessName()) {
179  proc = (*plist)[i];
180  break;
181  }
182  }
183  if(!proc) {
184  G4cout << "### G4EmConfigurator WARNING: fails to find a process <"
185  << processName << "> for " << particleName << G4endl;
186  return;
187  }
188 
189  if(mod) {
190  if(!UpdateModelEnergyRange(mod, emin, emax)) { return; }
191  }
192  // classify process
193  G4int ii = proc->GetProcessSubType();
194  if(10 == ii && mod) {
195  G4VMultipleScattering* p = static_cast<G4VMultipleScattering*>(proc);
196  p->AddEmModel(index,mod,reg);
197  if(1 < verbose) {
198  G4cout << "### Added msc model order= " << index << " for "
199  << particleName << " and " << processName << G4endl;
200  }
201  return;
202  } else if(2 <= ii && 4 >= ii) {
203  G4VEnergyLossProcess* p = static_cast<G4VEnergyLossProcess*>(proc);
204  if(!mod && fm) {
205  p->SetFluctModel(fm);
206  } else {
207  p->AddEmModel(index,mod,fm,reg);
208  if(1 < verbose) {
209  G4cout << "### Added eloss model order= " << index << " for "
210  << particleName << " and " << processName << G4endl;
211  }
212  }
213  return;
214  } else if(mod) {
215  G4VEmProcess* p = static_cast<G4VEmProcess*>(proc);
216  p->AddEmModel(index,mod,reg);
217  if(1 < verbose) {
218  G4cout << "### Added em model order= " << index << " for "
219  << particleName << " and " << processName << G4endl;
220  }
221  return;
222  } else {
223  return;
224  }
225  }
226  }
227 }
static const double MeV
Definition: G4SIunits.hh:211
G4ProcessVector * GetProcessList() const
G4ProcessManager * GetProcessManager() const
void SetFluctModel(G4VEmFluctuationModel *)
const G4String & GetName() const
int G4int
Definition: G4Types.hh:78
G4bool UpdateModelEnergyRange(G4VEmModel *mod, G4double emin, G4double emax)
G4int GetProcessSubType() const
Definition: G4VProcess.hh:426
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
void reset(G4bool ifSkipIon=true)
TString part[npart]
void AddEmModel(G4int, G4VEmModel *, G4VEmFluctuationModel *fluc=0, const G4Region *region=0)
const G4String & GetName() const
static const G4double emax
static G4ParticleTable * GetParticleTable()
void AddEmModel(G4int, G4VEmModel *, const G4Region *region=0)
void AddEmModel(G4int order, G4VEmModel *, const G4Region *region=0)
G4int GetProcessListLength() const
#define G4endl
Definition: G4ios.hh:61
G4double GetPDGCharge() const
G4PTblDicIterator * GetIterator() const
#define theParticleIterator
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetVerbose()

void G4EmConfigurator::SetVerbose ( G4int  value)
inline

Definition at line 136 of file G4EmConfigurator.hh.

137 {
138  verbose = value;
139 }
Here is the caller graph for this function:

◆ UpdateModelEnergyRange()

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

Definition at line 390 of file G4EmConfigurator.cc.

392 {
393  // energy limits
394  G4double e1 = std::max(emin,mod->LowEnergyLimit());
396  if(e2 <= e1) {
397  G4cout << "### G4EmConfigurator WARNING: empty energy interval"
398  << " for <" << mod->GetName()
399  << "> Emin(MeV)= " << e1/CLHEP::MeV
400  << "> Emax(MeV)= " << e2/CLHEP::MeV
401  << G4endl;
402  return false;
403  }
404  mod->SetLowEnergyLimit(e1);
405  mod->SetHighEnergyLimit(e2);
406  if(verbose > 1) {
407  G4cout << "### G4EmConfigurator for " << mod->GetName()
408  << " Emin(MeV)= " << e1/MeV << " Emax(MeV)= " << e2/MeV
409  << G4endl;
410  }
411  return true;
412 }
G4double LowEnergyLimit() const
Definition: G4VEmModel.hh:641
const G4String & GetName() const
Definition: G4VEmModel.hh:795
static const double MeV
Definition: G4SIunits.hh:211
static const G4double e2
void SetHighEnergyLimit(G4double)
Definition: G4VEmModel.hh:725
G4GLOB_DLL std::ostream G4cout
G4double HighEnergyLimit() const
Definition: G4VEmModel.hh:634
static const G4double e1
static const G4double emax
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void SetLowEnergyLimit(G4double)
Definition: G4VEmModel.hh:732
static const double MeV
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ flucModels

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

Definition at line 123 of file G4EmConfigurator.hh.

◆ highEnergy

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

Definition at line 128 of file G4EmConfigurator.hh.

◆ index

G4int G4EmConfigurator::index
private

Definition at line 130 of file G4EmConfigurator.hh.

◆ lowEnergy

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

Definition at line 127 of file G4EmConfigurator.hh.

◆ models

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

Definition at line 122 of file G4EmConfigurator.hh.

◆ particles

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

Definition at line 124 of file G4EmConfigurator.hh.

◆ processes

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

Definition at line 125 of file G4EmConfigurator.hh.

◆ regions

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

Definition at line 126 of file G4EmConfigurator.hh.

◆ verbose

G4int G4EmConfigurator::verbose
private

Definition at line 131 of file G4EmConfigurator.hh.


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