56 }
else if (first ==
"p") {
65void Replace(std::string& str,
const std::string& from,
const std::string& to) {
67 if (from.empty())
return;
69 while ((start_pos = str.find(from, start_pos)) != std::string::npos) {
70 str.replace(start_pos, from.length(), to);
71 start_pos += to.length();
93 Replace(newStr,
"UHNTYPE_", upperHnType);
104 Replace(newStr,
"LOBJECT", lowerObjectType);
111 Replace(newStr,
"UAXIS", upperAxis);
125std::unique_ptr<G4UIdirectory>
129 directory->SetGuidance(
Update(
"NDIM_D LOBJECT control"));
134std::unique_ptr<G4UIcommand>
138 parId->SetGuidance(
Update(
"OBJECT id"));
139 parId->SetParameterRange(
"id>=0");
141 std::unique_ptr<G4UIcommand> command(
143 command->SetGuidance(
Update(
"Get the address of the NDIM_D LOBJECT of given id"));
144 command->SetParameter(parId);
151std::unique_ptr<G4UIcommand>
155 parId->SetGuidance(
Update(
"OBJECT id"));
156 parId->SetParameterRange(
"id>=0");
159 parTitle->SetGuidance(
Update(
"OBJECT title"));
160 parTitle->SetDefaultValue(
"none");
162 std::unique_ptr<G4UIcommand> command(
164 command->SetGuidance(
Update(
"Set title for the NDIM_D LOBJECT of given id"));
165 command->SetParameter(parId);
166 command->SetParameter(parTitle);
174std::unique_ptr<G4UIcommand>
179 parId->SetGuidance(
Update(
"OBJECT id"));
180 parId->SetParameterRange(
"id>=0");
183 parNbins->SetGuidance(
"Number of bins");
186 parValMin->SetGuidance(
"Minimum value, expressed in unit");
189 parValMax->SetGuidance(
"Maximum value, expressed in unit");
192 parValUnit->SetGuidance(
"The unit applied to filled values and valMin, valMax");
193 parValUnit->SetDefaultValue(
"none");
196 parValFcn->SetParameterCandidates(
"log log10 exp none");
197 G4String fcnGuidance =
"The function applied to filled values (log, log10, exp, none).\n";
198 fcnGuidance +=
"Note that the unit parameter cannot be omitted in this case,\n";
199 fcnGuidance +=
"but none value should be used instead.";
200 parValFcn->SetGuidance(fcnGuidance);
201 parValFcn->SetDefaultValue(
"none");
203 auto parValBinScheme =
new G4UIparameter(
"valBinScheme",
's',
true);
204 parValBinScheme->SetParameterCandidates(
"linear log");
205 G4String binSchemeGuidance =
"The binning scheme (linear, log).\n";
207 +=
"Note that the unit and fcn parameters cannot be omitted in this case,\n";
208 binSchemeGuidance +=
"but none value should be used instead.";
209 parValBinScheme->SetGuidance(binSchemeGuidance);
210 parValBinScheme->SetDefaultValue(
"linear");
212 auto commandName =
Update(
"/analysis/HNTYPE_/setUAXIS", axis);
213 std::unique_ptr<G4UIcommand> command(
215 command->SetGuidance(
Update(
"Set parameters for the NDIM_D LOBJECT of given id:"));
216 command->SetGuidance(
217 Update(
" nAXISbins; AXISvalMin; AXISvalMax; AXISunit; AXISfunction; AXISbinScheme", axis));
218 command->SetParameter(parId);
219 command->SetParameter(parNbins);
220 command->SetParameter(parValMin);
221 command->SetParameter(parValMax);
222 command->SetParameter(parValUnit);
223 command->SetParameter(parValFcn);
224 command->SetParameter(parValBinScheme);
231 std::unique_ptr<G4UIcommand>
236 parId->SetGuidance(
Update(
"OBJECT id"));
237 parId->SetParameterRange(
"id>=0");
240 parValMin->SetGuidance(
Update(
"Minimum AXIS-value expressed in unit", axis));
243 parValMax->SetGuidance(
Update(
"Maximum AXIS-value expressed in unit", axis));
246 parValUnit->SetGuidance(
"The unit applied to filled values and valMin, valMax");
247 parValUnit->SetDefaultValue(
"none");
250 parValFcn->SetParameterCandidates(
"log log10 exp none");
251 G4String fcnGuidance =
"The function applied to filled values (log, log10, exp, none).\n";
252 fcnGuidance +=
"Note that the unit parameter cannot be omitted in this case,\n";
253 fcnGuidance +=
"but none value should be used instead.";
254 parValFcn->SetGuidance(fcnGuidance);
255 parValFcn->SetDefaultValue(
"none");
257 std::unique_ptr<G4UIcommand> command(
259 command->SetGuidance(
Update(
"Set parameters for the NDIM_D LOBJECT of #id:"));
260 command->SetGuidance(
261 Update(
" AXISvalMin; AXISvalMax; AXISunit; AXISfunction", axis));
262 command->SetParameter(parId);
263 command->SetParameter(parValMin);
264 command->SetParameter(parValMax);
265 command->SetParameter(parValUnit);
266 command->SetParameter(parValFcn);
273std::unique_ptr<G4UIcommand>
278 parId->SetGuidance(
Update(
"OBJECT id"));
279 parId->SetParameterRange(
"id>=0");
282 parAxis->SetGuidance(
Update(
"Histogram AXIS-axis title", axis));
284 std::unique_ptr<G4UIcommand> command(
286 command->SetGuidance(
Update(
"Set AXIS-axis title for the NDIM_D LOBJECT of given id", axis));
287 command->SetParameter(parId);
288 command->SetParameter(parAxis);
295std::unique_ptr<G4UIcommand>
300 parId->SetGuidance(
Update(
"OBJECT id"));
301 parId->SetParameterRange(
"id>=0");
304 parAxisLog->SetGuidance(
Update(
"Histogram AXIS-axis log scale", axis));
306 std::unique_ptr<G4UIcommand> command(
308 command->SetGuidance(
309 Update(
"Activate AXIS-axis log scale for plotting of the NDIM_D LOBJECT of given id", axis));
310 command->SetParameter(parId);
311 command->SetParameter(parAxisLog);
319 std::vector<G4String>& parameters,
320 G4int& counter)
const
325 data.
fSunit = parameters[counter++];
326 data.
fSfcn = parameters[counter++];
332 std::vector<G4String>& parameters,
333 G4int& counter)
const
337 data.
fSunit = parameters[counter++];
338 data.
fSfcn = parameters[counter++];
343 G4int nofParameters)
const
347 "\" parameters: " + to_string(nofParameters) +
349 fkClass,
"WarnAboutParameters");
356 "Command setX, setY, setZ must be called successively in this order.\n"
357 "Command was ignored.",
358 fkClass,
"WarnAboutSetCommands");
static constexpr double second
G4String Update(const G4String &str, const G4String &axis="") const
std::unique_ptr< G4UIdirectory > CreateHnDirectory() const
static constexpr std::string_view fkClass
std::unique_ptr< G4UIcommand > CreateSetBinsCommand(const G4String &axis, G4UImessenger *messenger) const
G4AnalysisMessengerHelper()=delete
void GetBinData(BinData &data, std::vector< G4String > ¶meters, G4int &counter) const
void GetValueData(ValueData &data, std::vector< G4String > ¶meters, G4int &counter) const
std::unique_ptr< G4UIcommand > CreateSetAxisLogCommand(const G4String &axis, G4UImessenger *messenger) const
std::unique_ptr< G4UIcommand > CreateGetCommand(G4UImessenger *messenger) const
void WarnAboutParameters(G4UIcommand *command, G4int nofParameters) const
std::unique_ptr< G4UIcommand > CreateSetAxisCommand(const G4String &axis, G4UImessenger *messenger) const
std::unique_ptr< G4UIcommand > CreateSetValuesCommand(const G4String &axis, G4UImessenger *messenger) const
std::unique_ptr< G4UIcommand > CreateSetTitleCommand(G4UImessenger *messenger) const
void WarnAboutSetCommands() const
std::size_t GetParameterEntries() const
static G4int ConvertToInt(const char *st)
static G4double ConvertToDouble(const char *st)
const G4String & GetCommandName() const
void Warn(const G4String &message, const std::string_view inClass, const std::string_view inFunction)
G4String to_lower_copy(G4String str)
Return lowercased copy of string.
G4String to_upper_copy(G4String str)
Return uppercase copy of string.
G4String ObjectType(const G4String &hnType)
void Replace(std::string &str, const std::string &from, const std::string &to)