47 fCreateP2Cmd(nullptr),
52 fSetP2TitleCmd(nullptr),
53 fSetP2XAxisCmd(nullptr),
54 fSetP2YAxisCmd(nullptr),
60 fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>(
"p2");
62 fDirectory = fHelper->CreateHnDirectory();
67 fSetP2XCmd = fHelper->CreateSetBinsCommand(
"x",
this);
68 fSetP2YCmd = fHelper->CreateSetBinsCommand(
"y",
this);
69 fSetP2ZCmd = fHelper->CreateSetValuesCommand(
"z",
this);
71 fSetP2TitleCmd = fHelper->CreateSetTitleCommand(
this);
72 fSetP2XAxisCmd = fHelper->CreateSetAxisCommand(
"x",
this);
73 fSetP2YAxisCmd = fHelper->CreateSetAxisCommand(
"y",
this);
74 fSetP2ZAxisCmd = fHelper->CreateSetAxisCommand(
"z",
this);
75 fSetP2XAxisLogCmd = fHelper->CreateSetAxisLogCommand(
"x",
this);
76 fSetP2YAxisLogCmd = fHelper->CreateSetAxisLogCommand(
"y",
this);
77 fSetP2ZAxisLogCmd = fHelper->CreateSetAxisLogCommand(
"z",
this);
89void G4P2Messenger::CreateP2Cmd()
92 p2Name->SetGuidance(
"Profile name (label)");
95 p2Title->SetGuidance(
"Profile title");
98 p2xNbins0->SetGuidance(
"Number of x-bins (default = 100)");
99 p2xNbins0->SetGuidance(
"Can be reset with /analysis/p2/set command");
100 p2xNbins0->SetDefaultValue(100);
103 p2xValMin0->SetGuidance(
"Minimum x-value, expressed in unit (default = 0.)");
104 p2xValMin0->SetGuidance(
"Can be reset with /analysis/p2/set command");
105 p2xValMin0->SetDefaultValue(0.);
108 p2xValMax0->SetGuidance(
"Maximum x-value, expressed in unit (default = 1.)");
109 p2xValMax0->SetGuidance(
"Can be reset with /analysis/p2/set command");
110 p2xValMax0->SetDefaultValue(1.);
112 auto p2xValUnit0 =
new G4UIparameter(
"xvalUnit0",
's',
true);
113 p2xValUnit0->SetGuidance(
"The unit applied to filled x-values and xvalMin0, xvalMax0");
114 p2xValUnit0->SetDefaultValue(
"none");
117 G4String fcnxGuidance =
"The function applied to filled x-values (log, log10, exp, none).";
118 p2xValFcn0->SetGuidance(fcnxGuidance);
119 p2xValFcn0->SetParameterCandidates(
"log log10 exp none");
120 p2xValFcn0->SetDefaultValue(
"none");
122 auto p2xValBinScheme0 =
new G4UIparameter(
"xvalBinScheme0",
's',
true);
123 G4String binSchemeGuidance =
"The binning scheme (linear, log).";
124 p2xValBinScheme0->SetParameterCandidates(
"linear log");
125 p2xValBinScheme0->SetGuidance(binSchemeGuidance);
126 p2xValBinScheme0->SetDefaultValue(
"linear");
129 p2yNbins0->SetGuidance(
"Number of y-bins (default = 100)");
130 p2yNbins0->SetGuidance(
"Can be reset with /analysis/p2/set command");
131 p2yNbins0->SetDefaultValue(100);
134 p2yValMin0->SetGuidance(
"Minimum y-value, expressed in unit (default = 0.)");
135 p2yValMin0->SetGuidance(
"Can be reset with /analysis/p2/set command");
136 p2yValMin0->SetDefaultValue(0.);
139 p2yValMax0->SetGuidance(
"Maximum y-value, expressed in unit (default = 1.)");
140 p2yValMax0->SetGuidance(
"Can be reset with /analysis/p2/set command");
141 p2yValMax0->SetDefaultValue(1.);
143 auto p2yValUnit0 =
new G4UIparameter(
"yvalUnit0",
's',
true);
144 p2yValUnit0->SetGuidance(
"The unit applied to filled y-values and yvalMin0, yvalMax0");
145 p2yValUnit0->SetDefaultValue(
"none");
148 G4String fcnyGuidance =
"The function applied to filled y-values (log, log10, exp, none).";
149 p2yValFcn0->SetGuidance(fcnyGuidance);
150 p2yValFcn0->SetParameterCandidates(
"log log10 exp none");
151 p2yValFcn0->SetDefaultValue(
"none");
153 auto p2yValBinScheme0 =
new G4UIparameter(
"yvalBinScheme0",
's',
true);
154 p2yValBinScheme0->SetParameterCandidates(
"linear log");
155 p2yValBinScheme0->SetGuidance(binSchemeGuidance);
156 p2yValBinScheme0->SetDefaultValue(
"linear");
159 p2zValMin0->SetGuidance(
"Minimum z-value, expressed in unit (default = 0.)");
160 p2zValMin0->SetGuidance(
"Can be reset with /analysis/p2/set command");
161 p2zValMin0->SetDefaultValue(0.);
164 p2zValMax0->SetGuidance(
"Maximum z-value, expressed in unit (default = 1.)");
165 p2zValMax0->SetGuidance(
"Can be reset with /analysis/p2/set command");
166 p2zValMax0->SetDefaultValue(1.);
168 auto p2zValUnit0 =
new G4UIparameter(
"zvalUnit0",
's',
true);
169 p2zValUnit0->SetGuidance(
"The unit applied to filled z-values and zvalMin0, zvalMax0");
170 p2zValUnit0->SetDefaultValue(
"none");
173 G4String fcnzGuidance =
"The function applied to filled z-values (log, log10, exp, none).";
174 p2zValFcn0->SetGuidance(fcnzGuidance);
175 p2zValFcn0->SetParameterCandidates(
"log log10 exp none");
176 p2zValFcn0->SetDefaultValue(
"none");
178 fCreateP2Cmd = G4Analysis::make_unique<G4UIcommand>(
"/analysis/p2/create",
this);
179 fCreateP2Cmd->SetGuidance(
"Create 2D profile");
180 fCreateP2Cmd->SetParameter(p2Name);
181 fCreateP2Cmd->SetParameter(p2Title);
182 fCreateP2Cmd->SetParameter(p2xNbins0);
183 fCreateP2Cmd->SetParameter(p2xValMin0);
184 fCreateP2Cmd->SetParameter(p2xValMax0);
185 fCreateP2Cmd->SetParameter(p2xValUnit0);
186 fCreateP2Cmd->SetParameter(p2xValFcn0);
187 fCreateP2Cmd->SetParameter(p2xValBinScheme0);
188 fCreateP2Cmd->SetParameter(p2yNbins0);
189 fCreateP2Cmd->SetParameter(p2yValMin0);
190 fCreateP2Cmd->SetParameter(p2yValMax0);
191 fCreateP2Cmd->SetParameter(p2yValUnit0);
192 fCreateP2Cmd->SetParameter(p2yValFcn0);
193 fCreateP2Cmd->SetParameter(p2yValBinScheme0);
194 fCreateP2Cmd->SetParameter(p2zValMin0);
195 fCreateP2Cmd->SetParameter(p2zValMax0);
196 fCreateP2Cmd->SetParameter(p2zValUnit0);
197 fCreateP2Cmd->SetParameter(p2zValFcn0);
203void G4P2Messenger::SetP2Cmd()
206 p2Id->SetGuidance(
"Profile id");
207 p2Id->SetParameterRange(
"id>=0");
210 p2xNbins->SetGuidance(
"Number of x-bins");
213 p2xValMin->SetGuidance(
"Minimum x-value, expressed in unit");
216 p2xValMax->SetGuidance(
"Maximum x-value, expressed in unit");
219 p2xValUnit->SetGuidance(
"The unit applied to filled x-values and xvalMin0, xvalMax0");
220 p2xValUnit->SetDefaultValue(
"none");
223 p2xValFcn->SetParameterCandidates(
"log log10 exp none");
224 G4String fcnxGuidance =
"The function applied to filled x-values (log, log10, exp, none).";
225 p2xValFcn->SetGuidance(fcnxGuidance);
226 p2xValFcn->SetDefaultValue(
"none");
228 auto p2xValBinScheme =
new G4UIparameter(
"xvalBinScheme",
's',
true);
229 G4String binSchemeGuidance =
"The binning scheme (linear, log).";
230 p2xValBinScheme->SetParameterCandidates(
"linear log");
231 p2xValBinScheme->SetGuidance(binSchemeGuidance);
232 p2xValBinScheme->SetDefaultValue(
"linear");
235 p2yNbins->SetGuidance(
"Number of y-bins");
238 p2yValMin->SetGuidance(
"Minimum y-value, expressed in unit");
241 p2yValMax->SetGuidance(
"Maximum y-value, expressed in unit");
244 p2yValUnit->SetGuidance(
"The unit applied to filled y-values and yvalMin0, yvalMax0");
245 p2yValUnit->SetDefaultValue(
"none");
248 p2yValFcn->SetParameterCandidates(
"log log10 exp none");
249 G4String fcnyGuidance =
"The function applied to filled y-values (log, log10, exp, none).";
250 p2yValFcn->SetGuidance(fcnyGuidance);
251 p2yValFcn->SetDefaultValue(
"none");
253 auto p2yValBinScheme =
new G4UIparameter(
"yvalBinScheme",
's',
true);
254 p2yValBinScheme->SetParameterCandidates(
"linear log");
255 p2yValBinScheme->SetGuidance(binSchemeGuidance);
256 p2yValBinScheme->SetDefaultValue(
"linear");
259 p2zValMin->SetGuidance(
"Minimum z-value, expressed in unit");
262 p2zValMax->SetGuidance(
"Maximum z-value, expressed in unit");
265 p2zValUnit->SetGuidance(
"The unit applied to filled z-values and zvalMin0, zvalMax0");
266 p2zValUnit->SetDefaultValue(
"none");
269 p2zValFcn->SetParameterCandidates(
"log log10 exp none");
270 G4String fcnzGuidance =
"The function applied to filled z-values (log, log10, exp, none).";
271 p2zValFcn->SetGuidance(fcnzGuidance);
272 p2zValFcn->SetDefaultValue(
"none");
274 fSetP2Cmd = G4Analysis::make_unique<G4UIcommand>(
"/analysis/p2/set",
this);
275 fSetP2Cmd->SetGuidance(
"Set parameters for the 2D profile of given id:");
276 fSetP2Cmd->SetGuidance(
" nxbins; xvalMin; xvalMax; xunit; xbinScheme");
277 fSetP2Cmd->SetGuidance(
" nybins; yvalMin; yvalMax; yunit; ybinScheme");
278 fSetP2Cmd->SetGuidance(
" zvalMin; zvalMax; zunit; zfunction");
279 fSetP2Cmd->SetParameter(p2Id);
280 fSetP2Cmd->SetParameter(p2xNbins);
281 fSetP2Cmd->SetParameter(p2xValMin);
282 fSetP2Cmd->SetParameter(p2xValMax);
283 fSetP2Cmd->SetParameter(p2xValUnit);
284 fSetP2Cmd->SetParameter(p2xValFcn);
285 fSetP2Cmd->SetParameter(p2xValBinScheme);
286 fSetP2Cmd->SetParameter(p2yNbins);
287 fSetP2Cmd->SetParameter(p2yValMin);
288 fSetP2Cmd->SetParameter(p2yValMax);
289 fSetP2Cmd->SetParameter(p2yValUnit);
290 fSetP2Cmd->SetParameter(p2yValFcn);
291 fSetP2Cmd->SetParameter(p2yValBinScheme);
292 fSetP2Cmd->SetParameter(p2zValMin);
293 fSetP2Cmd->SetParameter(p2zValMax);
294 fSetP2Cmd->SetParameter(p2zValUnit);
295 fSetP2Cmd->SetParameter(p2zValFcn);
308 std::vector<G4String> parameters;
313 fHelper->WarnAboutParameters(command, parameters.size());
317 if ( command == fCreateP2Cmd.get() ) {
319 auto name = parameters[counter++];
320 auto title = parameters[counter++];
322 fHelper->GetBinData(xdata, parameters, counter);
325 fHelper->GetBinData(ydata, parameters, counter);
328 fHelper->GetValueData(zdata, parameters, counter);
338 else if ( command == fSetP2Cmd.get() ) {
342 fHelper->GetBinData(xdata, parameters, counter);
345 fHelper->GetBinData(ydata, parameters, counter);
348 fHelper->GetValueData(zdata, parameters, counter);
358 else if ( command == fSetP2XCmd.get() ) {
362 fHelper->GetBinData(fXData, parameters, counter);
364 else if ( command == fSetP2YCmd.get() ) {
369 if ( fXId == -1 || fXId != fYId ) {
370 fHelper->WarnAboutSetCommands();
373 fHelper->GetBinData(fYData, parameters, counter);
378 fManager->
SetP2(fYId,
386 else if ( command == fSetP2ZCmd.get() ) {
390 if ( fXId == -1 || fXId !=
id ||
391 fYId == -1 || fYId !=
id ) {
392 fHelper->WarnAboutSetCommands();
398 fHelper->GetValueData(zdata, parameters, counter);
410 else if ( command == fSetP2TitleCmd.get() ) {
413 auto title = parameters[counter++];
416 else if ( command == fSetP2XAxisCmd.get() ) {
419 auto xaxis = parameters[counter++];
422 else if ( command == fSetP2YAxisCmd.get() ) {
425 auto yaxis = parameters[counter++];
428 else if ( command == fSetP2ZAxisCmd.get() ) {
431 auto zaxis = parameters[counter++];
434 else if ( command == fSetP2XAxisLogCmd.get() ) {
440 else if ( command == fSetP2YAxisLogCmd.get() ) {
446 else if ( command == fSetP2ZAxisLogCmd.get() ) {
virtual void SetNewValue(G4UIcommand *command, G4String value) final
G4P2Messenger(G4VAnalysisManager *manager)
std::size_t GetParameterEntries() const
static G4int ConvertToInt(const char *st)
static G4bool ConvertToBool(const char *st)
G4bool SetP2YAxisTitle(G4int id, const G4String &title)
G4int CreateP2(const G4String &name, const G4String &title, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, G4double zmin=0, G4double zmax=0, 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")
G4bool SetP2ZAxisIsLog(G4int id, G4bool isLog)
G4bool SetP2(G4int id, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, G4double zmin=0, G4double zmax=0, 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")
G4bool SetP2Title(G4int id, const G4String &title)
G4bool SetP2ZAxisTitle(G4int id, const G4String &title)
G4bool SetP2YAxisIsLog(G4int id, G4bool isLog)
G4bool SetP2XAxisIsLog(G4int id, G4bool isLog)
G4bool SetP2XAxisTitle(G4int id, const G4String &title)
void Tokenize(const G4String &line, std::vector< G4String > &tokens)
G4double GetUnitValue(const G4String &unit)