39 bool to_vector(base_ntu& a_ntu,std::vector<T>& a_vec) {
41 const std::vector<base_col*>& cols = a_ntu.cols();
42 if(cols.empty())
return false;
43 base_col* _base_col = cols.front();
44 aida_col<T>* _col = safe_cast<base_col, aida_col<T> >(*_base_col);
45 if(!_col)
return false;
47 uint64 _rows = a_ntu.rows();
50 {
for(
uint64 row=0;row<_rows;row++) {
51 if(!a_ntu.next()) {a_vec.clear();
return false;}
52 if(!_col->get_entry(v)) {a_vec.clear();
return false;}
75 std::vector<G4int>& vector)
82 description <<
" ntupleId " << ntupleId <<
" " << columnName;
88 if ( ! ntupleDescription )
return false;
95 ntupleDescription->fIVectorBindingMap[subNtuple] = &vector;
96 tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
97 ntupleBinding->add_column_cid(columnName, *subNtuple);
102 description <<
" ntupleId " << ntupleId <<
" " << columnName;
113 std::vector<G4float>& vector)
120 description <<
" ntupleId " << ntupleId <<
" " << columnName;
126 if ( ! ntupleDescription )
return false;
133 ntupleDescription->fFVectorBindingMap[subNtuple] = &vector;
134 tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
135 ntupleBinding->add_column_cid(columnName, *subNtuple);
140 description <<
" ntupleId " << ntupleId <<
" " << columnName;
151 std::vector<G4double>& vector)
158 description <<
" ntupleId " << ntupleId <<
" " << columnName;
164 if ( ! ntupleDescription )
return false;
171 ntupleDescription->fDVectorBindingMap[subNtuple] = &vector;
172 tools::ntuple_binding* ntupleBinding = ntupleDescription->fNtupleBinding;
173 ntupleBinding->add_column_cid(columnName, *subNtuple);
178 description <<
" ntupleId " << ntupleId <<
" " << columnName;
193 if ( ! isInitialized ) {
194 tools::ntuple_binding* ntupleBinding = ntupleDescription->
fNtupleBinding;
195 if ( !
ntuple->set_binding(std::cout, *ntupleBinding) ) {
199 <<
"Ntuple initialization failed !!";
210 if ( !
ntuple->get_row() ) {
214 <<
"Ntuple get_row() failed !!";
222 {std::map<tools::aida::ntuple*, std::vector<int>* >::iterator
it;
225 tools::aida::to_vector<int>(*(it->first), *(it->second));
227 {std::map<tools::aida::ntuple*, std::vector<float>* >::iterator
it;
230 tools::aida::to_vector<float>(*(it->first), *(it->second));
232 {std::map<tools::aida::ntuple*, std::vector<double>* >::iterator
it;
235 tools::aida::to_vector<double>(*(it->first), *(it->second));