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 | // |
---|
27 | // $Id: PhysicsListMessenger.cc,v 1.4 2006/08/11 14:38:11 vnivanch Exp $ |
---|
28 | // GEANT4 tag $Name: $ |
---|
29 | // |
---|
30 | // |
---|
31 | ///////////////////////////////////////////////////////////////////////// |
---|
32 | // |
---|
33 | // PhysicsListMessenger |
---|
34 | // |
---|
35 | // Created: 31.01.2006 V.Ivanchenko |
---|
36 | // |
---|
37 | // Modified: |
---|
38 | // 04.06.2006 Adoptation of hadr01 (V.Ivanchenko) |
---|
39 | // |
---|
40 | //////////////////////////////////////////////////////////////////////// |
---|
41 | // |
---|
42 | // |
---|
43 | |
---|
44 | #include "PhysicsListMessenger.hh" |
---|
45 | |
---|
46 | #include "PhysicsList.hh" |
---|
47 | #include "G4UIcmdWithADoubleAndUnit.hh" |
---|
48 | #include "G4UIcmdWithAString.hh" |
---|
49 | #include "G4UIcmdWithoutParameter.hh" |
---|
50 | |
---|
51 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
52 | |
---|
53 | PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys) |
---|
54 | :pPhysicsList(pPhys) |
---|
55 | { |
---|
56 | gammaCutCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/CutGamma",this); |
---|
57 | gammaCutCmd->SetGuidance("Set gamma cut."); |
---|
58 | gammaCutCmd->SetParameterName("Gcut",false); |
---|
59 | gammaCutCmd->SetUnitCategory("Length"); |
---|
60 | gammaCutCmd->SetRange("Gcut>0.0"); |
---|
61 | gammaCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
62 | |
---|
63 | electCutCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/CutEl",this); |
---|
64 | electCutCmd->SetGuidance("Set electron cut."); |
---|
65 | electCutCmd->SetParameterName("Ecut",false); |
---|
66 | electCutCmd->SetUnitCategory("Length"); |
---|
67 | electCutCmd->SetRange("Ecut>0.0"); |
---|
68 | electCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
69 | |
---|
70 | posCutCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/CutPos",this); |
---|
71 | posCutCmd->SetGuidance("Set positron cut."); |
---|
72 | posCutCmd->SetParameterName("Pcut",false); |
---|
73 | posCutCmd->SetUnitCategory("Length"); |
---|
74 | posCutCmd->SetRange("Pcut>0.0"); |
---|
75 | posCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
76 | |
---|
77 | allCutCmd = new G4UIcmdWithADoubleAndUnit("/testhadr/CutsAll",this); |
---|
78 | allCutCmd->SetGuidance("Set cut for all."); |
---|
79 | allCutCmd->SetParameterName("cut",false); |
---|
80 | allCutCmd->SetUnitCategory("Length"); |
---|
81 | allCutCmd->SetRange("cut>0.0"); |
---|
82 | allCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
83 | |
---|
84 | pListCmd = new G4UIcmdWithAString("/testhadr/Physics",this); |
---|
85 | pListCmd->SetGuidance("Add modula physics list."); |
---|
86 | pListCmd->SetParameterName("PList",false); |
---|
87 | pListCmd->AvailableForStates(G4State_PreInit); |
---|
88 | |
---|
89 | listCmd = new G4UIcmdWithoutParameter("/testhadr/ListPhysics",this); |
---|
90 | listCmd->SetGuidance("Available Physics Lists"); |
---|
91 | listCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
92 | |
---|
93 | } |
---|
94 | |
---|
95 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
96 | |
---|
97 | PhysicsListMessenger::~PhysicsListMessenger() |
---|
98 | { |
---|
99 | delete gammaCutCmd; |
---|
100 | delete electCutCmd; |
---|
101 | delete posCutCmd; |
---|
102 | delete allCutCmd; |
---|
103 | delete pListCmd; |
---|
104 | delete listCmd; |
---|
105 | } |
---|
106 | |
---|
107 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
108 | |
---|
109 | void PhysicsListMessenger::SetNewValue(G4UIcommand* command, |
---|
110 | G4String newValue) |
---|
111 | { |
---|
112 | if( command == gammaCutCmd ) |
---|
113 | pPhysicsList->SetCutForGamma(gammaCutCmd->GetNewDoubleValue(newValue)); |
---|
114 | |
---|
115 | if( command == electCutCmd ) |
---|
116 | pPhysicsList->SetCutForElectron(electCutCmd->GetNewDoubleValue(newValue)); |
---|
117 | |
---|
118 | if( command == posCutCmd ) |
---|
119 | pPhysicsList->SetCutForPositron(posCutCmd->GetNewDoubleValue(newValue)); |
---|
120 | |
---|
121 | if( command == allCutCmd ) |
---|
122 | { |
---|
123 | G4double cut = allCutCmd->GetNewDoubleValue(newValue); |
---|
124 | pPhysicsList->SetCutForGamma(cut); |
---|
125 | pPhysicsList->SetCutForElectron(cut); |
---|
126 | pPhysicsList->SetCutForPositron(cut); |
---|
127 | } |
---|
128 | |
---|
129 | if( command == pListCmd ) { |
---|
130 | G4String name = newValue; |
---|
131 | if(name == "PHYSLIST") { |
---|
132 | char* path = getenv(name); |
---|
133 | if (path) name = G4String(path); |
---|
134 | else { |
---|
135 | G4cout << "### PhysicsListMessenger WARNING: " |
---|
136 | << " environment variable PHYSLIST is not defined" |
---|
137 | << G4endl; |
---|
138 | return; |
---|
139 | } |
---|
140 | } |
---|
141 | pPhysicsList->AddPhysicsList(name); |
---|
142 | } |
---|
143 | |
---|
144 | if( command == listCmd ) |
---|
145 | pPhysicsList->List(); |
---|
146 | |
---|
147 | } |
---|
148 | |
---|
149 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|