Geant4-11
Functions
anonymous_namespace{G4H2ToolsManager.cc} Namespace Reference

Functions

void AddH2Annotation (tools::histo::h2d *h2d, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName)
 
void ConfigureToolsH2 (tools::histo::h2d *h2d, const std::vector< G4double > &xedges, const std::vector< G4double > &yedges, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName)
 
void ConfigureToolsH2 (tools::histo::h2d *h2d, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &xbinSchemeName, const G4String &ybinSchemeName, std::string_view className)
 
tools::histo::h2d * CreateToolsH2 (const G4String &title, const std::vector< G4double > &xedges, const std::vector< G4double > &yedges, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName)
 
tools::histo::h2d * CreateToolsH2 (const G4String &title, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &xbinSchemeName, const G4String &ybinSchemeName, std::string_view className)
 
void UpdateH2Information (G4HnInformation *hnInformation, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName, G4BinScheme xbinScheme, G4BinScheme ybinScheme)
 

Function Documentation

◆ AddH2Annotation()

void anonymous_namespace{G4H2ToolsManager.cc}::AddH2Annotation ( tools::histo::h2d *  h2d,
const G4String xunitName,
const G4String yunitName,
const G4String xfcnName,
const G4String yfcnName 
)

Definition at line 67 of file G4H2ToolsManager.cc.

72{
73 G4String xaxisTitle;
74 G4String yaxisTitle;
75 UpdateTitle(xaxisTitle, xunitName, xfcnName);
76 UpdateTitle(yaxisTitle, yunitName, yfcnName);
77 h2d->add_annotation(tools::histo::key_axis_x_title(), xaxisTitle);
78 h2d->add_annotation(tools::histo::key_axis_y_title(), yaxisTitle);
79}
void UpdateTitle(G4String &title, const G4String &unitName, const G4String &fcnName)

References G4Analysis::UpdateTitle().

Referenced by G4H2ToolsManager::AddH2(), G4H2ToolsManager::CreateH2(), and G4H2ToolsManager::SetH2().

◆ ConfigureToolsH2() [1/2]

void anonymous_namespace{G4H2ToolsManager.cc}::ConfigureToolsH2 ( tools::histo::h2d *  h2d,
const std::vector< G4double > &  xedges,
const std::vector< G4double > &  yedges,
const G4String xunitName,
const G4String yunitName,
const G4String xfcnName,
const G4String yfcnName 
)

Definition at line 193 of file G4H2ToolsManager.cc.

200{
201 auto xunit = GetUnitValue(xunitName);
202 auto xfcn = GetFunction(xfcnName);
203 std::vector<G4double> xnewEdges;
204 ComputeEdges(xedges, xunit, xfcn, xnewEdges);
205
206 auto yunit = GetUnitValue(yunitName);
207 auto yfcn = GetFunction(yfcnName);
208 std::vector<G4double> ynewEdges;
209 ComputeEdges(yedges, yunit, yfcn, ynewEdges);
210
211 h2d->configure(xnewEdges, ynewEdges);
212}
G4double GetUnitValue(const G4String &unit)
void ComputeEdges(G4int nbins, G4double xmin, G4double xmax, G4double unit, G4Fcn fcn, G4BinScheme, std::vector< G4double > &edges)
Definition: G4BinScheme.cc:53
G4Fcn GetFunction(const G4String &fcnName)
Definition: G4Fcn.cc:36

References G4Analysis::ComputeEdges(), G4Analysis::GetFunction(), and G4Analysis::GetUnitValue().

Referenced by G4H2ToolsManager::SetH2().

◆ ConfigureToolsH2() [2/2]

void anonymous_namespace{G4H2ToolsManager.cc}::ConfigureToolsH2 ( tools::histo::h2d *  h2d,
G4int  nxbins,
G4double  xmin,
G4double  xmax,
G4int  nybins,
G4double  ymin,
G4double  ymax,
const G4String xunitName,
const G4String yunitName,
const G4String xfcnName,
const G4String yfcnName,
const G4String xbinSchemeName,
const G4String ybinSchemeName,
std::string_view  className 
)

Definition at line 153 of file G4H2ToolsManager.cc.

163{
164 auto xunit = GetUnitValue(xunitName);
165 auto yunit = GetUnitValue(yunitName);
166 auto xfcn = GetFunction(xfcnName);
167 auto yfcn = GetFunction(yfcnName);
168 auto xbinScheme = GetBinScheme(xbinSchemeName);
169 auto ybinScheme = GetBinScheme(ybinSchemeName);
170
171 if ( xbinScheme != G4BinScheme::kLog && ybinScheme != G4BinScheme::kLog) {
172 if ( xbinScheme == G4BinScheme::kUser || ybinScheme == G4BinScheme::kUser) {
173 // This should never happen, but let's make sure about it
174 // by issuing a warning
175 Warn("User binning scheme setting was ignored.\n"
176 "Linear binning will be applied with given (nbins, xmin, xmax) values.",
177 className, "ConfigureToolsH2");
178 }
179 h2d->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
180 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit));
181 }
182 else {
183 // Compute bins
184 std::vector<G4double> xedges;
185 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
186 std::vector<G4double> yedges;
187 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
188 h2d->configure(xedges, yedges);
189 }
190}
static char className[]
Definition: G4Win32.cc:36
G4BinScheme GetBinScheme(const G4String &binSchemeName)
Definition: G4BinScheme.cc:36
void Warn(const G4String &message, const std::string_view inClass, const std::string_view inFunction)

References className, G4Analysis::ComputeEdges(), G4Analysis::GetBinScheme(), G4Analysis::GetFunction(), G4Analysis::GetUnitValue(), kLog, kUser, and G4Analysis::Warn().

◆ CreateToolsH2() [1/2]

tools::histo::h2d * anonymous_namespace{G4H2ToolsManager.cc}::CreateToolsH2 ( const G4String title,
const std::vector< G4double > &  xedges,
const std::vector< G4double > &  yedges,
const G4String xunitName,
const G4String yunitName,
const G4String xfcnName,
const G4String yfcnName 
)

Definition at line 127 of file G4H2ToolsManager.cc.

135{
136 auto xunit = GetUnitValue(xunitName);
137 auto yunit = GetUnitValue(yunitName);
138 auto xfcn = GetFunction(xfcnName);
139 auto yfcn = GetFunction(yfcnName);
140
141 // Apply function
142 std::vector<G4double> xnewEdges;
143 ComputeEdges(xedges, xunit, xfcn, xnewEdges);
144 std::vector<G4double> ynewEdges;
145 ComputeEdges(yedges, yunit, yfcn, ynewEdges);
146
147 return new tools::histo::h2d(title, xnewEdges, ynewEdges);
148 // h2 objects are deleted in destructor and reset when
149 // closing a file.
150}

References G4Analysis::ComputeEdges(), G4Analysis::GetFunction(), and G4Analysis::GetUnitValue().

Referenced by G4H2ToolsManager::CreateH2().

◆ CreateToolsH2() [2/2]

tools::histo::h2d * anonymous_namespace{G4H2ToolsManager.cc}::CreateToolsH2 ( const G4String title,
G4int  nxbins,
G4double  xmin,
G4double  xmax,
G4int  nybins,
G4double  ymin,
G4double  ymax,
const G4String xunitName,
const G4String yunitName,
const G4String xfcnName,
const G4String yfcnName,
const G4String xbinSchemeName,
const G4String ybinSchemeName,
std::string_view  className 
)

Definition at line 82 of file G4H2ToolsManager.cc.

94{
95 auto xunit = GetUnitValue(xunitName);
96 auto yunit = GetUnitValue(yunitName);
97 auto xfcn = GetFunction(xfcnName);
98 auto yfcn = GetFunction(yfcnName);
99 auto xbinScheme = GetBinScheme(xbinSchemeName);
100 auto ybinScheme = GetBinScheme(ybinSchemeName);
101
102 if ( xbinScheme != G4BinScheme::kLog && ybinScheme != G4BinScheme::kLog) {
103 if ( xbinScheme == G4BinScheme::kUser || ybinScheme == G4BinScheme::kUser) {
104 // This should never happen, but let's make sure about it
105 // by issuing a warning
106 Warn("User binning scheme setting was ignored.\n"
107 "Linear binning will be applied with given (nbins, xmin, xmax) values.",
108 className, "CreateToolsH2");
109 }
110 return new tools::histo::h2d(title,
111 nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
112 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit));
113 // h2 objects are deleted in destructor and reset when
114 // closing a file.
115 }
116 else {
117 // Compute edges
118 std::vector<G4double> xedges;
119 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
120 std::vector<G4double> yedges;
121 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
122 return new tools::histo::h2d(title, xedges, yedges);
123 }
124}

References className, G4Analysis::ComputeEdges(), G4Analysis::GetBinScheme(), G4Analysis::GetFunction(), G4Analysis::GetUnitValue(), kLog, kUser, and G4Analysis::Warn().

◆ UpdateH2Information()

void anonymous_namespace{G4H2ToolsManager.cc}::UpdateH2Information ( G4HnInformation hnInformation,
const G4String xunitName,
const G4String yunitName,
const G4String xfcnName,
const G4String yfcnName,
G4BinScheme  xbinScheme,
G4BinScheme  ybinScheme 
)

Definition at line 54 of file G4H2ToolsManager.cc.

61{
62 hnInformation->SetDimension(kX, xunitName, xfcnName, xbinScheme);
63 hnInformation->SetDimension(kY, yunitName, yfcnName, ybinScheme);
64}
void SetDimension(G4int dimension, const G4String &unitName, const G4String &fcnName, G4BinScheme binScheme)
constexpr G4int kX
constexpr G4int kY

References G4Analysis::kX, G4Analysis::kY, and G4HnInformation::SetDimension().

Referenced by G4H2ToolsManager::SetH2().