43 std::string::size_type begIdx, std::string::size_type& endIdx)
45 while ( line[begIdx] ==
' ') ++begIdx;
46 if ( line[begIdx] ==
'"' ) {
47 endIdx = line.find(
'"', begIdx+1);
48 if ( endIdx == std::string::npos ) endIdx = line.length();
49 token = line.substr(begIdx+1, (endIdx-1)-begIdx);
53 endIdx = line.find(
' ', begIdx);
54 if ( endIdx == std::string::npos ) endIdx = line.length();
55 token = line.substr(begIdx, endIdx-begIdx);
57 return ( token.length() > 0 );
67 const std::string_view inClass,
68 const std::string_view inFunction)
70 auto source = std::string(inClass) +
"::" + std::string(inFunction);
78 Warn(
"Illegal value of number of bins: nbins <= 0",
94 Warn(
"Illegal value of number of (xmin >= xmax)",
99 if ( ( fcnName !=
"none" ) && ( binSchemeName !=
"linear" ) ) {
100 Warn(
"Combining Function and Binning scheme is not supported.",
106 fcnName ==
"log" || fcnName ==
"log10" ) && ( xmin == 0 ) ) {
107 Warn(
"Illegal value of (xmin = 0) with logarithmic function or binning",
118 if ( edges.size() <= 1 ) {
119 Warn(
"Illegal edges vector (size <= 1)",
131 if ( !
name.size() ) {
132 Warn(
"Empty " + objectType +
" name is not allowed.\n" +
144 if ( unit !=
"none" ) {
146 if ( value == 0. ) value = 1.;
156 if ( fcnName !=
"none" ) { title +=
" "; title += fcnName; title +=
"("; }
157 if ( unitName !=
"none" ) { title +=
" ["; title += unitName; title +=
"]";}
158 if ( fcnName !=
"none" ) { title +=
")"; }
165 std::string::size_type begIdx = 0;
166 std::string::size_type endIdx = 0;
170 if (
GetToken(line, token, begIdx, endIdx) ) {
173 tokens.push_back(token);
177 while ( endIdx < line.length() );
189 Warn(
"\"" + outputName +
"\" output type is not supported.",
216 Warn(
"\"" + to_string(
static_cast<int>(output)) +
217 "\" output type is not supported.",
227 G4fs::path filePath(fileName.data());
228 if ( filePath.has_parent_path()) {
229 return filePath.parent_path().string() +
"/" + filePath.stem().string();
232 return filePath.stem().string();
242 G4fs::path filePath(fileName.data());
243 if ( filePath.has_extension() ) {
244 auto extension = filePath.extension().string();
246 return extension.substr(1, extension.length());
249 return defaultExtension;
273 if ( extension.size() ) {
275 name.append(extension);
296 name.append(ntupleName);
300 std::ostringstream os;
303 name.append(os.str());
308 if ( extension.size() ) {
310 name.append(extension);
320 G4int ntupleFileNumber)
329 std::ostringstream os;
330 os << ntupleFileNumber;
332 name.append(os.str());
336 if ( extension.size() ) {
338 name.append(extension);
357 std::ostringstream os;
360 name.append(os.str());
365 if ( extension.size() ) {
367 name.append(extension);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
static G4double GetValueOf(const G4String &)
G4BinScheme GetBinScheme(const G4String &binSchemeName)
G4String GetExtension(const G4String &fileName, const G4String &defaultExtension="")
G4bool CheckMinMax(G4double xmin, G4double xmax, const G4String &fcnName="none", const G4String &binSchemeName="linear")
void Tokenize(const G4String &line, std::vector< G4String > &tokens)
G4String GetTnFileName(const G4String &fileName, const G4String &fileType)
G4bool CheckNbins(G4int nbins)
G4String GetPlotFileName(const G4String &fileName)
constexpr std::string_view kNamespaceName
G4double GetUnitValue(const G4String &unit)
G4String GetOutputName(G4AnalysisOutput outputType)
G4AnalysisOutput GetOutput(const G4String &outputName, G4bool warn=true)
void UpdateTitle(G4String &title, const G4String &unitName, const G4String &fcnName)
G4bool CheckEdges(const std::vector< G4double > &edges)
G4String GetHnFileName(const G4String &fileName, const G4String &fileType, const G4String &hnType, const G4String &hnName)
G4String GetBaseName(const G4String &fileName)
void Warn(const G4String &message, const std::string_view inClass, const std::string_view inFunction)
G4bool CheckName(const G4String &name, const G4String &objectType)
G4String GetNtupleFileName(const G4String &fileName, const G4String &fileType, const G4String &ntupleName)
const char * name(G4int ptype)
G4bool GetToken(const G4String &line, G4String &token, std::string::size_type begIdx, std::string::size_type &endIdx)