File indexing completed on 2025-01-18 09:59:03
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 #include "G4AnalysisUtilities.hh"
0030
0031 using std::to_string;
0032
0033
0034 inline void G4RootNtupleManager::SetNtupleFile(std::shared_ptr<G4RootFile> file)
0035 {
0036 fNtupleFile = std::move(file);
0037 }
0038
0039
0040 inline const
0041 std::vector<G4TNtupleDescription<tools::wroot::ntuple, G4RootFile>* >&
0042 G4RootNtupleManager::GetNtupleDescriptionVector() const
0043 {
0044 return fNtupleDescriptionVector;
0045 }
0046
0047
0048 template <>
0049 template <>
0050 inline G4bool G4TNtupleManager<tools::wroot::ntuple, G4RootFile>::FillNtupleTColumn(
0051 G4int ntupleId, G4int columnId, const std::string& value)
0052 {
0053 if ( fState.GetIsActivation() && ( ! GetActivation(ntupleId) ) ) {
0054
0055 return false;
0056 }
0057
0058 auto ntuple = GetNtupleInFunction(ntupleId, "FillNtupleTColumn");
0059 if (ntuple == nullptr) return false;
0060
0061 auto index = columnId - fFirstNtupleColumnId;
0062 if ( index < 0 || index >= G4int(ntuple->columns().size()) ) {
0063 G4Analysis::Warn(
0064 "ntupleId " + to_string(ntupleId) + " columnId " + to_string(columnId) +
0065 " does not exist.",
0066 fkClass, "FillNtupleTColumn");
0067 return false;
0068 }
0069
0070 auto icolumn = ntuple->columns()[index];
0071 auto column = dynamic_cast<tools::wroot::ntuple::column_string* >(icolumn);
0072 if (column == nullptr) {
0073 G4Analysis::Warn(
0074 "Column type does not match: ntupleId " + to_string(ntupleId) +
0075 " columnId " + to_string(columnId) + " value " + value,
0076 fkClass, "FillNtupleTColumn");
0077 return false;
0078 }
0079
0080 column->fill(value);
0081
0082 if ( IsVerbose(G4Analysis::kVL4) ) {
0083 Message(G4Analysis::kVL4, "fill", "ntuple T column",
0084 " ntupleId " + to_string(ntupleId) + " columnId " + to_string(columnId) +
0085 " value " + value);
0086 }
0087 return true;
0088 }