2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 #ifndef MUONTESTER_MUONSMATRIXBRANCH_IXX
5 #define MUONTESTER_MUONSMATRIXBRANCH_IXX
10 template <class T> MatrixBranch<T>::MatrixBranch(TTree* tree, const std::string& name) :
11 VectorBranch<std::vector<T>>(tree, name) {}
12 template <class T> MatrixBranch<T>::MatrixBranch(TTree* tree, const std::string& b_name, const T& def) :
13 MatrixBranch<T>(tree, b_name) {
16 template <class T> MatrixBranch<T>::MatrixBranch(MuonTesterTree& parent, const std::string& name) :
17 VectorBranch<std::vector<T>>{parent, name} {}
19 MatrixBranch<T>::MatrixBranch(MuonTesterTree& tree, const std::string& b_name, const T& def) :
20 MatrixBranch<T>(tree, b_name) {
23 template <class T> void MatrixBranch<T>::push_back(size_t i, const T& value) {
24 get(i).push_back(value); }
25 template <class T> T& MatrixBranch<T>::get(size_t i, size_t j) {
27 if (get(i).size() <= j) {
28 for (size_t k = get(i).size(); k <= j; ++k) { get(i).push_back(getDefault()); }
32 template <class T> size_t MatrixBranch<T>::nrows() const { return VectorBranch<std::vector<T>>::size(); }
33 template <class T> size_t MatrixBranch<T>::ncols(size_t row) const {
34 if (row >= nrows()) { return 0; }
35 return get(row).size();
37 template <class T> const T& MatrixBranch<T>::getDefault() const { return m_default; }
38 template <class T> void MatrixBranch<T>::setDefault(const T& def) { m_default = def; }