g4tools  5.4.0
Public Member Functions | Protected Attributes | List of all members
tools::ntuple_booking Class Reference

Public Member Functions

 ntuple_booking (const std::string &a_name="", const std::string &a_title="")
 
virtual ~ntuple_booking ()
 
 ntuple_booking (const ntuple_booking &a_from)
 
ntuple_bookingoperator= (const ntuple_booking &a_from)
 
template<class T >
void add_column (const std::string &a_name)
 
template<class T >
void add_column (const std::string &a_name, T &a_user)
 
template<class T >
void add_column_vec (const std::string &a_name)
 
template<class T >
void add_column_vec (const std::string &a_name, std::vector< T > &a_user_vec)
 
template<class T >
void add_column (const std::string &a_name, std::vector< T > &a_user_vec)
 
const std::string & name () const
 
const std::string & title () const
 
const std::vector< column_booking > & columns () const
 
std::vector< column_booking > & columns ()
 
void set_name (const std::string &a_s)
 
void set_title (const std::string &a_s)
 
bool has_similar_layout (std::ostream &a_out, const ntuple_booking &a_nbk)
 

Protected Attributes

std::string m_name
 
std::string m_title
 
std::vector< column_bookingm_columns
 

Detailed Description

Definition at line 49 of file ntuple_booking.

Constructor & Destructor Documentation

◆ ntuple_booking() [1/2]

tools::ntuple_booking::ntuple_booking ( const std::string &  a_name = "",
const std::string &  a_title = "" 
)
inline

Definition at line 51 of file ntuple_booking.

52  :m_name(a_name)
53  ,m_title(a_title)
54  {}

◆ ~ntuple_booking()

virtual tools::ntuple_booking::~ntuple_booking ( )
inlinevirtual

Definition at line 55 of file ntuple_booking.

55 {}

◆ ntuple_booking() [2/2]

tools::ntuple_booking::ntuple_booking ( const ntuple_booking a_from)
inline

Definition at line 57 of file ntuple_booking.

58  :m_name(a_from.m_name)
59  ,m_title(a_from.m_title)
60  ,m_columns(a_from.m_columns)
61  {}

Member Function Documentation

◆ add_column() [1/3]

template<class T >
void tools::ntuple_booking::add_column ( const std::string &  a_name)
inline

Definition at line 70 of file ntuple_booking.

70  {
71  m_columns.push_back(column_booking(a_name,_cid(T()),0));
72  }

◆ add_column() [2/3]

template<class T >
void tools::ntuple_booking::add_column ( const std::string &  a_name,
std::vector< T > &  a_user_vec 
)
inline

Definition at line 87 of file ntuple_booking.

87  {
88  m_columns.push_back(column_booking(a_name,_cid_std_vector<T>(),(void*)&a_user_vec));
89  }

◆ add_column() [3/3]

template<class T >
void tools::ntuple_booking::add_column ( const std::string &  a_name,
T &  a_user 
)
inline

Definition at line 74 of file ntuple_booking.

74  {
75  m_columns.push_back(column_booking(a_name,_cid(T()),(void*)&a_user));
76  }

◆ add_column_vec() [1/2]

template<class T >
void tools::ntuple_booking::add_column_vec ( const std::string &  a_name)
inline

Definition at line 79 of file ntuple_booking.

79  {
80  m_columns.push_back(column_booking(a_name,_cid_std_vector<T>(),0));
81  }

◆ add_column_vec() [2/2]

template<class T >
void tools::ntuple_booking::add_column_vec ( const std::string &  a_name,
std::vector< T > &  a_user_vec 
)
inline

Definition at line 83 of file ntuple_booking.

83  {
84  m_columns.push_back(column_booking(a_name,_cid_std_vector<T>(),(void*)&a_user_vec));
85  }

◆ columns() [1/2]

std::vector<column_booking>& tools::ntuple_booking::columns ( )
inline

Definition at line 94 of file ntuple_booking.

94 {return m_columns;}

◆ columns() [2/2]

const std::vector<column_booking>& tools::ntuple_booking::columns ( ) const
inline

Definition at line 93 of file ntuple_booking.

93 {return m_columns;}

◆ has_similar_layout()

bool tools::ntuple_booking::has_similar_layout ( std::ostream &  a_out,
const ntuple_booking a_nbk 
)
inline

Definition at line 99 of file ntuple_booking.

99  {
100  if(m_columns.size()!=a_nbk.m_columns.size()) {
101  a_out << "tools::ntuple_booking::has_similar_layout :"
102  << " bookings have not the same number of columns."
103  << " (" << m_columns.size() << " != " << a_nbk.m_columns.size() << ")."
104  << std::endl;
105  return false;
106  }
107  std::vector<column_booking>::const_iterator ait = a_nbk.m_columns.begin();
109  if((*it).name()!=(*ait).name()) {
110  a_out << "tools::ntuple_booking::has_similar_layout :"
111  << " columns don't have same name."
112  << " (" << (*it).name() << " != " << (*ait).name() << ")."
113  << std::endl;
114  return false;
115  }
116  if((*it).cls_id()!=(*ait).cls_id()) {
117  a_out << "tools::ntuple_booking::has_similar_layout :"
118  << " columns don't have same class id."
119  << " (" << (*it).cls_id() << " != " << (*ait).cls_id() << ")."
120  << std::endl;
121  return false;
122  }
123 
124  ait++;
125  }
126  return true;
127  }

◆ name()

const std::string& tools::ntuple_booking::name ( ) const
inline

Definition at line 91 of file ntuple_booking.

91 {return m_name;}

◆ operator=()

ntuple_booking& tools::ntuple_booking::operator= ( const ntuple_booking a_from)
inline

Definition at line 62 of file ntuple_booking.

62  {
63  m_name = a_from.m_name;
64  m_title = a_from.m_title;
65  m_columns = a_from.m_columns;
66  return *this;
67  }

◆ set_name()

void tools::ntuple_booking::set_name ( const std::string &  a_s)
inline

Definition at line 96 of file ntuple_booking.

96 {m_name = a_s;}

◆ set_title()

void tools::ntuple_booking::set_title ( const std::string &  a_s)
inline

Definition at line 97 of file ntuple_booking.

97 {m_title = a_s;}

◆ title()

const std::string& tools::ntuple_booking::title ( ) const
inline

Definition at line 92 of file ntuple_booking.

92 {return m_title;}

Member Data Documentation

◆ m_columns

std::vector<column_booking> tools::ntuple_booking::m_columns
protected

Definition at line 132 of file ntuple_booking.

◆ m_name

std::string tools::ntuple_booking::m_name
protected

Definition at line 130 of file ntuple_booking.

◆ m_title

std::string tools::ntuple_booking::m_title
protected

Definition at line 131 of file ntuple_booking.


The documentation for this class was generated from the following file:
tools::_cid
cid _cid(byte)
Definition: cids:14
tools::column_booking
Definition: ntuple_booking:17
tools::ntuple_booking::m_columns
std::vector< column_booking > m_columns
Definition: ntuple_booking:132
tools_vforit
#define tools_vforit(a__T, a__v, a__it)
Definition: forit:13
tools::ntuple_booking::m_title
std::string m_title
Definition: ntuple_booking:131
tools::ntuple_booking::m_name
std::string m_name
Definition: ntuple_booking:130