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

Functions

void AddH1Annotation (tools::histo::h1d *h1d, const G4String &unitName, const G4String &fcnName)
 
void ConfigureToolsH1 (tools::histo::h1d *h1d, const std::vector< G4double > &edges, const G4String &unitName, const G4String &fcnName)
 
void ConfigureToolsH1 (tools::histo::h1d *h1d, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName, const G4String &fcnName, const G4String &binSchemeName, std::string_view className)
 
tools::histo::h1d * CreateToolsH1 (const G4String &title, const std::vector< G4double > &edges, const G4String &unitName, const G4String &fcnName)
 
tools::histo::h1d * CreateToolsH1 (const G4String &title, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName, const G4String &fcnName, const G4String &binSchemeName, std::string_view className)
 
void UpdateH1Information (G4HnInformation *hnInformation, const G4String &unitName, const G4String &fcnName, G4BinScheme binScheme)
 

Function Documentation

◆ AddH1Annotation()

void anonymous_namespace{G4H1ToolsManager.cc}::AddH1Annotation ( tools::histo::h1d *  h1d,
const G4String unitName,
const G4String fcnName 
)

Definition at line 68 of file G4H1ToolsManager.cc.

71{
72 G4String axisTitle;
73 UpdateTitle(axisTitle, unitName, fcnName);
74 h1d->add_annotation(tools::histo::key_axis_x_title(), axisTitle);
75}
void UpdateTitle(G4String &title, const G4String &unitName, const G4String &fcnName)

References G4Analysis::UpdateTitle().

Referenced by G4H1ToolsManager::AddH1(), G4H1ToolsManager::CreateH1(), and G4H1ToolsManager::SetH1().

◆ ConfigureToolsH1() [1/2]

void anonymous_namespace{G4H1ToolsManager.cc}::ConfigureToolsH1 ( tools::histo::h1d *  h1d,
const std::vector< G4double > &  edges,
const G4String unitName,
const G4String fcnName 
)

Definition at line 155 of file G4H1ToolsManager.cc.

159{
160 // Apply function to edges
161 auto unit = GetUnitValue(unitName);
162 auto fcn = GetFunction(fcnName);
163 std::vector<G4double> newEdges;
164 ComputeEdges(edges, unit, fcn, newEdges);
165
166 h1d->configure(newEdges);
167}
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 G4H1ToolsManager::SetH1().

◆ ConfigureToolsH1() [2/2]

void anonymous_namespace{G4H1ToolsManager.cc}::ConfigureToolsH1 ( tools::histo::h1d *  h1d,
G4int  nbins,
G4double  xmin,
G4double  xmax,
const G4String unitName,
const G4String fcnName,
const G4String binSchemeName,
std::string_view  className 
)

Definition at line 124 of file G4H1ToolsManager.cc.

130{
131 auto unit = GetUnitValue(unitName);
132 auto fcn = GetFunction(fcnName);
133 auto binScheme = GetBinScheme(binSchemeName);
134
135 if ( binScheme != G4BinScheme::kLog ) {
136 if ( binScheme == G4BinScheme::kUser ) {
137 // This should never happen, but let's make sure about it
138 // by issuing a warning
139 Warn("User binning scheme setting was ignored.\n"
140 "Linear binning will be applied with given (nbins, xmin, xmax) values.",
141 className, "ConfigureToolsH1");
142
143 }
144 h1d->configure(nbins, fcn(xmin/unit), fcn(xmax/unit));
145 }
146 else {
147 // Compute bins
148 std::vector<G4double> edges;
149 ComputeEdges(nbins, xmin, xmax, unit, fcn, binScheme, edges);
150 h1d->configure(edges);
151 }
152}
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().

◆ CreateToolsH1() [1/2]

tools::histo::h1d * anonymous_namespace{G4H1ToolsManager.cc}::CreateToolsH1 ( const G4String title,
const std::vector< G4double > &  edges,
const G4String unitName,
const G4String fcnName 
)

Definition at line 108 of file G4H1ToolsManager.cc.

112{
113 auto unit = GetUnitValue(unitName);
114 auto fcn = GetFunction(fcnName);
115
116 // Apply function
117 std::vector<G4double> newEdges;
118 ComputeEdges(edges, unit, fcn, newEdges);
119
120 return new tools::histo::h1d(title, newEdges);
121}

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

Referenced by G4H1ToolsManager::CreateH1().

◆ CreateToolsH1() [2/2]

tools::histo::h1d * anonymous_namespace{G4H1ToolsManager.cc}::CreateToolsH1 ( const G4String title,
G4int  nbins,
G4double  xmin,
G4double  xmax,
const G4String unitName,
const G4String fcnName,
const G4String binSchemeName,
std::string_view  className 
)

Definition at line 78 of file G4H1ToolsManager.cc.

84{
85 auto unit = GetUnitValue(unitName);
86 auto fcn = GetFunction(fcnName);
87 auto binScheme = GetBinScheme(binSchemeName);
88
89 if ( binScheme != G4BinScheme::kLog ) {
90 if ( binScheme == G4BinScheme::kUser ) {
91 // This should never happen, but let's make sure about it
92 // by issuing a warning
93 Warn("User binning scheme setting was ignored.\n"
94 "Linear binning will be applied with given (nbins, xmin, xmax) values.",
95 className, "CreateToolsH1");
96 }
97 return new tools::histo::h1d(title, nbins, fcn(xmin/unit), fcn(xmax/unit));
98 }
99 else {
100 // Compute edges
101 std::vector<G4double> edges;
102 ComputeEdges(nbins, xmin, xmax, unit, fcn, binScheme, edges);
103 return new tools::histo::h1d(title, edges);
104 }
105}

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

◆ UpdateH1Information()

void anonymous_namespace{G4H1ToolsManager.cc}::UpdateH1Information ( G4HnInformation hnInformation,
const G4String unitName,
const G4String fcnName,
G4BinScheme  binScheme 
)

Definition at line 59 of file G4H1ToolsManager.cc.

63{
64 hnInformation->SetDimension(kX, unitName, fcnName, binScheme);
65}
void SetDimension(G4int dimension, const G4String &unitName, const G4String &fcnName, G4BinScheme binScheme)
constexpr G4int kX

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

Referenced by G4H1ToolsManager::SetH1().