Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
 
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 45 of file G4AnalysisMessengerHelper.hh.

Constructor & Destructor Documentation

G4AnalysisMessengerHelper::G4AnalysisMessengerHelper ( const G4String hnType)
explicit

Definition at line 79 of file G4AnalysisMessengerHelper.cc.

80  : fHnType(hnType)
81 {}
G4AnalysisMessengerHelper::~G4AnalysisMessengerHelper ( )

Definition at line 84 of file G4AnalysisMessengerHelper.cc.

85 {}

Member Function Documentation

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

Definition at line 134 of file G4AnalysisMessengerHelper.cc.

135 {
136  std::unique_ptr<G4UIdirectory> directory(new G4UIdirectory(Update("/analysis/HNTYPE_/")));
137  directory->SetGuidance(Update("NDIM_D LOBJECT control"));
138  return directory;
139 }
std::unique_ptr< G4UIcommand > G4AnalysisMessengerHelper::CreateSetAxisCommand ( const G4String axis,
G4UImessenger messenger 
) const

Definition at line 265 of file G4AnalysisMessengerHelper.cc.

267 {
268  auto parId = new G4UIparameter("id", 'i', false);
269  parId->SetGuidance(Update("OBJECT id"));
270  parId->SetParameterRange("id>=0");
271 
272  auto parAxis = new G4UIparameter("axis", 's', true);
273  parAxis->SetGuidance(Update("Histogram AXIS-axis title", axis));
274  parAxis->SetDefaultValue("none");
275 
276  std::unique_ptr<G4UIcommand> command(
277  new G4UIcommand(Update("/analysis/HNTYPE_/setUAXISaxis", axis), messenger));
278  command->SetGuidance(Update("Set AXIS-axis title for the NDIM_D LOBJECT of given id", axis));
279  command->SetParameter(parId);
280  command->SetParameter(parAxis);
281  command->AvailableForStates(G4State_PreInit, G4State_Idle);
282 
283  return command;
284 }
std::unique_ptr< G4UIcommand > G4AnalysisMessengerHelper::CreateSetBinsCommand ( const G4String axis,
G4UImessenger messenger 
) const

Definition at line 166 of file G4AnalysisMessengerHelper.cc.

168 {
169  auto parId = new G4UIparameter("id", 'i', false);
170  parId->SetGuidance(Update( "OBJECT id"));
171  parId->SetParameterRange("id>=0");
172 
173  auto parNbins = new G4UIparameter("nbins", 'i', false);
174  parNbins->SetGuidance("Number of bins");
175 
176  auto parValMin = new G4UIparameter("valMin", 'd', false);
177  parValMin->SetGuidance("Minimum value, expressed in unit");
178 
179  auto parValMax = new G4UIparameter("valMax", 'd', false);
180  parValMax->SetGuidance("Maximum value, expressed in unit");
181 
182  auto parValUnit = new G4UIparameter("valUnit", 's', true);
183  parValUnit->SetGuidance("The unit applied to filled values and valMin, valMax");
184  parValUnit->SetDefaultValue("none");
185 
186  auto parValFcn = new G4UIparameter("valFcn", 's', true);
187  parValFcn->SetParameterCandidates("log log10 exp none");
188  G4String fcnGuidance = "The function applied to filled values (log, log10, exp, none).\n";
189  fcnGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
190  fcnGuidance += "but none value should be used instead.";
191  parValFcn->SetGuidance(fcnGuidance);
192  parValFcn->SetDefaultValue("none");
193 
194  auto parValBinScheme = new G4UIparameter("valBinScheme", 's', true);
195  parValBinScheme->SetParameterCandidates("linear log");
196  G4String binSchemeGuidance = "The binning scheme (linear, log).\n";
197  binSchemeGuidance
198  += "Note that the unit and fcn parameters cannot be omitted in this case,\n";
199  binSchemeGuidance += "but none value should be used instead.";
200  parValBinScheme->SetGuidance(binSchemeGuidance);
201  parValBinScheme->SetDefaultValue("linear");
202 
203  auto commandName = Update("/analysis/HNTYPE_/setUAXIS", axis);
204  std::unique_ptr<G4UIcommand> command(
205  new G4UIcommand(Update("/analysis/HNTYPE_/setUAXIS", axis), messenger));
206  command->SetGuidance(Update("Set parameters for the NDIM_D LOBJECT of given id:"));
207  command->SetGuidance(
208  Update(" nAXISbins; AXISvalMin; AXISvalMax; AXISunit; AXISfunction; AXISbinScheme", axis));
209  command->SetParameter(parId);
210  command->SetParameter(parNbins);
211  command->SetParameter(parValMin);
212  command->SetParameter(parValMax);
213  command->SetParameter(parValUnit);
214  command->SetParameter(parValFcn);
215  command->SetParameter(parValBinScheme);
216  command->AvailableForStates(G4State_PreInit, G4State_Idle);
217 
218  return command;
219 }
std::unique_ptr< G4UIcommand > G4AnalysisMessengerHelper::CreateSetTitleCommand ( G4UImessenger messenger) const

Definition at line 143 of file G4AnalysisMessengerHelper.cc.

144 {
145  auto parId = new G4UIparameter("id", 'i', false);
146  parId->SetGuidance(Update("OBJECT id"));
147  parId->SetParameterRange("id>=0");
148 
149  auto parTitle = new G4UIparameter("title", 's', true);
150  parTitle->SetGuidance(Update("OBJECT title"));
151  parTitle->SetDefaultValue("none");
152 
153  std::unique_ptr<G4UIcommand> command(
154  new G4UIcommand(Update("/analysis/HNTYPE_/setTitle"), messenger));
155  command->SetGuidance(Update("Set title for the NDIM_D LOBJECT of given id"));
156  command->SetParameter(parId);
157  command->SetParameter(parTitle);
158  command->AvailableForStates(G4State_PreInit, G4State_Idle);
159 
160  return command;
161 }
std::unique_ptr< G4UIcommand > G4AnalysisMessengerHelper::CreateSetValuesCommand ( const G4String axis,
G4UImessenger messenger 
) const

Definition at line 223 of file G4AnalysisMessengerHelper.cc.

225 {
226  auto parId = new G4UIparameter("id", 'i', false);
227  parId->SetGuidance(Update("OBJECT id"));
228  parId->SetParameterRange("id>=0");
229 
230  auto parValMin = new G4UIparameter("valMin", 'd', false);
231  parValMin->SetGuidance(Update("Minimum AXIS-value expressed in unit", axis));
232 
233  auto parValMax = new G4UIparameter("valMax", 'd', false);
234  parValMax->SetGuidance(Update("Maximum AXIS-value expressed in unit", axis));
235 
236  auto parValUnit = new G4UIparameter("valUnit", 's', true);
237  parValUnit->SetGuidance("The unit applied to filled values and valMin, valMax");
238  parValUnit->SetDefaultValue("none");
239 
240  auto parValFcn = new G4UIparameter("valFcn", 's', true);
241  parValFcn->SetParameterCandidates("log log10 exp none");
242  G4String fcnGuidance = "The function applied to filled values (log, log10, exp, none).\n";
243  fcnGuidance += "Note that the unit parameter cannot be omitted in this case,\n";
244  fcnGuidance += "but none value should be used instead.";
245  parValFcn->SetGuidance(fcnGuidance);
246  parValFcn->SetDefaultValue("none");
247 
248  std::unique_ptr<G4UIcommand> command(
249  new G4UIcommand(Update("/analysis/HNTYPE_/setUAXIS", axis), messenger));
250  command->SetGuidance(Update("Set parameters for the NDIM_D LOBJECT of #id:"));
251  command->SetGuidance(
252  Update(" AXISvalMin; AXISvalMax; AXISunit; AXISfunction", axis));
253  command->SetParameter(parId);
254  command->SetParameter(parValMin);
255  command->SetParameter(parValMax);
256  command->SetParameter(parValUnit);
257  command->SetParameter(parValFcn);
258  command->AvailableForStates(G4State_PreInit, G4State_Idle);
259 
260  return command;
261 }
void G4AnalysisMessengerHelper::GetBinData ( BinData data,
std::vector< G4String > &  parameters,
G4int counter 
) const

Definition at line 287 of file G4AnalysisMessengerHelper.cc.

290 {
291  data.fNbins = G4UIcommand::ConvertToInt(parameters[counter++]);
292  data.fVmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
293  data.fVmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
294  data.fSunit = parameters[counter++];
295  data.fSfcn = parameters[counter++];
296  data.fSbinScheme = parameters[counter++];
297 }
const XML_Char const XML_Char * data
Definition: expat.h:268
static G4double ConvertToDouble(const char *st)
Definition: G4UIcommand.cc:455
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:447

Here is the call graph for this function:

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

Definition at line 300 of file G4AnalysisMessengerHelper.cc.

303 {
304  data.fVmin = G4UIcommand::ConvertToDouble(parameters[counter++]);
305  data.fVmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ;
306  data.fSunit = parameters[counter++];
307  data.fSfcn = parameters[counter++];
308 }
const XML_Char const XML_Char * data
Definition: expat.h:268
static G4double ConvertToDouble(const char *st)
Definition: G4UIcommand.cc:455

Here is the call graph for this function:

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

Definition at line 311 of file G4AnalysisMessengerHelper.cc.

313 {
314  G4ExceptionDescription description;
315  description
316  << "Got wrong number of \"" << command->GetCommandName()
317  << "\" parameters: " << nofParameters
318  << " instead of " << command->GetParameterEntries()
319  << " expected" << G4endl;
320  G4String methodName(Update("G4UHNTYPE_Messenger::SetNewValue"));
321  G4Exception(methodName,
322  "Analysis_W013", JustWarning, description);
323 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
const G4String & GetCommandName() const
Definition: G4UIcommand.hh:141
#define G4endl
Definition: G4ios.hh:61
G4int GetParameterEntries() const
Definition: G4UIcommand.hh:143

Here is the call graph for this function:

void G4AnalysisMessengerHelper::WarnAboutSetCommands ( ) const

Definition at line 326 of file G4AnalysisMessengerHelper.cc.

327 {
328  G4ExceptionDescription description;
329  description
330  << "Command setX, setY, setZ must be called sucessively in this order. " << G4endl
331  << "Command was ignored." << G4endl;
332  G4String methodName(Update("G4UHNTYPE_Messenger::SetNewValue"));
333  G4Exception(methodName,
334  "Analysis_W013", JustWarning, description);
335 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

Friends And Related Function Documentation

friend class G4HnMessenger
friend

Definition at line 79 of file G4AnalysisMessengerHelper.hh.


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