Geant4-11
G4Plotter.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// Guy Barrand 25th September 2021
27
28#include "G4Plotter.hh"
29
30G4Plotter::G4Plotter():fColumns(1),fRows(1) {}
31
33:fColumns(a_from.fColumns)
34,fRows(a_from.fRows)
35,fStyles(a_from.fStyles)
36,fRegionStyles(a_from.fRegionStyles)
37,fRegionParameters(a_from.fRegionParameters)
38,fRegion_h1ds(a_from.fRegion_h1ds)
39,fRegion_h2ds(a_from.fRegion_h2ds)
40,fRegion_h1s(a_from.fRegion_h1s)
41,fRegion_h2s(a_from.fRegion_h2s)
42{}
43
45 fColumns = a_from.fColumns;
46 fRows = a_from.fRows;
47 fStyles = a_from.fStyles;
52 fRegion_h1s = a_from.fRegion_h1s;
53 fRegion_h2s = a_from.fRegion_h2s;
54 return *this;
55}
56
57void G4Plotter::SetLayout(unsigned int a_cols,unsigned int a_rows) {
58 fColumns = a_cols;
59 fRows = a_rows;
60}
61void G4Plotter::AddStyle(const G4String& a_style) {
62 fStyles.push_back(a_style);
63}
64void G4Plotter::AddRegionStyle(unsigned int a_region,const G4String& a_style) {
65 fRegionStyles.push_back(RegionStyle(a_region,a_style));
66}
67void G4Plotter::AddRegionParameter(unsigned int a_region,const G4String& a_parameter,const G4String& a_value) {
68 fRegionParameters.push_back(RegionParameter(a_region,Parameter(a_parameter,a_value)));
69}
70
71void G4Plotter::AddRegionHistogram(unsigned int a_region,tools::histo::h1d* a_h) {
72 fRegion_h1ds.push_back(Region_h1d(a_region,a_h));
73}
74void G4Plotter::AddRegionHistogram(unsigned int a_region,tools::histo::h2d* a_h) {
75 fRegion_h2ds.push_back(Region_h2d(a_region,a_h));
76}
77void G4Plotter::AddRegionH1(unsigned int a_region,int a_id) {
78 fRegion_h1s.push_back(Region_h1(a_region,a_id));
79}
80void G4Plotter::AddRegionH2(unsigned int a_region,int a_id) {
81 fRegion_h2s.push_back(Region_h2(a_region,a_id));
82}
83
85 fColumns = 1;
86 fRows = 1;
87 fStyles.clear();
88 fRegionStyles.clear();
89 fRegionParameters.clear();
90 fRegion_h1ds.clear();
91 fRegion_h2ds.clear();
92 fRegion_h1s.clear();
93 fRegion_h2s.clear();
94}
96 fRegion_h1ds.clear();
97 fRegion_h2ds.clear();
98 fRegion_h1s.clear();
99 fRegion_h2s.clear();
100}
101void G4Plotter::ClearRegion(unsigned int a_region) {
102 {std::vector<Region_h1d>::iterator it;
103 for(it=fRegion_h1ds.begin();it!=fRegion_h1ds.end();) {
104 if((*it).first==a_region) {
105 it = fRegion_h1ds.erase(it);
106 } else {
107 ++it;
108 }
109 }}
110 {std::vector<Region_h2d>::iterator it;
111 for(it=fRegion_h2ds.begin();it!=fRegion_h2ds.end();) {
112 if((*it).first==a_region) {
113 it = fRegion_h2ds.erase(it);
114 } else {
115 ++it;
116 }
117 }}
118
119 {std::vector<Region_h1>::iterator it;
120 for(it=fRegion_h1s.begin();it!=fRegion_h1s.end();) {
121 if((*it).first==a_region) {
122 it = fRegion_h1s.erase(it);
123 } else {
124 ++it;
125 }
126 }}
127 {std::vector<Region_h2>::iterator it;
128 for(it=fRegion_h2s.begin();it!=fRegion_h2s.end();) {
129 if((*it).first==a_region) {
130 it = fRegion_h2s.erase(it);
131 } else {
132 ++it;
133 }
134 }}
135}
std::pair< unsigned int, G4String > RegionStyle
Definition: G4Plotter.hh:42
std::vector< Region_h2d > fRegion_h2ds
Definition: G4Plotter.hh:85
void AddRegionH2(unsigned int region, int id)
Definition: G4Plotter.cc:80
std::vector< RegionParameter > fRegionParameters
Definition: G4Plotter.hh:83
std::vector< RegionStyle > fRegionStyles
Definition: G4Plotter.hh:82
std::pair< unsigned int, tools::histo::h1d * > Region_h1d
Definition: G4Plotter.hh:45
void AddRegionStyle(unsigned int region, const G4String &style)
Definition: G4Plotter.cc:64
void AddRegionH1(unsigned int region, int id)
Definition: G4Plotter.cc:77
G4Plotter & operator=(const G4Plotter &)
Definition: G4Plotter.cc:44
std::pair< unsigned int, int > Region_h2
Definition: G4Plotter.hh:48
void Clear()
Definition: G4Plotter.cc:95
std::vector< Region_h1 > fRegion_h1s
Definition: G4Plotter.hh:86
std::pair< G4String, G4String > Parameter
Definition: G4Plotter.hh:43
std::vector< Region_h1d > fRegion_h1ds
Definition: G4Plotter.hh:84
void Reset()
Definition: G4Plotter.cc:84
std::pair< unsigned int, Parameter > RegionParameter
Definition: G4Plotter.hh:44
std::pair< unsigned int, int > Region_h1
Definition: G4Plotter.hh:47
void AddRegionHistogram(unsigned int region, tools::histo::h1d *histo)
Definition: G4Plotter.cc:71
void AddStyle(const G4String &style)
Definition: G4Plotter.cc:61
std::vector< Region_h2 > fRegion_h2s
Definition: G4Plotter.hh:87
unsigned int fRows
Definition: G4Plotter.hh:80
void ClearRegion(unsigned int region)
Definition: G4Plotter.cc:101
std::pair< unsigned int, tools::histo::h2d * > Region_h2d
Definition: G4Plotter.hh:46
void SetLayout(unsigned int colums, unsigned int rows)
Definition: G4Plotter.cc:57
void AddRegionParameter(unsigned int region, const G4String &parameter, const G4String &value)
Definition: G4Plotter.cc:67
unsigned int fColumns
Definition: G4Plotter.hh:79
std::vector< G4String > fStyles
Definition: G4Plotter.hh:81