Warning, file /include/Geant4/G4AnalysisUtilities.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #ifndef G4AnalysisUtilities_h
0030 #define G4AnalysisUtilities_h 1
0031
0032 #include "G4Exception.hh"
0033 #include "globals.hh"
0034
0035 #include <vector>
0036 #include <memory>
0037 #include <string_view>
0038
0039
0040
0041 enum class G4AnalysisOutput {
0042 kCsv,
0043 kHdf5,
0044 kRoot,
0045 kXml,
0046 kNone
0047 };
0048
0049 namespace G4Analysis
0050 {
0051
0052
0053
0054 constexpr G4int kX { 0 };
0055 constexpr G4int kY { 1 };
0056 constexpr G4int kZ { 2 };
0057 constexpr G4int kInvalidId { -1 };
0058 constexpr G4int kVL0 { 0 };
0059 constexpr G4int kVL1 { 1 };
0060 constexpr G4int kVL2 { 2 };
0061 constexpr G4int kVL3 { 3 };
0062 constexpr G4int kVL4 { 4 };
0063 constexpr unsigned int kDim1 { 1 };
0064 constexpr unsigned int kDim2 { 2 };
0065 constexpr unsigned int kDim3 { 3 };
0066 constexpr unsigned int kMaxDim { kDim3 };
0067 constexpr unsigned int kDefaultBasketSize { 32000 };
0068 constexpr unsigned int kDefaultBasketEntries {4000 };
0069 constexpr std::string_view kNamespaceName { "G4Analysis" };
0070
0071
0072
0073 void Warn(const G4String& message,
0074 const std::string_view inClass,
0075 const std::string_view inFunction);
0076
0077
0078 G4double GetUnitValue(const G4String& unit);
0079
0080
0081 void Tokenize(const G4String& line, std::vector<G4String>& tokens);
0082
0083
0084 G4AnalysisOutput GetOutput(const G4String& outputName, G4bool warn = true);
0085 size_t GetOutputId(const G4String& outputName, G4bool warn = true);
0086 G4String GetOutputName(G4AnalysisOutput outputType);
0087
0088
0089 template <typename HT>
0090 G4String GetHnType()
0091 {
0092
0093 G4String hnTypeLong = HT::s_class();
0094
0095
0096 return hnTypeLong.substr(14, 2);
0097 }
0098
0099 template <typename HT>
0100 G4bool IsProfile()
0101 {
0102
0103 G4String hnTypeLong = HT::s_class();
0104
0105
0106 return hnTypeLong[14] == 'p';
0107 }
0108
0109
0110 template <typename T>
0111 inline
0112 std::string ToString(const T& value)
0113 { return std::to_string(value); }
0114
0115 template <>
0116 inline
0117 std::string ToString<std::string>(const std::string& value)
0118 { return value; }
0119
0120
0121
0122
0123 G4String GetBaseName(const G4String& fileName);
0124
0125
0126 G4String GetExtension(const G4String& fileName,
0127 const G4String& defaultExtension = "");
0128
0129
0130
0131
0132 G4String GetHnFileName(
0133 const G4String& fileName,
0134 const G4String& fileType,
0135 const G4String& hnType,
0136 const G4String& hnName);
0137
0138
0139
0140 G4String GetHnFileName(
0141 const G4String& fileName,
0142 const G4String& fileType,
0143 G4int cycle = 0);
0144
0145
0146
0147
0148
0149
0150 G4String GetNtupleFileName(
0151 const G4String& fileName,
0152 const G4String& fileType,
0153 const G4String& ntupleName,
0154 G4int cycle = 0);
0155
0156
0157
0158
0159
0160 G4String GetNtupleFileName(
0161 const G4String& fileName,
0162 const G4String& fileType,
0163 G4int ntupleFileNumber,
0164 G4int cycle = 0);
0165
0166
0167
0168
0169
0170 G4String GetTnFileName(
0171 const G4String& fileName,
0172 const G4String& fileType,
0173 G4int cycle = 0);
0174
0175
0176 G4String GetPlotFileName(const G4String& fileName);
0177
0178 }
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188
0189
0190 #endif
0191