3 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 #ifndef MUONTESTER_MUONTESTERBRANCH_IXX
6 #define MUONTESTER_MUONTESTERBRANCH_IXX
8 #include <algorithm> //for std::find
10 template <class T> bool MuonTesterBranch::addToTree(T& variable) {
12 ATH_MSG_INFO("init() -- " << name() << " is already initialized.");
15 std::string bName = eraseWhiteSpaces(name());
16 if (bName.empty() || !m_tree) {
17 ATH_MSG_ERROR("init() -- Empty names are forbidden.");
19 } else if (m_tree->FindBranch(bName.c_str())) {
20 ATH_MSG_ERROR("The branch " << name() << " already exists in TTree " << m_tree->GetName() << ".");
22 } else if (!m_tree->Branch(bName.c_str(), &variable)) {
23 ATH_MSG_ERROR("Could not create the branch " << name() << " in TTree " << m_tree->GetName() << ".");
30 bool MuonTesterBranch::declare_dependency(Key& key) {
31 if (std::find(m_dependencies.begin(), m_dependencies.end(),&key) != m_dependencies.end()) return true;
32 if (!key.initialize(!key.empty())) return false;
33 m_dependencies.emplace_back(&key);
34 ATH_MSG_DEBUG("Declared new dependency "<<key.fullKey()<<" to "<<name());