Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ProductionCutsTableMessenger.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 //
26 //
27 // $Id: G4ProductionCutsTableMessenger.cc 70369 2013-05-29 14:59:24Z gcosmo $
28 //
29 //
30 //---------------------------------------------------------------
31 //
32 // G4ProductionCutsTableMessenger.cc
33 // ------------------------------------------------------------
34 // History
35 // first version 02 Mar. 2008 by H.Kurashige
36 //
37 
39 #include "G4ProductionCutsTable.hh"
40 
41 #include "G4UIdirectory.hh"
43 #include "G4UIcmdWithAnInteger.hh"
45 #include "G4UIcmdWithAString.hh"
46 #include "G4ios.hh"
47 #include "G4Tokenizer.hh"
48 
49 #include <sstream>
50 
51 G4ProductionCutsTableMessenger::G4ProductionCutsTableMessenger( G4ProductionCutsTable* pTable)
52  :theCutsTable(pTable)
53 {
54  // /cuts/ directory
55  theDirectory = new G4UIdirectory("/cuts/");
56  theDirectory->SetGuidance("Commands for G4VUserPhysicsList.");
57 
58  // /cuts/verbose command
59  verboseCmd = new G4UIcmdWithAnInteger("/cuts/verbose",this);
60  verboseCmd->SetGuidance("Set the Verbose level of G4ProductionCutsTable.");
61  verboseCmd->SetGuidance(" 0 : Silent (default)");
62  verboseCmd->SetGuidance(" 1 : Display warning messages");
63  verboseCmd->SetGuidance(" 2 : Display more info");
64  verboseCmd->SetGuidance(" 2 : Display debug info");
65  verboseCmd->SetParameterName("level",true);
66  verboseCmd->SetDefaultValue(0);
67  verboseCmd->SetRange("level >=0 && level <=3");
68 
69  // /cuts/setLowEdge command
70  setLowEdgeCmd = new G4UIcmdWithADoubleAndUnit("/cuts/setLowEdge",this);
71  setLowEdgeCmd->SetGuidance("Set low edge energy value ");
72  setLowEdgeCmd->SetParameterName("edge",false);
73  setLowEdgeCmd->SetDefaultValue(0.99);
74  setLowEdgeCmd->SetRange("edge >0.0");
75  setLowEdgeCmd->SetDefaultUnit("keV");
76  setLowEdgeCmd->AvailableForStates(G4State_PreInit);
77 
78  // /cuts/setHighEdge command
79  setHighEdgeCmd = new G4UIcmdWithADoubleAndUnit("/cuts/setHighEdge",this);
80  setHighEdgeCmd->SetGuidance("Set high edge energy value ");
81  setHighEdgeCmd->SetParameterName("edge",false);
82  setHighEdgeCmd->SetDefaultValue(100.0);
83  setHighEdgeCmd->SetRange("edge >0.0");
84  setHighEdgeCmd->SetDefaultUnit("TeV");
85  setHighEdgeCmd->AvailableForStates(G4State_PreInit);
86 
87  // /cuts/setMaxCutEnergy command
88  setMaxEnergyCutCmd = new G4UIcmdWithADoubleAndUnit("/cuts/setMaxCutEnergy",this);
89  setMaxEnergyCutCmd->SetGuidance("Set maximum of cut energy value ");
90  setMaxEnergyCutCmd->SetParameterName("cut",false);
91  setMaxEnergyCutCmd->SetDefaultValue(10.0);
92  setMaxEnergyCutCmd->SetRange("cut >0.0");
93  setMaxEnergyCutCmd->SetDefaultUnit("GeV");
94  setMaxEnergyCutCmd->AvailableForStates(G4State_PreInit);
95 
96  // /cuts/dump command
97  dumpCmd = new G4UIcmdWithoutParameter("/cuts/dump",this);
98  dumpCmd->SetGuidance("Dump cuplues in ProductuinCutsTable. ");
99 
100 }
101 
103 {
104  delete dumpCmd;
105  delete setMaxEnergyCutCmd;
106  delete setHighEdgeCmd;
107  delete setLowEdgeCmd;
108  delete verboseCmd;
109  delete theDirectory;
110 }
111 
113  G4String newValue)
114 {
115  if( command==verboseCmd ) {
116  theCutsTable->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue));
117 
118  } else if( command==dumpCmd ){
119  theCutsTable-> DumpCouples();
120 
121  } else if( command==setLowEdgeCmd ){
122  G4double lowEdge = setLowEdgeCmd->GetNewDoubleValue(newValue);
124  theCutsTable->SetEnergyRange(lowEdge, highEdge);
125 
126  } else if( command==setHighEdgeCmd ){
127  G4double highEdge = setHighEdgeCmd->GetNewDoubleValue(newValue);
129  theCutsTable->SetEnergyRange(lowEdge, highEdge);
130 
131  } else if( command==setMaxEnergyCutCmd ){
132  G4double cut = setHighEdgeCmd->GetNewDoubleValue(newValue);
134 
135  }
136 }
137 
139 {
140  G4String cv;
141 
142  if( command==verboseCmd ){
143  cv = verboseCmd->ConvertToString(theCutsTable->GetVerboseLevel());
144 
145  } else if( command==setLowEdgeCmd ){
147  cv = setLowEdgeCmd->ConvertToString( lowEdge, "keV" );
148 
149  } else if( command==setHighEdgeCmd ){
151  cv = setHighEdgeCmd->ConvertToString( highEdge, "TeV" );
152 
153  } else if( command==setMaxEnergyCutCmd ){
155  cv = setMaxEnergyCutCmd->ConvertToString( cut, "GeV" );
156  }
157 
158 
159  return cv;
160 
161 }
162 
G4double GetHighEdgeEnergy() const
virtual void SetNewValue(G4UIcommand *command, G4String newValues)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetEnergyRange(G4double lowedge, G4double highedge)
static G4int GetNewIntValue(const char *paramString)
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:372
static G4double GetNewDoubleValue(const char *paramString)
virtual G4String GetCurrentValue(G4UIcommand *command)
void SetVerboseLevel(G4int value)
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:240
G4double GetLowEdgeEnergy() const
void SetDefaultUnit(const char *defUnit)
void SetDefaultValue(G4int defVal)
double G4double
Definition: G4Types.hh:76
void SetMaxEnergyCut(G4double value)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)