45 using namespace G4Analysis;
50 fPlotParameters(plotParameters),
53 fSetLayoutCmd(nullptr),
54 fSetDimensionsCmd(nullptr),
57 fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>(
"plot");
59 fDirectory = fHelper->CreateHnDirectory();
75 void G4PlotMessenger::SetStyleCmd()
77 fSetStyleCmd = G4Analysis::make_unique<G4UIcmdWithAString>(
"/analysis/plot/setStyle",
this);
78 #if defined(TOOLS_USE_FREETYPE)
79 fSetStyleCmd->SetGuidance(
"Set plotting style from: ");
80 fSetStyleCmd->SetGuidance(
" ROOT_default: ROOT style with high resolution fonts");
81 fSetStyleCmd->SetGuidance(
" hippodraw: hippodraw style with high resolution fonts");
82 fSetStyleCmd->SetGuidance(
" inlib_default: PAW style with low resolution fonts");
83 fSetStyleCmd->SetParameterName(
"Style",
false);
85 fSetStyleCmd->SetGuidance(
"Only one plotting style is available in low resolution: ");
86 fSetStyleCmd->SetGuidance(
" inlib_default: PAW style with low resolution fonts");
87 fSetStyleCmd->SetParameterName(
"Style",
false);
88 fSetStyleCmd->SetCandidates(
"inlib_default");
95 void G4PlotMessenger::SetLayoutCmd()
98 columns->SetGuidance(
"The number of columns in the page layout.");
100 std::ostringstream osMaxColumns;
102 range.
append(osMaxColumns.str());
103 columns->SetParameterRange(range);
106 rows->SetGuidance(
"The number of rows in the page layout.");
107 range =
"rows>=1 && rows<=";
108 std::ostringstream osMaxRows;
110 range.
append(osMaxRows.str());
111 rows->SetParameterRange(range);
113 fSetLayoutCmd = G4Analysis::make_unique<G4UIcommand>(
"/analysis/plot/setLayout",
this);
119 fSetLayoutCmd->SetGuidance(
"Set page layout (number of columns and rows per page).");
120 fSetLayoutCmd->SetGuidance(
" Suported layouts: ");
121 G4String guidance =
" columns = 1 .. ";
122 guidance.
append(osMaxColumns.str());
123 fSetLayoutCmd->SetGuidance(guidance);
124 guidance =
" rows = 1 .. ";
125 guidance.
append(osMaxRows.str());
126 guidance.
append(
" and >= columns");
127 fSetLayoutCmd->SetGuidance(guidance);
128 fSetLayoutCmd->SetParameter(columns);
129 fSetLayoutCmd->SetParameter(rows);
134 void G4PlotMessenger::SetDimensionsCmd()
137 width->SetGuidance(
"The page width.");
140 height->SetGuidance(
"The page height.");
142 fSetDimensionsCmd = G4Analysis::make_unique<G4UIcommand>(
"/analysis/plot/setDimensions",
this);
143 fSetDimensionsCmd->SetGuidance(
"Set the plotter window size (width and height) in pixels.");
144 fSetDimensionsCmd->SetParameter(
width);
145 fSetDimensionsCmd->SetParameter(height);
157 std::vector<G4String> parameters;
162 fHelper->WarnAboutParameters(command, parameters.size());
166 if ( command == fSetLayoutCmd.get() ) {
170 fPlotParameters->
SetLayout(columns, rows);
172 else if ( command == fSetDimensionsCmd.get() ) {
178 #if defined(TOOLS_USE_FREETYPE)
179 else if ( command == fSetStyleCmd.get() ) {
180 fPlotParameters->
SetStyle(newValues);
G4String GetAvailableStyles()
virtual void SetNewValue(G4UIcommand *command, G4String value) final
const G4ParticleDefinition const G4Material *G4double range
static G4int ConvertToInt(const char *st)
void Tokenize(const G4String &line, std::vector< G4String > &tokens)
G4String & append(const G4String &)
void SetLayout(G4int columns, G4int rows)
virtual ~G4PlotMessenger()
void SetDimensions(G4int width, G4int height)
void SetStyle(const G4String &style)
G4int GetParameterEntries() const
G4PlotMessenger(G4PlotParameters *plotParameters)