Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4AnalysisMessengerHelper Class Reference

#include <G4AnalysisMessengerHelper.hh>

Classes

struct  BinData
 
struct  ValueData
 

Public Member Functions

 G4AnalysisMessengerHelper (const G4String &hnType)
 
 ~G4AnalysisMessengerHelper ()
 
std::unique_ptr< G4UIdirectoryCreateHnDirectory () const
 
std::unique_ptr< G4UIcommandCreateSetTitleCommand (G4UImessenger *messenger) const
 
std::unique_ptr< G4UIcommandCreateSetBinsCommand (const G4String &axis, G4UImessenger *messenger) const
 
std::unique_ptr< G4UIcommandCreateSetValuesCommand (const G4String &axis, G4UImessenger *messenger) const
 
std::unique_ptr< G4UIcommandCreateSetAxisCommand (const G4String &axis, G4UImessenger *messenger) const
 
std::unique_ptr< G4UIcommandCreateSetAxisLogCommand (const G4String &axis, G4UImessenger *messenger) const
 
void GetBinData (BinData &data, std::vector< G4String > &parameters, G4int &counter) const
 
void GetValueData (ValueData &data, std::vector< G4String > &parameters, G4int &counter) const
 
void WarnAboutParameters (G4UIcommand *command, G4int nofParameters) const
 
void WarnAboutSetCommands () const
 

Friends

class G4HnMessenger
 

Detailed Description

Definition at line 44 of file G4AnalysisMessengerHelper.hh.

Constructor & Destructor Documentation

◆ G4AnalysisMessengerHelper()

G4AnalysisMessengerHelper::G4AnalysisMessengerHelper ( const G4String hnType)
explicit

Definition at line 78 of file G4AnalysisMessengerHelper.cc.

79 : fHnType(hnType)
80{}

◆ ~G4AnalysisMessengerHelper()

G4AnalysisMessengerHelper::~G4AnalysisMessengerHelper ( )

Definition at line 83 of file G4AnalysisMessengerHelper.cc.

84{}

Member Function Documentation

◆ CreateHnDirectory()

std::unique_ptr< G4UIdirectory > G4AnalysisMessengerHelper::CreateHnDirectory ( ) const

Definition at line 133 of file G4AnalysisMessengerHelper.cc.

134{
135 std::unique_ptr<G4UIdirectory> directory(new G4UIdirectory(Update("/analysis/HNTYPE_/")));
136 directory->SetGuidance(Update("NDIM_D LOBJECT control"));
137 return directory;
138}

◆ CreateSetAxisCommand()

std::unique_ptr< G4UIcommand > G4AnalysisMessengerHelper::CreateSetAxisCommand ( const G4String axis,
G4UImessenger messenger 
) const

Definition at line 264 of file G4AnalysisMessengerHelper.cc.

266{
267 auto parId = new G4UIparameter("id", 'i', false);
268 parId->SetGuidance(Update("OBJECT id"));
269 parId->SetParameterRange("id>=0");
270
271 auto parAxis = new G4UIparameter("axis", 's', false);
272 parAxis->SetGuidance(Update("Histogram AXIS-axis title", axis));
273
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);
279 command->AvailableForStates(G4State_PreInit, G4State_Idle);
280
281 return command;
282}
@ G4State_Idle
@ G4State_PreInit

◆ CreateSetAxisLogCommand()

std::unique_ptr< G4UIcommand > G4AnalysisMessengerHelper::CreateSetAxisLogCommand ( const G4String axis,
G4UImessenger messenger 
) const

Definition at line 286 of file G4AnalysisMessengerHelper.cc.

288{
289 auto parId = new G4UIparameter("id", 'i', false);
290 parId->SetGuidance(Update("OBJECT id"));
291 parId->SetParameterRange("id>=0");
292
293 auto parAxisLog = new G4UIparameter("axis", 'b', false);
294 parAxisLog->SetGuidance(Update("Histogram AXIS-axis log scale", axis));
295
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);
302 command->AvailableForStates(G4State_PreInit, G4State_Idle);
303
304 return command;
305}

◆ CreateSetBinsCommand()

std::unique_ptr< G4UIcommand > G4AnalysisMessengerHelper::CreateSetBinsCommand ( const G4String axis,
G4UImessenger messenger 
) const

Definition at line 165 of file G4AnalysisMessengerHelper.cc.

167{
168 auto parId = new G4UIparameter("id", 'i', false);
169 parId->SetGuidance(Update( "OBJECT id"));
170 parId->SetParameterRange("id>=0");
171
172 auto parNbins = new G4UIparameter("nbins", 'i', false);
173 parNbins->SetGuidance("Number of bins");
174
175 auto parValMin = new G4UIparameter("valMin", 'd', false);
176 parValMin->SetGuidance("Minimum value, expressed in unit");
177
178 auto parValMax = new G4UIparameter("valMax", 'd', false);
179 parValMax->SetGuidance("Maximum value, expressed in unit");
180
181 auto parValUnit = new G4UIparameter("valUnit", 's', true);
182 parValUnit->SetGuidance("The unit applied to filled values and valMin, valMax");
183 parValUnit->SetDefaultValue("none");
184
185 auto parValFcn = new G4UIparameter("valFcn", 's', true);
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");
192
193 auto parValBinScheme = new G4UIparameter("valBinScheme", 's', true);
194 parValBinScheme->SetParameterCandidates("linear log");
195 G4String binSchemeGuidance = "The binning scheme (linear, log).\n";
196 binSchemeGuidance
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");
201
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);
215 command->AvailableForStates(G4State_PreInit, G4State_Idle);
216
217 return command;
218}

◆ CreateSetTitleCommand()

std::unique_ptr< G4UIcommand > G4AnalysisMessengerHelper::CreateSetTitleCommand ( G4UImessenger messenger) const

Definition at line 142 of file G4AnalysisMessengerHelper.cc.

143{
144 auto parId = new G4UIparameter("id", 'i', false);
145 parId->SetGuidance(Update("OBJECT id"));
146 parId->SetParameterRange("id>=0");
147
148 auto parTitle = new G4UIparameter("title", 's', true);
149 parTitle->SetGuidance(Update("OBJECT title"));
150 parTitle->SetDefaultValue("none");
151
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);
157 command->AvailableForStates(G4State_PreInit, G4State_Idle);
158
159 return command;
160}

◆ CreateSetValuesCommand()

std::unique_ptr< G4UIcommand > G4AnalysisMessengerHelper::CreateSetValuesCommand ( const G4String axis,
G4UImessenger messenger 
) const

Definition at line 222 of file G4AnalysisMessengerHelper.cc.

224{
225 auto parId = new G4UIparameter("id", 'i', false);
226 parId->SetGuidance(Update("OBJECT id"));
227 parId->SetParameterRange("id>=0");
228
229 auto parValMin = new G4UIparameter("valMin", 'd', false);
230 parValMin->SetGuidance(Update("Minimum AXIS-value expressed in unit", axis));
231
232 auto parValMax = new G4UIparameter("valMax", 'd', false);
233 parValMax->SetGuidance(Update("Maximum AXIS-value expressed in unit", axis));
234
235 auto parValUnit = new G4UIparameter("valUnit", 's', true);
236 parValUnit->SetGuidance("The unit applied to filled values and valMin, valMax");
237 parValUnit->SetDefaultValue("none");
238
239 auto parValFcn = new G4UIparameter("valFcn", 's', true);
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");
246
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);
257 command->AvailableForStates(G4State_PreInit, G4State_Idle);
258
259 return command;
260}

◆ GetBinData()

void G4AnalysisMessengerHelper::GetBinData ( BinData data,
std::vector< G4String > &  parameters,
G4int counter 
) const

Definition at line 308 of file G4AnalysisMessengerHelper.cc.

311{
312 data.fNbins = G4UIcommand::ConvertToInt(parameters[counter++]);
313 data.fVmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
314 data.fVmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
315 data.fSunit = parameters[counter++];
316 data.fSfcn = parameters[counter++];
317 data.fSbinScheme = parameters[counter++];
318}
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:543
static G4double ConvertToDouble(const char *st)
Definition: G4UIcommand.cc:561

◆ GetValueData()

void G4AnalysisMessengerHelper::GetValueData ( ValueData data,
std::vector< G4String > &  parameters,
G4int counter 
) const

Definition at line 321 of file G4AnalysisMessengerHelper.cc.

324{
325 data.fVmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
326 data.fVmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
327 data.fSunit = parameters[counter++];
328 data.fSfcn = parameters[counter++];
329}

◆ WarnAboutParameters()

void G4AnalysisMessengerHelper::WarnAboutParameters ( G4UIcommand command,
G4int  nofParameters 
) const

Definition at line 332 of file G4AnalysisMessengerHelper.cc.

334{
335 G4ExceptionDescription description;
336 description
337 << "Got wrong number of \"" << command->GetCommandName()
338 << "\" parameters: " << nofParameters
339 << " instead of " << command->GetParameterEntries()
340 << " expected" << G4endl;
341 G4String methodName(Update("G4UHNTYPE_Messenger::SetNewValue"));
342 G4Exception(methodName,
343 "Analysis_W013", JustWarning, description);
344}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
#define G4endl
Definition: G4ios.hh:57
std::size_t GetParameterEntries() const
Definition: G4UIcommand.hh:138
const G4String & GetCommandName() const
Definition: G4UIcommand.hh:137

◆ WarnAboutSetCommands()

void G4AnalysisMessengerHelper::WarnAboutSetCommands ( ) const

Definition at line 347 of file G4AnalysisMessengerHelper.cc.

348{
349 G4ExceptionDescription description;
350 description
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"));
354 G4Exception(methodName,
355 "Analysis_W013", JustWarning, description);
356}

Friends And Related Function Documentation

◆ G4HnMessenger

friend class G4HnMessenger
friend

Definition at line 78 of file G4AnalysisMessengerHelper.hh.


The documentation for this class was generated from the following files: