source: trunk/source/processes/electromagnetic/utils/src/G4EmProcessOptions.cc @ 1015

Last change on this file since 1015 was 1007, checked in by garnier, 15 years ago

update to geant4.9.2

File size: 17.3 KB
Line 
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: G4EmProcessOptions.cc,v 1.24 2008/04/17 10:33:27 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-02 $
28//
29// -------------------------------------------------------------------
30//
31// GEANT4 Class file
32//
33//
34// File name:     G4EmProcessOptions
35//
36// Author:        Vladimir Ivanchenko
37//
38// Creation date: 27.02.2004
39//
40// Modifications:
41// 30-06-04 G4EmProcess is pure discrete (V.Ivanchenko)
42// 24-03-05 Add ApplyCuts and RandomStep (V.Ivanchenko)
43// 10-01-06 PreciseRange -> CSDARange (V.Ivantchenko)
44// 10-05-06 Add command MscStepLimit to G4LossTableManager (V.Ivantchenko)
45// 22-05-06 Add SetBremsstrahlungTh (V.Ivanchenko)
46// 12-02-07 Add SetSkin, SetLinearLossLimit (V.Ivanchenko)
47//
48// Class Description:
49//
50// -------------------------------------------------------------------
51//
52//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
53//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
54
55#include "G4EmProcessOptions.hh"
56#include "G4LossTableManager.hh"
57#include "G4VEmProcess.hh"
58#include "G4VEnergyLossProcess.hh"
59#include "G4VMultipleScattering.hh"
60#include "G4Region.hh"
61
62//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
63
64G4EmProcessOptions::G4EmProcessOptions()
65{
66  theManager = G4LossTableManager::Instance();
67}
68
69//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
70
71G4EmProcessOptions::~G4EmProcessOptions()
72{
73}
74
75//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
76
77void G4EmProcessOptions::SetLossFluctuations(G4bool val)
78{
79  theManager->SetLossFluctuations(val);
80  const std::vector<G4VEnergyLossProcess*>& v =
81        theManager->GetEnergyLossProcessVector();
82  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
83  for(itr = v.begin(); itr != v.end(); itr++) {
84    G4VEnergyLossProcess* p = *itr;
85    if(p) p->SetLossFluctuations(val);
86  }
87}
88
89//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
90
91void G4EmProcessOptions::SetSubCutoff(G4bool val, const G4Region* r)
92{
93  theManager->SetSubCutoff(val);
94  const std::vector<G4VEnergyLossProcess*>& v =
95        theManager->GetEnergyLossProcessVector();
96  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
97  for(itr = v.begin(); itr != v.end(); itr++) {
98    G4VEnergyLossProcess* p = *itr;
99    if(p) p->ActivateSubCutoff(val, r);
100  }
101}
102
103//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
104
105void G4EmProcessOptions::SetIntegral(G4bool val)
106{
107  theManager->SetIntegral(val);
108  const std::vector<G4VEnergyLossProcess*>& v =
109        theManager->GetEnergyLossProcessVector();
110  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
111  for(itr = v.begin(); itr != v.end(); itr++) {
112    G4VEnergyLossProcess* p = *itr;
113    if(p) p->SetIntegral(val);
114  }
115}
116
117//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
118
119void G4EmProcessOptions::SetMinSubRange(G4double val)
120{
121  theManager->SetMinSubRange(val);
122  const std::vector<G4VEnergyLossProcess*>& v =
123        theManager->GetEnergyLossProcessVector();
124  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
125  for(itr = v.begin(); itr != v.end(); itr++) {
126    G4VEnergyLossProcess* p = *itr;
127    if(p) p->SetMinSubRange(val);
128  }
129}
130
131//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
132
133void G4EmProcessOptions::SetMinEnergy(G4double val)
134{
135  theManager->SetMinEnergy(val);
136  const std::vector<G4VEnergyLossProcess*>& v =
137        theManager->GetEnergyLossProcessVector();
138  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
139  for(itr = v.begin(); itr != v.end(); itr++) {
140    G4VEnergyLossProcess* p = *itr;
141    if(p) p->SetMinKinEnergy(val);
142  }
143  const std::vector<G4VEmProcess*>& w =
144        theManager->GetEmProcessVector();
145  std::vector<G4VEmProcess*>::const_iterator itp;
146  for(itp = w.begin(); itp != w.end(); itp++) {
147    G4VEmProcess* q = *itp;
148    if(q) q->SetMinKinEnergy(val);
149  }
150  const std::vector<G4VMultipleScattering*>& u =
151        theManager->GetMultipleScatteringVector();
152  std::vector<G4VMultipleScattering*>::const_iterator itm;
153  for(itm = u.begin(); itm != u.end(); itm++) {
154    G4VMultipleScattering* s = *itm;
155    if(s) s->SetMinKinEnergy(val);
156  }
157}
158
159//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
160
161void G4EmProcessOptions::SetMaxEnergy(G4double val)
162{
163  theManager->SetMaxEnergy(val);
164  const std::vector<G4VEnergyLossProcess*>& v =
165        theManager->GetEnergyLossProcessVector();
166  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
167  for(itr = v.begin(); itr != v.end(); itr++) {
168    G4VEnergyLossProcess* p = *itr;
169    if(p) p->SetMaxKinEnergy(val);
170  }
171  const std::vector<G4VEmProcess*>& w =
172        theManager->GetEmProcessVector();
173  std::vector<G4VEmProcess*>::const_iterator itp;
174  for(itp = w.begin(); itp != w.end(); itp++) {
175    G4VEmProcess* q = *itp;
176    if(q) q->SetMaxKinEnergy(val);
177  }
178  const std::vector<G4VMultipleScattering*>& u =
179        theManager->GetMultipleScatteringVector();
180  std::vector<G4VMultipleScattering*>::const_iterator itm;
181  for(itm = u.begin(); itm != u.end(); itm++) {
182    G4VMultipleScattering* s = *itm;
183    if(s) s->SetMaxKinEnergy(val);
184  }
185}
186
187//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
188
189void G4EmProcessOptions::SetMaxEnergyForCSDARange(G4double val)
190{
191  theManager->SetMaxEnergyForCSDARange(val);
192  const std::vector<G4VEnergyLossProcess*>& v =
193        theManager->GetEnergyLossProcessVector();
194  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
195  for(itr = v.begin(); itr != v.end(); itr++) {
196    G4VEnergyLossProcess* p = *itr;
197    if(p) p->SetMaxKinEnergyForCSDARange(val);
198  }
199}
200
201//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
202
203void G4EmProcessOptions::SetMaxEnergyForMuons(G4double val)
204{
205  theManager->SetMaxEnergyForMuons(val);
206  const std::vector<G4VEnergyLossProcess*>& v =
207        theManager->GetEnergyLossProcessVector();
208  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
209  for(itr = v.begin(); itr != v.end(); itr++) {
210    G4VEnergyLossProcess* p = *itr;
211    if(p) {
212      if(std::abs(p->Particle()->GetPDGMass() - 105.66*MeV) < MeV)
213        p->SetMaxKinEnergy(val);
214    }
215  }
216  const std::vector<G4VEmProcess*>& w =
217        theManager->GetEmProcessVector();
218  std::vector<G4VEmProcess*>::const_iterator itp;
219  for(itp = w.begin(); itp != w.end(); itp++) {
220    G4VEmProcess* q = *itp;
221    if(q) {
222      if(std::abs(q->Particle()->GetPDGMass() - 105.66*MeV) < MeV)
223        q->SetMaxKinEnergy(val);
224    }
225  }
226  /*
227  const std::vector<G4VMultipleScattering*>& u =
228        theManager->GetMultipleScatteringVector();
229  std::vector<G4VMultipleScattering*>::const_iterator itm;
230  for(itm = u.begin(); itm != u.end(); itm++) {
231    G4VMultipleScattering* s = *itm;
232    if(s) {
233      if(std::abs(s->Particle()->GetPDGMass() - 105.66*MeV) < MeV)
234        s->SetMaxKinEnergy(val);
235    }
236  }
237  */
238}
239
240//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
241
242void G4EmProcessOptions::SetDEDXBinning(G4int val)
243{
244  theManager->SetDEDXBinning(val);
245  const std::vector<G4VEnergyLossProcess*>& v =
246        theManager->GetEnergyLossProcessVector();
247  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
248  for(itr = v.begin(); itr != v.end(); itr++) {
249    G4VEnergyLossProcess* p = *itr;
250    if(p) p->SetDEDXBinning(val);
251  }
252}
253
254//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
255
256void G4EmProcessOptions::SetDEDXBinningForCSDARange(G4int val)
257{
258  theManager->SetDEDXBinningForCSDARange(val);
259  const std::vector<G4VEnergyLossProcess*>& v =
260        theManager->GetEnergyLossProcessVector();
261  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
262  for(itr = v.begin(); itr != v.end(); itr++) {
263    G4VEnergyLossProcess* p = *itr;
264    if(p) p->SetDEDXBinningForCSDARange(val);
265  }
266}
267
268//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
269
270void G4EmProcessOptions::SetLambdaBinning(G4int val)
271{
272  theManager->SetLambdaBinning(val);
273  const std::vector<G4VEmProcess*>& w =
274        theManager->GetEmProcessVector();
275  std::vector<G4VEmProcess*>::const_iterator itp;
276  for(itp = w.begin(); itp != w.end(); itp++) {
277    G4VEmProcess* q = *itp;
278    if(q) q->SetLambdaBinning(val);
279  }
280  const std::vector<G4VMultipleScattering*>& u =
281        theManager->GetMultipleScatteringVector();
282  std::vector<G4VMultipleScattering*>::const_iterator itm;
283  for(itm = u.begin(); itm != u.end(); itm++) {
284    G4VMultipleScattering* s = *itm;
285    if(s) s->SetBinning(val);
286  }
287}
288
289//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
290
291void G4EmProcessOptions::SetStepFunction(G4double v1, G4double v2)
292{
293  theManager->SetStepFunction(v1, v2);
294  const std::vector<G4VEnergyLossProcess*>& v =
295        theManager->GetEnergyLossProcessVector();
296  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
297  for(itr = v.begin(); itr != v.end(); itr++) {
298    G4VEnergyLossProcess* p = *itr;
299    if(p) p->SetStepFunction(v1, v2);
300  }
301}
302
303//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
304
305void G4EmProcessOptions::SetRandomStep(G4bool val)
306{
307  theManager->SetRandomStep(val);
308  const std::vector<G4VEnergyLossProcess*>& v =
309        theManager->GetEnergyLossProcessVector();
310  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
311  for(itr = v.begin(); itr != v.end(); itr++) {
312    G4VEnergyLossProcess* p = *itr;
313    if(p) p->SetRandomStep(val);
314  }
315}
316
317//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
318
319void G4EmProcessOptions::SetApplyCuts(G4bool val)
320{
321  const std::vector<G4VEmProcess*>& w =
322        theManager->GetEmProcessVector();
323  std::vector<G4VEmProcess*>::const_iterator itp;
324  for(itp = w.begin(); itp != w.end(); itp++) {
325    G4VEmProcess* q = *itp;
326    if(q) q->SetApplyCuts(val);
327  }
328}
329
330//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
331
332void G4EmProcessOptions::SetBuildCSDARange(G4bool val)
333{
334  theManager->SetBuildCSDARange(val);
335}
336
337//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
338
339void G4EmProcessOptions::SetVerbose(G4int val, const G4String& name)
340{
341  G4bool all = false;
342  if("all" == name) all = true;
343  const std::vector<G4VEnergyLossProcess*>& v =
344        theManager->GetEnergyLossProcessVector();
345
346  if(all) theManager->SetVerbose(val);
347
348  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
349  for(itr = v.begin(); itr != v.end(); itr++) {
350    G4VEnergyLossProcess* p = *itr;
351    if(p) {
352      if(all) p->SetVerboseLevel(val);
353      else if (p->GetProcessName() == name) p->SetVerboseLevel(val);
354    }
355  }
356  const std::vector<G4VEmProcess*>& w =
357        theManager->GetEmProcessVector();
358  std::vector<G4VEmProcess*>::const_iterator itp;
359  for(itp = w.begin(); itp != w.end(); itp++) {
360    G4VEmProcess* q = *itp;
361    if(q) {
362      if(all) q->SetVerboseLevel(val);
363      else if (q->GetProcessName() == name) q->SetVerboseLevel(val);
364    }
365  }
366  const std::vector<G4VMultipleScattering*>& u =
367        theManager->GetMultipleScatteringVector();
368  std::vector<G4VMultipleScattering*>::const_iterator itm;
369  for(itm = u.begin(); itm != u.end(); itm++) {
370    G4VMultipleScattering* s = *itm;
371    if(s) {
372      if(all) s->SetVerboseLevel(val);
373      else if (s->GetProcessName() == name) s->SetVerboseLevel(val);
374    }
375  }
376}
377
378//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
379
380void G4EmProcessOptions::SetLambdaFactor(G4double val)
381{
382  const std::vector<G4VEnergyLossProcess*>& v =
383        theManager->GetEnergyLossProcessVector();
384  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
385  for(itr = v.begin(); itr != v.end(); itr++) {
386    G4VEnergyLossProcess* p = *itr;
387    if(p) p->SetLambdaFactor(val);
388  }
389
390}
391
392//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
393
394void G4EmProcessOptions::ActivateDeexcitation(G4bool val, const G4Region* r)
395{
396  const std::vector<G4VEnergyLossProcess*>& v =
397        theManager->GetEnergyLossProcessVector();
398  std::vector<G4VEnergyLossProcess*>::const_iterator itr;
399  for(itr = v.begin(); itr != v.end(); itr++) {
400    G4VEnergyLossProcess* p = *itr;
401    if(p) p->ActivateDeexcitation(val,r);
402  }
403  const std::vector<G4VEmProcess*>& w =
404        theManager->GetEmProcessVector();
405  std::vector<G4VEmProcess*>::const_iterator itp;
406  for(itp = w.begin(); itp != w.end(); itp++) {
407    G4VEmProcess* q = *itp;
408    if(q) q->ActivateDeexcitation(val,r);
409  }
410}
411
412//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
413
414void G4EmProcessOptions::SetMscStepLimitation(G4MscStepLimitType val)
415{
416  const std::vector<G4VMultipleScattering*>& u =
417        theManager->GetMultipleScatteringVector();
418  std::vector<G4VMultipleScattering*>::const_iterator itm;
419  for(itm = u.begin(); itm != u.end(); itm++) {
420    if(*itm) (*itm)->SetStepLimitType(val);
421  }
422}
423
424//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
425
426void G4EmProcessOptions::SetMscLateralDisplacement(G4bool val)
427{
428  const std::vector<G4VMultipleScattering*>& u =
429        theManager->GetMultipleScatteringVector();
430  std::vector<G4VMultipleScattering*>::const_iterator itm;
431  for(itm = u.begin(); itm != u.end(); itm++) {
432    if(*itm) (*itm)->SetLateralDisplasmentFlag(val);
433  }
434}
435
436//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
437
438void G4EmProcessOptions::SetSkin(G4double val)
439{
440  if(val < 0.0) return;
441  const std::vector<G4VMultipleScattering*>& u =
442        theManager->GetMultipleScatteringVector();
443  std::vector<G4VMultipleScattering*>::const_iterator itm;
444  for(itm = u.begin(); itm != u.end(); itm++) {
445    if(*itm) {
446      (*itm)->SetSkin(val);
447    }
448  }
449}
450
451//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
452
453void G4EmProcessOptions::SetMscRangeFactor(G4double val)
454{
455  if(val < 0.0) return;
456  const std::vector<G4VMultipleScattering*>& u =
457        theManager->GetMultipleScatteringVector();
458  std::vector<G4VMultipleScattering*>::const_iterator itm;
459  for(itm = u.begin(); itm != u.end(); itm++) {
460    if(*itm) (*itm)->SetRangeFactor(val);
461  }
462}
463
464//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
465
466void G4EmProcessOptions::SetMscGeomFactor(G4double val)
467{
468  if(val < 0.0) return;
469  const std::vector<G4VMultipleScattering*>& u =
470        theManager->GetMultipleScatteringVector();
471  std::vector<G4VMultipleScattering*>::const_iterator itm;
472  for(itm = u.begin(); itm != u.end(); itm++) {
473    if(*itm) (*itm)->SetGeomFactor(val);
474  }
475}
476
477//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
478
479void G4EmProcessOptions::SetPolarAngleLimit(G4double val)
480{
481  const std::vector<G4VMultipleScattering*>& u =
482        theManager->GetMultipleScatteringVector();
483  std::vector<G4VMultipleScattering*>::const_iterator itm;
484  for(itm = u.begin(); itm != u.end(); itm++) {
485    if(*itm) (*itm)->SetPolarAngleLimit(val);
486  }
487  const std::vector<G4VEmProcess*>& w =
488        theManager->GetEmProcessVector();
489  std::vector<G4VEmProcess*>::const_iterator itp;
490  for(itp = w.begin(); itp != w.end(); itp++) {
491    G4VEmProcess* q = *itp;
492    if(q) q->SetPolarAngleLimit(val);
493  }
494}
495
496//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
497
498void G4EmProcessOptions::SetLPMFlag(G4bool val)
499{
500  theManager->SetLPMFlag(val);
501}
502
503//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
504
505void G4EmProcessOptions::SetSplineFlag(G4bool val)
506{
507  theManager->SetSplineFlag(val);
508}
509
510//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
511
512void G4EmProcessOptions::SetLinearLossLimit(G4double val)
513{
514  theManager->SetLinearLossLimit(val);
515}
516
517//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
518
519void G4EmProcessOptions::SetBremsstrahlungTh(G4double val)
520{
521  theManager->SetBremsstrahlungTh(val);
522}
523
524//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
525
Note: See TracBrowser for help on using the repository browser.