Geant4_10
PhysicsListMessenger.cc
Go to the documentation of this file.
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 //
28 //
29 // $Id: PhysicsListMessenger.cc 67268 2013-02-13 11:38:40Z ihrivnac $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "PhysicsListMessenger.hh"
35 
36 #include "PhysicsList.hh"
37 #include "G4UIdirectory.hh"
39 #include "G4UIcmdWithAString.hh"
40 
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42 
44 :G4UImessenger(),fPhysicsList(pPhys),
45  fPhysDir(0),
46  fGammaCutCmd(0),
47  fElectCutCmd(0),
48  fProtoCutCmd(0),
49  fAllCutCmd(0),
50  fRCmd(0),
51  fListCmd(0)
52 {
53  fPhysDir = new G4UIdirectory("/testem/phys/");
54  fPhysDir->SetGuidance("physics list commands");
55 
56  fGammaCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setGCut",this);
57  fGammaCutCmd->SetGuidance("Set gamma cut.");
58  fGammaCutCmd->SetParameterName("Gcut",false);
59  fGammaCutCmd->SetUnitCategory("Length");
60  fGammaCutCmd->SetRange("Gcut>0.0");
62 
63  fElectCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setECut",this);
64  fElectCutCmd->SetGuidance("Set electron cut.");
65  fElectCutCmd->SetParameterName("Ecut",false);
66  fElectCutCmd->SetUnitCategory("Length");
67  fElectCutCmd->SetRange("Ecut>0.0");
69 
70  fProtoCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setPCut",this);
71  fProtoCutCmd->SetGuidance("Set positron cut.");
72  fProtoCutCmd->SetParameterName("Pcut",false);
73  fProtoCutCmd->SetUnitCategory("Length");
74  fProtoCutCmd->SetRange("Pcut>0.0");
76 
77  fAllCutCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/setCuts",this);
78  fAllCutCmd->SetGuidance("Set cut for all.");
79  fAllCutCmd->SetParameterName("cut",false);
80  fAllCutCmd->SetUnitCategory("Length");
81  fAllCutCmd->SetRange("cut>0.0");
83 
84  fRCmd = new G4UIcmdWithADoubleAndUnit("/testem/phys/getRange",this);
85  fRCmd->SetGuidance("get the electron cut for the current material.");
86  fRCmd->SetParameterName("energy",false);
87  fRCmd->SetRange("energy>0.");
88  fRCmd->SetUnitCategory("Energy");
90 
91  fListCmd = new G4UIcmdWithAString("/testem/phys/addPhysics",this);
92  fListCmd->SetGuidance("Add modula physics list.");
93  fListCmd->SetParameterName("PList",false);
95 }
96 
97 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
98 
100 {
101  delete fGammaCutCmd;
102  delete fElectCutCmd;
103  delete fProtoCutCmd;
104  delete fAllCutCmd;
105  delete fRCmd;
106  delete fListCmd;
107  delete fPhysDir;
108 }
109 
110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
111 
113  G4String newValue)
114 {
115  if( command == fGammaCutCmd )
116  { fPhysicsList->SetCutForGamma(fGammaCutCmd->GetNewDoubleValue(newValue));}
117 
118  if( command == fElectCutCmd )
119  { fPhysicsList->SetCutForElectron(fElectCutCmd->GetNewDoubleValue(newValue));}
120 
121  if( command == fProtoCutCmd )
122  { fPhysicsList->SetCutForPositron(fProtoCutCmd->GetNewDoubleValue(newValue));}
123 
124  if( command == fAllCutCmd )
125  {
126  G4double cut = fAllCutCmd->GetNewDoubleValue(newValue);
127  fPhysicsList->SetCutForGamma(cut);
128  fPhysicsList->SetCutForElectron(cut);
129  fPhysicsList->SetCutForPositron(cut);
130  }
131 
132  if( command == fRCmd )
133  { fPhysicsList->GetRange(fRCmd->GetNewDoubleValue(newValue));}
134 
135  if( command == fListCmd )
136  { fPhysicsList->AddPhysicsList(newValue);}
137 }
138 
139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetCutForGamma(G4double)
Definition: PhysicsList.cc:231
void SetCutForPositron(G4double)
Definition: PhysicsList.cc:247
void SetUnitCategory(const char *unitCategory)
static G4double GetNewDoubleValue(const char *paramString)
void SetCutForElectron(G4double)
Definition: PhysicsList.cc:239
void AddPhysicsList(const G4String &name)
Definition: PhysicsList.cc:191
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetNewValue(G4UIcommand *, G4String)
PhysicsListMessenger(PhysicsList *)
double G4double
Definition: G4Types.hh:76
void GetRange(G4double)
Definition: PhysicsList.cc:396
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)