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

Functions

void AddP2Annotation (tools::histo::p2d *p2d, const G4String &xunitName, const G4String &yunitName, const G4String &zunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &zfcnName)
 
void ConfigureToolsP2 (tools::histo::p2d *p2d, const std::vector< G4double > &xedges, const std::vector< G4double > &yedges, G4double zmin, G4double zmax, const G4String &xunitName, const G4String &yunitName, const G4String &zunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &zfcnName)
 
void ConfigureToolsP2 (tools::histo::p2d *p2d, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, G4double zmin, G4double zmax, const G4String &xunitName, const G4String &yunitName, const G4String &zunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &zfcnName, const G4String &xbinSchemeName, const G4String &ybinSchemeName, std::string_view className)
 
tools::histo::p2d * CreateToolsP2 (const G4String &title, const std::vector< G4double > &xedges, const std::vector< G4double > &yedges, G4double zmin, G4double zmax, const G4String &xunitName, const G4String &yunitName, const G4String &zunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &zfcnName)
 
tools::histo::p2d * CreateToolsP2 (const G4String &title, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, G4double zmin, G4double zmax, const G4String &xunitName, const G4String &yunitName, const G4String &zunitName, const G4String &xfcnName, const G4String &zfcnName, const G4String &yfcnName, const G4String &xbinSchemeName, const G4String &ybinSchemeName, std::string_view className)
 
void UpdateP2Information (G4HnInformation *hnInformation, const G4String &xunitName, const G4String &yunitName, const G4String &zunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &zfcnName, G4BinScheme xbinScheme, G4BinScheme ybinScheme)
 

Function Documentation

◆ AddP2Annotation()

void anonymous_namespace{G4P2ToolsManager.cc}::AddP2Annotation ( tools::histo::p2d *  p2d,
const G4String xunitName,
const G4String yunitName,
const G4String zunitName,
const G4String xfcnName,
const G4String yfcnName,
const G4String zfcnName 
)

Definition at line 70 of file G4P2ToolsManager.cc.

77{
78 G4String xaxisTitle;
79 G4String yaxisTitle;
80 G4String zaxisTitle;
81 UpdateTitle(xaxisTitle, xunitName, xfcnName);
82 UpdateTitle(yaxisTitle, yunitName, yfcnName);
83 UpdateTitle(zaxisTitle, zunitName, zfcnName);
84 p2d->add_annotation(tools::histo::key_axis_x_title(), xaxisTitle);
85 p2d->add_annotation(tools::histo::key_axis_y_title(), yaxisTitle);
86 p2d->add_annotation(tools::histo::key_axis_z_title(), zaxisTitle);
87}
void UpdateTitle(G4String &title, const G4String &unitName, const G4String &fcnName)

References G4Analysis::UpdateTitle().

Referenced by G4P2ToolsManager::AddP2(), G4P2ToolsManager::CreateP2(), and G4P2ToolsManager::SetP2().

◆ ConfigureToolsP2() [1/2]

void anonymous_namespace{G4P2ToolsManager.cc}::ConfigureToolsP2 ( tools::histo::p2d *  p2d,
const std::vector< G4double > &  xedges,
const std::vector< G4double > &  yedges,
G4double  zmin,
G4double  zmax,
const G4String xunitName,
const G4String yunitName,
const G4String zunitName,
const G4String xfcnName,
const G4String yfcnName,
const G4String zfcnName 
)

Definition at line 246 of file G4P2ToolsManager.cc.

256{
257 // Apply function to edges
258 auto xunit = GetUnitValue(xunitName);
259 auto xfcn = GetFunction(xfcnName);
260 std::vector<G4double> xnewEdges;
261 ComputeEdges(xedges, xunit, xfcn, xnewEdges);
262
263 auto yunit = GetUnitValue(yunitName);
264 auto yfcn = GetFunction(yfcnName);
265 std::vector<G4double> ynewEdges;
266 ComputeEdges(yedges, yunit, yfcn, ynewEdges);
267
268 auto zunit = GetUnitValue(zunitName);
269 auto zfcn = GetFunction(zfcnName);
270 if ( zmin == 0. && zmax == 0. ) {
271 p2d->configure(xnewEdges, ynewEdges);
272 } else {
273 p2d->configure(xnewEdges, ynewEdges, zfcn(zmin/zunit), zfcn(zmax/zunit));
274 }
275}
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 G4P2ToolsManager::SetP2().

◆ ConfigureToolsP2() [2/2]

void anonymous_namespace{G4P2ToolsManager.cc}::ConfigureToolsP2 ( tools::histo::p2d *  p2d,
G4int  nxbins,
G4double  xmin,
G4double  xmax,
G4int  nybins,
G4double  ymin,
G4double  ymax,
G4double  zmin,
G4double  zmax,
const G4String xunitName,
const G4String yunitName,
const G4String zunitName,
const G4String xfcnName,
const G4String yfcnName,
const G4String zfcnName,
const G4String xbinSchemeName,
const G4String ybinSchemeName,
std::string_view  className 
)

Definition at line 191 of file G4P2ToolsManager.cc.

204{
205 auto xunit = GetUnitValue(xunitName);
206 auto yunit = GetUnitValue(yunitName);
207 auto zunit = GetUnitValue(zunitName);
208 auto xfcn = GetFunction(xfcnName);
209 auto yfcn = GetFunction(yfcnName);
210 auto zfcn = GetFunction(zfcnName);
211 auto xbinScheme = GetBinScheme(xbinSchemeName);
212 auto ybinScheme = GetBinScheme(ybinSchemeName);
213
214 if ( xbinScheme != G4BinScheme::kLog && ybinScheme != G4BinScheme::kLog) {
215 if ( xbinScheme == G4BinScheme::kUser || ybinScheme == G4BinScheme::kUser) {
216 // This should never happen, but let's make sure about it
217 // by issuing a warning
218 Warn("User binning scheme setting was ignored.\n"
219 "Linear binning will be applied with given (nbins, xmin, xmax) values.",
220 className, "ConfigureToolsP2");
221 }
222 if ( zmin == 0. && zmax == 0. ) {
223 p2d->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
224 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit));
225 } else {
226 p2d->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
227 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
228 zfcn(zmin/zunit), zfcn(zmax/zunit));
229 }
230 }
231 else {
232 // Compute bins
233 std::vector<G4double> xedges;
234 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
235 std::vector<G4double> yedges;
236 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
237 if ( zmin == 0. && zmax == 0. ) {
238 p2d->configure(xedges, yedges);
239 } else {
240 p2d->configure(xedges, yedges, zfcn(zmin/zunit), zfcn(zmax/zunit));
241 }
242 }
243}
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().

◆ CreateToolsP2() [1/2]

tools::histo::p2d * anonymous_namespace{G4P2ToolsManager.cc}::CreateToolsP2 ( const G4String title,
const std::vector< G4double > &  xedges,
const std::vector< G4double > &  yedges,
G4double  zmin,
G4double  zmax,
const G4String xunitName,
const G4String yunitName,
const G4String zunitName,
const G4String xfcnName,
const G4String yfcnName,
const G4String zfcnName 
)

Definition at line 153 of file G4P2ToolsManager.cc.

164{
165 auto xunit = GetUnitValue(xunitName);
166 auto yunit = GetUnitValue(yunitName);
167 auto zunit = GetUnitValue(zunitName);
168 auto xfcn = GetFunction(xfcnName);
169 auto yfcn = GetFunction(yfcnName);
170 auto zfcn = GetFunction(zfcnName);
171
172 // Apply function
173 std::vector<G4double> xnewEdges;
174 ComputeEdges(xedges, xunit, xfcn, xnewEdges);
175 std::vector<G4double> ynewEdges;
176 ComputeEdges(yedges, yunit, yfcn, ynewEdges);
177
178 if ( zmin == 0. && zmax == 0.) {
179 return new tools::histo::p2d(title, xnewEdges, ynewEdges);
180 // p2 objects are deleted in destructor and reset when
181 // closing a file.
182 } else {
183 return new tools::histo::p2d(title, xnewEdges, ynewEdges,
184 zfcn(zmin/zunit), zfcn(zmax/zunit));
185 // p2 objects are deleted in destructor and reset when
186 // closing a file.
187 }
188}

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

Referenced by G4P2ToolsManager::CreateP2().

◆ CreateToolsP2() [2/2]

tools::histo::p2d * anonymous_namespace{G4P2ToolsManager.cc}::CreateToolsP2 ( const G4String title,
G4int  nxbins,
G4double  xmin,
G4double  xmax,
G4int  nybins,
G4double  ymin,
G4double  ymax,
G4double  zmin,
G4double  zmax,
const G4String xunitName,
const G4String yunitName,
const G4String zunitName,
const G4String xfcnName,
const G4String zfcnName,
const G4String yfcnName,
const G4String xbinSchemeName,
const G4String ybinSchemeName,
std::string_view  className 
)

Definition at line 90 of file G4P2ToolsManager.cc.

104{
105 auto xunit = GetUnitValue(xunitName);
106 auto yunit = GetUnitValue(yunitName);
107 auto zunit = GetUnitValue(zunitName);
108 auto xfcn = GetFunction(xfcnName);
109 auto yfcn = GetFunction(yfcnName);
110 auto zfcn = GetFunction(zfcnName);
111 auto xbinScheme = GetBinScheme(xbinSchemeName);
112 auto ybinScheme = GetBinScheme(ybinSchemeName);
113
114 if ( xbinScheme != G4BinScheme::kLog && ybinScheme != G4BinScheme::kLog) {
115 if ( xbinScheme == G4BinScheme::kUser || ybinScheme == G4BinScheme::kUser ) {
116 // This should never happen, but let's make sure about it
117 // by issuing a warning
118 Warn("User binning scheme setting was ignored.\n"
119 "Linear binning will be applied with given (nbins, xmin, xmax) values.",
120 className, "CreateToolsP2");
121 }
122 if ( zmin == 0. && zmax == 0.) {
123 return new tools::histo::p2d(title,
124 nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
125 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit));
126 // p2 objects are deleted in destructor and reset when
127 // closing a file.
128 } else {
129 return new tools::histo::p2d(title,
130 nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
131 nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
132 zfcn(zmin/zunit), zfcn(zmax/zunit));
133 // p2 objects are deleted in destructor and reset when
134 // closing a file.
135 }
136 }
137 else {
138 // Compute edges
139 std::vector<G4double> xedges;
140 ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
141 std::vector<G4double> yedges;
142 ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
143 if ( zmin == 0. && zmax == 0.) {
144 return new tools::histo::p2d(title, xedges, yedges);
145 } else {
146 return new tools::histo::p2d(title, xedges, yedges,
147 zfcn(zmin/zunit), zfcn(zmax/zunit));
148 }
149 }
150}

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

◆ UpdateP2Information()

void anonymous_namespace{G4P2ToolsManager.cc}::UpdateP2Information ( G4HnInformation hnInformation,
const G4String xunitName,
const G4String yunitName,
const G4String zunitName,
const G4String xfcnName,
const G4String yfcnName,
const G4String zfcnName,
G4BinScheme  xbinScheme,
G4BinScheme  ybinScheme 
)

Definition at line 54 of file G4P2ToolsManager.cc.

63{
64 hnInformation->SetDimension(kX, xunitName, xfcnName, xbinScheme);
65 hnInformation->SetDimension(kY, yunitName, yfcnName, ybinScheme);
66 hnInformation->SetDimension(kZ, zunitName, zfcnName, G4BinScheme::kLinear);
67}
void SetDimension(G4int dimension, const G4String &unitName, const G4String &fcnName, G4BinScheme binScheme)
constexpr G4int kX
constexpr G4int kZ
constexpr G4int kY

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

Referenced by G4P2ToolsManager::SetP2().