Geant4  10.02.p03
G4HnMessenger Class Reference

#include <G4HnMessenger.hh>

Inheritance diagram for G4HnMessenger:
Collaboration diagram for G4HnMessenger:

Public Member Functions

 G4HnMessenger (G4HnManager &manager)
 
virtual ~G4HnMessenger ()
 
virtual void SetNewValue (G4UIcommand *command, G4String value) final
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Private Member Functions

void SetHnAsciiCmd ()
 
void SetHnActivationCmd ()
 
void SetHnActivationToAllCmd ()
 
void SetHnPlottingCmd ()
 
void SetHnPlottingToAllCmd ()
 

Private Attributes

G4HnManagerfManager
 Associated class. More...
 
std::unique_ptr< G4AnalysisMessengerHelperfHelper
 
std::unique_ptr< G4UIcmdWithAnIntegerfSetHnAsciiCmd
 
std::unique_ptr< G4UIcommandfSetHnActivationCmd
 
std::unique_ptr< G4UIcmdWithABoolfSetHnActivationAllCmd
 
std::unique_ptr< G4UIcommandfSetHnPlottingCmd
 
std::unique_ptr< G4UIcmdWithABoolfSetHnPlottingAllCmd
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

Detailed Description

Definition at line 47 of file G4HnMessenger.hh.

Constructor & Destructor Documentation

◆ G4HnMessenger()

G4HnMessenger::G4HnMessenger ( G4HnManager manager)
explicit

Definition at line 44 of file G4HnMessenger.cc.

45  : G4UImessenger(),
46  fManager(manager),
47  fHelper(nullptr),
48  fSetHnAsciiCmd(nullptr),
49  fSetHnActivationCmd(nullptr),
50  fSetHnActivationAllCmd(nullptr),
51  fSetHnPlottingCmd(nullptr),
52  fSetHnPlottingAllCmd(nullptr)
53 {
54  G4String hnType = fManager.GetHnType();
55  hnType.toLower();
56  fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>(hnType);
57 
58  SetHnAsciiCmd();
63 }
std::unique_ptr< G4UIcmdWithABool > fSetHnActivationAllCmd
void SetHnPlottingToAllCmd()
G4HnManager & fManager
Associated class.
G4String GetHnType() const
Definition: G4HnManager.hh:118
void SetHnPlottingCmd()
std::unique_ptr< G4AnalysisMessengerHelper > fHelper
std::unique_ptr< G4UIcommand > fSetHnPlottingCmd
void SetHnAsciiCmd()
std::unique_ptr< G4UIcmdWithAnInteger > fSetHnAsciiCmd
void toLower()
std::unique_ptr< G4UIcommand > fSetHnActivationCmd
void SetHnActivationCmd()
std::unique_ptr< G4UIcmdWithABool > fSetHnPlottingAllCmd
void SetHnActivationToAllCmd()
Here is the call graph for this function:

◆ ~G4HnMessenger()

G4HnMessenger::~G4HnMessenger ( )
virtual

Definition at line 66 of file G4HnMessenger.cc.

67 {}

Member Function Documentation

◆ SetHnActivationCmd()

void G4HnMessenger::SetHnActivationCmd ( )
private

Definition at line 87 of file G4HnMessenger.cc.

88 {
89  auto hnId = new G4UIparameter("id", 'i', false);
90  hnId->SetGuidance(fHelper->Update("OBJECT id"));
91  hnId->SetParameterRange("id>=0");
92 
93  auto hnActivation = new G4UIparameter("hnActivation", 's', true);
94  hnActivation->SetGuidance(fHelper->Update("OBJECT activation"));
95  hnActivation->SetDefaultValue("none");
96 
98  = G4Analysis::make_unique<G4UIcommand>(fHelper->Update("/analysis/HNTYPE_/setActivation"), this);
99  fSetHnActivationCmd->SetGuidance(
100  fHelper->Update("Set activation for the NDIM_D LOBJECT of given id"));
101  fSetHnActivationCmd->SetParameter(hnId);
102  fSetHnActivationCmd->SetParameter(hnActivation);
103  fSetHnActivationCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
104 }
std::unique_ptr< G4AnalysisMessengerHelper > fHelper
std::unique_ptr< G4UIcommand > fSetHnActivationCmd
Here is the caller graph for this function:

◆ SetHnActivationToAllCmd()

void G4HnMessenger::SetHnActivationToAllCmd ( )
private

Definition at line 107 of file G4HnMessenger.cc.

108 {
110  = G4Analysis::make_unique<G4UIcmdWithABool>(fHelper->Update("/analysis/HNTYPE_/setActivationToAll"), this);
111  fSetHnActivationAllCmd->SetGuidance(
112  fHelper->Update("Set activation to all NDIM_D LOBJECTs"));
113  fSetHnActivationAllCmd->SetParameterName("Activation",false);
114 }
std::unique_ptr< G4UIcmdWithABool > fSetHnActivationAllCmd
std::unique_ptr< G4AnalysisMessengerHelper > fHelper
Here is the caller graph for this function:

◆ SetHnAsciiCmd()

void G4HnMessenger::SetHnAsciiCmd ( )
private

Definition at line 74 of file G4HnMessenger.cc.

75 {
77  = G4Analysis::make_unique<G4UIcmdWithAnInteger>(fHelper->Update("/analysis/HNTYPE_/setAscii"), this);
78  fSetHnAsciiCmd->SetGuidance(
79  fHelper->Update("Print NDIM_D LOBJECT of given id on ascii file."));
80 
81  fSetHnAsciiCmd->SetParameterName("id",false);
82  fSetHnAsciiCmd->SetRange("id>=0");
83  fSetHnAsciiCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
84 }
std::unique_ptr< G4AnalysisMessengerHelper > fHelper
std::unique_ptr< G4UIcmdWithAnInteger > fSetHnAsciiCmd
Here is the caller graph for this function:

◆ SetHnPlottingCmd()

void G4HnMessenger::SetHnPlottingCmd ( )
private

Definition at line 117 of file G4HnMessenger.cc.

118 {
119  auto hnId = new G4UIparameter("id", 'i', false);
120  hnId->SetGuidance(fHelper->Update("OBJECT id"));
121  hnId->SetParameterRange("id>=0");
122 
123  auto hnPlotting = new G4UIparameter("hnPlotting", 's', true);
124  hnPlotting->SetGuidance(fHelper->Update("(In)Activate OBJECT plotting"));
125  hnPlotting->SetDefaultValue("none");
126 
128  = G4Analysis::make_unique<G4UIcommand>(fHelper->Update("/analysis/HNTYPE_/setPlotting"), this);
129  fSetHnPlottingCmd->SetGuidance(
130  fHelper->Update("(In)Activate batch plotting of the NDIM_D LOBJECT of given id"));
131  fSetHnPlottingCmd->SetParameter(hnId);
132  fSetHnPlottingCmd->SetParameter(hnPlotting);
133  fSetHnPlottingCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
134 }
std::unique_ptr< G4AnalysisMessengerHelper > fHelper
std::unique_ptr< G4UIcommand > fSetHnPlottingCmd
Here is the caller graph for this function:

◆ SetHnPlottingToAllCmd()

void G4HnMessenger::SetHnPlottingToAllCmd ( )
private

Definition at line 137 of file G4HnMessenger.cc.

138 {
140  = G4Analysis::make_unique<G4UIcmdWithABool>(fHelper->Update("/analysis/HNTYPE_/setPlottingToAll"), this);
141  fSetHnPlottingAllCmd->SetGuidance(
142  fHelper->Update("(In)Activate batch plotting of all NDIM_D LOBJECTs"));
143  fSetHnPlottingAllCmd->SetParameterName("Plotting",false);
144 }
std::unique_ptr< G4AnalysisMessengerHelper > fHelper
std::unique_ptr< G4UIcmdWithABool > fSetHnPlottingAllCmd
Here is the caller graph for this function:

◆ SetNewValue()

void G4HnMessenger::SetNewValue ( G4UIcommand command,
G4String  value 
)
finalvirtual

Reimplemented from G4UImessenger.

Definition at line 151 of file G4HnMessenger.cc.

152 {
153  if ( command == fSetHnAsciiCmd.get() ) {
154  auto id = fSetHnAsciiCmd->GetNewIntValue(newValues);
155  fManager.SetAscii(id, true);
156  }
157  else if ( command == fSetHnActivationCmd.get() ) {
158  // tokenize parameters in a vector
159  std::vector<G4String> parameters;
160  G4Analysis::Tokenize(newValues, parameters);
161  // check consistency
162  if ( G4int(parameters.size()) == command->GetParameterEntries() ) {
163  auto counter = 0;
164  auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
165  auto activation = G4UIcommand::ConvertToBool(parameters[counter++]);
166  fManager.SetActivation(id, activation);
167  }
168  else {
169  // Should never happen but let's check anyway for consistency
170  fHelper->WarnAboutParameters(command, parameters.size());
171  }
172  }
173  else if ( command == fSetHnActivationAllCmd.get() ) {
174  auto activation = fSetHnActivationAllCmd->GetNewBoolValue(newValues);
175  fManager.SetActivation(activation);
176  }
177  else if ( command == fSetHnPlottingCmd.get() ) {
178  // tokenize parameters in a vector
179  std::vector<G4String> parameters;
180  G4Analysis::Tokenize(newValues, parameters);
181  // check consistency
182  if ( G4int(parameters.size()) == command->GetParameterEntries() ) {
183  auto counter = 0;
184  auto id = G4UIcommand::ConvertToInt(parameters[counter++]);
185  auto activation = G4UIcommand::ConvertToBool(parameters[counter++]);
186  fManager.SetPlotting(id, activation);
187  }
188  else {
189  // Should never happen but let's check anyway for consistency
190  fHelper->WarnAboutParameters(command, parameters.size());
191  }
192  }
193  else if ( command == fSetHnPlottingAllCmd.get() ) {
194  auto activation = fSetHnPlottingAllCmd->GetNewBoolValue(newValues);
195  fManager.SetPlotting(activation);
196  }
197 }
std::unique_ptr< G4UIcmdWithABool > fSetHnActivationAllCmd
G4HnManager & fManager
Associated class.
std::unique_ptr< G4AnalysisMessengerHelper > fHelper
std::unique_ptr< G4UIcommand > fSetHnPlottingCmd
int G4int
Definition: G4Types.hh:78
void SetPlotting(G4bool plotting)
Definition: G4HnManager.cc:200
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:425
std::unique_ptr< G4UIcmdWithAnInteger > fSetHnAsciiCmd
void SetAscii(G4int id, G4bool ascii)
Definition: G4HnManager.cc:164
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:435
std::unique_ptr< G4UIcommand > fSetHnActivationCmd
void Tokenize(const G4String &line, std::vector< G4String > &tokens)
std::unique_ptr< G4UIcmdWithABool > fSetHnPlottingAllCmd
G4int GetParameterEntries() const
Definition: G4UIcommand.hh:143
void SetActivation(G4bool activation)
Definition: G4HnManager.cc:141
Here is the call graph for this function:

Member Data Documentation

◆ fHelper

std::unique_ptr<G4AnalysisMessengerHelper> G4HnMessenger::fHelper
private

Definition at line 64 of file G4HnMessenger.hh.

◆ fManager

G4HnManager& G4HnMessenger::fManager
private

Associated class.

Definition at line 63 of file G4HnMessenger.hh.

◆ fSetHnActivationAllCmd

std::unique_ptr<G4UIcmdWithABool> G4HnMessenger::fSetHnActivationAllCmd
private

Definition at line 68 of file G4HnMessenger.hh.

◆ fSetHnActivationCmd

std::unique_ptr<G4UIcommand> G4HnMessenger::fSetHnActivationCmd
private

Definition at line 67 of file G4HnMessenger.hh.

◆ fSetHnAsciiCmd

std::unique_ptr<G4UIcmdWithAnInteger> G4HnMessenger::fSetHnAsciiCmd
private

Definition at line 66 of file G4HnMessenger.hh.

◆ fSetHnPlottingAllCmd

std::unique_ptr<G4UIcmdWithABool> G4HnMessenger::fSetHnPlottingAllCmd
private

Definition at line 70 of file G4HnMessenger.hh.

◆ fSetHnPlottingCmd

std::unique_ptr<G4UIcommand> G4HnMessenger::fSetHnPlottingCmd
private

Definition at line 69 of file G4HnMessenger.hh.


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