ATLAS Offline Software
Loading...
Searching...
No Matches
MatrixBranch.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MUONTESTER_MATRIXBRANCH_H
5#define MUONTESTER_MATRIXBRANCH_H
7
8class TTree;
9
10namespace MuonVal {
11class MuonTesterTree;
12template <class T> class MatrixBranch : public VectorBranch<std::vector<T>> {
13public:
15 MatrixBranch(TTree* tree, const std::string& name);
16 MatrixBranch(MuonTesterTree& tree, const std::string& name);
17
19 MatrixBranch(TTree* tree, const std::string& b_name, const T& def);
20 MatrixBranch(MuonTesterTree& tree, const std::string& b_name, const T& def);
21
22
23 virtual ~MatrixBranch() = default;
24
25
26
28 using VectorBranch<std::vector<T>>::get;
29 using VectorBranch<std::vector<T>>::operator[];
30
32 inline T& get(size_t i, size_t j);
33
35 using VectorBranch<std::vector<T>>::push_back;
36 inline void push_back(size_t i, const T& value);
37
39 inline size_t nrows() const;
41 inline size_t ncols(size_t row) const;
42
44 inline const T& getDefault() const;
45 void setDefault(const T& def);
46
47private:
49};
50}
52#endif
MatrixBranch(MuonTesterTree &tree, const std::string &name)
MatrixBranch(MuonTesterTree &tree, const std::string &b_name, const T &def)
size_t nrows() const
Size of the outer vector.
void setDefault(const T &def)
virtual ~MatrixBranch()=default
const T & getDefault() const
Get the default value to fill the empty fields in the vector.
T & get(size_t i, size_t j)
Returns the j-th element of the i-th inner vector.
MatrixBranch(TTree *tree, const std::string &name)
Standard constructor.
size_t ncols(size_t row) const
Size of the i-th inner vector.
void push_back(size_t i, const T &value)
MatrixBranch(TTree *tree, const std::string &b_name, const T &def)
Constructor with default value extending the array.
std::string name() const override final
VectorBranch(TTree *tree, const std::string &name)
Class to store array like branches into the n-tuples.
Definition HitValAlg.cxx:19