Warning, file /include/Geant4/G4RootPNtupleManager.icc 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 using std::to_string;
0030
0031
0032 template <>
0033 inline G4bool G4RootPNtupleManager::FillNtupleTColumn(
0034 G4int ntupleId, G4int columnId, const std::string& value)
0035 {
0036 if ( fState.GetIsActivation() && ( ! GetActivation(ntupleId) ) ) {
0037 G4cout << "Skipping FillNtupleIColumn for " << ntupleId << G4endl;
0038 return false;
0039 }
0040
0041 if ( IsVerbose(G4Analysis::kVL4) ) {
0042 Message(G4Analysis::kVL4, "fill", "pntuple T column",
0043 " ntupleId " + to_string(ntupleId) + " columnId " + to_string(columnId) +
0044 " value " + G4Analysis::ToString(value));
0045 }
0046
0047
0048
0049 CreateNtuplesIfNeeded();
0050
0051 auto ntuple = GetNtupleInFunction(ntupleId, "FillNtupleTColumn");
0052 if (ntuple == nullptr) return false;
0053
0054 auto index = columnId - fFirstNtupleColumnId;
0055 if ( index < 0 || index >= G4int(ntuple->columns().size()) ) {
0056 G4Analysis::Warn(
0057 "ntupleId " + to_string(ntupleId) + " columnId " + to_string(columnId) +
0058 " does not exist.",
0059 fkClass, "FillNtupleTColumn");
0060 return false;
0061 }
0062
0063 auto icolumn = ntuple->columns()[index];
0064 auto column = dynamic_cast<tools::wroot::base_pntuple::column_string* >(icolumn);
0065 if (column == nullptr) {
0066 G4Analysis::Warn(
0067 " Column type does not match: ntupleId " + to_string(ntupleId) +
0068 " columnId " + to_string(columnId) + " value " + value,
0069 fkClass, "FillNtupleTColumn");
0070 return false;
0071 }
0072
0073 column->fill(value);
0074
0075 if ( IsVerbose(G4Analysis::kVL4) ) {
0076 Message(G4Analysis::kVL4, "done fill", "pntuple T column",
0077 " ntupleId " + to_string(ntupleId) +
0078 " columnId " + to_string(columnId) +
0079 " value " + value);
0080 }
0081
0082 return true;
0083 }
0084
0085
0086 template <typename T>
0087 G4bool G4RootPNtupleManager::FillNtupleTColumn(
0088 G4int ntupleId, G4int columnId, const T& value)
0089 {
0090
0091
0092 CreateNtuplesIfNeeded();
0093
0094 if ( fState.GetIsActivation() && ( ! GetActivation(ntupleId) ) ) {
0095 G4cout << "Skipping FillNtupleIColumn for " << ntupleId << G4endl;
0096 return false;
0097 }
0098
0099 if ( IsVerbose(G4Analysis::kVL4) ) {
0100 Message(G4Analysis::kVL4, "fill", "pntuple T column",
0101 " ntupleId " + to_string(ntupleId) +
0102 " columnId " + to_string(columnId) +
0103 " value " + G4Analysis::ToString(value));
0104 }
0105
0106
0107 auto ntuple = GetNtupleInFunction(ntupleId, "FillNtupleTColumn");
0108 if ( ! ntuple ) return false;
0109
0110
0111 auto index = columnId - fFirstNtupleColumnId;
0112 if ( index < 0 || index >= G4int(ntuple->columns().size()) ) {
0113 G4Analysis::Warn(
0114 "ntupleId " + to_string(ntupleId) + " columnId " + to_string(columnId) +
0115 " does not exist.",
0116 fkClass, "FillNtupleTColumn");
0117 return false;
0118 }
0119 auto icolumn = ntuple->columns()[index];
0120
0121
0122 auto column = dynamic_cast<tools::wroot::base_pntuple::column<T>* >(icolumn);
0123 if ( ! column ) {
0124 G4Analysis::Warn(
0125 " Column type does not match: ntupleId " + to_string(ntupleId) +
0126 " columnId " + to_string(columnId) + " value " + G4Analysis::ToString(value),
0127 fkClass, "FillNtupleTColumn");
0128 return false;
0129 }
0130
0131 column->fill(value);
0132
0133 if ( IsVerbose(G4Analysis::kVL4) ) {
0134 Message(G4Analysis::kVL4, "done fill", "pntuple T column",
0135 " ntupleId " + to_string(ntupleId) +
0136 " columnId " + to_string(columnId) +
0137 " value " + G4Analysis::ToString(value));
0138 }
0139
0140 return true;
0141 }
0142
0143
0144 template <typename T>
0145 G4bool G4RootPNtupleManager::FillNtupleTColumn(G4int columnId, const T& value) {
0146 return FillNtupleTColumn(0, columnId, value);
0147 }