40 bool to_vector(base_ntu& a_ntu,std::vector<T>& a_vec) {
42 const std::vector<base_col*>& cols = a_ntu.cols();
43 if(cols.empty())
return false;
44 base_col* _base_col = cols.front();
45 aida_col<T>* _col = safe_cast<base_col, aida_col<T> >(*_base_col);
46 if(!_col)
return false;
48 uint64 _rows = a_ntu.rows();
51 {
for(
uint64 row=0;row<_rows;row++) {
52 if(!a_ntu.next()) {a_vec.clear();
return false;}
53 if(!_col->get_entry(v)) {a_vec.clear();
return false;}
76 std::vector<G4int>& vector)
83 description <<
" ntupleId " << ntupleId <<
" " << columnName;
89 if ( ! ntupleDescription )
return false;
96 ntupleDescription->fIVectorBindingMap[subNtuple] = &vector;
97 tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
98 ntupleBinding->add_column_cid(columnName, *subNtuple);
103 description <<
" ntupleId " << ntupleId <<
" " << columnName;
114 std::vector<G4float>& vector)
121 description <<
" ntupleId " << ntupleId <<
" " << columnName;
127 if ( ! ntupleDescription )
return false;
134 ntupleDescription->fFVectorBindingMap[subNtuple] = &vector;
135 tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
136 ntupleBinding->add_column_cid(columnName, *subNtuple);
141 description <<
" ntupleId " << ntupleId <<
" " << columnName;
152 std::vector<G4double>& vector)
159 description <<
" ntupleId " << ntupleId <<
" " << columnName;
165 if ( ! ntupleDescription )
return false;
172 ntupleDescription->fDVectorBindingMap[subNtuple] = &vector;
173 tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
174 ntupleBinding->add_column_cid(columnName, *subNtuple);
179 description <<
" ntupleId " << ntupleId <<
" " << columnName;
194 if ( ! isInitialized ) {
195 tools::ntuple_binding* ntupleBinding = ntupleDescription->
fNtupleBinding;
196 if ( !
ntuple->set_binding(std::cout, *ntupleBinding) ) {
200 <<
"Ntuple initialization failed !!";
211 if ( !
ntuple->get_row() ) {
215 <<
"Ntuple get_row() failed !!";
223 {std::map<tools::aida::ntuple*, std::vector<int>* >::iterator it;
226 tools::aida::to_vector<int>(*(it->first), *(it->second));
228 {std::map<tools::aida::ntuple*, std::vector<float>* >::iterator it;
231 tools::aida::to_vector<float>(*(it->first), *(it->second));
233 {std::map<tools::aida::ntuple*, std::vector<double>* >::iterator it;
236 tools::aida::to_vector<double>(*(it->first), *(it->second));
const G4AnalysisVerbose * GetVerboseL2() const
virtual G4bool SetNtupleFColumn(G4int ntupleId, const G4String &columnName, std::vector< G4float > &vector) final
std::ostringstream G4ExceptionDescription
virtual ~G4XmlRNtupleManager()
tools::ntuple_binding * fNtupleBinding
virtual G4bool SetNtupleIColumn(G4int ntupleId, const G4String &columnName, std::vector< G4int > &vector) final
G4TRNtupleDescription< tools::aida::ntuple > * GetNtupleDescriptionInFunction(G4int id, G4String function, G4bool warn=true) const
std::map< TNTUPLE *, std::vector< float > * > fFVectorBindingMap
const G4AnalysisVerbose * GetVerboseL4() const
virtual G4bool GetTNtupleRow(G4TRNtupleDescription< tools::aida::ntuple > *ntupleDescription) final
unsigned long long uint64
virtual G4bool SetNtupleDColumn(G4int ntupleId, const G4String &columnName, std::vector< G4double > &vector) final
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::map< TNTUPLE *, std::vector< double > * > fDVectorBindingMap
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
G4GLOB_DLL std::ostream G4cout
std::map< TNTUPLE *, std::vector< int > * > fIVectorBindingMap
const G4AnalysisManagerState & fState
G4XmlRNtupleManager(const G4AnalysisManagerState &state)