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 2008/04/03 15:07:55 vnivanch Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
29 | // |
---|
30 | // |
---|
31 | |
---|
32 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
33 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
34 | |
---|
35 | #include "PhysicsListMessenger.hh" |
---|
36 | |
---|
37 | #include "PhysicsList.hh" |
---|
38 | #include "G4UIcmdWithADoubleAndUnit.hh" |
---|
39 | #include "G4UIcmdWithAString.hh" |
---|
40 | #include "G4UIcmdWithABool.hh" |
---|
41 | |
---|
42 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
43 | |
---|
44 | PhysicsListMessenger::PhysicsListMessenger(PhysicsList* pPhys) |
---|
45 | :pPhysicsList(pPhys) |
---|
46 | { |
---|
47 | gammaCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setGCut",this); |
---|
48 | gammaCutCmd->SetGuidance("Set gamma cut."); |
---|
49 | gammaCutCmd->SetParameterName("Gcut",false); |
---|
50 | gammaCutCmd->SetUnitCategory("Length"); |
---|
51 | gammaCutCmd->SetRange("Gcut>0.0"); |
---|
52 | gammaCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
53 | |
---|
54 | electCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setECut",this); |
---|
55 | electCutCmd->SetGuidance("Set electron cut."); |
---|
56 | electCutCmd->SetParameterName("Ecut",false); |
---|
57 | electCutCmd->SetUnitCategory("Length"); |
---|
58 | electCutCmd->SetRange("Ecut>0.0"); |
---|
59 | electCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
60 | |
---|
61 | protoCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setPCut",this); |
---|
62 | protoCutCmd->SetGuidance("Set positron cut."); |
---|
63 | protoCutCmd->SetParameterName("Pcut",false); |
---|
64 | protoCutCmd->SetUnitCategory("Length"); |
---|
65 | protoCutCmd->SetRange("Pcut>0.0"); |
---|
66 | protoCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
67 | |
---|
68 | allCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setCuts",this); |
---|
69 | allCutCmd->SetGuidance("Set cut for all."); |
---|
70 | allCutCmd->SetParameterName("cut",false); |
---|
71 | allCutCmd->SetUnitCategory("Length"); |
---|
72 | allCutCmd->SetRange("cut>0.0"); |
---|
73 | allCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
74 | |
---|
75 | eCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/VertexCuts",this); |
---|
76 | eCutCmd->SetGuidance("Set cuts for the Vertex Detector"); |
---|
77 | eCutCmd->SetParameterName("Ecut",false); |
---|
78 | eCutCmd->SetUnitCategory("Length"); |
---|
79 | eCutCmd->SetRange("Ecut>0.0"); |
---|
80 | eCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
81 | |
---|
82 | mCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/MuonCuts",this); |
---|
83 | mCutCmd->SetGuidance("Set cuts for the Muon Detector"); |
---|
84 | mCutCmd->SetParameterName("Ecut",false); |
---|
85 | mCutCmd->SetUnitCategory("Length"); |
---|
86 | mCutCmd->SetRange("Ecut>0.0"); |
---|
87 | mCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); |
---|
88 | |
---|
89 | pListCmd = new G4UIcmdWithAString("/testem/phys/addPhysics",this); |
---|
90 | pListCmd->SetGuidance("Add modula physics list."); |
---|
91 | pListCmd->SetParameterName("PList",false); |
---|
92 | pListCmd->AvailableForStates(G4State_PreInit); |
---|
93 | |
---|
94 | mscCmd = new G4UIcmdWithABool("/testem/phys/mscStepLimit",this); |
---|
95 | mscCmd->SetGuidance("Activate Multiple Scattering step limit"); |
---|
96 | mscCmd->SetParameterName("PList",false); |
---|
97 | mscCmd->AvailableForStates(G4State_PreInit); |
---|
98 | } |
---|
99 | |
---|
100 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
101 | |
---|
102 | PhysicsListMessenger::~PhysicsListMessenger() |
---|
103 | { |
---|
104 | delete gammaCutCmd; |
---|
105 | delete electCutCmd; |
---|
106 | delete protoCutCmd; |
---|
107 | delete allCutCmd; |
---|
108 | delete pListCmd; |
---|
109 | delete eCutCmd; |
---|
110 | delete mCutCmd; |
---|
111 | delete mscCmd; |
---|
112 | } |
---|
113 | |
---|
114 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
115 | |
---|
116 | void PhysicsListMessenger::SetNewValue(G4UIcommand* command, |
---|
117 | G4String newValue) |
---|
118 | { |
---|
119 | if( command == gammaCutCmd ) |
---|
120 | { pPhysicsList->SetCutForGamma(gammaCutCmd->GetNewDoubleValue(newValue));} |
---|
121 | |
---|
122 | if( command == electCutCmd ) |
---|
123 | { pPhysicsList->SetCutForElectron(electCutCmd->GetNewDoubleValue(newValue));} |
---|
124 | |
---|
125 | if( command == protoCutCmd ) |
---|
126 | { pPhysicsList->SetCutForPositron(protoCutCmd->GetNewDoubleValue(newValue));} |
---|
127 | |
---|
128 | if( command == allCutCmd ) |
---|
129 | { |
---|
130 | G4double cut = allCutCmd->GetNewDoubleValue(newValue); |
---|
131 | pPhysicsList->SetCutForGamma(cut); |
---|
132 | pPhysicsList->SetCutForElectron(cut); |
---|
133 | pPhysicsList->SetCutForPositron(cut); |
---|
134 | } |
---|
135 | |
---|
136 | if( command == eCutCmd ) |
---|
137 | { pPhysicsList->SetVertexCut(eCutCmd->GetNewDoubleValue(newValue));} |
---|
138 | |
---|
139 | if( command == mCutCmd ) |
---|
140 | { pPhysicsList->SetMuonCut(mCutCmd->GetNewDoubleValue(newValue));} |
---|
141 | |
---|
142 | if( command == pListCmd ) |
---|
143 | { pPhysicsList->AddPhysicsList(newValue);} |
---|
144 | |
---|
145 | // if( command == mscCmd ) |
---|
146 | // { pPhysicsList->SetMscStepLimit(mscCmd->GetNewBoolValue(newValue));} |
---|
147 | } |
---|
148 | |
---|
149 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|