48 fSetHnAsciiCmd(nullptr),
49 fSetHnActivationCmd(nullptr),
50 fSetHnActivationAllCmd(nullptr),
51 fSetHnPlottingCmd(nullptr),
52 fSetHnPlottingAllCmd(nullptr),
53 fSetHnFileNameCmd(nullptr),
54 fSetHnFileNameAllCmd(nullptr)
58 fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>(hnType);
62 SetHnActivationToAllCmd();
64 SetHnPlottingToAllCmd();
66 SetHnFileNameToAllCmd();
78void G4HnMessenger::SetHnAsciiCmd()
81 = G4Analysis::make_unique<G4UIcmdWithAnInteger>(fHelper->Update(
"/analysis/HNTYPE_/setAscii"),
this);
82 fSetHnAsciiCmd->SetGuidance(
83 fHelper->Update(
"Print NDIM_D LOBJECT of given id on ascii file."));
85 fSetHnAsciiCmd->SetParameterName(
"id",
false);
86 fSetHnAsciiCmd->SetRange(
"id>=0");
91void G4HnMessenger::SetHnActivationCmd()
94 hnId->SetGuidance(fHelper->Update(
"OBJECT id"));
95 hnId->SetParameterRange(
"id>=0");
97 auto hnActivation =
new G4UIparameter(
"hnActivation",
's',
true);
98 hnActivation->SetGuidance(fHelper->Update(
"OBJECT activation"));
99 hnActivation->SetDefaultValue(
"none");
102 = G4Analysis::make_unique<G4UIcommand>(fHelper->Update(
"/analysis/HNTYPE_/setActivation"),
this);
103 fSetHnActivationCmd->SetGuidance(
104 fHelper->Update(
"Set activation for the NDIM_D LOBJECT of given id"));
105 fSetHnActivationCmd->SetParameter(hnId);
106 fSetHnActivationCmd->SetParameter(hnActivation);
111void G4HnMessenger::SetHnActivationToAllCmd()
113 fSetHnActivationAllCmd
114 = G4Analysis::make_unique<G4UIcmdWithABool>(fHelper->Update(
"/analysis/HNTYPE_/setActivationToAll"),
this);
115 fSetHnActivationAllCmd->SetGuidance(
116 fHelper->Update(
"Set activation to all NDIM_D LOBJECTs"));
117 fSetHnActivationAllCmd->SetParameterName(
"Activation",
false);
121void G4HnMessenger::SetHnPlottingCmd()
124 hnId->SetGuidance(fHelper->Update(
"OBJECT id"));
125 hnId->SetParameterRange(
"id>=0");
127 auto hnPlotting =
new G4UIparameter(
"hnPlotting",
's',
true);
128 hnPlotting->SetGuidance(fHelper->Update(
"(In)Activate OBJECT plotting"));
129 hnPlotting->SetDefaultValue(
"none");
132 = G4Analysis::make_unique<G4UIcommand>(fHelper->Update(
"/analysis/HNTYPE_/setPlotting"),
this);
133 fSetHnPlottingCmd->SetGuidance(
134 fHelper->Update(
"(In)Activate batch plotting of the NDIM_D LOBJECT of given id"));
135 fSetHnPlottingCmd->SetParameter(hnId);
136 fSetHnPlottingCmd->SetParameter(hnPlotting);
141void G4HnMessenger::SetHnPlottingToAllCmd()
144 = G4Analysis::make_unique<G4UIcmdWithABool>(fHelper->Update(
"/analysis/HNTYPE_/setPlottingToAll"),
this);
145 fSetHnPlottingAllCmd->SetGuidance(
146 fHelper->Update(
"(In)Activate batch plotting of all NDIM_D LOBJECTs"));
147 fSetHnPlottingAllCmd->SetParameterName(
"Plotting",
false);
151void G4HnMessenger::SetHnFileNameCmd()
154 hnId->SetGuidance(fHelper->Update(
"OBJECT id"));
155 hnId->SetParameterRange(
"id>=0");
157 auto hnFileName =
new G4UIparameter(
"hnFileName",
's',
true);
158 hnFileName->SetGuidance(fHelper->Update(
"OBJECT output file name"));
159 hnFileName->SetDefaultValue(
"none");
162 = G4Analysis::make_unique<G4UIcommand>(fHelper->Update(
"/analysis/HNTYPE_/setFileName"),
this);
163 fSetHnFileNameCmd->SetGuidance(
164 fHelper->Update(
"Set the NDIM_D LOBJECT of given id output file name"));
165 fSetHnFileNameCmd->SetParameter(hnId);
166 fSetHnFileNameCmd->SetParameter(hnFileName);
171void G4HnMessenger::SetHnFileNameToAllCmd()
174 = G4Analysis::make_unique<G4UIcmdWithAString>(fHelper->Update(
"/analysis/HNTYPE_/setFileNameToAll"),
this);
175 fSetHnFileNameAllCmd->SetGuidance(
176 fHelper->Update(
"Set output file name for all NDIM_D LOBJECTs"));
177 fSetHnFileNameAllCmd->SetParameterName(
"FileName",
false);
187 if ( command == fSetHnAsciiCmd.get() ) {
188 auto id = fSetHnAsciiCmd->GetNewIntValue(newValues);
191 else if ( command == fSetHnActivationCmd.get() ) {
193 std::vector<G4String> parameters;
204 fHelper->WarnAboutParameters(command, parameters.size());
207 else if ( command == fSetHnActivationAllCmd.get() ) {
208 auto activation = fSetHnActivationAllCmd->GetNewBoolValue(newValues);
211 else if ( command == fSetHnPlottingCmd.get() ) {
213 std::vector<G4String> parameters;
224 fHelper->WarnAboutParameters(command, parameters.size());
227 else if ( command == fSetHnPlottingAllCmd.get() ) {
228 auto activation = fSetHnPlottingAllCmd->GetNewBoolValue(newValues);
231 else if ( command == fSetHnFileNameCmd.get() ) {
233 std::vector<G4String> parameters;
239 auto fileName = parameters[counter++];
244 fHelper->WarnAboutParameters(command, parameters.size());
247 else if ( command == fSetHnFileNameAllCmd.get() ) {
248 auto fileName = newValues;
void SetActivation(G4bool activation)
void SetFileName(G4int id, const G4String &fileName)
void SetAscii(G4int id, G4bool ascii)
G4String GetHnType() const
void SetPlotting(G4int id, G4bool plotting)
G4HnMessenger(G4HnManager &manager)
virtual void SetNewValue(G4UIcommand *command, G4String value) final
std::size_t GetParameterEntries() const
static G4int ConvertToInt(const char *st)
static G4bool ConvertToBool(const char *st)
void Tokenize(const G4String &line, std::vector< G4String > &tokens)