4#ifndef MUONTESTERTREE_MUONTESTERTREE_H
5#define MUONTESTERTREE_MUONTESTERTREE_H
7#include <GaudiKernel/ITHistSvc.h>
8#include <GaudiKernel/ServiceHandle.h>
32 MuonTesterTree(
const std::string& tree_name,
const std::string& stream);
37 const TTree*
tree()
const;
47 bool fill(
const EventContext& ctx);
50 std::string
name()
const;
54 const std::string&
path()
const;
57 void setPath(
const std::string& new_path);
60 template <
class OWNER,
61 typename =
typename std::enable_if<std::is_base_of<IProperty, OWNER>::value>
::type>
74 bool addBranch(std::shared_ptr<IMuonTesterBranch> branch);
86 template <
class T> std::shared_ptr<T>
getBranch(
const std::string&
str)
const;
101 template <
typename T> T&
newBranch(std::shared_ptr<T> br);
113 const std::vector<FriendTreePtr>&
getFriends()
const;
145 std::vector<std::shared_ptr<IMuonTesterBranch>>
m_branches{};
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Most basic interface class used by the MuonTester tree.
SG::VarHandleKey * DataDependency
std::set< std::string > m_excludedBranches
bool m_init
Flag to avoid double initialization with the StoreGate.
MatrixBranch< T > & newMatrix(const std::string &name)
T & newBranch(std::shared_ptr< T > br)
returns the reference of the branch
IMuonTesterBranch::DataDependency DataDependency
const std::vector< FriendTreePtr > & getFriends() const
std::vector< std::shared_ptr< IMuonTesterBranch > > m_branches
std::set< MuonTesterTree * > m_commonClients
List of all other MuonTesterTree instances using this instance as a common Tree If the Tree has one c...
std::vector< IMuonTesterBranch * > m_branches_to_init
bool registerBranch(std::shared_ptr< IMuonTesterBranch > branch)
This method adds the branch to the tree and hands over the ownership to the MuonAnalysisTree instance...
MuonTesterTree(const std::string &tree_name, const std::string &stream)
bool fill(const EventContext &ctx)
Fills the tree per call.
bool addBranch(std::shared_ptr< IMuonTesterBranch > branch)
Branch is added to the tree without transferring the ownership.
MatrixBranch< T > & newMatrix(const std::string &name, const T def_val)
TTree * operator->()
Operator to the TTree object.
unsigned int m_depCounter
StatusCode init(OWNER *instance)
Initialize method.
ServiceHandle< ITHistSvc > m_hist_svc
VectorBranch< T > & newVector(const std::string &name, const T def_val)
Creates and returns branches with a default value.
void removeBranch(IMuonTesterBranch *branch)
In case instances of a certain branch type are destroyed before hand.
void disableBranch(const std::string &br_name)
Skips the branch from being added to the tree.
VectorBranch< T > & newVector(const std::string &name)
Creates new branches and returns their reference.
bool addClient(MuonTesterTree *client)
Adds the other TTree as a Client and declares this instance as a Common Tree.
bool initialized() const
Has the init method been called and the tree is connected with the output file.
bool m_written
Flag to indicate whether the TTree is written to the file or not.
std::shared_ptr< MuonTesterTree > FriendTreePtr
Appends the other tester Tree as friend to this instance.
ScalarBranch< T > & newScalar(const std::string &name, const T def_val)
std::shared_ptr< T > getBranch(const std::string &str) const
Retrieves the branches owned by the muon_tree.
void setPath(const std::string &new_path)
Save the TTree in a subfolder of the TFile.
SetBranch< T > & newSet(const std::string &name)
std::vector< FriendTreePtr > m_friendLinks
List of all other common instances that are acting as friends.
const std::string & path() const
sub directory in the TFile
bool addCommonTree(FriendTreePtr common_tree)
std::unique_ptr< TTree > m_tree
bool isActive(const IMuonTesterBranch *branch) const
Returns a boolean whether the branch is already part of the tree or one of the deligated friends.
std::vector< DataDependency > m_dependencies
std::string name() const
Name of the tree.
const std::string & fileStream() const
file_stream of the analysis to which the tree belongs
StatusCode write()
Finally write the TTree objects.
std::shared_ptr< EventHashBranch > m_hash_br
ScalarBranch< T > & newScalar(const std::string &name)
TTree * tree()
TTree object.
bool isCommonTree() const
Returns Whether the Tree is a common tree or not.
std::set< IMuonTesterBranch * > m_initialized_br
Set of branches that were already initialized.
Class to store array like branches into the n-tuples.