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

Last change on this file since 1065 was 1055, checked in by garnier, 17 years ago

maj sur la beta de geant 4.9.3

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