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

Functions

void AddP1Annotation (tools::histo::p1d *p1d, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName)
 
void ConfigureToolsP1 (tools::histo::p1d *p1d, const std::vector< G4double > &edges, G4double ymin, G4double ymax, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName)
 
void ConfigureToolsP1 (tools::histo::p1d *p1d, G4int nbins, G4double xmin, G4double xmax, G4double ymin, G4double ymax, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &xbinSchemeName, std::string_view className)
 
tools::histo::p1d * CreateToolsP1 (const G4String &title, const std::vector< G4double > &edges, G4double ymin, G4double ymax, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName)
 
tools::histo::p1d * CreateToolsP1 (const G4String &title, G4int nbins, G4double xmin, G4double xmax, G4double ymin, G4double ymax, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &xbinSchemeName, std::string_view className)
 
void UpdateP1Information (G4HnInformation *hnInformation, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName, G4BinScheme xbinScheme)
 

Function Documentation

◆ AddP1Annotation()

void anonymous_namespace{G4P1ToolsManager.cc}::AddP1Annotation ( tools::histo::p1d *  p1d,
const G4String xunitName,
const G4String yunitName,
const G4String xfcnName,
const G4String yfcnName 
)

Definition at line 70 of file G4P1ToolsManager.cc.

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

References G4Analysis::UpdateTitle().

Referenced by G4P1ToolsManager::AddP1(), G4P1ToolsManager::CreateP1(), and G4P1ToolsManager::SetP1().

◆ ConfigureToolsP1() [1/2]

void anonymous_namespace{G4P1ToolsManager.cc}::ConfigureToolsP1 ( tools::histo::p1d *  p1d,
const std::vector< G4double > &  edges,
G4double  ymin,
G4double  ymax,
const G4String xunitName,
const G4String yunitName,
const G4String xfcnName,
const G4String yfcnName 
)

Definition at line 196 of file G4P1ToolsManager.cc.

203{
204 // Apply function to edges
205 auto xunit = GetUnitValue(xunitName);
206 auto yunit = GetUnitValue(yunitName);
207 auto xfcn = GetFunction(xfcnName);
208 auto yfcn = GetFunction(yfcnName);
209 std::vector<G4double> newEdges;
210 ComputeEdges(edges, xunit, xfcn, newEdges);
211
212 if ( ymin == 0. && ymax == 0. ) {
213 p1d->configure(newEdges);
214 } else {
215 p1d->configure(newEdges, yfcn(ymin/yunit), yfcn(ymax/yunit));
216 }
217}
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 G4P1ToolsManager::SetP1().

◆ ConfigureToolsP1() [2/2]

void anonymous_namespace{G4P1ToolsManager.cc}::ConfigureToolsP1 ( tools::histo::p1d *  p1d,
G4int  nbins,
G4double  xmin,
G4double  xmax,
G4double  ymin,
G4double  ymax,
const G4String xunitName,
const G4String yunitName,
const G4String xfcnName,
const G4String yfcnName,
const G4String xbinSchemeName,
std::string_view  className 
)

Definition at line 152 of file G4P1ToolsManager.cc.

161{
162 auto xunit = GetUnitValue(xunitName);
163 auto yunit = GetUnitValue(yunitName);
164 auto xfcn = GetFunction(xfcnName);
165 auto yfcn = GetFunction(yfcnName);
166 auto xbinScheme = GetBinScheme(xbinSchemeName);
167
168 if ( xbinScheme != G4BinScheme::kLog ) {
169 if ( xbinScheme == G4BinScheme::kUser ) {
170 // This should never happen, but let's make sure about it
171 // by issuing a warning
172 Warn("User binning scheme setting was ignored.\n"
173 "Linear binning will be applied with given (nbins, xmin, xmax) values.",
174 className, "ConfigureToolsP1");
175 }
176 if ( ymin == 0. && ymax == 0. ) {
177 p1d->configure(nbins, xfcn(xmin/xunit), xfcn(xmax/xunit));
178 } else {
179 p1d->configure(nbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
180 yfcn(ymin/yunit), yfcn(ymax/yunit));
181 }
182 }
183 else {
184 // Compute bins
185 std::vector<G4double> edges;
186 ComputeEdges(nbins, xmin, xmax, xunit, xfcn, xbinScheme, edges);
187 if ( ymin == 0. && ymax == 0. ) {
188 p1d->configure(edges);
189 } else {
190 p1d->configure(edges, yfcn(ymin/yunit), yfcn(ymax/yunit));
191 }
192 }
193}
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().

◆ CreateToolsP1() [1/2]

tools::histo::p1d * anonymous_namespace{G4P1ToolsManager.cc}::CreateToolsP1 ( const G4String title,
const std::vector< G4double > &  edges,
G4double  ymin,
G4double  ymax,
const G4String xunitName,
const G4String yunitName,
const G4String xfcnName,
const G4String yfcnName 
)

Definition at line 131 of file G4P1ToolsManager.cc.

138{
139 auto xunit = GetUnitValue(xunitName);
140 auto yunit = GetUnitValue(yunitName);
141 auto xfcn = GetFunction(xfcnName);
142 auto yfcn = GetFunction(yfcnName);
143
144 // Apply function
145 std::vector<G4double> newEdges;
146 ComputeEdges(edges, xunit, xfcn, newEdges);
147
148 return new tools::histo::p1d(title, newEdges, yfcn(ymin/yunit), yfcn(ymax/yunit));
149}

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

Referenced by G4P1ToolsManager::CreateP1().

◆ CreateToolsP1() [2/2]

tools::histo::p1d * anonymous_namespace{G4P1ToolsManager.cc}::CreateToolsP1 ( const G4String title,
G4int  nbins,
G4double  xmin,
G4double  xmax,
G4double  ymin,
G4double  ymax,
const G4String xunitName,
const G4String yunitName,
const G4String xfcnName,
const G4String yfcnName,
const G4String xbinSchemeName,
std::string_view  className 
)

Definition at line 85 of file G4P1ToolsManager.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
101 if ( xbinScheme != G4BinScheme::kLog ) {
102 if ( xbinScheme == G4BinScheme::kUser ) {
103 // This should never happen, but let's make sure about it
104 // by issuing a warning
105 Warn("User binning scheme setting was ignored.\n"
106 "Linear binning will be applied with given (nbins, xmin, xmax) values.",
107 className, "CreateToolsP1");
108 }
109 if ( ymin == 0. && ymax == 0.) {
110 return new tools::histo::p1d(title,
111 nbins, xfcn(xmin/xunit), xfcn(xmax/xunit));
112 } else {
113 return new tools::histo::p1d(title,
114 nbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
115 yfcn(ymin/yunit), yfcn(ymax/yunit));
116 }
117 }
118 else {
119 // Compute edges
120 std::vector<G4double> edges;
121 ComputeEdges(nbins, xmin, xmax, xunit, xfcn, xbinScheme, edges);
122 if ( ymin == 0. && ymax == 0.) {
123 return new tools::histo::p1d(title, edges);
124 } else {
125 return new tools::histo::p1d(title, edges, yfcn(ymin/yunit), yfcn(ymax/yunit));
126 }
127 }
128}

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

◆ UpdateP1Information()

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

Definition at line 58 of file G4P1ToolsManager.cc.

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

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

Referenced by G4P1ToolsManager::SetP1().