47 fCreateH3Cmd(nullptr),
52 fSetH3TitleCmd(nullptr),
53 fSetH3XAxisCmd(nullptr),
54 fSetH3YAxisCmd(nullptr),
55 fSetH3ZAxisCmd(nullptr),
61 fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>(
"h3");
63 fDirectory = fHelper->CreateHnDirectory();
68 fSetH3XCmd = fHelper->CreateSetBinsCommand(
"x",
this);
69 fSetH3YCmd = fHelper->CreateSetBinsCommand(
"y",
this);
71 fSetH3TitleCmd = fHelper->CreateSetTitleCommand(
this);
72 fSetH3XAxisCmd = fHelper->CreateSetAxisCommand(
"x",
this);
73 fSetH3YAxisCmd = fHelper->CreateSetAxisCommand(
"y",
this);
74 fSetH3ZAxisCmd = fHelper->CreateSetAxisCommand(
"z",
this);
75 fSetH3XAxisLogCmd = fHelper->CreateSetAxisLogCommand(
"x",
this);
76 fSetH3YAxisLogCmd = fHelper->CreateSetAxisLogCommand(
"y",
this);
77 fSetH3ZAxisLogCmd = fHelper->CreateSetAxisLogCommand(
"z",
this);
89void G4H3Messenger::CreateH3Cmd()
92 h3Name->SetGuidance(
"Histogram name (label)");
95 h3Title->SetGuidance(
"Histogram title");
98 h3xNbins0->SetGuidance(
"Number of x-bins (default = 100)");
99 h3xNbins0->SetGuidance(
"Can be reset with /analysis/h3/set command");
100 h3xNbins0->SetDefaultValue(100);
103 h3xValMin0->SetGuidance(
"Minimum x-value, expressed in unit (default = 0.)");
104 h3xValMin0->SetGuidance(
"Can be reset with /analysis/h3/set command");
105 h3xValMin0->SetDefaultValue(0.);
108 h3xValMax0->SetGuidance(
"Maximum x-value, expressed in unit (default = 1.)");
109 h3xValMax0->SetGuidance(
"Can be reset with /analysis/h3/set command");
110 h3xValMax0->SetDefaultValue(1.);
112 auto h3xValUnit0 =
new G4UIparameter(
"xvalUnit0",
's',
true);
113 h3xValUnit0->SetGuidance(
"The unit applied to filled x-values and xvalMin0, xvalMax0");
114 h3xValUnit0->SetDefaultValue(
"none");
117 G4String fcnxGuidance =
"The function applied to filled x-values (log, log10, exp, none).";
118 h3xValFcn0->SetGuidance(fcnxGuidance);
119 h3xValFcn0->SetParameterCandidates(
"log log10 exp none");
120 h3xValFcn0->SetDefaultValue(
"none");
122 auto h3xValBinScheme0 =
new G4UIparameter(
"xvalBinScheme0",
's',
true);
123 G4String xbinSchemeGuidance =
"The binning scheme (linear, log).";
124 h3xValBinScheme0->SetParameterCandidates(
"linear log");
125 h3xValBinScheme0->SetGuidance(xbinSchemeGuidance);
126 h3xValBinScheme0->SetDefaultValue(
"linear");
129 h3yNbins0->SetGuidance(
"Number of y-bins (default = 100)");
130 h3yNbins0->SetGuidance(
"Can be reset with /analysis/h3/set command");
131 h3yNbins0->SetDefaultValue(100);
134 h3yValMin0->SetGuidance(
"Minimum y-value, expressed in unit (default = 0.)");
135 h3yValMin0->SetGuidance(
"Can be reset with /analysis/h3/set command");
136 h3yValMin0->SetDefaultValue(0.);
139 h3yValMax0->SetGuidance(
"Maximum y-value, expressed in unit (default = 1.)");
140 h3yValMax0->SetGuidance(
"Can be reset with /analysis/h3/set command");
141 h3yValMax0->SetDefaultValue(1.);
143 auto h3yValUnit0 =
new G4UIparameter(
"yvalUnit0",
's',
true);
144 h3yValUnit0->SetGuidance(
"The unit applied to filled y-values and yvalMin0, yvalMax0");
145 h3yValUnit0->SetDefaultValue(
"none");
148 G4String fcnyGuidance =
"The function applied to filled y-values (log, log10, exp, none).";
149 h3yValFcn0->SetGuidance(fcnyGuidance);
150 h3yValFcn0->SetParameterCandidates(
"log log10 exp none");
151 h3yValFcn0->SetDefaultValue(
"none");
153 auto h3yValBinScheme0 =
new G4UIparameter(
"yvalBinScheme0",
's',
true);
154 G4String ybinSchemeGuidance =
"The binning scheme (linear, log).";
155 h3yValBinScheme0->SetParameterCandidates(
"linear log");
156 h3yValBinScheme0->SetGuidance(ybinSchemeGuidance);
157 h3yValBinScheme0->SetDefaultValue(
"linear");
160 h3zNbins0->SetGuidance(
"Number of z-bins (default = 100)");
161 h3zNbins0->SetGuidance(
"Can be reset with /analysis/h3/set command");
162 h3zNbins0->SetDefaultValue(100);
165 h3zValMin0->SetGuidance(
"Minimum z-value, expressed in unit (default = 0.)");
166 h3zValMin0->SetGuidance(
"Can be reset with /analysis/h3/set command");
167 h3zValMin0->SetDefaultValue(0.);
170 h3zValMax0->SetGuidance(
"Maximum z-value, expressed in unit (default = 1.)");
171 h3zValMax0->SetGuidance(
"Can be reset with /analysis/h3/set command");
172 h3zValMax0->SetDefaultValue(1.);
174 auto h3zValUnit0 =
new G4UIparameter(
"zvalUnit0",
's',
true);
175 h3zValUnit0->SetGuidance(
"The unit applied to filled z-values and zvalMin0, zvalMax0");
176 h3zValUnit0->SetDefaultValue(
"none");
179 G4String fcnzGuidance =
"The function applied to filled z-values (log, log10, exp, none).";
180 h3zValFcn0->SetGuidance(fcnzGuidance);
181 h3zValFcn0->SetParameterCandidates(
"log log10 exp none");
182 h3zValFcn0->SetDefaultValue(
"none");
184 auto h3zValBinScheme0 =
new G4UIparameter(
"zvalBinScheme0",
's',
true);
185 G4String zbinSchemeGuidance =
"The binning scheme (linear, log).";
186 h3zValBinScheme0->SetParameterCandidates(
"linear log");
187 h3zValBinScheme0->SetGuidance(zbinSchemeGuidance);
188 h3zValBinScheme0->SetDefaultValue(
"linear");
190 fCreateH3Cmd = G4Analysis::make_unique<G4UIcommand>(
"/analysis/h3/create",
this);
191 fCreateH3Cmd->SetGuidance(
"Create 3D histogram");
192 fCreateH3Cmd->SetParameter(h3Name);
193 fCreateH3Cmd->SetParameter(h3Title);
194 fCreateH3Cmd->SetParameter(h3xNbins0);
195 fCreateH3Cmd->SetParameter(h3xValMin0);
196 fCreateH3Cmd->SetParameter(h3xValMax0);
197 fCreateH3Cmd->SetParameter(h3xValUnit0);
198 fCreateH3Cmd->SetParameter(h3xValFcn0);
199 fCreateH3Cmd->SetParameter(h3xValBinScheme0);
200 fCreateH3Cmd->SetParameter(h3yNbins0);
201 fCreateH3Cmd->SetParameter(h3yValMin0);
202 fCreateH3Cmd->SetParameter(h3yValMax0);
203 fCreateH3Cmd->SetParameter(h3yValUnit0);
204 fCreateH3Cmd->SetParameter(h3yValFcn0);
205 fCreateH3Cmd->SetParameter(h3yValBinScheme0);
206 fCreateH3Cmd->SetParameter(h3zNbins0);
207 fCreateH3Cmd->SetParameter(h3zValMin0);
208 fCreateH3Cmd->SetParameter(h3zValMax0);
209 fCreateH3Cmd->SetParameter(h3zValUnit0);
210 fCreateH3Cmd->SetParameter(h3zValFcn0);
211 fCreateH3Cmd->SetParameter(h3zValBinScheme0);
217void G4H3Messenger::SetH3Cmd()
220 h3Id->SetGuidance(
"Histogram id");
221 h3Id->SetParameterRange(
"id>=0");
224 h3xNbins->SetGuidance(
"Number of x-bins");
227 h3xValMin->SetGuidance(
"Minimum x-value, expressed in unit");
230 h3xValMax->SetGuidance(
"Maximum x-value, expressed in unit");
233 h3xValUnit->SetGuidance(
"The unit applied to filled x-values and xvalMin0, xvalMax0");
234 h3xValUnit->SetDefaultValue(
"none");
237 h3xValFcn->SetParameterCandidates(
"log log10 exp none");
238 G4String fcnxGuidance =
"The function applied to filled x-values (log, log10, exp, none).";
239 h3xValFcn->SetGuidance(fcnxGuidance);
240 h3xValFcn->SetDefaultValue(
"none");
242 auto h3xValBinScheme =
new G4UIparameter(
"xvalBinScheme",
's',
true);
243 G4String xbinSchemeGuidance =
"The binning scheme (linear, log).";
244 h3xValBinScheme->SetParameterCandidates(
"linear log");
245 h3xValBinScheme->SetGuidance(xbinSchemeGuidance);
246 h3xValBinScheme->SetDefaultValue(
"linear");
249 h3yNbins->SetGuidance(
"Number of y-bins");
252 h3yValMin->SetGuidance(
"Minimum y-value, expressed in unit");
255 h3yValMax->SetGuidance(
"Maximum y-value, expressed in unit");
258 h3yValUnit->SetGuidance(
"The unit applied to filled y-values and yvalMin0, yvalMax0");
259 h3yValUnit->SetDefaultValue(
"none");
262 h3yValFcn->SetParameterCandidates(
"log log10 exp none");
263 G4String fcnyGuidance =
"The function applied to filled y-values (log, log10, exp, none).";
264 h3yValFcn->SetGuidance(fcnyGuidance);
265 h3yValFcn->SetDefaultValue(
"none");
267 auto h3yValBinScheme =
new G4UIparameter(
"yvalBinScheme",
's',
true);
268 G4String ybinSchemeGuidance =
"The binning scheme (linear, log).";
269 h3yValBinScheme->SetParameterCandidates(
"linear log");
270 h3yValBinScheme->SetGuidance(ybinSchemeGuidance);
271 h3yValBinScheme->SetDefaultValue(
"linear");
274 h3zNbins->SetGuidance(
"Number of z-bins");
277 h3zValMin->SetGuidance(
"Minimum z-value, expressed in unit");
280 h3zValMax->SetGuidance(
"Maximum z-value, expressed in unit");
283 h3zValUnit->SetGuidance(
"The unit applied to filled z-values and zvalMin0, zvalMax0");
284 h3zValUnit->SetDefaultValue(
"none");
287 h3zValFcn->SetParameterCandidates(
"log log10 exp none");
288 G4String fcnzGuidance =
"The function applied to filled z-values (log, log10, exp, none).";
289 h3zValFcn->SetGuidance(fcnzGuidance);
290 h3zValFcn->SetDefaultValue(
"none");
292 auto h3zValBinScheme =
new G4UIparameter(
"zvalBinScheme",
's',
true);
293 G4String zbinSchemeGuidance =
"The binning scheme (linear, log).";
294 h3zValBinScheme->SetParameterCandidates(
"linear log");
295 h3zValBinScheme->SetGuidance(zbinSchemeGuidance);
296 h3zValBinScheme->SetDefaultValue(
"linear");
298 fSetH3Cmd = G4Analysis::make_unique<G4UIcommand>(
"/analysis/h3/set",
this);
299 fSetH3Cmd->SetGuidance(
"Set parameters for the 3D histogram of given id:");
300 fSetH3Cmd->SetGuidance(
" nxbins; xvalMin; xvalMax; xunit; xfunction; xbinScheme");
301 fSetH3Cmd->SetGuidance(
" nybins; yvalMin; yvalMax; yunit; yfunction; ybinScheme");
302 fSetH3Cmd->SetGuidance(
" nzbins; zvalMin; zvalMax; zunit; zfunction; zbinScheme");
303 fSetH3Cmd->SetParameter(h3Id);
304 fSetH3Cmd->SetParameter(h3xNbins);
305 fSetH3Cmd->SetParameter(h3xValMin);
306 fSetH3Cmd->SetParameter(h3xValMax);
307 fSetH3Cmd->SetParameter(h3xValUnit);
308 fSetH3Cmd->SetParameter(h3xValFcn);
309 fSetH3Cmd->SetParameter(h3xValBinScheme);
310 fSetH3Cmd->SetParameter(h3yNbins);
311 fSetH3Cmd->SetParameter(h3yValMin);
312 fSetH3Cmd->SetParameter(h3yValMax);
313 fSetH3Cmd->SetParameter(h3yValUnit);
314 fSetH3Cmd->SetParameter(h3yValFcn);
315 fSetH3Cmd->SetParameter(h3yValBinScheme);
316 fSetH3Cmd->SetParameter(h3zNbins);
317 fSetH3Cmd->SetParameter(h3zValMin);
318 fSetH3Cmd->SetParameter(h3zValMax);
319 fSetH3Cmd->SetParameter(h3zValUnit);
320 fSetH3Cmd->SetParameter(h3zValFcn);
321 fSetH3Cmd->SetParameter(h3zValBinScheme);
334 std::vector<G4String> parameters;
339 fHelper->WarnAboutParameters(command, parameters.size());
343 if ( command == fCreateH3Cmd.get() ) {
345 auto name = parameters[counter++];
346 auto title = parameters[counter++];
348 fHelper->GetBinData(xdata, parameters, counter);
351 fHelper->GetBinData(ydata, parameters, counter);
354 fHelper->GetBinData(zdata, parameters, counter);
364 else if ( command == fSetH3Cmd.get() ) {
368 fHelper->GetBinData(xdata, parameters, counter);
371 fHelper->GetBinData(ydata, parameters, counter);
374 fHelper->GetBinData(zdata, parameters, counter);
384 else if ( command == fSetH3XCmd.get() ) {
388 fHelper->GetBinData(fXData, parameters, counter);
390 else if ( command == fSetH3YCmd.get() ) {
394 fHelper->GetBinData(fYData, parameters, counter);
396 else if ( command == fSetH3ZCmd.get() ) {
400 if ( fXId == -1 || fXId !=
id ||
401 fYId == -1 || fYId !=
id ) {
402 fHelper->WarnAboutSetCommands();
408 fHelper->GetBinData(zdata, parameters, counter);
420 else if ( command == fSetH3TitleCmd.get() ) {
423 auto title = parameters[counter++];
426 else if ( command == fSetH3XAxisCmd.get() ) {
429 auto xaxis = parameters[counter++];
432 else if ( command == fSetH3YAxisCmd.get() ) {
435 auto yaxis = parameters[counter++];
438 else if ( command == fSetH3ZAxisCmd.get() ) {
441 auto zaxis = parameters[counter++];
444 else if ( command == fSetH3XAxisLogCmd.get() ) {
450 else if ( command == fSetH3YAxisLogCmd.get() ) {
456 else if ( command == fSetH3ZAxisLogCmd.get() ) {
virtual void SetNewValue(G4UIcommand *command, G4String value) final
G4H3Messenger(G4VAnalysisManager *manager)
std::size_t GetParameterEntries() const
static G4int ConvertToInt(const char *st)
static G4bool ConvertToBool(const char *st)
G4bool SetH3Title(G4int id, const G4String &title)
G4bool SetH3(G4int id, G4int nxbins, G4double xmin, G4double xmax, G4int nzbins, G4double zmin, G4double zmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &zunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &zfcnName="none", const G4String &xbinSchemeName="linear", const G4String &ybinSchemeName="linear", const G4String &zbinSchemeName="linear")
G4bool SetH3YAxisTitle(G4int id, const G4String &title)
G4int CreateH3(const G4String &name, const G4String &title, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, G4int nzbins, G4double zmin, G4double zmax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &zunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &zfcnName="none", const G4String &xbinSchemeName="linear", const G4String &ybinSchemeName="linear", const G4String &zbinSchemeName="linear")
G4bool SetH3XAxisIsLog(G4int id, G4bool isLog)
G4bool SetH3XAxisTitle(G4int id, const G4String &title)
G4bool SetH3YAxisIsLog(G4int id, G4bool isLog)
G4bool SetH3ZAxisIsLog(G4int id, G4bool isLog)
G4bool SetH3ZAxisTitle(G4int id, const G4String &title)
void Tokenize(const G4String &line, std::vector< G4String > &tokens)
G4double GetUnitValue(const G4String &unit)