Geant4-11
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
G4ProductionCutsTableMessenger Class Reference

#include <G4ProductionCutsTableMessenger.hh>

Inheritance diagram for G4ProductionCutsTableMessenger:
G4UImessenger

Public Member Functions

G4bool CommandsShouldBeInMaster () const
 
 G4ProductionCutsTableMessenger (const G4ProductionCutsTableMessenger &)=delete
 
 G4ProductionCutsTableMessenger (G4ProductionCutsTable *pTable)
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4ProductionCutsTableMessengeroperator= (const G4ProductionCutsTableMessenger &)=delete
 
G4bool operator== (const G4UImessenger &messenger) const
 
virtual void SetNewValue (G4UIcommand *command, G4String newValues)
 
virtual ~G4ProductionCutsTableMessenger ()
 

Protected Member Functions

void AddUIcommand (G4UIcommand *newCommand)
 
G4String BtoS (G4bool b)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
G4String DtoS (G4double a)
 
G4String ItoS (G4int i)
 
G4bool StoB (G4String s)
 
G4double StoD (G4String s)
 
G4int StoI (G4String s)
 
G4long StoL (G4String s)
 

Protected Attributes

G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 
G4ProductionCutsTabletheCutsTable = nullptr
 

Private Member Functions

 G4ProductionCutsTableMessenger ()
 

Private Attributes

G4UIcmdWithoutParameterdumpCmd = nullptr
 
G4UIcmdWithADoubleAndUnitsetHighEdgeCmd = nullptr
 
G4UIcmdWithADoubleAndUnitsetLowEdgeCmd = nullptr
 
G4UIcmdWithADoubleAndUnitsetMaxEnergyCutCmd = nullptr
 
G4UIdirectorytheDirectory = nullptr
 
G4UIcmdWithAnIntegerverboseCmd = nullptr
 

Detailed Description

Definition at line 57 of file G4ProductionCutsTableMessenger.hh.

Constructor & Destructor Documentation

◆ G4ProductionCutsTableMessenger() [1/3]

G4ProductionCutsTableMessenger::G4ProductionCutsTableMessenger ( G4ProductionCutsTable pTable)

Definition at line 45 of file G4ProductionCutsTableMessenger.cc.

47 : theCutsTable(pTable)
48{
49 // /cuts/ directory
50 theDirectory = new G4UIdirectory("/cuts/");
51 theDirectory->SetGuidance("Commands for G4VUserPhysicsList.");
52
53 // /cuts/verbose command
54 verboseCmd = new G4UIcmdWithAnInteger("/cuts/verbose",this);
55 verboseCmd->SetGuidance("Set the Verbose level of G4ProductionCutsTable.");
56 verboseCmd->SetGuidance(" 0 : Silent (default)");
57 verboseCmd->SetGuidance(" 1 : Display warning messages");
58 verboseCmd->SetGuidance(" 2 : Display more info");
59 verboseCmd->SetGuidance(" 2 : Display debug info");
60 verboseCmd->SetParameterName("level",true);
62 verboseCmd->SetRange("level >=0 && level <=3");
63
64 // /cuts/setLowEdge command
65 setLowEdgeCmd = new G4UIcmdWithADoubleAndUnit("/cuts/setLowEdge",this);
66 setLowEdgeCmd->SetGuidance("Set low edge energy value ");
67 setLowEdgeCmd->SetParameterName("edge",false);
69 setLowEdgeCmd->SetRange("edge >0.0");
72
73 // /cuts/setHighEdge command
74 setHighEdgeCmd = new G4UIcmdWithADoubleAndUnit("/cuts/setHighEdge",this);
75 setHighEdgeCmd->SetGuidance("Set high edge energy value ");
76 setHighEdgeCmd->SetParameterName("edge",false);
78 setHighEdgeCmd->SetRange("edge >0.0");
81
82 // /cuts/setMaxCutEnergy command
83 setMaxEnergyCutCmd = new G4UIcmdWithADoubleAndUnit("/cuts/setMaxCutEnergy",this);
84 setMaxEnergyCutCmd->SetGuidance("Set maximum of cut energy value ");
87 setMaxEnergyCutCmd->SetRange("cut >0.0");
90
91 // /cuts/dump command
92 dumpCmd = new G4UIcmdWithoutParameter("/cuts/dump",this);
93 dumpCmd->SetGuidance("Dump couples in G4ProductionCutsTable. ");
94}
@ G4State_PreInit
G4UIcmdWithADoubleAndUnit * setMaxEnergyCutCmd
void SetDefaultUnit(const char *defUnit)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4int defVal)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
void SetRange(const char *rs)
Definition: G4UIcommand.hh:120
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:288

References G4UIcommand::AvailableForStates(), dumpCmd, G4State_PreInit, G4UIcmdWithADoubleAndUnit::SetDefaultUnit(), G4UIcmdWithADoubleAndUnit::SetDefaultValue(), G4UIcmdWithAnInteger::SetDefaultValue(), G4UIcommand::SetGuidance(), setHighEdgeCmd, setLowEdgeCmd, setMaxEnergyCutCmd, G4UIcmdWithADoubleAndUnit::SetParameterName(), G4UIcmdWithAnInteger::SetParameterName(), G4UIcommand::SetRange(), theDirectory, and verboseCmd.

◆ ~G4ProductionCutsTableMessenger()

G4ProductionCutsTableMessenger::~G4ProductionCutsTableMessenger ( )
virtual

Definition at line 97 of file G4ProductionCutsTableMessenger.cc.

98{
99 delete dumpCmd;
100 delete setMaxEnergyCutCmd;
101 delete setHighEdgeCmd;
102 delete setLowEdgeCmd;
103 delete verboseCmd;
104 delete theDirectory;
105}

References dumpCmd, setHighEdgeCmd, setLowEdgeCmd, setMaxEnergyCutCmd, theDirectory, and verboseCmd.

◆ G4ProductionCutsTableMessenger() [2/3]

G4ProductionCutsTableMessenger::G4ProductionCutsTableMessenger ( const G4ProductionCutsTableMessenger )
delete

◆ G4ProductionCutsTableMessenger() [3/3]

G4ProductionCutsTableMessenger::G4ProductionCutsTableMessenger ( )
inlineprivate

Definition at line 77 of file G4ProductionCutsTableMessenger.hh.

77{}

Member Function Documentation

◆ AddUIcommand()

void G4UImessenger::AddUIcommand ( G4UIcommand newCommand)
protectedinherited

Definition at line 149 of file G4UImessenger.cc.

150{
151 G4cerr << "Warning : Old style definition of G4UIcommand <"
152 << newCommand->GetCommandPath() << ">." << G4endl;
153}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:136

References G4cerr, G4endl, and G4UIcommand::GetCommandPath().

◆ BtoS()

G4String G4UImessenger::BtoS ( G4bool  b)
protectedinherited

Definition at line 98 of file G4UImessenger.cc.

99{
100 G4String vl = "0";
101 if(b)
102 vl = "true";
103 return vl;
104}

◆ CommandsShouldBeInMaster()

G4bool G4UImessenger::CommandsShouldBeInMaster ( ) const
inlineinherited

Definition at line 77 of file G4UImessenger.hh.

78 {
80 }
G4bool commandsShouldBeInMaster

References G4UImessenger::commandsShouldBeInMaster.

Referenced by G4UIcommand::G4UIcommandCommonConstructorCode().

◆ CreateCommand()

template<typename T >
T * G4UImessenger::CreateCommand ( const G4String cname,
const G4String dsc 
)
protectedinherited

Definition at line 110 of file G4UImessenger.hh.

111{
112 G4String path;
113 if(cname[0] != '/')
114 {
115 path = baseDirName + cname;
116 if(path[0] != '/')
117 path = "/" + path;
118 }
119
120 T* command = new T(path.c_str(), this);
121 command->SetGuidance(dsc.c_str());
122
123 return command;
124}
G4String baseDirName

References G4UImessenger::baseDirName.

◆ CreateDirectory()

void G4UImessenger::CreateDirectory ( const G4String path,
const G4String dsc,
G4bool  commandsToBeBroadcasted = true 
)
protectedinherited

Definition at line 156 of file G4UImessenger.cc.

158{
160
161 G4String fullpath = path;
162 if(fullpath.back() != '/')
163 fullpath.append("/");
164
165 G4UIcommandTree* tree = ui->GetTree()->FindCommandTree(fullpath.c_str());
166 if(tree != nullptr)
167 {
168 baseDirName = tree->GetPathName();
169 }
170 else
171 {
172 baseDir = new G4UIdirectory(fullpath.c_str(), commandsToBeBroadcasted);
173 baseDirName = fullpath;
174 baseDir->SetGuidance(dsc.c_str());
175 }
176}
const G4String & GetPathName() const
G4UIcommandTree * FindCommandTree(const char *commandPath)
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:186
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
G4UIdirectory * baseDir

References G4UImessenger::baseDir, G4UImessenger::baseDirName, G4UIcommandTree::FindCommandTree(), G4UIcommandTree::GetPathName(), G4UImanager::GetTree(), G4UImanager::GetUIpointer(), and G4UIcommand::SetGuidance().

Referenced by G4MoleculeShootMessenger::G4MoleculeShootMessenger(), and G4UImessenger::G4UImessenger().

◆ DtoS()

G4String G4UImessenger::DtoS ( G4double  a)
protectedinherited

Definition at line 90 of file G4UImessenger.cc.

91{
92 std::ostringstream os;
93 os << a;
94 return G4String(os.str());
95}

Referenced by G4ScoreQuantityMessenger::FilterCommands(), and G4UIcontrolMessenger::SetNewValue().

◆ GetCurrentValue()

G4String G4ProductionCutsTableMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 139 of file G4ProductionCutsTableMessenger.cc.

140{
141 G4String cv;
142
143 if( command==verboseCmd )
144 {
146 }
147 else if( command==setLowEdgeCmd )
148 {
150 cv = setLowEdgeCmd->ConvertToString( lowEdge, "keV" );
151 }
152 else if( command==setHighEdgeCmd )
153 {
155 cv = setHighEdgeCmd->ConvertToString( highEdge, "TeV" );
156 }
157 else if( command==setMaxEnergyCutCmd )
158 {
160 cv = setMaxEnergyCutCmd->ConvertToString( cut, "GeV" );
161 }
162
163 return cv;
164}
double G4double
Definition: G4Types.hh:83
G4double GetLowEdgeEnergy() const
G4double GetHighEdgeEnergy() const
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:445

References G4UIcommand::ConvertToString(), G4ProductionCutsTable::GetHighEdgeEnergy(), G4ProductionCutsTable::GetLowEdgeEnergy(), G4ProductionCutsTable::GetMaxEnergyCut(), G4ProductionCutsTable::GetVerboseLevel(), setHighEdgeCmd, setLowEdgeCmd, setMaxEnergyCutCmd, theCutsTable, and verboseCmd.

◆ ItoS()

G4String G4UImessenger::ItoS ( G4int  i)
protectedinherited

Definition at line 82 of file G4UImessenger.cc.

83{
84 std::ostringstream os;
85 os << i;
86 return G4String(os.str());
87}

Referenced by G4GenericMessenger::DeclareMethod(), and G4ParticleGunMessenger::GetCurrentValue().

◆ operator!=()

G4bool G4UImessenger::operator!= ( const G4UImessenger messenger) const
inherited

Definition at line 76 of file G4UImessenger.cc.

77{
78 return this != &messenger;
79}

◆ operator=()

G4ProductionCutsTableMessenger & G4ProductionCutsTableMessenger::operator= ( const G4ProductionCutsTableMessenger )
delete

◆ operator==()

G4bool G4UImessenger::operator== ( const G4UImessenger messenger) const
inherited

Definition at line 70 of file G4UImessenger.cc.

71{
72 return this == &messenger;
73}

◆ SetNewValue()

void G4ProductionCutsTableMessenger::SetNewValue ( G4UIcommand command,
G4String  newValues 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 108 of file G4ProductionCutsTableMessenger.cc.

110{
111 if( command==verboseCmd )
112 {
114 }
115 else if( command==dumpCmd )
116 {
117 theCutsTable-> DumpCouples();
118 }
119 else if( command==setLowEdgeCmd )
120 {
121 G4double lowEdge = setLowEdgeCmd->GetNewDoubleValue(newValue);
123 theCutsTable->SetEnergyRange(lowEdge, highEdge);
124 }
125 else if( command==setHighEdgeCmd )
126 {
127 G4double highEdge = setHighEdgeCmd->GetNewDoubleValue(newValue);
129 theCutsTable->SetEnergyRange(lowEdge, highEdge);
130 }
131 else if( command==setMaxEnergyCutCmd )
132 {
133 G4double cut = setHighEdgeCmd->GetNewDoubleValue(newValue);
135 }
136}
void SetMaxEnergyCut(G4double value)
void SetVerboseLevel(G4int value)
void SetEnergyRange(G4double lowedge, G4double highedge)
static G4double GetNewDoubleValue(const char *paramString)
static G4int GetNewIntValue(const char *paramString)

References dumpCmd, G4ProductionCutsTable::GetHighEdgeEnergy(), G4ProductionCutsTable::GetLowEdgeEnergy(), G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(), G4UIcmdWithAnInteger::GetNewIntValue(), G4ProductionCutsTable::SetEnergyRange(), setHighEdgeCmd, setLowEdgeCmd, G4ProductionCutsTable::SetMaxEnergyCut(), setMaxEnergyCutCmd, G4ProductionCutsTable::SetVerboseLevel(), theCutsTable, and verboseCmd.

◆ StoB()

G4bool G4UImessenger::StoB ( G4String  s)
protectedinherited

Definition at line 137 of file G4UImessenger.cc.

138{
140 G4bool vl = false;
141 if(v == "Y" || v == "YES" || v == "1" || v == "T" || v == "TRUE")
142 {
143 vl = true;
144 }
145 return vl;
146}
bool G4bool
Definition: G4Types.hh:86
G4String to_upper_copy(G4String str)
Return uppercase copy of string.

References G4StrUtil::to_upper_copy().

Referenced by G4LocalThreadCoutMessenger::SetNewValue(), G4CascadeParamMessenger::SetNewValue(), G4ScoreQuantityMessenger::SetNewValue(), and G4ScoringMessenger::SetNewValue().

◆ StoD()

G4double G4UImessenger::StoD ( G4String  s)
protectedinherited

◆ StoI()

G4int G4UImessenger::StoI ( G4String  s)
protectedinherited

◆ StoL()

G4long G4UImessenger::StoL ( G4String  s)
protectedinherited

Definition at line 117 of file G4UImessenger.cc.

118{
119 G4long vl;
120 const char* t = str;
121 std::istringstream is(t);
122 is >> vl;
123 return vl;
124}
long G4long
Definition: G4Types.hh:87

Referenced by G4RunMessenger::SetNewValue().

Field Documentation

◆ baseDir

G4UIdirectory* G4UImessenger::baseDir = nullptr
protectedinherited

◆ baseDirName

G4String G4UImessenger::baseDirName = ""
protectedinherited

◆ commandsShouldBeInMaster

G4bool G4UImessenger::commandsShouldBeInMaster = false
protectedinherited

◆ dumpCmd

G4UIcmdWithoutParameter* G4ProductionCutsTableMessenger::dumpCmd = nullptr
private

◆ setHighEdgeCmd

G4UIcmdWithADoubleAndUnit* G4ProductionCutsTableMessenger::setHighEdgeCmd = nullptr
private

◆ setLowEdgeCmd

G4UIcmdWithADoubleAndUnit* G4ProductionCutsTableMessenger::setLowEdgeCmd = nullptr
private

◆ setMaxEnergyCutCmd

G4UIcmdWithADoubleAndUnit* G4ProductionCutsTableMessenger::setMaxEnergyCutCmd = nullptr
private

◆ theCutsTable

G4ProductionCutsTable* G4ProductionCutsTableMessenger::theCutsTable = nullptr
protected

Definition at line 73 of file G4ProductionCutsTableMessenger.hh.

Referenced by GetCurrentValue(), and SetNewValue().

◆ theDirectory

G4UIdirectory* G4ProductionCutsTableMessenger::theDirectory = nullptr
private

◆ verboseCmd

G4UIcmdWithAnInteger* G4ProductionCutsTableMessenger::verboseCmd = nullptr
private

The documentation for this class was generated from the following files: