38 if ( binSchemeName !=
"linear" ) {
39 if ( binSchemeName ==
"log" )
40 binScheme = G4BinScheme::kLog;
45 <<
" \"" << binSchemeName <<
"\" binning scheme is not supported." <<
G4endl
46 <<
" " <<
"Linear binning will be applied.";
57 std::vector<G4double>& edges)
62 auto xumin = xmin/unit;
63 auto xumax = xmax/unit;
65 if ( binScheme == G4BinScheme::kLinear ) {
66 auto dx = (fcn(xumax) - fcn(xumin) ) / nbins;
67 auto binValue = fcn(xumin);
68 while (
G4int(edges.size()) <= nbins ) {
69 edges.push_back(binValue);
73 else if ( binScheme == G4BinScheme::kLog ) {
76 = (std::log10(xumax) - std::log10(xumin))/ nbins;
77 auto dx = std::pow(10, dlog);
78 auto binValue = xumin;
79 while (
G4int(edges.size()) <= nbins ) {
80 edges.push_back(binValue);
84 else if ( binScheme == G4BinScheme::kUser ) {
89 <<
" User binning scheme setting was ignored." <<
G4endl
90 <<
" Linear binning will be applied with given (nbins, xmin, xmax) values";
99 std::vector<G4double>& newBins)
103 for (
auto element : edges) {
104 newBins.push_back(fcn(element/unit));
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4double(*)(G4double) G4Fcn
G4BinScheme GetBinScheme(const G4String &binSchemeName)
void ComputeEdges(G4int nbins, G4double xmin, G4double xmax, G4double unit, G4Fcn fcn, G4BinScheme, std::vector< G4double > &edges)