ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TestBeam
TBRec
src
TBEventStreamer.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
#include "
TBEventStreamerTool.h
"
7
#include "
TBEventStreamer.h
"
8
9
TBEventStreamer::TBEventStreamer
(
const
std::string& name,
10
ISvcLocator* pService)
11
:
AthAlgorithm
(name,pService)
12
{
13
declareProperty
(
"ToolNames"
,
m_tools
);
14
}
15
16
TBEventStreamer::~TBEventStreamer
()
17
{ }
18
19
StatusCode
TBEventStreamer::initialize
()
20
{
21
ATH_CHECK
(
m_tools
.retrieve() );
22
23
24
// check tools
25
if
(
m_tools
.size() == 0 )
26
{
27
ATH_MSG_ERROR
(
"no tools found!"
);
28
return
StatusCode::FAILURE;
29
}
else
{
30
for
(
unsigned
int
i = 0; i <
m_tools
.size(); ++i) {
31
m_acceptCounter
[
m_tools
[i]] = 0;
32
m_rejectCounter
[
m_tools
[i]] = 0;
33
m_invokeCounter
[
m_tools
[i]] = 0;
34
}
35
}
36
37
38
// print out list of tools
39
ATH_MSG_INFO
(
" "
);
40
ATH_MSG_INFO
(
"List of tools in execution sequence:"
);
41
ATH_MSG_INFO
(
"------------------------------------"
);
42
ATH_MSG_INFO
(
" "
);
43
unsigned
int
toolCtr = 0;
44
for
(ToolHandle<TBEventStreamerTool>& tool :
m_tools
) {
45
toolCtr++;
46
ATH_MSG_INFO
(std::setw(2)
47
//<< std::setiosflags(std::ios_base::right)
48
<< toolCtr <<
".) "
49
//<< std::resetiosflags(std::ios_base::right)
50
//<< std::setw(36)
51
//<< std::setfill('.')
52
//<< std::setiosflags(std::ios_base::left)
53
<< tool->type()
54
//<< std::setfill('.')
55
<< tool->name() );
56
//<< std::setfill(' ')
57
}
58
59
return
StatusCode::SUCCESS;
60
61
}
62
63
StatusCode
TBEventStreamer::execute
(
const
EventContext& ctx)
64
{
65
bool
successFlag =
true
;
66
for
(ToolHandle<TBEventStreamerTool>& tool :
m_tools
)
67
{
68
m_invokeCounter
[tool]++;
69
successFlag = tool->accept() == StatusCode::SUCCESS;
70
if
( successFlag )
71
{
72
m_acceptCounter
[tool]++;
73
}
74
else
75
{
76
m_rejectCounter
[tool]++;
77
break
;
78
}
79
}
80
81
setFilterPassed
(successFlag, ctx);
82
return
StatusCode::SUCCESS;
83
}
84
85
StatusCode
TBEventStreamer::finalize
()
86
{
87
// print summary
88
for
(ToolHandle<TBEventStreamerTool>& tool :
m_tools
) {
89
ATH_MSG_INFO
(
"Tool "
90
<< tool->name()
91
<<
" (invoked/accept/reject) "
92
<<
"("
<<
m_invokeCounter
[tool]
93
<<
"/"
<<
m_acceptCounter
[tool]
94
<<
"/"
<<
m_rejectCounter
[tool]
95
<<
")"
);
96
}
97
98
return
StatusCode::SUCCESS;
99
}
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:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
TBEventStreamerTool.h
TBEventStreamer.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Definition
AthCommonAlgorithm.h:99
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
TBEventStreamer::~TBEventStreamer
virtual ~TBEventStreamer()
Definition
TBEventStreamer.cxx:16
TBEventStreamer::m_acceptCounter
std::map< ToolHandle< TBEventStreamerTool >, unsigned int > m_acceptCounter
Definition
TBEventStreamer.h:38
TBEventStreamer::initialize
virtual StatusCode initialize() override
Definition
TBEventStreamer.cxx:19
TBEventStreamer::m_invokeCounter
std::map< ToolHandle< TBEventStreamerTool >, unsigned int > m_invokeCounter
Definition
TBEventStreamer.h:40
TBEventStreamer::m_tools
ToolHandleArray< TBEventStreamerTool > m_tools
Definition
TBEventStreamer.h:36
TBEventStreamer::m_rejectCounter
std::map< ToolHandle< TBEventStreamerTool >, unsigned int > m_rejectCounter
Definition
TBEventStreamer.h:39
TBEventStreamer::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
TBEventStreamer.cxx:63
TBEventStreamer::finalize
virtual StatusCode finalize() override
Definition
TBEventStreamer.cxx:85
TBEventStreamer::TBEventStreamer
TBEventStreamer(const std::string &name, ISvcLocator *pService)
Algorithm constructor.
Definition
TBEventStreamer.cxx:9
Generated on
for ATLAS Offline Software by
1.17.0