40 using namespace G4Analysis;
48 fCreateP1Cmd(nullptr),
50 fSetP1TitleCmd(nullptr),
51 fSetP1XAxisCmd(nullptr),
52 fSetP1YAxisCmd(nullptr),
55 fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>(
"p1");
82 p1Name->SetGuidance(
"Profile name (label)");
85 p1Title->SetGuidance(
"Profile title");
88 p1xNbins0->SetGuidance(
"Number of x-bins (default = 100)");
89 p1xNbins0->SetGuidance(
"Can be reset with /analysis/p1/set command");
90 p1xNbins0->SetDefaultValue(100);
93 p1xValMin0->SetGuidance(
"Minimum x-value, expressed in unit (default = 0.)");
94 p1xValMin0->SetGuidance(
"Can be reset with /analysis/p1/set command");
95 p1xValMin0->SetDefaultValue(0.);
98 p1xValMax0->SetGuidance(
"Maximum x-value, expressed in unit (default = 1.)");
99 p1xValMax0->SetGuidance(
"Can be reset with /analysis/p1/set command");
100 p1xValMax0->SetDefaultValue(1.);
102 auto p1xValUnit0 =
new G4UIparameter(
"xvalUnit0",
's',
true);
103 p1xValUnit0->SetGuidance(
"The unit applied to filled x-values and xvalMin0, xvalMax0");
104 p1xValUnit0->SetDefaultValue(
"none");
107 G4String fcnxGuidance =
"The function applied to filled x-values (log, log10, exp, none).\n";
108 fcnxGuidance +=
"Note that the unit parameter cannot be omitted in this case,\n";
109 fcnxGuidance +=
"but none value should be used insted.";
110 p1xValFcn0->SetGuidance(fcnxGuidance);
111 p1xValFcn0->SetParameterCandidates(
"log log10 exp none");
112 p1xValFcn0->SetDefaultValue(
"none");
114 auto p1xValBinScheme0 =
new G4UIparameter(
"xvalBinScheme0",
's',
true);
115 G4String binSchemeGuidance =
"The binning scheme (linear, log).\n";
116 p1xValBinScheme0->SetParameterCandidates(
"linear log");
118 +=
"Note that the unit and fcn parameters cannot be omitted in this case,\n";
119 binSchemeGuidance +=
"but none value should be used insted.";
120 p1xValBinScheme0->SetGuidance(binSchemeGuidance);
121 p1xValBinScheme0->SetDefaultValue(
"linear");
124 p1yValMin0->SetGuidance(
"Minimum y-value, expressed in unit (default = 0.)");
125 p1yValMin0->SetGuidance(
"Can be reset with /analysis/p1/set command");
126 p1yValMin0->SetDefaultValue(0.);
129 p1yValMax0->SetGuidance(
"Maximum y-value, expressed in unit (default = 1.)");
130 p1yValMax0->SetGuidance(
"Can be reset with /analysis/p1/set command");
131 p1yValMax0->SetDefaultValue(1.);
133 auto p1yValUnit0 =
new G4UIparameter(
"yvalUnit0",
's',
true);
134 p1yValUnit0->SetGuidance(
"The unit applied to filled y-values and yvalMin0, yvalMax0");
135 p1yValUnit0->SetDefaultValue(
"none");
138 G4String fcnyGuidance =
"The function applied to filled y-values (log, log10, exp, none).\n";
139 fcnyGuidance +=
"Note that the unit parameter cannot be omitted in this case,\n";
140 fcnyGuidance +=
"but none value should be used insted.";
141 p1yValFcn0->SetGuidance(fcnyGuidance);
142 p1yValFcn0->SetParameterCandidates(
"log log10 exp none");
143 p1yValFcn0->SetDefaultValue(
"none");
145 fCreateP1Cmd = G4Analysis::make_unique<G4UIcommand>(
"/analysis/p1/create",
this);
167 p1Id->SetGuidance(
"Profile id");
168 p1Id->SetParameterRange(
"id>=0");
171 p1xNbins->SetGuidance(
"Number of x-bins");
174 p1xValMin->SetGuidance(
"Minimum x-value, expressed in unit");
177 p1xValMax->SetGuidance(
"Maximum x-value, expressed in unit");
180 p1xValUnit->SetGuidance(
"The unit applied to filled x-values and xvalMin0, xvalMax0");
181 p1xValUnit->SetDefaultValue(
"none");
184 p1xValFcn->SetParameterCandidates(
"log log10 exp none");
185 G4String fcnxGuidance =
"The function applied to filled x-values (log, log10, exp, none).\n";
186 fcnxGuidance +=
"Note that the unit parameter cannot be omitted in this case,\n";
187 fcnxGuidance +=
"but none value should be used insted.";
188 p1xValFcn->SetGuidance(fcnxGuidance);
189 p1xValFcn->SetDefaultValue(
"none");
191 auto p1xValBinScheme =
new G4UIparameter(
"xvalBinScheme",
's',
true);
192 G4String binSchemeGuidance =
"The binning scheme (linear, log).\n";
193 p1xValBinScheme->SetParameterCandidates(
"linear log");
195 +=
"Note that the unit and fcn parameters cannot be omitted in this case,\n";
196 binSchemeGuidance +=
"but none value should be used insted.";
197 p1xValBinScheme->SetGuidance(binSchemeGuidance);
198 p1xValBinScheme->SetDefaultValue(
"linear");
201 p1yValMin->SetGuidance(
"Minimum y-value, expressed in unit");
204 p1yValMax->SetGuidance(
"Maximum y-value, expressed in unit");
207 p1yValUnit->SetGuidance(
"The unit applied to filled y-values and yvalMin0, yvalMax0");
208 p1yValUnit->SetDefaultValue(
"none");
211 p1yValFcn->SetParameterCandidates(
"log log10 exp none");
212 G4String fcnyGuidance =
"The function applied to filled y-values (log, log10, exp, none).\n";
213 fcnyGuidance +=
"Note that the unit parameter cannot be omitted in this case,\n";
214 fcnyGuidance +=
"but none value should be used insted.";
215 p1yValFcn->SetGuidance(fcnyGuidance);
216 p1yValFcn->SetDefaultValue(
"none");
218 fSetP1Cmd = G4Analysis::make_unique<G4UIcommand>(
"/analysis/p1/set",
this);
219 fSetP1Cmd->SetGuidance(
"Set parameters for the 1D profile of given id:");
220 fSetP1Cmd->SetGuidance(
" nbins; xvalMin; xvalMax; xunit; xfunction; xbinScheme");
221 fSetP1Cmd->SetGuidance(
" yvalMin; yvalMax; yunit; yfunction");
228 fSetP1Cmd->SetParameter(p1xValBinScheme);
244 std::vector<G4String> parameters;
249 fHelper->WarnAboutParameters(command, parameters.size());
255 auto name = parameters[counter++];
256 auto title = parameters[counter++];
258 fHelper->GetBinData(xdata, parameters, counter);
261 fHelper->GetValueData(ydata, parameters, counter);
274 fHelper->GetBinData(xdata, parameters, counter);
277 fHelper->GetValueData(ydata, parameters, counter);
306 fHelper->WarnAboutSetCommands();
311 fHelper->GetValueData(ydata, parameters, counter);
324 auto title = parameters[counter++];
330 auto xaxis = parameters[counter++];
336 auto yaxis = parameters[counter++];
std::unique_ptr< G4UIcommand > fSetP1TitleCmd
G4bool SetP1(G4int id, G4int nbins, G4double xmin, G4double xmax, G4double ymin=0, G4double ymax=0, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &xbinSchemeName="linear")
std::unique_ptr< G4UIcommand > fCreateP1Cmd
std::unique_ptr< G4AnalysisMessengerHelper > fHelper
std::unique_ptr< G4UIcommand > fSetP1XAxisCmd
std::unique_ptr< G4UIcommand > fSetP1YCmd
G4double GetUnitValue(const G4String &unit)
static G4int ConvertToInt(const char *st)
std::unique_ptr< G4UIdirectory > fDirectory
G4VAnalysisManager * fManager
Associated class.
void Tokenize(const G4String &line, std::vector< G4String > &tokens)
G4bool SetP1YAxisTitle(G4int id, const G4String &title)
std::unique_ptr< G4UIcommand > fSetP1Cmd
G4P1Messenger(G4VAnalysisManager *manager)
virtual void SetNewValue(G4UIcommand *command, G4String value) final
std::unique_ptr< G4UIcommand > fSetP1XCmd
G4int GetParameterEntries() const
G4AnalysisMessengerHelper::BinData fXData
G4bool SetP1Title(G4int id, const G4String &title)
G4int CreateP1(const G4String &name, const G4String &title, G4int nbins, G4double xmin, G4double xmax, G4double ymin=0, G4double ymax=0, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &xbinSchemeName="linear")
G4bool SetP1XAxisTitle(G4int id, const G4String &title)
std::unique_ptr< G4UIcommand > fSetP1YAxisCmd