57 }
else if (first ==
"p") {
66 void Replace(std::string& str,
const std::string& from,
const std::string& to) {
68 if (from.empty())
return;
70 while ((start_pos = str.find(from, start_pos)) != std::string::npos) {
71 str.
replace(start_pos, from.length(), to);
72 start_pos += to.length();
99 Replace(newStr,
"UHNTYPE_", upperHnType);
102 Replace(newStr,
"HNTYPE_",
fHnType);
106 Replace(newStr,
"NDIM_", second);
111 Replace(newStr,
"LOBJECT", lowerObjectType);
114 Replace(newStr,
"OBJECT", ObjectType(
fHnType));
119 Replace(newStr,
"UAXIS", upperAxis);
122 Replace(newStr,
"AXIS", axis);
133 std::unique_ptr<G4UIdirectory>
137 directory->SetGuidance(
Update(
"NDIM_D LOBJECT control"));
142 std::unique_ptr<G4UIcommand>
146 parId->SetGuidance(
Update(
"OBJECT id"));
147 parId->SetParameterRange(
"id>=0");
150 parTitle->SetGuidance(
Update(
"OBJECT title"));
151 parTitle->SetDefaultValue(
"none");
153 std::unique_ptr<G4UIcommand> command(
155 command->SetGuidance(
Update(
"Set title for the NDIM_D LOBJECT of given id"));
156 command->SetParameter(parId);
157 command->SetParameter(parTitle);
165 std::unique_ptr<G4UIcommand>
170 parId->SetGuidance(
Update(
"OBJECT id"));
171 parId->SetParameterRange(
"id>=0");
174 parNbins->SetGuidance(
"Number of bins");
177 parValMin->SetGuidance(
"Minimum value, expressed in unit");
180 parValMax->SetGuidance(
"Maximum value, expressed in unit");
183 parValUnit->SetGuidance(
"The unit applied to filled values and valMin, valMax");
184 parValUnit->SetDefaultValue(
"none");
187 parValFcn->SetParameterCandidates(
"log log10 exp none");
188 G4String fcnGuidance =
"The function applied to filled values (log, log10, exp, none).\n";
189 fcnGuidance +=
"Note that the unit parameter cannot be omitted in this case,\n";
190 fcnGuidance +=
"but none value should be used instead.";
191 parValFcn->SetGuidance(fcnGuidance);
192 parValFcn->SetDefaultValue(
"none");
194 auto parValBinScheme =
new G4UIparameter(
"valBinScheme",
's',
true);
195 parValBinScheme->SetParameterCandidates(
"linear log");
196 G4String binSchemeGuidance =
"The binning scheme (linear, log).\n";
198 +=
"Note that the unit and fcn parameters cannot be omitted in this case,\n";
199 binSchemeGuidance +=
"but none value should be used instead.";
200 parValBinScheme->SetGuidance(binSchemeGuidance);
201 parValBinScheme->SetDefaultValue(
"linear");
203 std::unique_ptr<G4UIcommand> command(
205 command->SetGuidance(
Update(
"Set parameters for the NDIM_D LOBJECT of given id:"));
206 command->SetGuidance(
207 Update(
" nAXISbins; AXISvalMin; AXISvalMax; AXISunit; AXISfunction; AXISbinScheme", axis));
208 command->SetParameter(parId);
209 command->SetParameter(parNbins);
210 command->SetParameter(parValMin);
211 command->SetParameter(parValMax);
212 command->SetParameter(parValUnit);
213 command->SetParameter(parValFcn);
214 command->SetParameter(parValBinScheme);
221 std::unique_ptr<G4UIcommand>
226 parId->SetGuidance(
Update(
"OBJECT id"));
227 parId->SetParameterRange(
"id>=0");
230 parValMin->SetGuidance(
Update(
"Minimum AXIS-value expressed in unit", axis));
233 parValMax->SetGuidance(
Update(
"Maximum AXIS-value expressed in unit", axis));
236 parValUnit->SetGuidance(
"The unit applied to filled values and valMin, valMax");
237 parValUnit->SetDefaultValue(
"none");
240 parValFcn->SetParameterCandidates(
"log log10 exp none");
241 G4String fcnGuidance =
"The function applied to filled values (log, log10, exp, none).\n";
242 fcnGuidance +=
"Note that the unit parameter cannot be omitted in this case,\n";
243 fcnGuidance +=
"but none value should be used instead.";
244 parValFcn->SetGuidance(fcnGuidance);
245 parValFcn->SetDefaultValue(
"none");
247 std::unique_ptr<G4UIcommand> command(
249 command->SetGuidance(
Update(
"Set parameters for the NDIM_D LOBJECT of #id:"));
250 command->SetGuidance(
251 Update(
" AXISvalMin; AXISvalMax; AXISunit; AXISfunction", axis));
258 std::unique_ptr<G4UIcommand>
263 parId->SetGuidance(
Update(
"OBJECT id"));
264 parId->SetParameterRange(
"id>=0");
267 parAxis->SetGuidance(
Update(
"Histogram AXIS-axis title", axis));
268 parAxis->SetDefaultValue(
"none");
270 std::unique_ptr<G4UIcommand> command(
272 command->SetGuidance(
Update(
"Set AXIS-axis title for the NDIM_D LOBJECT of given id", axis));
273 command->SetParameter(parId);
274 command->SetParameter(parAxis);
282 std::vector<G4String>& parameters,
283 G4int& counter)
const
288 data.
fSunit = parameters[counter++];
289 data.
fSfcn = parameters[counter++];
295 std::vector<G4String>& parameters,
296 G4int& counter)
const
300 data.
fSunit = parameters[counter++];
301 data.
fSfcn = parameters[counter++];
306 G4int nofParameters)
const
311 <<
"\" parameters: " << nofParameters
324 <<
"Command setX, setY, setZ must be called sucessively in this order. " <<
G4endl
325 <<
"Command was ignored." <<
G4endl;
G4String Update(const G4String &str, const G4String &axis="") const
void WarnAboutParameters(G4UIcommand *command, G4int nofParameters) const
std::ostringstream G4ExceptionDescription
std::unique_ptr< G4UIcommand > CreateSetValuesCommand(const G4String &axis, G4UImessenger *messenger) const
std::unique_ptr< G4UIcommand > CreateSetAxisCommand(const G4String &axis, G4UImessenger *messenger) const
std::unique_ptr< G4UIcommand > CreateSetBinsCommand(const G4String &axis, G4UImessenger *messenger) const
void WarnAboutSetCommands() const
G4String & replace(unsigned int, unsigned int, const char *, unsigned int)
static G4double ConvertToDouble(const char *st)
static const double second
std::unique_ptr< G4UIcommand > CreateSetTitleCommand(G4UImessenger *messenger) const
~G4AnalysisMessengerHelper()
static G4int ConvertToInt(const char *st)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
const G4String & GetCommandName() const
G4AnalysisMessengerHelper(const G4String &hnType)
void GetBinData(BinData &data, std::vector< G4String > ¶meters, G4int &counter) const
G4int GetParameterEntries() const
void GetValueData(ValueData &data, std::vector< G4String > ¶meters, G4int &counter) const
std::unique_ptr< G4UIdirectory > CreateHnDirectory() const