40 fHnType(manager.GetHnType())
44 SetHnActivationToAllCmd();
46 SetHnPlottingToAllCmd();
48 SetHnFileNameToAllCmd();
59G4String G4HnMessenger::GetObjectType()
const
61 return (fHnType[0] ==
'h') ?
62 fHnType.substr(1,1) +
"D histogram" :
63 fHnType.substr(1,1) +
"D profile";
67void G4HnMessenger::AddIdParameter(
G4UIcommand& command)
70 htId->SetGuidance(
"Histogram id");
71 htId->SetParameterRange(
"id>=0");
79 auto guidance = GetObjectType() +
" " + optionName +
" option";
80 param->SetGuidance(guidance.c_str());
81 param->SetDefaultValue(
"true");
86void G4HnMessenger::SetHnAsciiCmd()
89 CreateCommand<G4UIcommand>(
"setAscii",
"Print on ascii file the ");
91 AddIdParameter(*fSetAsciiCmd);
92 AddOptionParameter(*fSetAsciiCmd,
"hnAscii");
97void G4HnMessenger::SetHnActivationCmd()
100 CreateCommand<G4UIcommand>(
"setActivation",
"Set activation to the ");
102 AddIdParameter(*fSetActivationCmd);
103 AddOptionParameter(*fSetActivationCmd,
"hnActivation");
107void G4HnMessenger::SetHnActivationToAllCmd()
109 fSetActivationAllCmd =
110 CreateCommand<G4UIcmdWithABool>(
111 "setActivationToAll",
"Set activation to all");
112 fSetActivationAllCmd->SetParameterName(
"Activation",
false);
116void G4HnMessenger::SetHnPlottingCmd()
119 CreateCommand<G4UIcommand>(
"setPlotting",
"(In)Activate batch plotting of the ");
121 AddIdParameter(*fSetPlottingCmd);
122 AddOptionParameter(*fSetPlottingCmd,
"hnPlotting");
126void G4HnMessenger::SetHnPlottingToAllCmd()
129 CreateCommand<G4UIcmdWithABool>(
130 "setPlottingToAll",
"(In)Activate batch plotting of all ");
131 fSetPlottingAllCmd->SetParameterName(
"Plotting",
false);
135void G4HnMessenger::SetHnFileNameCmd()
138 CreateCommand<G4UIcommand>(
"setFileName",
"Set the output file name for the ");
140 AddIdParameter(*fSetFileNameCmd);
143 auto guidance = GetObjectType() +
" output file name";
144 param->SetGuidance(guidance.c_str());
145 fSetFileNameCmd->SetParameter(param);
149void G4HnMessenger::SetHnFileNameToAllCmd()
152 CreateCommand<G4UIcmdWithAString>(
153 "setFileNameToAll",
"Set output file name for all ");
154 fSetFileNameAllCmd->SetParameterName(
"FileName",
false);
165 if ( command == fSetActivationAllCmd.get() ) {
166 fManager.
SetActivation(fSetActivationAllCmd->GetNewBoolValue(newValues));
170 if ( command == fSetPlottingAllCmd.get() ) {
171 fManager.
SetPlotting(fSetPlottingAllCmd->GetNewBoolValue(newValues));
175 if ( command == fSetFileNameAllCmd.get() ) {
181 std::vector<G4String> parameters;
188 "\" parameters: " + std::to_string(parameters.size()) +
190 fkClass,
"WarnAboutParameters");
197 if ( command == fSetAsciiCmd.get() ) {
202 if ( command == fSetActivationCmd.get() ) {
207 if ( command == fSetPlottingCmd.get() ) {
212 if ( command == fSetFileNameCmd.get() ) {
void SetActivation(G4bool activation)
void SetFileName(G4int id, const G4String &fileName)
void SetAscii(G4int id, G4bool ascii)
void SetPlotting(G4int id, G4bool plotting)
~G4HnMessenger() override
void SetNewValue(G4UIcommand *command, G4String value) final
std::size_t GetParameterEntries() const
void SetParameter(G4UIparameter *const newParameter)
static G4int ConvertToInt(const char *st)
static G4bool ConvertToBool(const char *st)
const G4String & GetCommandName() const
void Tokenize(const G4String &line, std::vector< G4String > &tokens)
void Warn(const G4String &message, const std::string_view inClass, const std::string_view inFunction)