ATLAS Offline Software
Loading...
Searching...
No Matches
MuonTesterBranch.cxx
Go to the documentation of this file.
1/*
2Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
5#include <GaudiKernel/MsgStream.h>
12
13#include <functional>
14
15#define SET_BRANCHSTRING(theType, thestring) \
16 template <> std::string ArrayBranch<theType>::tree_data_type() const { return thestring; }
17namespace MuonVal {
18SET_BRANCHSTRING(Char_t, "/B")
19SET_BRANCHSTRING(std::string, "/C")
20SET_BRANCHSTRING(UChar_t, "/b")
21SET_BRANCHSTRING(Short_t, "/S")
22SET_BRANCHSTRING(Int_t, "/I")
23SET_BRANCHSTRING(Long64_t, "/L")
24SET_BRANCHSTRING(long, "/I")
25SET_BRANCHSTRING(unsigned long, "/i")
26SET_BRANCHSTRING(UShort_t, "/s")
27SET_BRANCHSTRING(UInt_t, "/i")
28SET_BRANCHSTRING(ULong64_t, "/l")
29SET_BRANCHSTRING(Float_t, "/F")
30SET_BRANCHSTRING(Double_t, "/D")
31SET_BRANCHSTRING(Bool_t, "/o")
32
34 MuonTesterBranch(tree.tree(), br_name) {
36 m_parent->addBranch(this);
39 if (!m_parent) {
40 ATH_MSG_WARNING("The parent of " << name() << " is null.");
41 }
42 return *m_parent;
43}
45 if (m_parent) {
46 m_parent->removeBranch(this);
47 }
48}
49MuonTesterBranch::MuonTesterBranch(TTree* tree, const std::string& br_name) :
50 AthMessaging{"MuonTesterBranch"}, m_tree(tree), m_name(br_name) {}
51std::string MuonTesterBranch::name() const { return m_name; }
52bool MuonTesterBranch::initialized() const { return m_init; }
53TTree* MuonTesterBranch::tree() { return m_tree; }
54const TTree* MuonTesterBranch::tree() const { return m_tree; }
55
56std::string MuonTesterBranch::eraseWhiteSpaces(const std::string& In) {
57 std::string out = In;
58 out.erase(std::remove_if(out.begin(), out.end(), isspace), out.end());
59 return out;
60}
61std::vector<MuonTesterBranch::DataDependency> MuonTesterBranch::data_dependencies() { return m_dependencies;}
62
63template <> bool& VectorBranch<bool>::get(size_t) {
64 THROW_EXCEPTION("For boolean branches the get() operator is cumbersome");
65 return m_default;
66}
67}
68#undef SET_BRANCHSTRING
#define ATH_MSG_WARNING(x)
#define SET_BRANCHSTRING(theType, thestring)
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
bool initialized() const
Returns whether the object has been initialized or not The outcome of the variable is bound to a succ...
MuonTesterBranch(MuonTesterTree &tree, const std::string &br_name)
static std::string eraseWhiteSpaces(const std::string &In)
MuonTesterTree & parent()
Returns the reference to the MuonTesterTree parent.
std::vector< DataDependency > m_dependencies
std::string name() const override final
Returns the name of the branch.
std::vector< DataDependency > data_dependencies() override final
Returns the data dependencies needed by the MuonTesterBranch.
TTree * tree() override final
Returns the underlying TTree object.
T & get(size_t idx)
singleton-like access to IMessageSvc via open function and helper
Class to store array like branches into the n-tuples.
Definition HitValAlg.cxx:19
STL namespace.
DataModel_detail::iterator< DVL > remove_if(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, Predicate pred)
Specialization of remove_if for DataVector/List.
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10