Geant4_10
G4LossTableManager.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 // $Id: G4LossTableManager.cc 76333 2013-11-08 14:31:50Z gcosmo $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 //
33 // File name: G4LossTableManager
34 //
35 // Author: Vladimir Ivanchenko
36 //
37 // Creation date: 03.01.2002
38 //
39 // Modifications:
40 //
41 // 20-01-03 Migrade to cut per region (V.Ivanchenko)
42 // 15-02-03 Lambda table can be scaled (V.Ivanchenko)
43 // 17-02-03 Fix problem of store/restore tables (V.Ivanchenko)
44 // 10-03-03 Add Ion registration (V.Ivanchenko)
45 // 25-03-03 Add deregistration (V.Ivanchenko)
46 // 02-04-03 Change messenger (V.Ivanchenko)
47 // 26-04-03 Fix retrieve tables (V.Ivanchenko)
48 // 13-05-03 Add calculation of precise range (V.Ivanchenko)
49 // 23-07-03 Add exchange with G4EnergyLossTables (V.Ivanchenko)
50 // 05-10-03 Add G4VEmProcesses registration and Verbose command (V.Ivanchenko)
51 // 17-10-03 Add SetParameters method (V.Ivanchenko)
52 // 23-10-03 Add control on inactive processes (V.Ivanchenko)
53 // 04-11-03 Add checks in RetrievePhysicsTable (V.Ivanchenko)
54 // 12-11-03 G4EnergyLossSTD -> G4EnergyLossProcess (V.Ivanchenko)
55 // 14-01-04 Activate precise range calculation (V.Ivanchenko)
56 // 10-03-04 Fix a problem of Precise Range table (V.Ivanchenko)
57 // 08-11-04 Migration to new interface of Store/Retrieve tables (V.Ivanchenko)
58 // 13-01-04 Fix problem which takes place for inactivate eIoni (V.Ivanchenko)
59 // 25-01-04 Fix initialisation problem for ions (V.Ivanchenko)
60 // 11-03-05 Shift verbose level by 1 (V.Ivantchenko)
61 // 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
62 // 20-01-06 Introduce G4EmTableType to remove repeating code (VI)
63 // 23-03-06 Set flag isIonisation (VI)
64 // 10-05-06 Add methods SetMscStepLimitation, FacRange and MscFlag (VI)
65 // 22-05-06 Add methods Set/Get bremsTh (VI)
66 // 05-06-06 Do not clear loss_table map between runs (VI)
67 // 16-01-07 Create new energy loss table for e+,e-,mu+,mu- and
68 // left ionisation table for further usage (VI)
69 // 12-02-07 Add SetSkin, SetLinearLossLimit (V.Ivanchenko)
70 // 18-06-07 Move definition of msc parameters to G4EmProcessOptions (V.Ivanchenko)
71 // 21-02-08 Added G4EmSaturation (V.Ivanchenko)
72 // 12-04-10 Added PreparePhysicsTables and BuildPhysicsTables entries (V.Ivanchenko)
73 // 04-06-13 (V.Ivanchenko) Adaptation for MT mode; new method LocalPhysicsTables;
74 // ions expect G4GenericIon are not included in the map of energy loss
75 // processes for performnc reasons
76 //
77 // Class Description:
78 //
79 // -------------------------------------------------------------------
80 //
81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
83 
84 #include "G4LossTableManager.hh"
85 #include "G4SystemOfUnits.hh"
86 #include "G4EnergyLossMessenger.hh"
87 #include "G4PhysicsTable.hh"
88 #include "G4ParticleDefinition.hh"
89 #include "G4MaterialCutsCouple.hh"
90 #include "G4ProcessManager.hh"
91 #include "G4Electron.hh"
92 #include "G4Proton.hh"
93 #include "G4VMultipleScattering.hh"
94 #include "G4VEmProcess.hh"
95 #include "G4ProductionCutsTable.hh"
96 #include "G4PhysicsTableHelper.hh"
97 #include "G4EmCorrections.hh"
98 #include "G4EmSaturation.hh"
99 #include "G4EmConfigurator.hh"
100 #include "G4ElectronIonPair.hh"
101 #include "G4EmTableType.hh"
102 #include "G4LossTableBuilder.hh"
103 #include "G4VAtomDeexcitation.hh"
104 #include "G4Region.hh"
105 #include "G4PhysicalConstants.hh"
106 
107 //G4ThreadLocal G4LossTableManager* G4LossTableManager::theInstance = 0;
108 
109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
110 
112 {
113  /*
114  if(!theInstance) {
115  theInstance = new G4LossTableManager;
116  }
117  return theInstance;
118  */
120  return instance.Instance();
121 }
122 
123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
124 
126 {
127  //G4cout << "### G4LossTableManager::~G4LossTableManager()" << G4endl;
128  for (G4int i=0; i<n_loss; ++i) {
129  if( loss_vector[i] ) { delete loss_vector[i]; }
130  }
131  size_t msc = msc_vector.size();
132  for (size_t j=0; j<msc; ++j) {
133  if( msc_vector[j] ) { delete msc_vector[j]; }
134  }
135  size_t emp = emp_vector.size();
136  for (size_t k=0; k<emp; ++k) {
137  if( emp_vector[k] ) { delete emp_vector[k]; }
138  }
139  size_t mod = mod_vector.size();
140  size_t fmod = fmod_vector.size();
141  for (size_t a=0; a<mod; ++a) {
142  if( mod_vector[a] ) {
143  for (size_t b=0; b<fmod; ++b) {
144  if((G4VEmModel*)(fmod_vector[b]) == mod_vector[a]) {
145  fmod_vector[b] = 0;
146  }
147  }
148  delete mod_vector[a];
149  }
150  }
151  for (size_t b=0; b<fmod; ++b) {
152  if( fmod_vector[b] ) { delete fmod_vector[b]; }
153  }
154  Clear();
155  delete theMessenger;
156  delete tableBuilder;
157  delete emCorrections;
158  delete emSaturation;
159  delete emConfigurator;
160  delete emElectronIonPair;
161  delete atomDeexcitation;
162 }
163 
164 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
165 
166 G4LossTableManager::G4LossTableManager()
167 {
168  n_loss = 0;
169  run = -1;
170  startInitialisation = false;
171  all_tables_are_built = false;
172  currentLoss = 0;
173  currentParticle = 0;
174  firstParticle = 0;
175  lossFluctuationFlag = true;
176  subCutoffFlag = false;
177  rndmStepFlag = false;
178  minSubRange = 0.0;
179  maxRangeVariation = 1.0;
180  maxFinalStep = 0.0;
181  minKinEnergy = 0.1*keV;
182  maxKinEnergy = 10.0*TeV;
183  nbinsLambda = 77;
184  nbinsPerDecade = 7;
185  maxKinEnergyForMuons = 10.*TeV;
186  integral = true;
187  integralActive = false;
188  buildCSDARange = false;
189  minEnergyActive = false;
190  maxEnergyActive = false;
191  maxEnergyForMuonsActive = false;
192  stepFunctionActive = false;
193  flagLPM = true;
194  splineFlag = true;
195  isMaster = false;
196  bremsTh = DBL_MAX;
197  factorForAngleLimit = 1.0;
198  verbose = 1;
199  theMessenger = new G4EnergyLossMessenger();
200  theElectron = G4Electron::Electron();
201  theGenericIon= 0;
202  tableBuilder = new G4LossTableBuilder();
203  emCorrections= new G4EmCorrections();
204  emSaturation = new G4EmSaturation();
205  emConfigurator = new G4EmConfigurator(verbose);
206  emElectronIonPair = new G4ElectronIonPair();
207  tableBuilder->SetSplineFlag(splineFlag);
208  atomDeexcitation = 0;
209 }
210 
211 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
212 
214 {
215  all_tables_are_built = false;
216  currentLoss = 0;
217  currentParticle = 0;
218  if(n_loss)
219  {
220  dedx_vector.clear();
221  range_vector.clear();
222  inv_range_vector.clear();
223  loss_map.clear();
224  loss_vector.clear();
225  part_vector.clear();
226  base_part_vector.clear();
227  tables_are_built.clear();
228  isActive.clear();
229  n_loss = 0;
230  }
231 }
232 
233 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
234 
236 {
237  if(!p) { return; }
238  for (G4int i=0; i<n_loss; ++i) {
239  if(loss_vector[i] == p) { return; }
240  }
241  if(verbose > 1) {
242  G4cout << "G4LossTableManager::Register G4VEnergyLossProcess : "
243  << p->GetProcessName() << " idx= " << n_loss << G4endl;
244  }
245  ++n_loss;
246  loss_vector.push_back(p);
247  part_vector.push_back(0);
248  base_part_vector.push_back(0);
249  dedx_vector.push_back(0);
250  range_vector.push_back(0);
251  inv_range_vector.push_back(0);
252  tables_are_built.push_back(false);
253  isActive.push_back(true);
254  all_tables_are_built = false;
255  if(!lossFluctuationFlag) { p->SetLossFluctuations(false); }
256  if(subCutoffFlag) { p->ActivateSubCutoff(true); }
257  if(rndmStepFlag) { p->SetRandomStep(true); }
258  if(stepFunctionActive) { p->SetStepFunction(maxRangeVariation,
259  maxFinalStep); }
260  if(integralActive) { p->SetIntegral(integral); }
261  if(minEnergyActive) { p->SetMinKinEnergy(minKinEnergy); }
262  if(maxEnergyActive) { p->SetMaxKinEnergy(maxKinEnergy); }
263 }
264 
265 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
266 
268 {
269  if(!p) { return; }
270  for (G4int i=0; i<n_loss; ++i) {
271  if(loss_vector[i] == p) { loss_vector[i] = 0; }
272  }
273 }
274 
275 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
276 
278 {
279  if(!p) { return; }
280  G4int n = msc_vector.size();
281  for (G4int i=0; i<n; ++i) {
282  if(msc_vector[i] == p) { return; }
283  }
284  if(verbose > 1) {
285  G4cout << "G4LossTableManager::Register G4VMultipleScattering : "
286  << p->GetProcessName() << " idx= " << msc_vector.size() << G4endl;
287  }
288  msc_vector.push_back(p);
289 }
290 
291 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
292 
294 {
295  if(!p) { return; }
296  size_t msc = msc_vector.size();
297  for (size_t i=0; i<msc; ++i) {
298  if(msc_vector[i] == p) { msc_vector[i] = 0; }
299  }
300 }
301 
302 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
303 
305 {
306  if(!p) { return; }
307  G4int n = emp_vector.size();
308  for (G4int i=0; i<n; ++i) {
309  if(emp_vector[i] == p) { return; }
310  }
311  if(verbose > 1) {
312  G4cout << "G4LossTableManager::Register G4VEmProcess : "
313  << p->GetProcessName() << " idx= " << emp_vector.size() << G4endl;
314  }
315  emp_vector.push_back(p);
316 }
317 
318 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
319 
321 {
322  if(!p) { return; }
323  size_t emp = emp_vector.size();
324  for (size_t i=0; i<emp; ++i) {
325  if(emp_vector[i] == p) { emp_vector[i] = 0; }
326  }
327 }
328 
329 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
330 
332 {
333  mod_vector.push_back(p);
334  if(verbose > 1) {
335  G4cout << "G4LossTableManager::Register G4VEmModel : "
336  << p->GetName() << G4endl;
337  }
338 }
339 
340 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
341 
343 {
344  size_t n = mod_vector.size();
345  for (size_t i=0; i<n; ++i) {
346  if(mod_vector[i] == p) { mod_vector[i] = 0; }
347  }
348 }
349 
350 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
351 
353 {
354  fmod_vector.push_back(p);
355  if(verbose > 1) {
356  G4cout << "G4LossTableManager::Register G4VEmFluctuationModel : "
357  << p->GetName() << G4endl;
358  }
359 }
360 
361 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
362 
364 {
365  size_t n = fmod_vector.size();
366  for (size_t i=0; i<n; ++i) {
367  if(fmod_vector[i] == p) { fmod_vector[i] = 0; }
368  }
369 }
370 
371 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
372 
374  const G4ParticleDefinition* part,
376 {
377  if(!p || !part) { return; }
378  for (G4int i=0; i<n_loss; ++i) {
379  if(loss_vector[i] == p) { return; }
380  }
381  if(verbose > 1) {
382  G4cout << "G4LossTableManager::RegisterExtraParticle "
383  << part->GetParticleName() << " G4VEnergyLossProcess : "
384  << p->GetProcessName() << " idx= " << n_loss << G4endl;
385  }
386  ++n_loss;
387  loss_vector.push_back(p);
388  part_vector.push_back(part);
389  base_part_vector.push_back(p->BaseParticle());
390  dedx_vector.push_back(0);
391  range_vector.push_back(0);
392  inv_range_vector.push_back(0);
393  tables_are_built.push_back(false);
394  all_tables_are_built = false;
395 }
396 
397 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
398 
399 void
402  G4bool theMaster)
403 {
404  if (1 < verbose) {
405  G4cout << "G4LossTableManager::PreparePhysicsTable for "
406  << particle->GetParticleName()
407  << " and " << p->GetProcessName() << " run= " << run
408  << " loss_vector " << loss_vector.size() << G4endl;
409  }
410 
411  isMaster = theMaster;
412 
413  if(!startInitialisation) {
414  tableBuilder->SetInitialisationFlag(false);
415  if (1 < verbose) {
416  G4cout << "====== G4LossTableManager::PreparePhysicsTable start ====="
417  << G4endl;
418  }
419  }
420 
421  // start initialisation for the first run
422  if( -1 == run ) {
423  emConfigurator->PrepareModels(particle, p);
424 
425  // initialise particles for given process
426  for (G4int j=0; j<n_loss; ++j) {
427  if (p == loss_vector[j] && !part_vector[j]) {
428  part_vector[j] = particle;
429  if(particle->GetParticleName() == "GenericIon") {
430  theGenericIon = particle;
431  }
432  }
433  }
434  }
435  startInitialisation = true;
436 }
437 
438 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
439 
440 void
442  G4VEmProcess* p, G4bool theMaster)
443 {
444  if (1 < verbose) {
445  G4cout << "G4LossTableManager::PreparePhysicsTable for "
446  << particle->GetParticleName()
447  << " and " << p->GetProcessName() << G4endl;
448  }
449  isMaster = theMaster;
450 
451  if(!startInitialisation) {
452  tableBuilder->SetInitialisationFlag(false);
453  if (1 < verbose) {
454  G4cout << "====== G4LossTableManager::PreparePhysicsTable start ====="
455  << G4endl;
456  }
457  }
458 
459  // start initialisation for the first run
460  if( -1 == run ) {
461  emConfigurator->PrepareModels(particle, p);
462  }
463  startInitialisation = true;
464 }
465 
466 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
467 
468 void
471  G4bool theMaster)
472 {
473  if (1 < verbose) {
474  G4cout << "G4LossTableManager::PreparePhysicsTable for "
475  << particle->GetParticleName()
476  << " and " << p->GetProcessName() << G4endl;
477  }
478 
479  isMaster = theMaster;
480 
481  if(!startInitialisation) {
482  tableBuilder->SetInitialisationFlag(false);
483  if (1 < verbose) {
484  G4cout << "====== G4LossTableManager::PreparePhysicsTable start ====="
485  << G4endl;
486  }
487  }
488 
489  // start initialisation for the first run
490  if( -1 == run ) {
491  emConfigurator->PrepareModels(particle, p);
492  }
493  startInitialisation = true;
494 }
495 
496 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
497 
498 void
500 {
501  if(-1 == run && startInitialisation) {
502  emConfigurator->Clear();
503  }
504 }
505 
506 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
507 
509  const G4ParticleDefinition* aParticle,
511 {
512  if(1 < verbose) {
513  G4cout << "### G4LossTableManager::SlavePhysicsTable() for "
514  << aParticle->GetParticleName()
515  << " and process " << p->GetProcessName()
516  << G4endl;
517  }
518 
519  if(-1 == run && startInitialisation) {
520  emConfigurator->Clear();
521  firstParticle = aParticle;
522  }
523 
524  if(startInitialisation) {
525  ++run;
526  if(1 < verbose) {
527  G4cout << "===== G4LossTableManager::SlavePhysicsTable() for run "
528  << run << " =====" << G4endl;
529  }
530  if(atomDeexcitation) {
531  atomDeexcitation->InitialiseAtomicDeexcitation();
532  }
533  currentParticle = 0;
534  startInitialisation = false;
535  for (G4int i=0; i<n_loss; ++i) {
536  if(loss_vector[i]) {
537  tables_are_built[i] = false;
538  } else {
539  tables_are_built[i] = true;
540  part_vector[i] = 0;
541  }
542  }
543  }
544 
545  all_tables_are_built= true;
546  for (G4int i=0; i<n_loss; ++i) {
547  if(p == loss_vector[i]) {
548  tables_are_built[i] = true;
549  isActive[i] = true;
550  /*
551  const G4ProcessManager* pm = p->GetProcessManager();
552  isActive[i] = false;
553  if(pm) { isActive[i] = pm->GetProcessActivation(p); }
554  */
555  part_vector[i] = p->Particle();
556  base_part_vector[i] = p->BaseParticle();
557  dedx_vector[i] = p->DEDXTable();
558  range_vector[i] = p->RangeTableForLoss();
559  inv_range_vector[i] = p->InverseRangeTable();
560  if(0 == run && p->IsIonisationProcess()) {
561  loss_map[part_vector[i]] = loss_vector[i];
562  }
563 
564  if(1 < verbose) {
565  G4cout << i <<". "<< p->GetProcessName();
566  if(part_vector[i]) {
567  G4cout << " for " << part_vector[i]->GetParticleName();
568  }
569  G4cout << " active= " << isActive[i]
570  << " table= " << tables_are_built[i]
571  << " isIonisation= " << p->IsIonisationProcess()
572  << G4endl;
573  }
574  break;
575  } else if(!tables_are_built[i]) {
576  all_tables_are_built = false;
577  }
578  }
579 
580  // Set run time parameters
581  SetParameters(aParticle, p);
582 
583  if(1 < verbose) {
584  G4cout << "### G4LossTableManager::SlavePhysicsTable end"
585  << G4endl;
586  }
587  if(all_tables_are_built) {
588  if(1 < verbose) {
589  G4cout << "%%%%% All dEdx and Range tables for worker are ready for run "
590  << run << " %%%%%" << G4endl;
591  }
592  }
593 }
594 
595 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
596 
598  const G4ParticleDefinition* aParticle,
600 {
601  if(1 < verbose) {
602  G4cout << "### G4LossTableManager::BuildPhysicsTable() for "
603  << aParticle->GetParticleName()
604  << " and process " << p->GetProcessName() << G4endl;
605  }
606  // clear configurator
607  if(-1 == run && startInitialisation) {
608  emConfigurator->Clear();
609  firstParticle = aParticle;
610  }
611  if(startInitialisation) {
612  ++run;
613  if(1 < verbose) {
614  G4cout << "===== G4LossTableManager::BuildPhysicsTable() for run "
615  << run << " =====" << G4endl;
616  }
617  if(atomDeexcitation) {
618  atomDeexcitation->InitialiseAtomicDeexcitation();
619  }
620  currentParticle = 0;
621  startInitialisation = false;
622  all_tables_are_built= true;
623  }
624 
625  // initialisation before any table is built
626  if ( aParticle == firstParticle ) {
627 
628  if(1 < verbose) {
629  G4cout << "### G4LossTableManager start initilisation for first particle "
630  << firstParticle->GetParticleName()
631  << G4endl;
632  }
633  for (G4int i=0; i<n_loss; ++i) {
634  G4VEnergyLossProcess* el = loss_vector[i];
635 
636  if(el) {
637  isActive[i] = true;
638  /*
639  const G4ProcessManager* pm = el->GetProcessManager();
640  isActive[i] = false;
641  if(pm) { isActive[i] = pm->GetProcessActivation(el); }
642  */
643  base_part_vector[i] = el->BaseParticle();
644  tables_are_built[i] = false;
645  all_tables_are_built= false;
646  if(!isActive[i]) {
647  el->SetIonisation(false);
648  tables_are_built[i] = true;
649  }
650 
651  if(1 < verbose) {
652  G4cout << i <<". "<< el->GetProcessName();
653  if(el->Particle()) {
654  G4cout << " for " << el->Particle()->GetParticleName();
655  }
656  G4cout << " active= " << isActive[i]
657  << " table= " << tables_are_built[i]
658  << " isIonisation= " << el->IsIonisationProcess();
659  if(base_part_vector[i]) {
660  G4cout << " base particle "
661  << base_part_vector[i]->GetParticleName();
662  }
663  G4cout << G4endl;
664  }
665  } else {
666  tables_are_built[i] = true;
667  part_vector[i] = 0;
668  isActive[i] = false;
669  }
670  }
671  }
672 
673  // Set run time parameters
674  SetParameters(aParticle, p);
675 
676  if (all_tables_are_built) { return; }
677 
678  // Build tables for given particle
679  all_tables_are_built = true;
680 
681  for(G4int i=0; i<n_loss; ++i) {
682  if(p == loss_vector[i] && !tables_are_built[i] && !base_part_vector[i]) {
683  const G4ParticleDefinition* curr_part = part_vector[i];
684  if(1 < verbose) {
685  G4cout << "### Build Table for " << p->GetProcessName()
686  << " and " << curr_part->GetParticleName() << G4endl;
687  }
688  G4VEnergyLossProcess* curr_proc = BuildTables(curr_part);
689  if(curr_proc) { CopyTables(curr_part, curr_proc); }
690  }
691  if ( !tables_are_built[i] ) { all_tables_are_built = false; }
692  }
693  if(0 == run && p->IsIonisationProcess()) { loss_map[aParticle] = p; }
694 
695  if(1 < verbose) {
696  G4cout << "### G4LossTableManager::BuildPhysicsTable end: "
697  << "all_tables_are_built= " << all_tables_are_built
698  << G4endl;
699  }
700  if(all_tables_are_built) {
701  if(1 < verbose) {
702  G4cout << "%%%%% All dEdx and Range tables are built for master run= "
703  << run << " %%%%%" << G4endl;
704  }
705  }
706 }
707 
708 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
709 
710 void G4LossTableManager::CopyTables(const G4ParticleDefinition* part,
711  G4VEnergyLossProcess* base_proc)
712 {
713  for (G4int j=0; j<n_loss; ++j) {
714 
715  G4VEnergyLossProcess* proc = loss_vector[j];
716 
717  if (!tables_are_built[j] && part == base_part_vector[j]) {
718  tables_are_built[j] = true;
719  proc->SetDEDXTable(base_proc->DEDXTable(),fRestricted);
720  proc->SetDEDXTable(base_proc->DEDXTableForSubsec(),fSubRestricted);
721  proc->SetDEDXTable(base_proc->DEDXunRestrictedTable(),fTotal);
722  proc->SetCSDARangeTable(base_proc->CSDARangeTable());
723  proc->SetRangeTableForLoss(base_proc->RangeTableForLoss());
724  proc->SetInverseRangeTable(base_proc->InverseRangeTable());
725  proc->SetLambdaTable(base_proc->LambdaTable());
726  proc->SetSubLambdaTable(base_proc->SubLambdaTable());
727  proc->SetIonisation(base_proc->IsIonisationProcess());
728  if(proc->IsIonisationProcess()) {
729  range_vector[j] = base_proc->RangeTableForLoss();
730  inv_range_vector[j] = base_proc->InverseRangeTable();
731  loss_map[part_vector[j]] = proc;
732  }
733  if (1 < verbose) {
734  G4cout << "For " << proc->GetProcessName()
735  << " for " << part_vector[j]->GetParticleName()
736  << " base_part= " << part->GetParticleName()
737  << " tables are assigned "
738  << G4endl;
739  }
740  }
741 
742  if (theElectron == part && theElectron == proc->SecondaryParticle() ) {
743  proc->SetSecondaryRangeTable(base_proc->RangeTableForLoss());
744  }
745  }
746 }
747 
748 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
749 
750 G4VEnergyLossProcess* G4LossTableManager::BuildTables(
751  const G4ParticleDefinition* aParticle)
752 {
753  if(1 < verbose) {
754  G4cout << "G4LossTableManager::BuildTables() for "
755  << aParticle->GetParticleName() << G4endl;
756  }
757 
758  std::vector<G4PhysicsTable*> t_list;
759  std::vector<G4VEnergyLossProcess*> loss_list;
760  loss_list.clear();
761  G4VEnergyLossProcess* em = 0;
762  G4VEnergyLossProcess* p = 0;
763  G4int iem = 0;
764  G4PhysicsTable* dedx = 0;
765  G4int i;
766 
767  for (i=0; i<n_loss; ++i) {
768  p = loss_vector[i];
769  if (p && aParticle == part_vector[i] && !tables_are_built[i]) {
770  if ((p->IsIonisationProcess() && isActive[i]) || !em) {
771  em = p;
772  iem= i;
773  }
774  dedx = p->BuildDEDXTable(fRestricted);
775  //G4cout << "Build DEDX table for " << aParticle->GetParticleName()
776  // << " " << dedx << " " << dedx->length() << G4endl;
777  p->SetDEDXTable(dedx,fRestricted);
778  t_list.push_back(dedx);
779  loss_list.push_back(p);
780  tables_are_built[i] = true;
781  }
782  }
783 
784  G4int n_dedx = t_list.size();
785  if (0 == n_dedx || !em) {
786  G4cout << "G4LossTableManager WARNING: no DEDX processes for "
787  << aParticle->GetParticleName() << G4endl;
788  return 0;
789  }
790  G4int nSubRegions = em->NumberOfSubCutoffRegions();
791 
792  if (1 < verbose) {
793  G4cout << "G4LossTableManager::BuildTables() start to build range tables"
794  << " and the sum of " << n_dedx << " processes"
795  << " iem= " << iem << " em= " << em->GetProcessName()
796  << " buildCSDARange= " << buildCSDARange
797  << " nSubRegions= " << nSubRegions
798  << G4endl;
799  }
800 
801  dedx = em->DEDXTable();
802  em->SetIonisation(true);
803 
804  if (1 < n_dedx) {
805  em->SetDEDXTable(dedx, fIsIonisation);
806  dedx = 0;
808  tableBuilder->BuildDEDXTable(dedx, t_list);
809  em->SetDEDXTable(dedx, fRestricted);
810  }
811  /*
812  if(2==run && "e-" == aParticle->GetParticleName()) {
813  G4cout << "G4LossTableManager::BuildTables for e- " << dedx << G4endl;
814  G4cout << (*dedx) << G4endl;
815  G4cout << "%%%%% Instance ID= " << (*dedx)[0]->GetInstanceID() << G4endl;
816  G4cout << "%%%%% LastValue= " << (*dedx)[0]->GetLastValue() << G4endl;
817  G4cout << "%%%%% 1.2 " << (*(dedx))[0]->Value(1.2) << G4endl;
818  }
819  */
820  dedx_vector[iem] = dedx;
821 
823  if(!range) range = G4PhysicsTableHelper::PreparePhysicsTable(range);
824  range_vector[iem] = range;
825 
826  G4PhysicsTable* invrange = em->InverseRangeTable();
827  if(!invrange) invrange = G4PhysicsTableHelper::PreparePhysicsTable(invrange);
828  inv_range_vector[iem] = invrange;
829 
830  tableBuilder->BuildRangeTable(dedx, range, true);
831  tableBuilder->BuildInverseRangeTable(range, invrange, true);
832 
833  // if(1<verbose) G4cout << *dedx << G4endl;
834 
835  em->SetRangeTableForLoss(range);
836  em->SetInverseRangeTable(invrange);
837 
838  // if(1<verbose) G4cout << *range << G4endl;
839 
840  std::vector<G4PhysicsTable*> listSub;
841  std::vector<G4PhysicsTable*> listCSDA;
842 
843  for (i=0; i<n_dedx; ++i) {
844  p = loss_list[i];
845  if(p != em) { p->SetIonisation(false); }
847  if (0 < nSubRegions) {
848  dedx = p->BuildDEDXTable(fSubRestricted);
849  p->SetDEDXTable(dedx,fSubRestricted);
850  listSub.push_back(dedx);
852  if(p != em) { em->AddCollaborativeProcess(p); }
853  }
854  if(buildCSDARange) {
855  dedx = p->BuildDEDXTable(fTotal);
856  p->SetDEDXTable(dedx,fTotal);
857  listCSDA.push_back(dedx);
858  }
859  }
860 
861  if (0 < nSubRegions) {
862  G4PhysicsTable* dedxSub = em->IonisationTableForSubsec();
863  if (1 < listSub.size()) {
864  em->SetDEDXTable(dedxSub, fIsSubIonisation);
865  dedxSub = 0;
867  tableBuilder->BuildDEDXTable(dedxSub, listSub);
868  em->SetDEDXTable(dedxSub, fSubRestricted);
869  }
870  }
871  if(buildCSDARange) {
872  G4PhysicsTable* dedxCSDA = em->DEDXunRestrictedTable();
873  if (1 < n_dedx) {
874  dedxCSDA = 0;
875  dedxCSDA = G4PhysicsTableHelper::PreparePhysicsTable(dedxCSDA);
876  tableBuilder->BuildDEDXTable(dedxCSDA, listCSDA);
877  em->SetDEDXTable(dedxCSDA,fTotal);
878  }
879  G4PhysicsTable* rCSDA = em->CSDARangeTable();
880  if(!rCSDA) { rCSDA = G4PhysicsTableHelper::PreparePhysicsTable(rCSDA); }
881  tableBuilder->BuildRangeTable(dedxCSDA, rCSDA, true);
882  em->SetCSDARangeTable(rCSDA);
883  }
884 
885  if (1 < verbose) {
886  G4cout << "G4LossTableManager::BuildTables: Tables are built for "
887  << aParticle->GetParticleName()
888  << "; ionisation process: " << em->GetProcessName()
889  << G4endl;
890  }
891  return em;
892 }
893 
894 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
895 
897 {
898  return theMessenger;
899 }
900 
901 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
902 
903 void G4LossTableManager::ParticleHaveNoLoss(
904  const G4ParticleDefinition* aParticle)
905 {
907  ed << "Energy loss process not found for " << aParticle->GetParticleName()
908  << " !";
909  G4Exception("G4LossTableManager::ParticleHaveNoLoss", "em0001",
910  FatalException, ed);
911 
912 }
913 
914 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
915 
917 {
918  return buildCSDARange;
919 }
920 
921 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
922 
924 {
925  lossFluctuationFlag = val;
926  for(G4int i=0; i<n_loss; ++i) {
927  if(loss_vector[i]) { loss_vector[i]->SetLossFluctuations(val); }
928  }
929 }
930 
931 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
932 
934 {
935  subCutoffFlag = val;
936  for(G4int i=0; i<n_loss; ++i) {
937  if(loss_vector[i]) { loss_vector[i]->ActivateSubCutoff(val, r); }
938  }
939 }
940 
941 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
942 
944 {
945  integral = val;
946  integralActive = true;
947  for(G4int i=0; i<n_loss; ++i) {
948  if(loss_vector[i]) { loss_vector[i]->SetIntegral(val); }
949  }
950  size_t emp = emp_vector.size();
951  for (size_t k=0; k<emp; ++k) {
952  if(emp_vector[k]) { emp_vector[k]->SetIntegral(val); }
953  }
954 }
955 
956 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
957 
959 {
960  minSubRange = val;
961  for(G4int i=0; i<n_loss; ++i) {
962  if(loss_vector[i]) { loss_vector[i]->SetMinSubRange(val); }
963  }
964 }
965 
966 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
967 
969 {
970  rndmStepFlag = val;
971  for(G4int i=0; i<n_loss; ++i) {
972  if(loss_vector[i]) { loss_vector[i]->SetRandomStep(val); }
973  }
974 }
975 
976 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
977 
979 {
980  minEnergyActive = true;
981  minKinEnergy = val;
982  for(G4int i=0; i<n_loss; ++i) {
983  if(loss_vector[i]) { loss_vector[i]->SetMinKinEnergy(val); }
984  }
985  size_t emp = emp_vector.size();
986  for (size_t k=0; k<emp; ++k) {
987  if(emp_vector[k]) { emp_vector[k]->SetMinKinEnergy(val); }
988  }
989 }
990 
991 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
992 
994 {
995  maxEnergyActive = true;
996  maxKinEnergy = val;
997  for(G4int i=0; i<n_loss; ++i) {
998  if(loss_vector[i]) { loss_vector[i]->SetMaxKinEnergy(val); }
999  }
1000  size_t emp = emp_vector.size();
1001  for (size_t k=0; k<emp; ++k) {
1002  if(emp_vector[k]) { emp_vector[k]->SetMaxKinEnergy(val); }
1003  }
1004 }
1005 
1006 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1007 
1009 {
1010  for(G4int i=0; i<n_loss; ++i) {
1011  if(loss_vector[i]) { loss_vector[i]->SetMaxKinEnergyForCSDARange(val); }
1012  }
1013 }
1014 
1015 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1016 
1018 {
1019  maxEnergyForMuonsActive = true;
1020  maxKinEnergyForMuons = val;
1021 }
1022 
1023 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1024 
1026 {
1027  for(G4int i=0; i<n_loss; ++i) {
1028  if(loss_vector[i]) { loss_vector[i]->SetDEDXBinning(val); }
1029  }
1030 }
1031 
1032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1033 
1035 {
1036  for(G4int i=0; i<n_loss; ++i) {
1037  if(loss_vector[i]) { loss_vector[i]->SetDEDXBinningForCSDARange(val); }
1038  }
1039 }
1040 
1041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1042 
1044 {
1045  G4int n = val/G4int(std::log10(maxKinEnergy/minKinEnergy) + 0.5);
1046  if(n < 5) {
1047  G4cout << "G4LossTableManager::SetLambdaBinning WARNING "
1048  << "too small number of bins " << val << " ignored"
1049  << G4endl;
1050  return;
1051  }
1052  nbinsLambda = val;
1053  nbinsPerDecade = n;
1054  size_t emp = emp_vector.size();
1055  for (size_t k=0; k<emp; ++k) {
1056  if(emp_vector[k]) { emp_vector[k]->SetLambdaBinning(val); }
1057  }
1058 }
1059 
1060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1061 
1063 {
1064  return nbinsPerDecade;
1065 }
1066 
1067 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1068 
1070 {
1071  verbose = val;
1072  for(G4int i=0; i<n_loss; ++i) {
1073  if(loss_vector[i]) { loss_vector[i]->SetVerboseLevel(val); }
1074  }
1075  size_t msc = msc_vector.size();
1076  for (size_t j=0; j<msc; ++j) {
1077  if(msc_vector[j]) { msc_vector[j]->SetVerboseLevel(val); }
1078  }
1079  size_t emp = emp_vector.size();
1080  for (size_t k=0; k<emp; ++k) {
1081  if(emp_vector[k]) { emp_vector[k]->SetVerboseLevel(val); }
1082  }
1083  emConfigurator->SetVerbose(val);
1084  //tableBuilder->SetVerbose(val);
1085  //emCorrections->SetVerbose(val);
1086  emSaturation->SetVerbose(val);
1087  emElectronIonPair->SetVerbose(val);
1088  if(atomDeexcitation) { atomDeexcitation->SetVerboseLevel(val); }
1089 }
1090 
1091 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1092 
1094 {
1095  stepFunctionActive = true;
1096  maxRangeVariation = v1;
1097  maxFinalStep = v2;
1098  for(G4int i=0; i<n_loss; ++i) {
1099  if(loss_vector[i]) { loss_vector[i]->SetStepFunction(v1, v2); }
1100  }
1101 }
1102 
1103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1104 
1106 {
1107  for(G4int i=0; i<n_loss; ++i) {
1108  if(loss_vector[i]) { loss_vector[i]->SetLinearLossLimit(val); }
1109  }
1110 }
1111 
1112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1113 
1115 {
1116  buildCSDARange = val;
1117 }
1118 
1119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1120 
1121 void
1122 G4LossTableManager::SetParameters(const G4ParticleDefinition* aParticle,
1124 {
1125  if(stepFunctionActive) {
1126  p->SetStepFunction(maxRangeVariation, maxFinalStep);
1127  }
1128  if(integralActive) { p->SetIntegral(integral); }
1129  if(minEnergyActive) { p->SetMinKinEnergy(minKinEnergy); }
1130  if(maxEnergyActive) { p->SetMaxKinEnergy(maxKinEnergy); }
1131  p->SetVerboseLevel(verbose);
1132  if(maxEnergyForMuonsActive) {
1133  G4double dm = std::abs(aParticle->GetPDGMass() - 105.7*MeV);
1134  if(dm < 5.*MeV) { p->SetMaxKinEnergy(maxKinEnergyForMuons); }
1135  }
1136 }
1137 
1138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1139 
1140 const std::vector<G4VEnergyLossProcess*>&
1142 {
1143  return loss_vector;
1144 }
1145 
1146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1147 
1148 const std::vector<G4VEmProcess*>& G4LossTableManager::GetEmProcessVector()
1149 {
1150  return emp_vector;
1151 }
1152 
1153 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1154 
1155 const std::vector<G4VMultipleScattering*>&
1157 {
1158  return msc_vector;
1159 }
1160 
1161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1162 
1164 {
1165  flagLPM = val;
1166 }
1167 
1168 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1169 
1171 {
1172  return flagLPM;
1173 }
1174 
1175 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1176 
1178 {
1179  splineFlag = val;
1180  tableBuilder->SetSplineFlag(splineFlag);
1181 }
1182 
1183 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1184 
1186 {
1187  return splineFlag;
1188 }
1189 
1190 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1191 
1193 {
1194  return isMaster;
1195 }
1196 
1197 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1198 
1200 {
1201  bremsTh = val;
1202 }
1203 
1204 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1205 
1207 {
1208  return bremsTh;
1209 }
1210 
1211 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1212 
1214 {
1215  if(val > 0.0) { factorForAngleLimit = val; }
1216 }
1217 
1218 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1219 
1221 {
1222  return factorForAngleLimit;
1223 }
1224 
1225 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1226 
1228 {
1229  return minKinEnergy;
1230 }
1231 
1232 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1233 
1235 {
1236  return maxKinEnergy;
1237 }
1238 
1239 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1240 
1242 {
1243  return emCorrections;
1244 }
1245 
1246 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1247 
1249 {
1250  return emSaturation;
1251 }
1252 
1253 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1254 
1256 {
1257  return emConfigurator;
1258 }
1259 
1260 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1261 
1263 {
1264  return emElectronIonPair;
1265 }
1266 
1267 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1268 
1270 {
1271  return atomDeexcitation;
1272 }
1273 
1274 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1275 
1277 {
1278  return tableBuilder;
1279 }
1280 
1281 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1282 
1284 {
1285  atomDeexcitation = p;
1286 }
1287 
1288 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1289 
1292 {
1293  if(aParticle != currentParticle) {
1294  currentParticle = aParticle;
1295  std::map<PD,G4VEnergyLossProcess*,std::less<PD> >::const_iterator pos;
1296  if ((pos = loss_map.find(aParticle)) != loss_map.end()) {
1297  currentLoss = (*pos).second;
1298  } else {
1299  currentLoss = 0;
1300  if(aParticle->GetParticleType() == "nucleus") {
1301  if ((pos = loss_map.find(theGenericIon)) != loss_map.end()) {
1302  currentLoss = (*pos).second;
1303  }
1304  }
1305  }
1306  }
1307  return currentLoss;
1308 }
1309 
1310 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1311 
1313  G4double kineticEnergy,
1314  const G4MaterialCutsCouple *couple)
1315 {
1316  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
1317  G4double x = 0.0;
1318  if(currentLoss) { x = currentLoss->GetDEDX(kineticEnergy, couple); }
1319  return x;
1320 }
1321 
1322 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1323 
1325  G4double kineticEnergy,
1326  const G4MaterialCutsCouple *couple)
1327 {
1328  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
1329  G4double x = 0.0;
1330  if(currentLoss) { x = currentLoss->GetDEDXForSubsec(kineticEnergy, couple); }
1331  return x;
1332 }
1333 
1334 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1335 
1337  G4double kineticEnergy,
1338  const G4MaterialCutsCouple *couple)
1339 {
1340  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
1341  G4double x = DBL_MAX;
1342  if(currentLoss) { x = currentLoss->GetCSDARange(kineticEnergy, couple); }
1343  return x;
1344 }
1345 
1346 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1347 
1349  const G4ParticleDefinition *aParticle,
1350  G4double kineticEnergy,
1351  const G4MaterialCutsCouple *couple)
1352 {
1353  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
1354  G4double x = DBL_MAX;
1355  if(currentLoss) { x = currentLoss->GetRangeForLoss(kineticEnergy, couple); }
1356  return x;
1357 }
1358 
1359 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
1360 
1362  G4double kineticEnergy,
1363  const G4MaterialCutsCouple *couple)
1364 {
1365  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
1366  G4double x = DBL_MAX;
1367  if(currentLoss) { x = currentLoss->GetRange(kineticEnergy, couple); }
1368  return x;
1369 }
1370 
1371 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1372 
1374  G4double range,
1375  const G4MaterialCutsCouple *couple)
1376 {
1377  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
1378  G4double x = 0;
1379  if(currentLoss) { x = currentLoss->GetKineticEnergy(range, couple); }
1380  return x;
1381 }
1382 
1383 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1384 
1386  const G4MaterialCutsCouple *couple,
1387  const G4DynamicParticle* dp,
1388  G4double& length)
1389 {
1390  const G4ParticleDefinition* aParticle = dp->GetParticleDefinition();
1391  if(aParticle != currentParticle) { GetEnergyLossProcess(aParticle); }
1392  G4double x = 0.0;
1393  if(currentLoss) { currentLoss->GetDEDXDispersion(couple, dp, length); }
1394  return x;
1395 }
1396 
1397 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double GetKineticEnergy(G4double &range, const G4MaterialCutsCouple *)
G4EmConfigurator * EmConfigurator()
void SetRandomStep(G4bool val)
void BuildRangeTable(const G4PhysicsTable *dedxTable, G4PhysicsTable *rangeTable, G4bool isIonisation=false)
void SetDEDXTable(G4PhysicsTable *p, G4EmTableType tType)
void SetIntegral(G4bool val)
G4bool SplineFlag() const
static G4LossTableManager * Instance()
tuple a
Definition: test.py:11
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4double GetDEDX(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
void SetIonisation(G4bool val)
void SetBremsstrahlungTh(G4double val)
G4double GetDEDX(G4double &kineticEnergy, const G4MaterialCutsCouple *)
G4PhysicsTable * SubLambdaTable() const
G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple, const G4DynamicParticle *dp, G4double &length)
void DeRegister(G4VEnergyLossProcess *p)
G4PhysicsTable * RangeTableForLoss() const
void SetLambdaBinning(G4int val)
const char * p
Definition: xmltok.h:285
G4double GetSubDEDX(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
G4bool BuildCSDARange() const
G4double GetRangeForLoss(G4double &kineticEnergy, const G4MaterialCutsCouple *)
void AddCollaborativeProcess(G4VEnergyLossProcess *)
void SetStepFunction(G4double v1, G4double v2)
G4PhysicsTable * CSDARangeTable() const
G4double GetCSDARange(G4double &kineticEnergy, const G4MaterialCutsCouple *)
G4EnergyLossMessenger * GetMessenger()
G4double FactorForAngleLimit() const
void SetFactorForAngleLimit(G4double val)
G4PhysicsTable * IonisationTableForSubsec() const
G4double GetDEDXForSubsec(G4double &kineticEnergy, const G4MaterialCutsCouple *)
tuple x
Definition: test.py:50
const std::vector< G4VEmProcess * > & GetEmProcessVector()
int G4int
Definition: G4Types.hh:78
G4PhysicsTable * BuildLambdaTable(G4EmTableType tType=fRestricted)
void SetVerbose(G4int)
static G4PhysicsTable * PreparePhysicsTable(G4PhysicsTable *physTable)
const G4String & GetParticleName() const
G4double GetCSDARange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
G4LossTableBuilder * GetTableBuilder()
void SetBuildCSDARange(G4bool val)
void SetInitialisationFlag(G4bool flag)
G4PhysicsTable * LambdaTable() const
tuple b
Definition: test.py:12
void SetInverseRangeTable(G4PhysicsTable *p)
const G4ParticleDefinition * SecondaryParticle() const
Char_t n[5]
G4GLOB_DLL std::ostream G4cout
G4PhysicsTable * DEDXTable() const
G4double MinKinEnergy() const
void SetLPMFlag(G4bool val)
const G4ParticleDefinition const G4Material *G4double range
bool G4bool
Definition: G4Types.hh:79
G4EmCorrections * EmCorrections()
void SetLossFluctuations(G4bool val)
G4ElectronIonPair * ElectronIonPair()
G4EmSaturation * EmSaturation()
TString part[npart]
Definition: Style.C:32
void SetMaxEnergyForCSDARange(G4double val)
G4bool IsMaster() const
G4int NumberOfSubCutoffRegions() const
const G4String & GetParticleType() const
void SetMaxKinEnergy(G4double e)
void Register(G4VEnergyLossProcess *p)
const G4ParticleDefinition * BaseParticle() const
const G4ParticleDefinition * GetParticleDefinition() const
void SetDEDXBinningForCSDARange(G4int val)
void BuildInverseRangeTable(const G4PhysicsTable *rangeTable, G4PhysicsTable *invRangeTable, G4bool isIonisation=false)
G4PhysicsTable * DEDXTableForSubsec() const
G4double GetEnergy(const G4ParticleDefinition *aParticle, G4double range, const G4MaterialCutsCouple *couple)
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
const std::vector< G4VEnergyLossProcess * > & GetEnergyLossProcessVector()
void SetSubCutoff(G4bool val, const G4Region *r=0)
G4double BremsstrahlungTh() const
G4double GetRangeFromRestricteDEDX(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
void RegisterExtraParticle(const G4ParticleDefinition *aParticle, G4VEnergyLossProcess *p)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void BuildDEDXTable(G4PhysicsTable *dedxTable, const std::vector< G4PhysicsTable * > &)
void SetVerbose(G4int value)
void SetMinSubRange(G4double val)
void SetMinEnergy(G4double val)
G4VEnergyLossProcess * GetEnergyLossProcess(const G4ParticleDefinition *)
void SetLambdaTable(G4PhysicsTable *p)
void SetMaxEnergy(G4double val)
jump r
Definition: plot.C:36
void SetStepFunction(G4double v1, G4double v2)
G4PhysicsTable * InverseRangeTable() const
void BuildPhysicsTable(const G4ParticleDefinition *aParticle)
G4double GetPDGMass() const
const G4ParticleDefinition * Particle() const
void SetLinearLossLimit(G4double val)
G4int GetNumberOfBinsPerDecade() const
void PrepareModels(const G4ParticleDefinition *aParticle, G4VEnergyLossProcess *p)
void PreparePhysicsTable(const G4ParticleDefinition *aParticle, G4VEnergyLossProcess *p, G4bool theMaster)
void SetCSDARangeTable(G4PhysicsTable *pRange)
G4double GetDEDXDispersion(const G4MaterialCutsCouple *couple, const G4DynamicParticle *dp, G4double length)
void SetVerbose(G4int val)
void LocalPhysicsTables(const G4ParticleDefinition *aParticle, G4VEnergyLossProcess *p)
void SetDEDXBinning(G4int val)
void SetMaxEnergyForMuons(G4double val)
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
void SetIntegral(G4bool val)
void SetLossFluctuations(G4bool val)
const G4String & GetName() const
Definition: G4VEmModel.hh:753
void SetSecondaryRangeTable(G4PhysicsTable *p)
G4VAtomDeexcitation * AtomDeexcitation()
G4PhysicsTable * DEDXunRestrictedTable() const
double G4double
Definition: G4Types.hh:76
void SetSubLambdaTable(G4PhysicsTable *p)
void ActivateSubCutoff(G4bool val, const G4Region *region=0)
void SetRangeTableForLoss(G4PhysicsTable *p)
#define DBL_MAX
Definition: templates.hh:83
G4double MaxKinEnergy() const
G4double GetRange(const G4ParticleDefinition *aParticle, G4double kineticEnergy, const G4MaterialCutsCouple *couple)
void SetAtomDeexcitation(G4VAtomDeexcitation *)
G4PhysicsTable * BuildDEDXTable(G4EmTableType tType=fRestricted)
void SetSplineFlag(G4bool val)
const std::vector< G4VMultipleScattering * > & GetMultipleScatteringVector()
void SetVerboseLevel(G4int value)
Definition: G4VProcess.hh:437
G4double GetRange(G4double &kineticEnergy, const G4MaterialCutsCouple *)
void SetRandomStep(G4bool val)
void SetSplineFlag(G4bool flag)
G4bool IsIonisationProcess() const
void SetMinKinEnergy(G4double e)