1 | //this |
---|
2 | #include "ELYSE/PhysicsListMessenger.hh" |
---|
3 | |
---|
4 | //Geant 4 |
---|
5 | #include "G4UIdirectory.hh" |
---|
6 | #include "G4UIcmdWithADoubleAndUnit.hh" |
---|
7 | #include "G4UIcmdWithAString.hh" |
---|
8 | #include "G4UIcmdWithAnInteger.hh" |
---|
9 | |
---|
10 | //ELYSE |
---|
11 | #include "ELYSE/PhysicsList.hh" |
---|
12 | |
---|
13 | |
---|
14 | //---------------------------------------------------------------------- |
---|
15 | |
---|
16 | ELYSE::PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys) |
---|
17 | :pPhysicsList(pPhys) { |
---|
18 | |
---|
19 | physDir = new G4UIdirectory("/ELYSE/phys/"); |
---|
20 | physDir->SetGuidance("physics list commands"); |
---|
21 | |
---|
22 | gammaCutCmd = new G4UIcmdWithADoubleAndUnit("/ELYSE/phys/setGCut",this); |
---|
23 | gammaCutCmd->SetGuidance("Set gamma cut."); |
---|
24 | gammaCutCmd->SetParameterName("Gcut",false); |
---|
25 | gammaCutCmd->SetUnitCategory("Length"); |
---|
26 | gammaCutCmd->SetRange("Gcut>0.0"); |
---|
27 | gammaCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
28 | |
---|
29 | electCutCmd = new G4UIcmdWithADoubleAndUnit("/ELYSE/phys/setECut",this); |
---|
30 | electCutCmd->SetGuidance("Set electron cut."); |
---|
31 | electCutCmd->SetParameterName("Ecut",false); |
---|
32 | electCutCmd->SetUnitCategory("Length"); |
---|
33 | electCutCmd->SetRange("Ecut>0.0"); |
---|
34 | electCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
35 | |
---|
36 | protoCutCmd = new G4UIcmdWithADoubleAndUnit("/ELYSE/phys/setPCut",this); |
---|
37 | protoCutCmd->SetGuidance("Set positron cut."); |
---|
38 | protoCutCmd->SetParameterName("Pcut",false); |
---|
39 | protoCutCmd->SetUnitCategory("Length"); |
---|
40 | protoCutCmd->SetRange("Pcut>0.0"); |
---|
41 | protoCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
42 | |
---|
43 | allCutCmd = new G4UIcmdWithADoubleAndUnit("/ELYSE/phys/setCuts",this); |
---|
44 | allCutCmd->SetGuidance("Set cut for all."); |
---|
45 | allCutCmd->SetParameterName("cut",false); |
---|
46 | allCutCmd->SetUnitCategory("Length"); |
---|
47 | allCutCmd->SetRange("cut>0.0"); |
---|
48 | allCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
49 | |
---|
50 | pListCmd = new G4UIcmdWithAString("/ELYSE/phys/addPhysics",this); |
---|
51 | pListCmd->SetGuidance("Add modula physics list."); |
---|
52 | pListCmd->SetParameterName("PList",false); |
---|
53 | pListCmd->AvailableForStates(G4State_PreInit); |
---|
54 | |
---|
55 | |
---|
56 | verboseCmd = new G4UIcmdWithAnInteger("/ELYSE/phys/verbose",this); |
---|
57 | verboseCmd->SetGuidance("set verbose for physics processes"); |
---|
58 | verboseCmd->SetParameterName("verbose",true); |
---|
59 | verboseCmd->SetDefaultValue(1); |
---|
60 | verboseCmd->SetRange("verbose>=0"); |
---|
61 | verboseCmd->AvailableForStates(G4State_Idle); |
---|
62 | |
---|
63 | cerenkovCmd = new G4UIcmdWithAnInteger("/ELYSE/phys/cerenkovMaxPhotons",this); |
---|
64 | cerenkovCmd->SetGuidance("set max nb of photons per step"); |
---|
65 | cerenkovCmd->SetParameterName("MaxNumber",false); |
---|
66 | cerenkovCmd->SetRange("MaxNumber>=0"); |
---|
67 | cerenkovCmd->AvailableForStates(G4State_Idle); |
---|
68 | } |
---|
69 | |
---|
70 | //---------------------------------------------------------------------- |
---|
71 | |
---|
72 | ELYSE::PhysicsListMessenger::~PhysicsListMessenger() { |
---|
73 | delete gammaCutCmd; |
---|
74 | delete electCutCmd; |
---|
75 | delete protoCutCmd; |
---|
76 | delete allCutCmd; |
---|
77 | delete pListCmd; |
---|
78 | delete verboseCmd; |
---|
79 | delete cerenkovCmd; |
---|
80 | delete physDir; |
---|
81 | |
---|
82 | } |
---|
83 | |
---|
84 | //---------------------------------------------------------------------- |
---|
85 | |
---|
86 | void ELYSE::PhysicsListMessenger::SetNewValue(G4UIcommand* command, |
---|
87 | G4String newValue) { |
---|
88 | if( command == gammaCutCmd ) { |
---|
89 | pPhysicsList->SetCutForGamma(gammaCutCmd->GetNewDoubleValue(newValue)); |
---|
90 | } |
---|
91 | |
---|
92 | if( command == electCutCmd ) { |
---|
93 | pPhysicsList->SetCutForElectron(electCutCmd->GetNewDoubleValue(newValue)); |
---|
94 | } |
---|
95 | |
---|
96 | if( command == protoCutCmd ) { |
---|
97 | pPhysicsList->SetCutForPositron(protoCutCmd->GetNewDoubleValue(newValue)); |
---|
98 | } |
---|
99 | |
---|
100 | if( command == allCutCmd ) { |
---|
101 | G4double cut = allCutCmd->GetNewDoubleValue(newValue); |
---|
102 | pPhysicsList->SetCutForGamma(cut); |
---|
103 | pPhysicsList->SetCutForElectron(cut); |
---|
104 | pPhysicsList->SetCutForPositron(cut); |
---|
105 | } |
---|
106 | |
---|
107 | if( command == pListCmd ) { |
---|
108 | pPhysicsList->AddPhysicsList(newValue); |
---|
109 | } |
---|
110 | |
---|
111 | |
---|
112 | if( command == verboseCmd ) { |
---|
113 | pPhysicsList->SetVerbose(verboseCmd->GetNewIntValue(newValue)); |
---|
114 | } |
---|
115 | |
---|
116 | if( command == cerenkovCmd ) { |
---|
117 | pPhysicsList->SetNbOfPhotonsCerenkov(cerenkovCmd->GetNewIntValue(newValue)); |
---|
118 | } |
---|
119 | |
---|
120 | }//SetNewValue |
---|
121 | |
---|
122 | //---------------------------------------------------------------------- |
---|