ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonValidation
MuonTesterTree
src
TreeTesterAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
TreeTesterAlg.h
"
5
#include <memory>
6
#include <vector>
7
8
namespace
MuonVal
{
9
namespace
MuonTester
{
10
11
StatusCode
TreeTestAlg::initialize
(){
12
auto
arrayTest = std::make_unique<ArrayBranch<unsigned>>(
m_tree
.tree(),
"testArray"
, 2);
13
m_arrayTest
= arrayTest.get();
14
bool
ok =
m_tree
.addBranch(std::move(arrayTest));
15
if
(not ok){
16
ATH_MSG_ERROR
(
"addBranch failed in TreeTestAlg::initialize"
);
17
return
StatusCode::FAILURE;
18
}
19
ATH_CHECK
(
m_tree
.init(
this
));
20
return
StatusCode::SUCCESS;
21
}
22
StatusCode
TreeTestAlg::execute
(
const
EventContext& ctx) {
23
for
(
unsigned
int
n = 0; n < 100; ++n) {
24
m_scalarTest
= n;
25
m_vectorTest
[n] = n +1;
26
m_matrixTest
[n+1] = std::vector<unsigned>{n,n+1,n+3};
27
(*m_arrayTest)[0] = n +1;
28
(*m_arrayTest)[1] = n+5;
29
ATH_CHECK
(
m_tree
.fill(ctx));
30
}
31
32
return
StatusCode::SUCCESS;
33
}
34
StatusCode
TreeTestAlg::finalize
(){
35
ATH_CHECK
(
m_tree
.write());
36
return
StatusCode::SUCCESS;
37
}
38
}
39
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
TreeTesterAlg.h
MuonVal::MuonTester::TreeTestAlg::initialize
virtual StatusCode initialize() override final
Definition
TreeTesterAlg.cxx:11
MuonVal::MuonTester::TreeTestAlg::m_tree
MuonTesterTree m_tree
Definition
TreeTesterAlg.h:19
MuonVal::MuonTester::TreeTestAlg::m_arrayTest
MuonVal::ArrayBranch< unsigned > * m_arrayTest
Definition
TreeTesterAlg.h:24
MuonVal::MuonTester::TreeTestAlg::m_vectorTest
MuonVal::VectorBranch< unsigned > & m_vectorTest
Definition
TreeTesterAlg.h:22
MuonVal::MuonTester::TreeTestAlg::finalize
virtual StatusCode finalize() override final
Definition
TreeTesterAlg.cxx:34
MuonVal::MuonTester::TreeTestAlg::m_matrixTest
MuonVal::MatrixBranch< unsigned > & m_matrixTest
Definition
TreeTesterAlg.h:23
MuonVal::MuonTester::TreeTestAlg::m_scalarTest
MuonVal::ScalarBranch< unsigned > & m_scalarTest
Definition
TreeTesterAlg.h:21
MuonVal::MuonTester::TreeTestAlg::execute
virtual StatusCode execute(const EventContext &ctx) override final
Execute method.
Definition
TreeTesterAlg.cxx:22
MuonVal::MuonTester
Definition
TreeTesterAlg.cxx:9
MuonVal
Class to store array like branches into the n-tuples.
Definition
HitValAlg.cxx:19
Generated on
for ATLAS Offline Software by
1.17.0