Geant4 11.1.1
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)
 
 G4PlotMessenger ()=delete
 
 ~G4PlotMessenger () override
 
void SetNewValue (G4UIcommand *command, G4String value) final
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()=default
 
 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 (const G4String &s)
 
G4long StoL (const G4String &s)
 
G4double StoD (const 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 47 of file G4PlotMessenger.hh.

Constructor & Destructor Documentation

◆ G4PlotMessenger() [1/2]

G4PlotMessenger::G4PlotMessenger ( G4PlotParameters plotParameters)
explicit

Definition at line 44 of file G4PlotMessenger.cc.

45 : fPlotParameters(plotParameters)
46{
47 fDirectory = std::make_unique<G4UIdirectory>("/analysis/plot/");
48 fDirectory->SetGuidance("Analysis batch plotting control");
49
50 SetStyleCmd();
51 SetLayoutCmd();
52 SetDimensionsCmd();
53}

◆ G4PlotMessenger() [2/2]

G4PlotMessenger::G4PlotMessenger ( )
delete

◆ ~G4PlotMessenger()

G4PlotMessenger::~G4PlotMessenger ( )
overridedefault

Member Function Documentation

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 134 of file G4PlotMessenger.cc.

135{
136 // tokenize parameters in a vector
137 std::vector<G4String> parameters;
138 G4Analysis::Tokenize(newValues, parameters);
139 // check consistency
140 if ( parameters.size() != command->GetParameterEntries() ) {
141 // Should never happen but let's check anyway for consistency
143 "Got wrong number of \"" + command->GetCommandName() +
144 "\" parameters: " + to_string(parameters.size()) +
145 " instead of " + to_string(command->GetParameterEntries()) + " expected",
146 fkClass, "WarnAboutParameters");
147 return;
148 }
149
150 auto counter = 0;
151 if ( command == fSetLayoutCmd.get() ) {
152 auto columns = G4UIcommand::ConvertToInt(parameters[counter++]);
153 auto rows = G4UIcommand::ConvertToInt(parameters[counter++]);
154 fPlotParameters->SetLayout(columns, rows);
155 return;
156 }
157
158 if ( command == fSetDimensionsCmd.get() ) {
159 auto width = G4UIcommand::ConvertToInt(parameters[counter++]);
160 auto height = G4UIcommand::ConvertToInt(parameters[counter++]);
161 fPlotParameters->SetDimensions(width, height);
162 return;
163 }
164
165 if ( command == fSetStyleCmd.get() ) {
166 fPlotParameters->SetStyle(newValues);
167 return;
168 }
169}
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:139
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:561
const G4String & GetCommandName() const
Definition: G4UIcommand.hh:138
void Tokenize(const G4String &line, std::vector< G4String > &tokens)
void Warn(const G4String &message, const std::string_view inClass, const std::string_view inFunction)

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