31#ifndef G4PlotManager_h
32#define G4PlotManager_h 1
38#include "tools/viewplot"
58 template <
typename HT>
64 G4int GetNofPlotsPerPage()
const;
68 static constexpr std::string_view fkClass {
"G4PlotManager" };
73 std::unique_ptr<tools::viewplot> fViewer;
80inline G4int G4PlotManager::GetNofPlotsPerPage()
const
87 const std::vector<std::pair<HT*, G4HnInformation*>>& hnVector)
89 if ( ! hnVector.size() )
return true;
91 fViewer->plots().init_sg();
94 fViewer->plots().set_current_plotter(0);
97 auto isWriteNeeded =
false;
99 for (
const auto& [ht, info] : hnVector) {
100 G4bool plotting = info->GetPlotting();
101 G4bool activation = info->GetActivation();
105 if ( ( ! plotting ) ||
110 fViewer->set_current_plotter_style(fPlotParameters.
GetStyle());
113 tools::sg::plotter& plotter = fViewer->plots().current_plotter();
115 plotter.bins_style(0).color = tools::colorf_blue();
119 if ( ht->annotation(tools::histo::key_axis_x_title(), title) ) {
120 plotter.x_axis().title = title;
122 if ( ht->annotation(tools::histo::key_axis_y_title(), title) ) {
123 plotter.y_axis().title = title;
125 if ( ht->annotation(tools::histo::key_axis_z_title(), title) ) {
126 plotter.z_axis().title = title;
129#ifndef TOOLS_USE_FREETYPE
130 plotter.set_encoding_none();
135 plotter.x_axis().labels_style().encoding =
"PAW";
136 plotter.x_axis_is_log =
true;
139 plotter.y_axis().labels_style().encoding =
"PAW";
140 plotter.y_axis_is_log =
true;
143 plotter.z_axis().labels_style().encoding =
"PAW";
144 plotter.z_axis_is_log =
true;
146 isWriteNeeded =
true;
151 if (
G4int(fViewer->plots().current_index()) == (GetNofPlotsPerPage() - 1) ) {
152 result &= WritePage();
153 isWriteNeeded =
false;
157 fViewer->plots().next();
161 if ( isWriteNeeded ) {
162 result &= WritePage();
void Message(G4int level, const G4String &action, const G4String &objectType, const G4String &objectName="", G4bool success=true) const
G4bool GetIsActivation() const
G4bool OpenFile(const G4String &fileName)
G4PlotManager & operator=(const G4PlotManager &rhs)=delete
G4PlotManager(const G4PlotManager &rhs)=delete
G4bool PlotAndWrite(const std::vector< std::pair< HT *, G4HnInformation * > > &hnVector)
G4String GetStyle() const