Geant4_10
G4EmManager.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: G4EmManager.cc 69320 2013-04-30 15:59:36Z vnivanch $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 Class file
31 //
32 //
33 // File name: G4EmManager
34 //
35 // Author: Vladimir Ivanchenko
36 //
37 // Creation date: 18.05.2013
38 //
39 // Modifications:
40 //
41 //
42 //
43 // -------------------------------------------------------------------
44 //
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
47 
48 #include "G4EmManager.hh"
49 #include "G4SystemOfUnits.hh"
50 #include "G4EmManagerMessenger.hh"
51 #include "G4PhysicsTable.hh"
52 #include "G4PhysicsTableHelper.hh"
53 #include "G4ParticleDefinition.hh"
54 #include "G4MaterialCutsCouple.hh"
55 #include "G4ProcessManager.hh"
56 #include "G4Electron.hh"
57 #include "G4Proton.hh"
58 #include "G4VEnergyLossProcess.hh"
59 #include "G4VMultipleScattering.hh"
60 #include "G4VEmProcess.hh"
61 #include "G4EmSaturation.hh"
62 #include "G4EmConfigurator.hh"
63 #include "G4ElectronIonPair.hh"
64 #include "G4LossTableBuilder.hh"
65 #include "G4Region.hh"
66 #include "G4NistManager.hh"
67 
68 G4EmManager* G4EmManager::theInstance = 0;
69 
70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
71 
73 {
74  if(0 == theInstance) {
75  static G4EmManager manager;
76  theInstance = &manager;
77  }
78  return theInstance;
79 }
80 
81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
82 
84 {
85  G4cout << "G4EmManager::~G4EmManager()" << G4endl;
86  G4int nmax = dedx_vector.size();
87  for (G4int i=0; i<nmax; ++i) {
88  if( dedx_vector[i] ) {
89  dedx_vector[i]->clearAndDestroy();
90  delete dedx_vector[i];
91  }
92  }
93  nmax = range_vector.size();
94  for (G4int i=0; i<nmax; ++i) {
95  if( range_vector[i] ) {
96  range_vector[i]->clearAndDestroy();
97  delete range_vector[i];
98  }
99  }
100  nmax = inv_range_vector.size();
101  for (G4int i=0; i<nmax; ++i) {
102  if( inv_range_vector[i] ) {
103  inv_range_vector[i]->clearAndDestroy();
104  delete inv_range_vector[i];
105  }
106  }
107  nmax = xsection_vector.size();
108  for (G4int i=0; i<nmax; ++i) {
109  if( xsection_vector[i] ) {
110  xsection_vector[i]->clearAndDestroy();
111  delete xsection_vector[i];
112  }
113  }
114  G4cout << "G4EmManager::~G4EmManager() 1" << G4endl;
115  delete theMessenger;
116  delete tableBuilder;
117  delete emSaturation;
118  delete emConfigurator;
119  delete emElectronIonPair;
120  G4cout << "G4EmManager::~G4EmManager() 2" << G4endl;
121 }
122 
123 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
124 
125 G4EmManager::G4EmManager()
126 {
128  n_loss = 0;
129  run = 0;
130  startInitialisation = false;
131  all_tables_are_built = false;
132  firstParticle = 0;
133  lossFluctuationFlag = true;
134  subCutoffFlag = false;
135  rndmStepFlag = false;
136  minSubRange = 0.0;
137  maxRangeVariation = 1.0;
138  maxFinalStep = 0.0;
139  minKinEnergy = 0.1*keV;
140  maxKinEnergy = 10.0*TeV;
141  nbinsLambda = 77;
142  nbinsPerDecade = 7;
143  maxKinEnergyForMuons = 10.*TeV;
144  integral = true;
145  integralActive = false;
146  buildCSDARange = false;
147  minEnergyActive = false;
148  maxEnergyActive = false;
149  maxEnergyForMuonsActive = false;
150  stepFunctionActive = false;
151  flagLPM = true;
152  splineFlag = true;
153  bremsTh = DBL_MAX;
154  factorForAngleLimit = 1.0;
155  verbose = 1;
156  theMessenger = 0;
157  tableBuilder = 0;
158  emSaturation = 0;
159  emConfigurator = 0;
160  emElectronIonPair = 0;
161  //theMessenger = new G4EmManagerMessenger(this);
162  theElectron = G4Electron::Electron();
163  //tableBuilder = new G4LossTableBuilder();
164  //emSaturation = new G4EmSaturation();
165  //emConfigurator = new G4EmConfigurator(verbose);
166  //emElectronIonPair = new G4ElectronIonPair();
167  //tableBuilder->SetSplineFlag(splineFlag);
168 }
169 
170 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
171 
173 {
174  if(!p) { return; }
175  for (G4int i=0; i<n_loss; ++i) {
176  if(loss_vector[i] == p) { return; }
177  }
178  if(verbose > 1) {
179  G4cout << "G4EmManager::Register G4VEnergyLossProcess : "
180  << p->GetProcessName() << " idx= " << n_loss << G4endl;
181  }
182  ++n_loss;
183  loss_vector.push_back(p);
184  part_vector.push_back(0);
185  base_part_vector.push_back(0);
186  dedx_vector.push_back(0);
187  range_vector.push_back(0);
188  inv_range_vector.push_back(0);
189  tables_are_built.push_back(false);
190  isActive.push_back(true);
191  all_tables_are_built = false;
192  if(!lossFluctuationFlag) { p->SetLossFluctuations(false); }
193  if(subCutoffFlag) { p->ActivateSubCutoff(true); }
194  if(rndmStepFlag) { p->SetRandomStep(true); }
195  if(stepFunctionActive) {
196  p->SetStepFunction(maxRangeVariation, maxFinalStep);
197  }
198  if(integralActive) { p->SetIntegral(integral); }
199  if(minEnergyActive) { p->SetMinKinEnergy(minKinEnergy); }
200  if(maxEnergyActive) { p->SetMaxKinEnergy(maxKinEnergy); }
201 }
202 
203 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
204 
206 {
207  if(!p) { return; }
208  G4int n = msc_vector.size();
209  for (G4int i=0; i<n; ++i) {
210  if(msc_vector[i] == p) { return; }
211  }
212  if(verbose > 1) {
213  G4cout << "G4EmManager::Register G4VMultipleScattering : "
214  << p->GetProcessName() << " idx= " << msc_vector.size() << G4endl;
215  }
216  msc_vector.push_back(p);
217 }
218 
219 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
220 
222 {
223  if(!p) { return; }
224  G4int n = emp_vector.size();
225  for (G4int i=0; i<n; ++i) {
226  if(emp_vector[i] == p) { return; }
227  }
228  if(verbose > 1) {
229  G4cout << "G4EmManager::Register G4VEmProcess : "
230  << p->GetProcessName() << " idx= " << emp_vector.size() << G4endl;
231  }
232  emp_vector.push_back(p);
233 }
234 
235 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
236 
238  const G4ParticleDefinition* part,
240 {
241  if(!p || !part) { return; }
242  for (G4int i=0; i<n_loss; ++i) {
243  if(loss_vector[i] == p) { return; }
244  }
245  if(verbose > 1) {
246  G4cout << "G4EmManager::RegisterExtraParticle "
247  << part->GetParticleName() << " G4VEnergyLossProcess : "
248  << p->GetProcessName() << " idx= " << n_loss << G4endl;
249  }
250  ++n_loss;
251  loss_vector.push_back(p);
252  part_vector.push_back(part);
253  base_part_vector.push_back(p->BaseParticle());
254  dedx_vector.push_back(0);
255  range_vector.push_back(0);
256  inv_range_vector.push_back(0);
257  tables_are_built.push_back(false);
258  all_tables_are_built = false;
259 }
260 
261 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
262 
263 void
266 {
267  if (1 < verbose) {
268  G4cout << "G4EmManager::PreparePhysicsTable for "
269  << particle->GetParticleName()
270  << " and " << p->GetProcessName() << " run= " << run
271  << " loss_vector " << loss_vector.size() << G4endl;
272  }
273  if(!startInitialisation) { tableBuilder->SetInitialisationFlag(false); }
274 
275  // start initialisation for the first run
276  startInitialisation = true;
277 
278  if( 0 == run ) {
279  emConfigurator->PrepareModels(particle, p);
280 
281  // initialise particles for given process
282  for (G4int j=0; j<n_loss; ++j) {
283  if (p == loss_vector[j]) {
284  if (!part_vector[j]) { part_vector[j] = particle; }
285  }
286  }
287  }
288 }
289 
290 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
291 
292 void
294  G4VEmProcess* p)
295 {
296  if (1 < verbose) {
297  G4cout << "G4EmManager::PreparePhysicsTable for "
298  << particle->GetParticleName()
299  << " and " << p->GetProcessName() << G4endl;
300  }
301  if(!startInitialisation) { tableBuilder->SetInitialisationFlag(false); }
302 
303  // start initialisation for the first run
304  if( 0 == run ) {
305  emConfigurator->PrepareModels(particle, p);
306  }
307  startInitialisation = true;
308 }
309 
310 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
311 
312 void
315 {
316  if (1 < verbose) {
317  G4cout << "G4EmManager::PreparePhysicsTable for "
318  << particle->GetParticleName()
319  << " and " << p->GetProcessName() << G4endl;
320  }
321  if(!startInitialisation) { tableBuilder->SetInitialisationFlag(false); }
322 
323  // start initialisation for the first run
324  if( 0 == run ) {
325  emConfigurator->PrepareModels(particle, p);
326  }
327 }
328 
329 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
330 
331 void
333 {
334  if(0 == run && startInitialisation) {
335  emConfigurator->Clear();
336  }
337 }
338 
339 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
340 
341 void
344 {
345  if(1 < verbose) {
346  G4cout << "### G4EmManager::BuildDEDXTable() is requested for "
347  << aParticle->GetParticleName()
348  << " and process " << p->GetProcessName() << G4endl;
349  }
350  // clear configurator
351  if(0 == run && startInitialisation) {
352  emConfigurator->Clear();
353  firstParticle = aParticle;
354  }
355  startInitialisation = false;
356 
357  // initialisation before any table is built
358  if ( aParticle == firstParticle ) {
359  all_tables_are_built = true;
360 
361  if(1 < verbose) {
362  G4cout << "### G4EmManager start initilisation for first particle "
363  << firstParticle->GetParticleName()
364  << G4endl;
365  }
366  for (G4int i=0; i<n_loss; ++i) {
367  G4VEnergyLossProcess* el = loss_vector[i];
368 
369  if(el) {
370  const G4ProcessManager* pm = el->GetProcessManager();
371  isActive[i] = false;
372  if(pm) { isActive[i] = pm->GetProcessActivation(el); }
373  if(0 == run) { base_part_vector[i] = el->BaseParticle(); }
374  tables_are_built[i] = false;
375  all_tables_are_built= false;
376  if(!isActive[i]) { el->SetIonisation(false); }
377 
378  if(1 < verbose) {
379  G4cout << i <<". "<< el->GetProcessName();
380  if(el->Particle()) {
381  G4cout << " for " << el->Particle()->GetParticleName();
382  }
383  G4cout << " active= " << isActive[i]
384  << " table= " << tables_are_built[i]
385  << " isIonisation= " << el->IsIonisationProcess();
386  if(base_part_vector[i]) {
387  G4cout << " base particle "
388  << base_part_vector[i]->GetParticleName();
389  }
390  G4cout << G4endl;
391  }
392  } else {
393  tables_are_built[i] = true;
394  part_vector[i] = 0;
395  }
396  }
397  ++run;
398  }
399 
400  // Set run time parameters
401  SetParameters(aParticle, p);
402 
403  if (all_tables_are_built) { return; }
404 
405  // Build tables for given particle
406  all_tables_are_built = true;
407 
408  for(G4int i=0; i<n_loss; ++i) {
409  if(p == loss_vector[i] && !tables_are_built[i] && !base_part_vector[i]) {
410  const G4ParticleDefinition* curr_part = part_vector[i];
411  if(1 < verbose) {
412  G4cout << "### BuildPhysicsTable for " << p->GetProcessName()
413  << " and " << curr_part->GetParticleName()
414  << " start BuildTable " << G4endl;
415  }
416  G4VEnergyLossProcess* curr_proc = BuildTables(curr_part);
417  if(curr_proc) { CopyTables(curr_part, curr_proc); }
418  }
419  if ( !tables_are_built[i] ) { all_tables_are_built = false; }
420  }
421 
422  if(1 < verbose) {
423  G4cout << "### G4EmManager::BuildDEDXTable end: "
424  << "all_tables_are_built= " << all_tables_are_built
425  << G4endl;
426 
427  if(all_tables_are_built) {
428  G4cout << "### All dEdx and Range tables are built #####" << G4endl;
429  }
430  }
431 }
432 
433 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
434 
435 void G4EmManager::CopyTables(const G4ParticleDefinition* part,
436  G4VEnergyLossProcess* base_proc)
437 {
438  for (G4int j=0; j<n_loss; ++j) {
439 
440  G4VEnergyLossProcess* proc = loss_vector[j];
441  //if(proc == base_proc || proc->Particle() == part)
442  // tables_are_built[j] = true;
443 
444  if (!tables_are_built[j] && part == base_part_vector[j]) {
445  tables_are_built[j] = true;
446  proc->SetDEDXTable(base_proc->DEDXTable(),fRestricted);
447  proc->SetDEDXTable(base_proc->DEDXTableForSubsec(),fSubRestricted);
448  proc->SetDEDXTable(base_proc->DEDXunRestrictedTable(),fTotal);
449  proc->SetCSDARangeTable(base_proc->CSDARangeTable());
450  proc->SetRangeTableForLoss(base_proc->RangeTableForLoss());
451  proc->SetInverseRangeTable(base_proc->InverseRangeTable());
452  proc->SetLambdaTable(base_proc->LambdaTable());
453  proc->SetSubLambdaTable(base_proc->SubLambdaTable());
454  proc->SetIonisation(base_proc->IsIonisationProcess());
455  loss_map[part_vector[j]] = proc;
456  if (1 < verbose) {
457  G4cout << "For " << proc->GetProcessName()
458  << " for " << part_vector[j]->GetParticleName()
459  << " base_part= " << part->GetParticleName()
460  << " tables are assigned "
461  << G4endl;
462  }
463  }
464 
465  if (theElectron == part && theElectron == proc->SecondaryParticle() ) {
466  proc->SetSecondaryRangeTable(base_proc->RangeTableForLoss());
467  }
468  }
469 }
470 
471 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
472 
474 G4EmManager::BuildTables(const G4ParticleDefinition* aParticle)
475 {
476  if(1 < verbose) {
477  G4cout << "G4EmManager::BuildTables() for "
478  << aParticle->GetParticleName() << G4endl;
479  }
480 
481  std::vector<G4PhysicsTable*> t_list;
482  std::vector<G4VEnergyLossProcess*> loss_list;
483  loss_list.clear();
484  G4VEnergyLossProcess* em = 0;
485  G4VEnergyLossProcess* p = 0;
486  G4int iem = 0;
487  G4PhysicsTable* dedx = 0;
488  G4int i;
489 
490  for (i=0; i<n_loss; ++i) {
491  p = loss_vector[i];
492  if (p && aParticle == part_vector[i] && !tables_are_built[i]) {
493  if ((p->IsIonisationProcess() && isActive[i]) ||
494  !em || (em && !isActive[iem]) ) {
495  em = p;
496  iem= i;
497  }
498  dedx = p->BuildDEDXTable(fRestricted);
499  // G4cout << "Build DEDX table for " << aParticle->GetParticleName()
500  // << " " << dedx << " " << dedx->length() << G4endl;
501  p->SetDEDXTable(dedx,fRestricted);
502  t_list.push_back(dedx);
503  loss_list.push_back(p);
504  tables_are_built[i] = true;
505  }
506  }
507 
508  G4int n_dedx = t_list.size();
509  if (0 == n_dedx || !em) {
510  G4cout << "G4EmManager WARNING: no DEDX processes for "
511  << aParticle->GetParticleName() << G4endl;
512  return 0;
513  }
514  G4int nSubRegions = em->NumberOfSubCutoffRegions();
515 
516  if (1 < verbose) {
517  G4cout << "G4EmManager::BuildTables() start to build range tables"
518  << " and the sum of " << n_dedx << " processes"
519  << " iem= " << iem << " em= " << em->GetProcessName()
520  << " buildCSDARange= " << buildCSDARange
521  << " nSubRegions= " << nSubRegions
522  << G4endl;
523  }
524 
525  dedx = em->IonisationTable();
526  if (1 < n_dedx) {
527  em->SetDEDXTable(dedx, fIsIonisation);
528  dedx = 0;
530  tableBuilder->BuildDEDXTable(dedx, t_list);
531  em->SetDEDXTable(dedx, fRestricted);
532  }
533  dedx_vector[iem] = dedx;
534 
536  if(!range) range = G4PhysicsTableHelper::PreparePhysicsTable(range);
537  range_vector[iem] = range;
538 
539  G4PhysicsTable* invrange = em->InverseRangeTable();
540  if(!invrange) invrange = G4PhysicsTableHelper::PreparePhysicsTable(invrange);
541  inv_range_vector[iem] = invrange;
542 
543  G4bool flag = em->IsIonisationProcess();
544  tableBuilder->BuildRangeTable(dedx, range, flag);
545  tableBuilder->BuildInverseRangeTable(range, invrange, flag);
546 
547  // if(1<verbose) G4cout << *dedx << G4endl;
548 
549  em->SetRangeTableForLoss(range);
550  em->SetInverseRangeTable(invrange);
551 
552  // if(1<verbose) G4cout << *range << G4endl;
553 
554  std::vector<G4PhysicsTable*> listSub;
555  std::vector<G4PhysicsTable*> listCSDA;
556 
557  for (i=0; i<n_dedx; ++i) {
558  p = loss_list[i];
559  p->SetIonisation(false);
561  if (0 < nSubRegions) {
562  dedx = p->BuildDEDXTable(fSubRestricted);
563  p->SetDEDXTable(dedx,fSubRestricted);
564  listSub.push_back(dedx);
566  if(p != em) em->AddCollaborativeProcess(p);
567  }
568  if(buildCSDARange) {
569  dedx = p->BuildDEDXTable(fTotal);
570  p->SetDEDXTable(dedx,fTotal);
571  listCSDA.push_back(dedx);
572  }
573  }
574 
575  if (0 < nSubRegions) {
576  G4PhysicsTable* dedxSub = em->IonisationTableForSubsec();
577  if (1 < listSub.size()) {
578  em->SetDEDXTable(dedxSub, fIsSubIonisation);
579  dedxSub = 0;
581  tableBuilder->BuildDEDXTable(dedxSub, listSub);
582  em->SetDEDXTable(dedxSub, fSubRestricted);
583  }
584  }
585  if(buildCSDARange) {
586  G4PhysicsTable* dedxCSDA = em->DEDXunRestrictedTable();
587  if (1 < n_dedx) {
588  dedxCSDA = 0;
589  dedxCSDA = G4PhysicsTableHelper::PreparePhysicsTable(dedxCSDA);
590  tableBuilder->BuildDEDXTable(dedxCSDA, listCSDA);
591  em->SetDEDXTable(dedxCSDA,fTotal);
592  }
593  G4PhysicsTable* rCSDA = em->CSDARangeTable();
594  if(!rCSDA) rCSDA = G4PhysicsTableHelper::PreparePhysicsTable(rCSDA);
595  tableBuilder->BuildRangeTable(dedxCSDA, rCSDA, flag);
596  em->SetCSDARangeTable(rCSDA);
597  }
598 
599  em->SetIonisation(true);
600  loss_map[aParticle] = em;
601 
602  if (1 < verbose) {
603  G4cout << "G4EmManager::BuildTables: Tables are built for "
604  << aParticle->GetParticleName()
605  << "; ionisation process: " << em->GetProcessName()
606  << G4endl;
607  }
608  return em;
609 }
610 
611 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
612 
614 {
615  return buildCSDARange;
616 }
617 
618 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
619 
621 {
622  lossFluctuationFlag = val;
623  for(G4int i=0; i<n_loss; ++i) {
624  if(loss_vector[i]) { loss_vector[i]->SetLossFluctuations(val); }
625  }
626 }
627 
628 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
629 
631 {
632  subCutoffFlag = val;
633  for(G4int i=0; i<n_loss; ++i) {
634  if(loss_vector[i]) { loss_vector[i]->ActivateSubCutoff(val, r); }
635  }
636 }
637 
638 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
639 
641 {
642  integral = val;
643  integralActive = true;
644  for(G4int i=0; i<n_loss; ++i) {
645  if(loss_vector[i]) { loss_vector[i]->SetIntegral(val); }
646  }
647  size_t emp = emp_vector.size();
648  for (size_t k=0; k<emp; ++k) {
649  if(emp_vector[k]) { emp_vector[k]->SetIntegral(val); }
650  }
651 }
652 
653 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
654 
656 {
657  minSubRange = val;
658  for(G4int i=0; i<n_loss; ++i) {
659  if(loss_vector[i]) { loss_vector[i]->SetMinSubRange(val); }
660  }
661 }
662 
663 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
664 
666 {
667  rndmStepFlag = val;
668  for(G4int i=0; i<n_loss; ++i) {
669  if(loss_vector[i]) { loss_vector[i]->SetRandomStep(val); }
670  }
671 }
672 
673 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
674 
676 {
677  minEnergyActive = true;
678  minKinEnergy = val;
679  for(G4int i=0; i<n_loss; ++i) {
680  if(loss_vector[i]) { loss_vector[i]->SetMinKinEnergy(val); }
681  }
682  size_t emp = emp_vector.size();
683  for (size_t k=0; k<emp; ++k) {
684  if(emp_vector[k]) { emp_vector[k]->SetMinKinEnergy(val); }
685  }
686 }
687 
688 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
689 
691 {
692  maxEnergyActive = true;
693  maxKinEnergy = val;
694  for(G4int i=0; i<n_loss; ++i) {
695  if(loss_vector[i]) { loss_vector[i]->SetMaxKinEnergy(val); }
696  }
697  size_t emp = emp_vector.size();
698  for (size_t k=0; k<emp; ++k) {
699  if(emp_vector[k]) { emp_vector[k]->SetMaxKinEnergy(val); }
700  }
701 }
702 
703 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
704 
706 {
707  for(G4int i=0; i<n_loss; ++i) {
708  if(loss_vector[i]) { loss_vector[i]->SetMaxKinEnergyForCSDARange(val); }
709  }
710 }
711 
712 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
713 
715 {
716  maxEnergyForMuonsActive = true;
717  maxKinEnergyForMuons = val;
718 }
719 
720 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
721 
723 {
724  for(G4int i=0; i<n_loss; ++i) {
725  if(loss_vector[i]) { loss_vector[i]->SetDEDXBinning(val); }
726  }
727 }
728 
729 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
730 
732 {
733  for(G4int i=0; i<n_loss; ++i) {
734  if(loss_vector[i]) { loss_vector[i]->SetDEDXBinningForCSDARange(val); }
735  }
736 }
737 
738 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
739 
741 {
742  G4int n = val/G4int(std::log10(maxKinEnergy/minKinEnergy) + 0.5);
743  if(n < 5) {
744  G4cout << "G4EmManager::SetLambdaBinning WARNING "
745  << "too small number of bins " << val << " ignored"
746  << G4endl;
747  return;
748  }
749  nbinsLambda = val;
750  nbinsPerDecade = n;
751  size_t emp = emp_vector.size();
752  for (size_t k=0; k<emp; ++k) {
753  if(emp_vector[k]) { emp_vector[k]->SetLambdaBinning(val); }
754  }
755 }
756 
757 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
758 
760 {
761  return nbinsPerDecade;
762 }
763 
764 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
765 
767 {
768  verbose = val;
769  /*
770  for(G4int i=0; i<n_loss; ++i) {
771  if(loss_vector[i]) { loss_vector[i]->SetVerboseLevel(val); }
772  }
773  size_t msc = msc_vector.size();
774  for (size_t j=0; j<msc; ++j) {
775  if(msc_vector[j]) { msc_vector[j]->SetVerboseLevel(val); }
776  }
777  size_t emp = emp_vector.size();
778  for (size_t k=0; k<emp; ++k) {
779  if(emp_vector[k]) { emp_vector[k]->SetVerboseLevel(val); }
780  }
781  */
782  G4cout << "1 " << emConfigurator << G4endl;
783  emConfigurator->SetVerbose(val);
784  G4cout << "2 " << emSaturation << G4endl;
785  //tableBuilder->SetVerbose(val);
786  emSaturation->SetVerbose(val);
787  G4cout << "3 " << emElectronIonPair << G4endl;
788  emElectronIonPair->SetVerbose(val);
789  G4cout << "4 " << G4endl;
790 }
791 
792 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
793 
795 {
796  stepFunctionActive = true;
797  maxRangeVariation = v1;
798  maxFinalStep = v2;
799  for(G4int i=0; i<n_loss; ++i) {
800  if(loss_vector[i]) { loss_vector[i]->SetStepFunction(v1, v2); }
801  }
802 }
803 
804 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
805 
807 {
808  for(G4int i=0; i<n_loss; ++i) {
809  if(loss_vector[i]) { loss_vector[i]->SetLinearLossLimit(val); }
810  }
811 }
812 
813 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
814 
816 {
817  buildCSDARange = val;
818 }
819 
820 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
821 
822 void G4EmManager::SetParameters(const G4ParticleDefinition* aParticle,
824 {
825  if(stepFunctionActive) {
826  p->SetStepFunction(maxRangeVariation, maxFinalStep);
827  }
828  if(integralActive) { p->SetIntegral(integral); }
829  if(minEnergyActive) { p->SetMinKinEnergy(minKinEnergy); }
830  if(maxEnergyActive) { p->SetMaxKinEnergy(maxKinEnergy); }
831  p->SetVerboseLevel(verbose);
832  if(maxEnergyForMuonsActive) {
833  G4double dm = std::abs(aParticle->GetPDGMass() - 105.7*MeV);
834  if(dm < 5.*MeV) { p->SetMaxKinEnergy(maxKinEnergyForMuons); }
835  }
836 }
837 
838 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
839 
841  G4VEnergyLossProcess* /*p*/)
842 {
843 }
844 
845 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
846 
848  G4VEmProcess* /*p*/)
849 {
850 }
851 
852 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
853 
856 {
857 }
858 
859 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
860 
862 {
863  flagLPM = val;
864 }
865 
866 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
867 
869 {
870  return flagLPM;
871 }
872 
873 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
874 
876 {
877  splineFlag = val;
878  tableBuilder->SetSplineFlag(splineFlag);
879 }
880 
881 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
882 
884 {
885  return splineFlag;
886 }
887 
888 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
889 
891 {
892  bremsTh = val;
893 }
894 
895 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
896 
898 {
899  return bremsTh;
900 }
901 
902 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
903 
905 {
906  if(val > 0.0) { factorForAngleLimit = val; }
907 }
908 
909 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
910 
912 {
913  return factorForAngleLimit;
914 }
915 
916 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
917 
919 {
920  return minKinEnergy;
921 }
922 
923 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
924 
926 {
927  return maxKinEnergy;
928 }
929 
930 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
931 
933 {
934  return emSaturation;
935 }
936 
937 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
938 
940 {
941  return emConfigurator;
942 }
943 
944 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
945 
947 {
948  return emElectronIonPair;
949 }
950 
951 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
952 
954 {
955  return tableBuilder;
956 }
957 
958 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BuildRangeTable(const G4PhysicsTable *dedxTable, G4PhysicsTable *rangeTable, G4bool isIonisation=false)
void SetDEDXTable(G4PhysicsTable *p, G4EmTableType tType)
void SetIntegral(G4bool val)
void SetIonisation(G4bool val)
G4bool BuildCSDARange() const
Definition: G4EmManager.cc:613
void Register(G4VEnergyLossProcess *p)
Definition: G4EmManager.cc:172
G4PhysicsTable * SubLambdaTable() const
G4bool SplineFlag() const
Definition: G4EmManager.cc:883
void SetMaxEnergy(G4double val)
Definition: G4EmManager.cc:690
void SetMaxEnergyForCSDARange(G4double val)
Definition: G4EmManager.cc:705
G4PhysicsTable * RangeTableForLoss() const
void SetSplineFlag(G4bool val)
Definition: G4EmManager.cc:875
const char * p
Definition: xmltok.h:285
void SetRandomStep(G4bool val)
Definition: G4EmManager.cc:665
void AddCollaborativeProcess(G4VEnergyLossProcess *)
void SetVerbose(G4int val)
Definition: G4EmManager.cc:766
void SetStepFunction(G4double v1, G4double v2)
void SetLossFluctuations(G4bool val)
Definition: G4EmManager.cc:620
G4PhysicsTable * CSDARangeTable() const
void SetDEDXBinningForCSDARange(G4int val)
Definition: G4EmManager.cc:731
G4PhysicsTable * IonisationTableForSubsec() const
G4bool LPMFlag() const
Definition: G4EmManager.cc:868
G4PhysicsTable * IonisationTable() const
void SetSubCutoff(G4bool val, const G4Region *r=0)
Definition: G4EmManager.cc:630
int G4int
Definition: G4Types.hh:78
G4PhysicsTable * BuildLambdaTable(G4EmTableType tType=fRestricted)
static G4NistManager * Instance()
void PreparePhysicsTable(const G4ParticleDefinition *aParticle, G4VEnergyLossProcess *p)
Definition: G4EmManager.cc:264
void SetVerbose(G4int)
static G4PhysicsTable * PreparePhysicsTable(G4PhysicsTable *physTable)
const G4String & GetParticleName() const
static G4EmManager * Instance()
Definition: G4EmManager.cc:72
G4double MaxKinEnergy() const
Definition: G4EmManager.cc:925
void SetInitialisationFlag(G4bool flag)
void SetBremsstrahlungTh(G4double val)
Definition: G4EmManager.cc:890
G4PhysicsTable * LambdaTable() const
G4ElectronIonPair * ElectronIonPair()
Definition: G4EmManager.cc:946
void SetInverseRangeTable(G4PhysicsTable *p)
const G4ParticleDefinition * SecondaryParticle() const
Char_t n[5]
void SetIntegral(G4bool val)
Definition: G4EmManager.cc:640
G4GLOB_DLL std::ostream G4cout
void SetFactorForAngleLimit(G4double val)
Definition: G4EmManager.cc:904
G4PhysicsTable * DEDXTable() const
G4double FactorForAngleLimit() const
Definition: G4EmManager.cc:911
const G4ParticleDefinition const G4Material *G4double range
void SetBuildCSDARange(G4bool val)
Definition: G4EmManager.cc:815
bool G4bool
Definition: G4Types.hh:79
G4double BremsstrahlungTh() const
Definition: G4EmManager.cc:897
void SetLossFluctuations(G4bool val)
void SetDEDXBinning(G4int val)
Definition: G4EmManager.cc:722
TString part[npart]
Definition: Style.C:32
G4int NumberOfSubCutoffRegions() const
G4int GetNumberOfBinsPerDecade() const
Definition: G4EmManager.cc:759
void SetMaxKinEnergy(G4double e)
const G4int nmax
const G4ParticleDefinition * BaseParticle() const
void BuildInverseRangeTable(const G4PhysicsTable *rangeTable, G4PhysicsTable *invRangeTable, G4bool isIonisation=false)
G4PhysicsTable * DEDXTableForSubsec() const
const G4String & GetProcessName() const
Definition: G4VProcess.hh:408
G4LossTableBuilder * GetTableBuilder()
Definition: G4EmManager.cc:953
G4EmConfigurator * EmConfigurator()
Definition: G4EmManager.cc:939
void SetLinearLossLimit(G4double val)
Definition: G4EmManager.cc:806
void BuildDEDXTable(G4PhysicsTable *dedxTable, const std::vector< G4PhysicsTable * > &)
void SetLambdaBinning(G4int val)
Definition: G4EmManager.cc:740
void SetVerbose(G4int value)
virtual const G4ProcessManager * GetProcessManager()
Definition: G4VProcess.hh:514
void SetLambdaTable(G4PhysicsTable *p)
jump r
Definition: plot.C:36
void RegisterExtraParticle(const G4ParticleDefinition *aParticle, G4VEnergyLossProcess *p)
Definition: G4EmManager.cc:237
G4PhysicsTable * InverseRangeTable() const
G4double GetPDGMass() const
void SetLPMFlag(G4bool val)
Definition: G4EmManager.cc:861
void InitialiseProcess(const G4ParticleDefinition *aParticle, G4VEnergyLossProcess *)
Definition: G4EmManager.cc:840
const G4ParticleDefinition * Particle() const
void PrepareModels(const G4ParticleDefinition *aParticle, G4VEnergyLossProcess *p)
void SetStepFunction(G4double v1, G4double v2)
Definition: G4EmManager.cc:794
void SetCSDARangeTable(G4PhysicsTable *pRange)
void BuildPhysicsTable(const G4ParticleDefinition *aParticle)
Definition: G4EmManager.cc:332
G4bool GetProcessActivation(G4VProcess *aProcess) const
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
void SetSecondaryRangeTable(G4PhysicsTable *p)
G4EmSaturation * EmSaturation()
Definition: G4EmManager.cc:932
G4PhysicsTable * DEDXunRestrictedTable() const
double G4double
Definition: G4Types.hh:76
void SetSubLambdaTable(G4PhysicsTable *p)
void SetMinSubRange(G4double val)
Definition: G4EmManager.cc:655
void ActivateSubCutoff(G4bool val, const G4Region *region=0)
void SetRangeTableForLoss(G4PhysicsTable *p)
#define DBL_MAX
Definition: templates.hh:83
void SetMinEnergy(G4double val)
Definition: G4EmManager.cc:675
void SetMaxEnergyForMuons(G4double val)
Definition: G4EmManager.cc:714
G4PhysicsTable * BuildDEDXTable(G4EmTableType tType=fRestricted)
void SetVerboseLevel(G4int value)
Definition: G4VProcess.hh:437
void SetRandomStep(G4bool val)
void SetSplineFlag(G4bool flag)
G4double MinKinEnergy() const
Definition: G4EmManager.cc:918
G4bool IsIonisationProcess() const
void SetMinKinEnergy(G4double e)