g4tools  5.4.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tools::wroot::base_pntuple_row_wise Class Reference
Inheritance diagram for tools::wroot::base_pntuple_row_wise:
Inheritance graph
[legend]
Collaboration diagram for tools::wroot::base_pntuple_row_wise:
Collaboration graph
[legend]

Public Member Functions

 base_pntuple_row_wise (std::ostream &a_out, bool a_byte_swap, uint32 a_compression, seek a_seek_directory, const std::string &a_name, const std::string &a_title, uint32 a_basket_size, bool a_verbose)
 
 base_pntuple_row_wise (std::ostream &a_out, bool a_byte_swap, uint32 a_compression, seek a_seek_directory, uint32 a_basket_size, const ntuple_booking &a_bkg, bool a_verbose)
 
virtual ~base_pntuple_row_wise ()
 
template<class T >
column_ref< T > * create_column_ref (const std::string &a_name, const T &a_ref)
 
template<class T >
column< T > * create_column (const std::string &a_name, const T &a_def=T())
 
column_string_ref * create_column_string_ref (const std::string &a_name, const std::string &a_ref)
 
column_string * create_column_string (const std::string &a_name, const std::string &a_def=std::string())
 
column_vector_string_ref * create_column_vector_string_ref (const std::string &a_name, const std::vector< std::string > &a_ref, char a_sep)
 
column_vector_string * create_column_vector_string (const std::string &a_name, const std::vector< std::string > &a_def, char a_sep)
 
template<class T >
std_vector_column_ref< T > * create_column_vector_ref (const std::string &a_name, const std::vector< T > &a_ref)
 
template<class T >
std_vector_column< T > * create_column_vector (const std::string &a_name, const std::vector< T > &a_def=std::vector< T >())
 
- Public Member Functions inherited from tools::wroot::base_pntuple
 base_pntuple (std::ostream &a_out, seek a_seek_directory, const std::string &a_name, const std::string &a_title)
 
virtual ~base_pntuple ()
 
const std::vector< icol * > & columns () const
 
template<class T >
column_ref< T > * find_column_ref (const std::string &a_name)
 
template<class T >
column< T > * find_column (const std::string &a_name)
 
column_string_ref * find_column_string_ref (const std::string &a_name)
 
column_string * find_column_string (const std::string &a_name)
 
template<class T >
std_vector_column_ref< T > * find_column_vector_ref (const std::string &a_name)
 
template<class T >
std_vector_column< T > * find_column_vector (const std::string &a_name)
 
column_vector_string_ref * find_column_vector_string_ref (const std::string &a_name)
 
column_vector_string * find_column_vector_string (const std::string &a_name)
 
void print_columns (std::ostream &a_out)
 

Protected Member Functions

 base_pntuple_row_wise (const base_pntuple_row_wise &a_from)
 
base_pntuple_row_wiseoperator= (const base_pntuple_row_wise &)
 
- Protected Member Functions inherited from tools::wroot::base_pntuple
 base_pntuple (const base_pntuple &a_from)
 
base_pntupleoperator= (const base_pntuple &)
 

Protected Attributes

branch m_row_wise_branch
 
- Protected Attributes inherited from tools::wroot::base_pntuple
std::ostream & m_out
 
seek m_seek_directory
 
std::string m_name
 
std::string m_title
 
std::vector< icol * > m_cols
 

Detailed Description

Definition at line 20 of file base_pntuple_row_wise.

Constructor & Destructor Documentation

◆ base_pntuple_row_wise() [1/3]

tools::wroot::base_pntuple_row_wise::base_pntuple_row_wise ( std::ostream &  a_out,
bool  a_byte_swap,
uint32  a_compression,
seek  a_seek_directory,
const std::string &  a_name,
const std::string &  a_title,
uint32  a_basket_size,
bool  a_verbose 
)
inline

Definition at line 23 of file base_pntuple_row_wise.

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)
28  {
29  m_row_wise_branch.set_basket_size(a_basket_size);
30  }

◆ base_pntuple_row_wise() [2/3]

tools::wroot::base_pntuple_row_wise::base_pntuple_row_wise ( std::ostream &  a_out,
bool  a_byte_swap,
uint32  a_compression,
seek  a_seek_directory,
uint32  a_basket_size,
const ntuple_booking a_bkg,
bool  a_verbose 
)
inline

Definition at line 32 of file base_pntuple_row_wise.

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)
37  {
38  m_row_wise_branch.set_basket_size(a_basket_size);
39 
40  const std::vector<column_booking>& cols = a_bkg.columns();
41 
42  tools_vforcit(column_booking,cols,it){
43 
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();\
47  if(user) {\
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);\
51  return;\
52  }\
53  } else {\
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);\
57  return;\
58  }\
59  }\
60  }
61 
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();\
65  if(vec) {\
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()) << "."\
69  << std::endl;\
70  safe_clear<icol>(m_cols);\
71  return;\
72  }\
73  } else {\
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()) << "."\
77  << std::endl;\
78  safe_clear<icol>(m_cols);\
79  return;\
80  }\
81  }\
82  }
83 
89 
90  else if((*it).cls_id()==_cid(std::string())) {
91  std::string* user = (std::string*)(*it).user_obj();
92  if(user) {
93  if(!create_column_string_ref((*it).name(),*user)) {
94  a_out << "tools::wroot::base_pntuple_row_wise : create_column_string_ref(" << (*it).name() << ") failed." << std::endl;
95  safe_clear<icol>(m_cols);
96  return;
97  }
98  } else {
99  if(!create_column_string((*it).name())) {
100  a_out << "tools::wroot::base_pntuple_row_wise : create_column_string(" << (*it).name() << ") failed." << std::endl;
101  safe_clear<icol>(m_cols);
102  return;
103  }
104  }
105  }
106 
112 
113  else if((*it).cls_id()==_cid_std_vector<std::string>()) {\
114  std::vector<std::string>* user = (std::vector<std::string>*)(*it).user_obj();
115  char sep = '\n';
116  if(user) {
117  if(!create_column_vector_string_ref((*it).name(),*user,sep)) {
118  a_out << "tools::wroot::base_pntuple_row_wise :"
119  << " create_column_vector_string_ref(" << (*it).name() << ") failed." << std::endl;
120  safe_clear<icol>(m_cols);
121  return;
122  }
123  } else {
124  if(!create_column_vector_string((*it).name(),std::vector<std::string>(),sep)) {
125  a_out << "tools::wroot::base_pntuple_row_wise :"
126  << " create_column_vector_string(" << (*it).name() << ") failed." << std::endl;
127  safe_clear<icol>(m_cols);
128  return;
129  }
130  }
131  }
132 
133  // no leaf_store_class() defined for the other types.
134 
135  else {
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."
139  << std::endl;
140  //throw
141  safe_clear<icol>(m_cols);
142  return;
143  }
144 
145 #undef TOOLS_WROOT_PNTUPLE_CREATE_COL
146 #undef TOOLS_WROOT_PNTUPLE_CREATE_VEC_COL
147  }
148  }

◆ ~base_pntuple_row_wise()

virtual tools::wroot::base_pntuple_row_wise::~base_pntuple_row_wise ( )
inlinevirtual

Definition at line 150 of file base_pntuple_row_wise.

150 {}

◆ base_pntuple_row_wise() [3/3]

tools::wroot::base_pntuple_row_wise::base_pntuple_row_wise ( const base_pntuple_row_wise a_from)
inlineprotected

Definition at line 152 of file base_pntuple_row_wise.

153  :parent(a_from)
154  ,m_row_wise_branch(m_out,false,0,0,"row_wise_branch","row_wise_branch",false)
155  {}

Member Function Documentation

◆ create_column()

template<class T >
column<T>* tools::wroot::base_pntuple_row_wise::create_column ( const std::string &  a_name,
const T &  a_def = T() 
)
inline

Definition at line 168 of file base_pntuple_row_wise.

168  {
169  if(find_named<icol>(m_cols,a_name)) return 0;
170  column<T>* col = new column<T>(m_row_wise_branch,a_name,a_def);
171  if(!col) return 0;
172  m_cols.push_back(col);
173  return col;
174  }

◆ create_column_ref()

template<class T >
column_ref<T>* tools::wroot::base_pntuple_row_wise::create_column_ref ( const std::string &  a_name,
const T &  a_ref 
)
inline

Definition at line 159 of file base_pntuple_row_wise.

159  {
160  if(find_named<icol>(m_cols,a_name)) return 0;
161  column_ref<T>* col = new column_ref<T>(m_row_wise_branch,a_name,a_ref);
162  if(!col) return 0;
163  m_cols.push_back(col);
164  return col;
165  }

◆ create_column_string()

column_string* tools::wroot::base_pntuple_row_wise::create_column_string ( const std::string &  a_name,
const std::string &  a_def = std::string() 
)
inline

Definition at line 184 of file base_pntuple_row_wise.

184  {
185  if(find_named<icol>(m_cols,a_name)) return 0;
186  column_string* col = new column_string(m_row_wise_branch,a_name,a_def);
187  if(!col) return 0;
188  m_cols.push_back(col);
189  return col;
190  }

◆ create_column_string_ref()

column_string_ref* tools::wroot::base_pntuple_row_wise::create_column_string_ref ( const std::string &  a_name,
const std::string &  a_ref 
)
inline

Definition at line 176 of file base_pntuple_row_wise.

176  {
177  if(find_named<icol>(m_cols,a_name)) return 0;
178  column_string_ref* col = new column_string_ref(m_row_wise_branch,a_name,a_ref);
179  if(!col) return 0;
180  m_cols.push_back(col);
181  return col;
182  }

◆ create_column_vector()

template<class T >
std_vector_column<T>* tools::wroot::base_pntuple_row_wise::create_column_vector ( const std::string &  a_name,
const std::vector< T > &  a_def = std::vector<T>() 
)
inline

Definition at line 219 of file base_pntuple_row_wise.

219  {
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);
222  if(!col) return 0;
223  m_cols.push_back(col);
224  return col;
225  }

◆ create_column_vector_ref()

template<class T >
std_vector_column_ref<T>* tools::wroot::base_pntuple_row_wise::create_column_vector_ref ( const std::string &  a_name,
const std::vector< T > &  a_ref 
)
inline

Definition at line 210 of file base_pntuple_row_wise.

210  {
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);
213  if(!col) return 0;
214  m_cols.push_back(col);
215  return col;
216  }

◆ create_column_vector_string()

column_vector_string* tools::wroot::base_pntuple_row_wise::create_column_vector_string ( const std::string &  a_name,
const std::vector< std::string > &  a_def,
char  a_sep 
)
inline

Definition at line 201 of file base_pntuple_row_wise.

201  {
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);
204  if(!col) return 0;
205  m_cols.push_back(col);
206  return col;
207  }

◆ create_column_vector_string_ref()

column_vector_string_ref* tools::wroot::base_pntuple_row_wise::create_column_vector_string_ref ( const std::string &  a_name,
const std::vector< std::string > &  a_ref,
char  a_sep 
)
inline

Definition at line 192 of file base_pntuple_row_wise.

193  {
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);
196  if(!col) return 0;
197  m_cols.push_back(col);
198  return col;
199  }

◆ operator=()

base_pntuple_row_wise& tools::wroot::base_pntuple_row_wise::operator= ( const base_pntuple_row_wise )
inlineprotected

Definition at line 156 of file base_pntuple_row_wise.

156 {return *this;}

Member Data Documentation

◆ m_row_wise_branch

branch tools::wroot::base_pntuple_row_wise::m_row_wise_branch
protected

Definition at line 228 of file base_pntuple_row_wise.


The documentation for this class was generated from the following file:
tools::wroot::base_pntuple_row_wise::create_column_vector_string_ref
column_vector_string_ref * create_column_vector_string_ref(const std::string &a_name, const std::vector< std::string > &a_ref, char a_sep)
Definition: base_pntuple_row_wise:192
tools::wroot::base_pntuple_row_wise::create_column_vector_string
column_vector_string * create_column_vector_string(const std::string &a_name, const std::vector< std::string > &a_def, char a_sep)
Definition: base_pntuple_row_wise:201
tools::_cid
cid _cid(byte)
Definition: cids:14
tools::wroot::base_pntuple::m_out
std::ostream & m_out
Definition: base_pntuple:122
TOOLS_WROOT_PNTUPLE_CREATE_COL
#define TOOLS_WROOT_PNTUPLE_CREATE_COL(a__type)
tools::wroot::base_pntuple_row_wise::m_row_wise_branch
branch m_row_wise_branch
Definition: base_pntuple_row_wise:228
tools::wroot::branch::set_basket_size
void set_basket_size(uint32 a_size)
Definition: branch:193
TOOLS_WROOT_PNTUPLE_CREATE_VEC_COL
#define TOOLS_WROOT_PNTUPLE_CREATE_VEC_COL(a__type)
tools::wroot::base_pntuple_row_wise::create_column_string
column_string * create_column_string(const std::string &a_name, const std::string &a_def=std::string())
Definition: base_pntuple_row_wise:184
tools::wroot::base_pntuple::m_cols
std::vector< icol * > m_cols
Definition: base_pntuple:126
tools::sep
const std::string & sep()
Definition: sep:11
tools_vforcit
#define tools_vforcit(a__T, a__v, a__it)
Definition: forit:7
tools::wroot::base_pntuple_row_wise::create_column_string_ref
column_string_ref * create_column_string_ref(const std::string &a_name, const std::string &a_ref)
Definition: base_pntuple_row_wise:176