47 using namespace G4Analysis;
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();
98 upperHnType.toUpper();
99 Replace(newStr,
"UHNTYPE_", upperHnType);
102 Replace(newStr,
"HNTYPE_", fHnType);
106 Replace(newStr,
"NDIM_", second);
109 G4String lowerObjectType(ObjectType(fHnType));
110 lowerObjectType.toLower();
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>
136 std::unique_ptr<G4UIdirectory> directory(
new G4UIdirectory(Update(
"/analysis/HNTYPE_/")));
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(
154 new G4UIcommand(Update(
"/analysis/HNTYPE_/setTitle"), messenger));
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 auto commandName = Update(
"/analysis/HNTYPE_/setUAXIS", axis);
204 std::unique_ptr<G4UIcommand> command(
205 new G4UIcommand(Update(
"/analysis/HNTYPE_/setUAXIS", axis), messenger));
206 command->SetGuidance(Update(
"Set parameters for the NDIM_D LOBJECT of given id:"));
207 command->SetGuidance(
208 Update(
" nAXISbins; AXISvalMin; AXISvalMax; AXISunit; AXISfunction; AXISbinScheme", axis));
209 command->SetParameter(parId);
210 command->SetParameter(parNbins);
211 command->SetParameter(parValMin);
212 command->SetParameter(parValMax);
213 command->SetParameter(parValUnit);
214 command->SetParameter(parValFcn);
215 command->SetParameter(parValBinScheme);
222 std::unique_ptr<G4UIcommand>
227 parId->SetGuidance(Update(
"OBJECT id"));
228 parId->SetParameterRange(
"id>=0");
231 parValMin->SetGuidance(Update(
"Minimum AXIS-value expressed in unit", axis));
234 parValMax->SetGuidance(Update(
"Maximum AXIS-value expressed in unit", axis));
237 parValUnit->SetGuidance(
"The unit applied to filled values and valMin, valMax");
238 parValUnit->SetDefaultValue(
"none");
241 parValFcn->SetParameterCandidates(
"log log10 exp none");
242 G4String fcnGuidance =
"The function applied to filled values (log, log10, exp, none).\n";
243 fcnGuidance +=
"Note that the unit parameter cannot be omitted in this case,\n";
244 fcnGuidance +=
"but none value should be used instead.";
245 parValFcn->SetGuidance(fcnGuidance);
246 parValFcn->SetDefaultValue(
"none");
248 std::unique_ptr<G4UIcommand> command(
249 new G4UIcommand(Update(
"/analysis/HNTYPE_/setUAXIS", axis), messenger));
250 command->SetGuidance(Update(
"Set parameters for the NDIM_D LOBJECT of #id:"));
251 command->SetGuidance(
252 Update(
" AXISvalMin; AXISvalMax; AXISunit; AXISfunction", axis));
253 command->SetParameter(parId);
254 command->SetParameter(parValMin);
255 command->SetParameter(parValMax);
256 command->SetParameter(parValUnit);
257 command->SetParameter(parValFcn);
264 std::unique_ptr<G4UIcommand>
269 parId->SetGuidance(Update(
"OBJECT id"));
270 parId->SetParameterRange(
"id>=0");
273 parAxis->SetGuidance(Update(
"Histogram AXIS-axis title", axis));
274 parAxis->SetDefaultValue(
"none");
276 std::unique_ptr<G4UIcommand> command(
277 new G4UIcommand(Update(
"/analysis/HNTYPE_/setUAXISaxis", axis), messenger));
278 command->SetGuidance(Update(
"Set AXIS-axis title for the NDIM_D LOBJECT of given id", axis));
279 command->SetParameter(parId);
280 command->SetParameter(parAxis);
288 std::vector<G4String>& parameters,
289 G4int& counter)
const
294 data.
fSunit = parameters[counter++];
295 data.
fSfcn = parameters[counter++];
301 std::vector<G4String>& parameters,
302 G4int& counter)
const
306 data.
fSunit = parameters[counter++];
307 data.
fSfcn = parameters[counter++];
312 G4int nofParameters)
const
317 <<
"\" parameters: " << nofParameters
320 G4String methodName(Update(
"G4UHNTYPE_Messenger::SetNewValue"));
330 <<
"Command setX, setY, setZ must be called sucessively in this order. " <<
G4endl
331 <<
"Command was ignored." <<
G4endl;
332 G4String methodName(Update(
"G4UHNTYPE_Messenger::SetNewValue"));
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
static constexpr double second
std::unique_ptr< G4UIcommand > CreateSetBinsCommand(const G4String &axis, G4UImessenger *messenger) const
void WarnAboutSetCommands() const
const XML_Char const XML_Char * data
G4String & replace(unsigned int, unsigned int, const char *, unsigned int)
static G4double ConvertToDouble(const char *st)
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