ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonValidation
MuonTesterTree
MuonTesterTree
MuonTesterBranch.icc
Go to the documentation of this file.
1
2
/*
3
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4
*/
5
#ifndef MUONTESTER_MUONTESTERBRANCH_IXX
6
#define MUONTESTER_MUONTESTERBRANCH_IXX
7
#include <TTree.h>
8
#include <algorithm> //for std::find
9
namespace MuonVal {
10
template <class T> bool MuonTesterBranch::addToTree(T& variable) {
11
if (initialized()) {
12
ATH_MSG_INFO("init() -- " << name() << " is already initialized.");
13
return true;
14
}
15
std::string bName = eraseWhiteSpaces(name());
16
if (bName.empty() || !m_tree) {
17
ATH_MSG_ERROR("init() -- Empty names are forbidden.");
18
return false;
19
} else if (m_tree->FindBranch(bName.c_str())) {
20
ATH_MSG_ERROR("The branch " << name() << " already exists in TTree " << m_tree->GetName() << ".");
21
return false;
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() << ".");
24
return false;
25
}
26
ATH_MSG_VERBOSE("init () -- Successfully initialized "<<name());
27
m_init = true;
28
return true;
29
}
30
template <class Key>
31
bool MuonTesterBranch::declare_dependency(Key& key) {
32
if (std::find(m_dependencies.begin(), m_dependencies.end(),&key) != m_dependencies.end()) return true;
33
if (!key.initialize(!key.empty())) return false;
34
m_dependencies.emplace_back(&key);
35
ATH_MSG_DEBUG("Declared new dependency "<<key.fullKey()<<" to "<<name());
36
return true;
37
}
38
}
39
#endif
Generated on
for ATLAS Offline Software by
1.17.0