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();
97 upperHnType.toUpper();
98 Replace(newStr,
"UHNTYPE_", upperHnType);
101 Replace(newStr,
"HNTYPE_", fHnType);
104 G4String second = fHnType.substr(1,1);
105 Replace(newStr,
"NDIM_", second);
108 G4String lowerObjectType(ObjectType(fHnType));
109 lowerObjectType.toLower();
110 Replace(newStr,
"LOBJECT", lowerObjectType);
113 Replace(newStr,
"OBJECT", ObjectType(fHnType));
118 Replace(newStr,
"UAXIS", upperAxis);
121 Replace(newStr,
"AXIS", axis);
132std::unique_ptr<G4UIdirectory>
135 std::unique_ptr<G4UIdirectory> directory(
new G4UIdirectory(Update(
"/analysis/HNTYPE_/")));
136 directory->SetGuidance(Update(
"NDIM_D LOBJECT control"));
141std::unique_ptr<G4UIcommand>
145 parId->SetGuidance(Update(
"OBJECT id"));
146 parId->SetParameterRange(
"id>=0");
149 parTitle->SetGuidance(Update(
"OBJECT title"));
150 parTitle->SetDefaultValue(
"none");
152 std::unique_ptr<G4UIcommand> command(
153 new G4UIcommand(Update(
"/analysis/HNTYPE_/setTitle"), messenger));
154 command->SetGuidance(Update(
"Set title for the NDIM_D LOBJECT of given id"));
155 command->SetParameter(parId);
156 command->SetParameter(parTitle);
164std::unique_ptr<G4UIcommand>
169 parId->SetGuidance(Update(
"OBJECT id"));
170 parId->SetParameterRange(
"id>=0");
173 parNbins->SetGuidance(
"Number of bins");
176 parValMin->SetGuidance(
"Minimum value, expressed in unit");
179 parValMax->SetGuidance(
"Maximum value, expressed in unit");
182 parValUnit->SetGuidance(
"The unit applied to filled values and valMin, valMax");
183 parValUnit->SetDefaultValue(
"none");
186 parValFcn->SetParameterCandidates(
"log log10 exp none");
187 G4String fcnGuidance =
"The function applied to filled values (log, log10, exp, none).\n";
188 fcnGuidance +=
"Note that the unit parameter cannot be omitted in this case,\n";
189 fcnGuidance +=
"but none value should be used instead.";
190 parValFcn->SetGuidance(fcnGuidance);
191 parValFcn->SetDefaultValue(
"none");
193 auto parValBinScheme =
new G4UIparameter(
"valBinScheme",
's',
true);
194 parValBinScheme->SetParameterCandidates(
"linear log");
195 G4String binSchemeGuidance =
"The binning scheme (linear, log).\n";
197 +=
"Note that the unit and fcn parameters cannot be omitted in this case,\n";
198 binSchemeGuidance +=
"but none value should be used instead.";
199 parValBinScheme->SetGuidance(binSchemeGuidance);
200 parValBinScheme->SetDefaultValue(
"linear");
202 auto commandName = Update(
"/analysis/HNTYPE_/setUAXIS", axis);
203 std::unique_ptr<G4UIcommand> command(
204 new G4UIcommand(Update(
"/analysis/HNTYPE_/setUAXIS", axis), messenger));
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(
248 new G4UIcommand(Update(
"/analysis/HNTYPE_/setUAXIS", axis), messenger));
249 command->SetGuidance(Update(
"Set parameters for the NDIM_D LOBJECT of #id:"));
250 command->SetGuidance(
251 Update(
" AXISvalMin; AXISvalMax; AXISunit; AXISfunction", axis));
252 command->SetParameter(parId);
253 command->SetParameter(parValMin);
254 command->SetParameter(parValMax);
255 command->SetParameter(parValUnit);
256 command->SetParameter(parValFcn);
263std::unique_ptr<G4UIcommand>
268 parId->SetGuidance(Update(
"OBJECT id"));
269 parId->SetParameterRange(
"id>=0");
272 parAxis->SetGuidance(Update(
"Histogram AXIS-axis title", axis));
274 std::unique_ptr<G4UIcommand> command(
275 new G4UIcommand(Update(
"/analysis/HNTYPE_/setUAXISaxis", axis), messenger));
276 command->SetGuidance(Update(
"Set AXIS-axis title for the NDIM_D LOBJECT of given id", axis));
277 command->SetParameter(parId);
278 command->SetParameter(parAxis);
285std::unique_ptr<G4UIcommand>
290 parId->SetGuidance(Update(
"OBJECT id"));
291 parId->SetParameterRange(
"id>=0");
294 parAxisLog->SetGuidance(Update(
"Histogram AXIS-axis log scale", axis));
296 std::unique_ptr<G4UIcommand> command(
297 new G4UIcommand(Update(
"/analysis/HNTYPE_/setUAXISaxisLog", axis), messenger));
298 command->SetGuidance(
299 Update(
"Activate AXIS-axis log scale for plotting of the NDIM_D LOBJECT of given id", axis));
300 command->SetParameter(parId);
301 command->SetParameter(parAxisLog);
309 std::vector<G4String>& parameters,
310 G4int& counter)
const
315 data.
fSunit = parameters[counter++];
316 data.
fSfcn = parameters[counter++];
322 std::vector<G4String>& parameters,
323 G4int& counter)
const
327 data.
fSunit = parameters[counter++];
328 data.
fSfcn = parameters[counter++];
333 G4int nofParameters)
const
338 <<
"\" parameters: " << nofParameters
341 G4String methodName(Update(
"G4UHNTYPE_Messenger::SetNewValue"));
351 <<
"Command setX, setY, setZ must be called successively in this order. " <<
G4endl
352 <<
"Command was ignored." <<
G4endl;
353 G4String methodName(Update(
"G4UHNTYPE_Messenger::SetNewValue"));
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
std::unique_ptr< G4UIdirectory > CreateHnDirectory() const
std::unique_ptr< G4UIcommand > CreateSetBinsCommand(const G4String &axis, G4UImessenger *messenger) const
G4AnalysisMessengerHelper(const G4String &hnType)
void GetBinData(BinData &data, std::vector< G4String > ¶meters, G4int &counter) const
~G4AnalysisMessengerHelper()
void GetValueData(ValueData &data, std::vector< G4String > ¶meters, G4int &counter) const
std::unique_ptr< G4UIcommand > CreateSetAxisLogCommand(const G4String &axis, 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
G4String & replace(unsigned int, unsigned int, const char *, unsigned int)
std::size_t GetParameterEntries() const
static G4int ConvertToInt(const char *st)
static G4double ConvertToDouble(const char *st)
const G4String & GetCommandName() const