47 using namespace G4Analysis;
55 fCreateH1Cmd(nullptr),
57 fSetH1TitleCmd(nullptr),
58 fSetH1XAxisCmd(nullptr),
59 fSetH1YAxisCmd(nullptr)
61 fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>(
"h1");
88 h1Name->SetGuidance(
"Histogram name (label)");
91 h1Title->SetGuidance(
"Histogram title");
94 h1Nbins0->SetGuidance(
"Number of bins (default = 100)");
95 h1Nbins0->SetGuidance(
"Can be reset with /analysis/h1/set command");
96 h1Nbins0->SetDefaultValue(100);
99 h1ValMin0->SetGuidance(
"Minimum value, expressed in unit (default = 0.)");
100 h1ValMin0->SetGuidance(
"Can be reset with /analysis/h1/set command");
101 h1ValMin0->SetDefaultValue(0.);
104 h1ValMax0->SetGuidance(
"Maximum value, expressed in unit (default = 1.)");
105 h1ValMax0->SetGuidance(
"Can be reset with /analysis/h1/set command");
106 h1ValMax0->SetDefaultValue(1.);
109 h1ValUnit0->SetGuidance(
"The unit applied to filled values and valMin0, valMax0");
110 h1ValUnit0->SetDefaultValue(
"none");
113 G4String fcnGuidance =
"The function applied to filled values (log, log10, exp).\n";
114 fcnGuidance +=
"Note that the unit parameter cannot be omitted in this case,\n";
115 fcnGuidance +=
"but none value should be used instead.";
116 h1ValFcn0->SetGuidance(fcnGuidance);
117 h1ValFcn0->SetParameterCandidates(
"log log10 exp none");
118 h1ValFcn0->SetDefaultValue(
"none");
120 auto h1ValBinScheme0 =
new G4UIparameter(
"valBinScheme0",
's',
true);
121 G4String binSchemeGuidance =
"The binning scheme (linear, log).\n";
122 h1ValBinScheme0->SetParameterCandidates(
"linear log");
124 +=
"Note that the unit and fcn parameters cannot be omitted in this case,\n";
125 binSchemeGuidance +=
"but none value should be used instead.";
126 h1ValBinScheme0->SetGuidance(binSchemeGuidance);
127 h1ValBinScheme0->SetDefaultValue(
"linear");
129 fCreateH1Cmd = G4Analysis::make_unique<G4UIcommand>(
"/analysis/h1/create",
this);
147 h1Id->SetGuidance(
"Histogram id");
148 h1Id->SetParameterRange(
"id>=0");
151 h1Nbins->SetGuidance(
"Number of bins");
154 h1ValMin->SetGuidance(
"Minimum value, expressed in unit");
157 h1ValMax->SetGuidance(
"Maximum value, expressed in unit");
160 h1ValUnit->SetGuidance(
"The unit applied to filled values and valMin, valMax");
161 h1ValUnit->SetDefaultValue(
"none");
164 h1ValFcn->SetParameterCandidates(
"log log10 exp none");
165 G4String fcnGuidance =
"The function applied to filled values (log, log10, exp, none).\n";
166 fcnGuidance +=
"Note that the unit parameter cannot be omitted in this case,\n";
167 fcnGuidance +=
"but none value should be used instead.";
168 h1ValFcn->SetGuidance(fcnGuidance);
169 h1ValFcn->SetDefaultValue(
"none");
171 auto h1ValBinScheme =
new G4UIparameter(
"valBinScheme",
's',
true);
172 h1ValBinScheme->SetParameterCandidates(
"linear log");
173 G4String binSchemeGuidance =
"The binning scheme (linear, log).\n";
175 +=
"Note that the unit and fcn parameters cannot be omitted in this case,\n";
176 binSchemeGuidance +=
"but none value should be used instead.";
177 h1ValBinScheme->SetGuidance(binSchemeGuidance);
178 h1ValBinScheme->SetDefaultValue(
"linear");
180 fSetH1Cmd = G4Analysis::make_unique<G4UIcommand>(
"/analysis/h1/set",
this);
181 fSetH1Cmd->SetGuidance(
"Set parameters for the 1D histogram of given id:");
182 fSetH1Cmd->SetGuidance(
" nbins; valMin; valMax; unit; function; binScheme");
201 std::vector<G4String> parameters;
206 fHelper->WarnAboutParameters(command, parameters.size());
212 auto name = parameters[counter++];
213 auto title = parameters[counter++];
215 fHelper->GetBinData(xdata, parameters, counter);
225 fHelper->GetBinData(xdata, parameters, counter);
235 fHelper->GetBinData(xdata, parameters, counter);
244 auto title = parameters[counter++];
250 auto xaxis = parameters[counter++];
256 auto yaxis = parameters[counter++];
G4bool SetH1(G4int id, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName="none", const G4String &fcnName="none", const G4String &binSchemeName="linear")
G4bool SetH1YAxisTitle(G4int id, const G4String &title)
G4bool SetH1XAxisTitle(G4int id, const G4String &title)
std::unique_ptr< G4UIcommand > fCreateH1Cmd
std::unique_ptr< G4UIcommand > fSetH1TitleCmd
G4double GetUnitValue(const G4String &unit)
G4int CreateH1(const G4String &name, const G4String &title, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName="none", const G4String &fcnName="none", const G4String &binSchemeName="linear")
static G4int ConvertToInt(const char *st)
std::unique_ptr< G4UIcommand > fSetH1YAxisCmd
void Tokenize(const G4String &line, std::vector< G4String > &tokens)
std::unique_ptr< G4UIcommand > fSetH1XCmd
std::unique_ptr< G4UIdirectory > fDirectory
std::unique_ptr< G4AnalysisMessengerHelper > fHelper
G4VAnalysisManager * fManager
Associated class.
virtual void SetNewValue(G4UIcommand *command, G4String value) final
std::unique_ptr< G4UIcommand > fSetH1Cmd
G4int GetParameterEntries() const
G4bool SetH1Title(G4int id, const G4String &title)
std::unique_ptr< G4UIcommand > fSetH1XAxisCmd
G4H1Messenger(G4VAnalysisManager *manager)