4 #ifndef tools_wroot_base_pntuple_row_wise
5 #define tools_wroot_base_pntuple_row_wise
11 #include "../ntuple_booking"
24 const std::string& a_name,
const std::string& a_title,
25 uint32 a_basket_size,
bool a_verbose)
26 :
parent(a_out,a_seek_directory,a_name,a_title)
27 ,
m_row_wise_branch(a_out,a_byte_swap,a_compression,a_seek_directory,
"row_wise_branch",
"row_wise_branch",a_verbose)
35 :
parent(a_out,a_seek_directory,a_bkg.name(),a_bkg.title())
36 ,
m_row_wise_branch(a_out,a_byte_swap,a_compression,a_seek_directory,
"row_wise_branch",
"row_wise_branch",a_verbose)
40 const std::vector<column_booking>& cols = a_bkg.
columns();
44 #define TOOLS_WROOT_PNTUPLE_CREATE_COL(a__type) \
45 if((*it).cls_id()==_cid(a__type())) {\
46 a__type* user = (a__type*)(*it).user_obj();\
48 if(!create_column_ref<a__type>((*it).name(),*user)) {\
49 a_out << "tools::wroot::base_pntuple_row_wise : create_column_ref(" << (*it).name() << ") failed." << std::endl;\
50 safe_clear<icol>(m_cols);\
54 if(!create_column<a__type>((*it).name())) {\
55 a_out << "tools::wroot::base_pntuple_row_wise : create_column(" << (*it).name() << ") failed." << std::endl;\
56 safe_clear<icol>(m_cols);\
62 #define TOOLS_WROOT_PNTUPLE_CREATE_VEC_COL(a__type) \
63 if((*it).cls_id()==_cid_std_vector<a__type>()) {\
64 std::vector<a__type>* vec = (std::vector<a__type>*)(*it).user_obj();\
66 if(!create_column_vector_ref<a__type>((*it).name(),*vec)) {\
67 a_out << "tools::wroot::base_pntuple_row_wise :"\
68 << " create_column_vector_ref failed for std::vector column " << sout((*it).name()) << "."\
70 safe_clear<icol>(m_cols);\
74 if(!create_column_vector<a__type>((*it).name())) {\
75 a_out << "tools::wroot::base_pntuple_row_wise :"\
76 << " create_column_vector failed for std::vector column " << sout((*it).name()) << "."\
78 safe_clear<icol>(m_cols);\
90 else if((*it).cls_id()==
_cid(std::string())) {
91 std::string* user = (std::string*)(*it).user_obj();
94 a_out <<
"tools::wroot::base_pntuple_row_wise : create_column_string_ref(" << (*it).name() <<
") failed." << std::endl;
100 a_out <<
"tools::wroot::base_pntuple_row_wise : create_column_string(" << (*it).name() <<
") failed." << std::endl;
113 else if((*it).cls_id()==_cid_std_vector<std::string>()) {\
114 std::vector<std::string>* user = (std::vector<std::string>*)(*it).user_obj();
118 a_out <<
"tools::wroot::base_pntuple_row_wise :"
119 <<
" create_column_vector_string_ref(" << (*it).name() <<
") failed." << std::endl;
125 a_out <<
"tools::wroot::base_pntuple_row_wise :"
126 <<
" create_column_vector_string(" << (*it).name() <<
") failed." << std::endl;
136 a_out <<
"tools::wroot::base_pntuple_row_wise :"
137 <<
" for column " <<
sout((*it).name())
138 <<
", type with cid " << (*it).cls_id() <<
" not yet handled."
145 #undef TOOLS_WROOT_PNTUPLE_CREATE_COL
146 #undef TOOLS_WROOT_PNTUPLE_CREATE_VEC_COL
160 if(find_named<icol>(
m_cols,a_name))
return 0;
169 if(find_named<icol>(
m_cols,a_name))
return 0;
177 if(find_named<icol>(
m_cols,a_name))
return 0;
185 if(find_named<icol>(
m_cols,a_name))
return 0;
193 const std::vector<std::string>& a_ref,
char a_sep) {
194 if(find_named<icol>(
m_cols,a_name))
return 0;
195 column_vector_string_ref* col =
new column_vector_string_ref(
m_row_wise_branch,a_name,a_ref,a_sep);
202 if(find_named<icol>(
m_cols,a_name))
return 0;
203 column_vector_string* col =
new column_vector_string(
m_row_wise_branch,a_name,a_def,a_sep);
211 if(find_named<icol>(
m_cols,a_name))
return 0;
212 std_vector_column_ref<T>* col =
new std_vector_column_ref<T>(
m_row_wise_branch,a_name,a_ref);
219 std_vector_column<T>*
create_column_vector(
const std::string& a_name,
const std::vector<T>& a_def = std::vector<T>()) {
220 if(find_named<icol>(
m_cols,a_name))
return 0;
221 std_vector_column<T>* col =
new std_vector_column<T>(
m_row_wise_branch,a_name,a_def);