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

#include <G4PlotMessenger.hh>

+ Inheritance diagram for G4PlotMessenger:

Public Member Functions

 G4PlotMessenger (G4PlotParameters *plotParameters)
 
virtual ~G4PlotMessenger ()
 
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)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

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)
 
G4long StoL (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 = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Detailed Description

Definition at line 46 of file G4PlotMessenger.hh.

Constructor & Destructor Documentation

◆ G4PlotMessenger()

G4PlotMessenger::G4PlotMessenger ( G4PlotParameters plotParameters)
explicit

Definition at line 47 of file G4PlotMessenger.cc.

48 : G4UImessenger(),
49 fPlotParameters(plotParameters),
50 fHelper(nullptr),
51 fDirectory(nullptr),
52 fSetLayoutCmd(nullptr),
53 fSetDimensionsCmd(nullptr),
54 fSetStyleCmd(nullptr)
55{
56 fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>("plot");
57
58 fDirectory = fHelper->CreateHnDirectory();
59
60 SetStyleCmd();
61 SetLayoutCmd();
62 SetDimensionsCmd();
63}

◆ ~G4PlotMessenger()

G4PlotMessenger::~G4PlotMessenger ( )
virtual

Definition at line 66 of file G4PlotMessenger.cc.

67{}

Member Function Documentation

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 153 of file G4PlotMessenger.cc.

154{
155 // tokenize parameters in a vector
156 std::vector<G4String> parameters;
157 G4Analysis::Tokenize(newValues, parameters);
158 // check consistency
159 if ( parameters.size() != command->GetParameterEntries() ) {
160 // Should never happen but let's check anyway for consistency
161 fHelper->WarnAboutParameters(command, parameters.size());
162 return;
163 }
164
165 if ( command == fSetLayoutCmd.get() ) {
166 auto counter = 0;
167 auto columns = G4UIcommand::ConvertToInt(parameters[counter++]);
168 auto rows = G4UIcommand::ConvertToInt(parameters[counter++]);
169 fPlotParameters->SetLayout(columns, rows);
170 }
171 else if ( command == fSetDimensionsCmd.get() ) {
172 auto counter = 0;
173 auto width = G4UIcommand::ConvertToInt(parameters[counter++]);
174 auto height = G4UIcommand::ConvertToInt(parameters[counter++]);
175 fPlotParameters->SetDimensions(width, height);
176 }
177#if defined(TOOLS_USE_FREETYPE)
178 else if ( command == fSetStyleCmd.get() ) {
179 fPlotParameters->SetStyle(newValues);
180 }
181#endif
182}
void SetLayout(G4int columns, G4int rows)
void SetDimensions(G4int width, G4int height)
void SetStyle(const G4String &style)
std::size_t GetParameterEntries() const
Definition: G4UIcommand.hh:138
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:543
void Tokenize(const G4String &line, std::vector< G4String > &tokens)

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