39 std::string::size_type begIdx, std::string::size_type& endIdx)
41 while ( line[begIdx] ==
' ') ++begIdx;
42 if ( line[begIdx] ==
'"' ) {
43 endIdx = line.find(
'"', begIdx+1);
44 if ( endIdx == std::string::npos ) endIdx = line.length();
45 token = line.substr(begIdx+1, (endIdx-1)-begIdx);
49 endIdx = line.find(
' ', begIdx);
50 if ( endIdx == std::string::npos ) endIdx = line.length();
51 token = line.substr(begIdx, endIdx-begIdx);
53 return ( token.length() > 0 );
67 <<
" Illegal value of number of bins: nbins <= 0" <<
G4endl;
86 <<
" Illegal values of (xmin >= xmax)" <<
G4endl;
93 if ( ( fcnName !=
"none" ) && ( binSchemeName !=
"linear" ) ) {
96 <<
" Combining Function and Binning scheme is not supported."
104 if ( (
GetBinScheme(binSchemeName) == G4BinScheme::kLog ||
105 fcnName ==
"log" || fcnName ==
"log10" ) && ( xmin == 0 ) ) {
108 <<
" Illegal value of (xmin = 0) with logarithmic function or binning"
122 if ( edges.size() <= 1 ) {
125 <<
" Illegal edges vector (size <= 1)" <<
G4endl;
138 if ( ! name.size() ) {
141 <<
" Empty " << objectType <<
" name is not allowed." <<
G4endl
142 <<
" " << objectType <<
" was not created." <<
G4endl;
155 if ( unit !=
"none" ) {
157 if ( value == 0. ) value = 1.;
167 if ( fcnName !=
"none" ) { title +=
" "; title += fcnName; title +=
"("; }
168 if ( unitName !=
"none" ) { title +=
" ["; title += unitName; title +=
"]";}
169 if ( fcnName !=
"none" ) { title +=
")"; }
176 std::string::size_type begIdx = 0;
177 std::string::size_type endIdx = 0;
181 if ( GetToken(line, token, begIdx, endIdx) ) {
184 tokens.push_back(token);
188 while ( endIdx < line.length() );
193 if ( outputName ==
"csv" ) {
return G4AnalysisOutput::kCsv; }
194 else if ( outputName ==
"hdf5" ) {
return G4AnalysisOutput::kHdf5; }
195 else if ( outputName ==
"root" ) {
return G4AnalysisOutput::kRoot; }
196 else if ( outputName ==
"xml" ) {
return G4AnalysisOutput::kXml; }
197 else if ( outputName ==
"none" ) {
return G4AnalysisOutput::kNone; }
202 <<
" \"" << outputName <<
"\" output type is not supported." <<
G4endl;
206 return G4AnalysisOutput::kNone;
213 case G4AnalysisOutput::kCsv:
216 case G4AnalysisOutput::kHdf5:
219 case G4AnalysisOutput::kRoot:
222 case G4AnalysisOutput::kXml:
225 case G4AnalysisOutput::kNone:
232 <<
" \"" <<
static_cast<int>(output) <<
"\" is not handled." <<
G4endl
233 <<
" " <<
"none type will be used.";
245 if ( name.rfind(
".") != std::string::npos ) {
246 name = name.substr(0, name.rfind(
"."));
259 if ( fileName.rfind(
".") != std::string::npos ) {
260 extension = fileName.substr(fileName.rfind(
".") + 1);
262 if ( ! extension.size() ) {
263 extension = defaultExtension;
289 if ( extension.size() ) {
291 name.append(extension);
312 name.append(ntupleName);
316 std::ostringstream os;
319 name.append(os.str());
324 if ( extension.size() ) {
326 name.append(extension);
336 G4int ntupleFileNumber)
345 std::ostringstream os;
346 os << ntupleFileNumber;
348 name.append(os.str());
352 if ( extension.size() ) {
354 name.append(extension);
373 std::ostringstream os;
376 name.append(os.str());
381 if ( extension.size() ) {
383 name.append(extension);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
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)
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)
G4bool CheckName(const G4String &name, const G4String &objectType)
G4String GetNtupleFileName(const G4String &fileName, const G4String &fileType, const G4String &ntupleName)