ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
Global
GlobalSimulation
src
GlobalSimComponents
GlobalSimulationAlg.cxx
Go to the documentation of this file.
1
// Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
3
#include "
GlobalSimulationAlg.h
"
4
#include "
TrigConfData/L1Menu.h
"
5
6
#include "
../Utilities/BasicDataCollector.h
"
7
#include "
CxxUtils/checker_macros.h
"
8
9
#include <fstream>
10
11
namespace
GlobalSim
{
12
13
GlobalSimulationAlg::GlobalSimulationAlg
(
const
std::string& name,
14
ISvcLocator *pSvcLocator):
15
AthReentrantAlgorithm
(name, pSvcLocator) {
16
}
17
18
StatusCode
GlobalSimulationAlg::initialize
() {
19
20
ATH_MSG_INFO
(
"number of TOB creators "
<<
m_algTools
.size());
21
ATH_MSG_INFO
(
"number of TIP writers "
<<
m_TIPwriters
.size());
22
23
// If we only run TOB creators, then don't write the TIP word
24
// as this leads to SG clashes (or spurious stuff in SG)
25
CHECK
(
m_tipWordKey
.initialize(!
m_TIPwriters
.empty()));
26
27
if
(
m_enableDumps
) {
28
std::stringstream
ss
;
29
ss
<<
"\nTOB creators ("
<<
m_algTools
.size() <<
")\n"
;
30
for
(
const
auto
& tool :
m_algTools
) {
31
ss
<< tool->toString() <<
'\n'
;
32
ss
<<
"=========\n"
;
33
}
34
ss
<<
"\nTIP writers ("
<<
m_TIPwriters
.size() <<
")\n"
;
35
for
(
const
auto
& tool :
m_TIPwriters
) {
36
ss
<< tool->toString() <<
'\n'
;
37
ss
<<
"=========\n"
;
38
}
39
40
std::ofstream out(name() +
"_init.log"
);
41
out <<
ss
.str();
42
out.close();
43
}
44
45
// Test that TIPwriters don't clash
46
TIPword
tip_test;
47
for
(
const
auto
& tool :
m_TIPwriters
) {
48
ATH_MSG_VERBOSE
(
"Current TIP word: "
<< tip_test);
49
TIPword
tip_tmp{tool->getFullTIPWord()};
50
ATH_MSG_VERBOSE
(
"TIP writer "
<< tool.name() <<
" produces: "
<< tip_tmp);
51
if
((tip_tmp & tip_test).any()) {
52
ATH_MSG_ERROR
(
"TIP word clash from "
<< tool->toString());
53
return
StatusCode::FAILURE;
54
}
55
tip_test |= tip_tmp;
56
}
57
58
return
StatusCode::SUCCESS;
59
}
60
61
62
63
StatusCode
GlobalSimulationAlg::execute
(
const
EventContext& ctx)
const
{
64
ATH_MSG_DEBUG
(
"Executing ..."
);
65
66
67
using
TIPWord = std::bitset<ITIPWriterAlgTool::s_nbits_TIP>;
68
69
auto
dc = std::unique_ptr<IDataCollector>(
nullptr
);
70
dc.reset(
new
BasicDataCollector
());
71
72
for
(
const
auto
& tool :
m_algTools
) {
73
ATH_MSG_DEBUG
(
"Running Algtool "
<< tool.name());
74
CHECK
(tool ->
run
(dc, ctx));
75
}
76
77
if
(!
m_TIPwriters
.empty()) {
78
auto
tipword = std::make_unique<TIPWord>();
// all zeros
79
for
(
const
auto
& tool :
m_TIPwriters
) {
80
ATH_MSG_DEBUG
(
"Collecting TIP bits "
<< tool.name());
81
CHECK
(tool -> updateTIP(*tipword, dc, ctx));
82
}
83
84
if
(
m_enableDumps
) {
85
std::stringstream
ss
;
86
ss
<<
"\nRun "
<< ctx <<
' '
<<
"TIP:\n"
<< *tipword <<
'\n'
;
87
88
89
std::ofstream out(name() +
"_tip.log"
, std::ios_base::app);
90
out <<
ss
.str();
91
out.close();
92
}
93
94
ATH_MSG_DEBUG
(
"TIP "
<< *tipword);
95
96
// write out the selection result
97
SG::WriteHandle<TIPWord>
h_write(
m_tipWordKey
, ctx);
98
CHECK
(h_write.
record
(std::move(tipword)));
99
}
100
101
return
StatusCode::SUCCESS;
102
}
103
}
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
BasicDataCollector.h
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
GlobalSimulationAlg.h
L1Menu.h
ss
static Double_t ss
Definition
LArPhysWaveHECTool.cxx:37
checker_macros.h
Define macros for attributes used to control the static checker.
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
GlobalSim::BasicDataCollector
Definition
BasicDataCollector.h:15
GlobalSim::GlobalSimulationAlg::initialize
virtual StatusCode initialize() override
Definition
GlobalSimulationAlg.cxx:18
GlobalSim::GlobalSimulationAlg::m_TIPwriters
ToolHandleArray< ITIPWriterAlgTool > m_TIPwriters
Definition
GlobalSimulationAlg.h:55
GlobalSim::GlobalSimulationAlg::m_enableDumps
Gaudi::Property< bool > m_enableDumps
Definition
GlobalSimulationAlg.h:62
GlobalSim::GlobalSimulationAlg::GlobalSimulationAlg
GlobalSimulationAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
GlobalSimulationAlg.cxx:13
GlobalSim::GlobalSimulationAlg::m_tipWordKey
SG::WriteHandleKey< TIPword > m_tipWordKey
Definition
GlobalSimulationAlg.h:38
GlobalSim::GlobalSimulationAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
GlobalSimulationAlg.cxx:63
GlobalSim::GlobalSimulationAlg::m_algTools
ToolHandleArray< IGlobalSimAlgTool > m_algTools
Definition
GlobalSimulationAlg.h:49
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
GlobalSim
AlgTool to read in LArStripNeighborhoods, and run the BDT Algorithm.
Definition
Trigger/TrigT1/Global/GlobalSimulation/src/Egamma1BDT/Egamma1BDT/BDT.h:11
GlobalSim::TIPword
std::bitset< ITIPWriterAlgTool::s_nbits_TIP > TIPword
Definition
ITIPWriterAlgTool.h:40
run
int run(int argc, char *argv[])
Definition
ttree2hdf5.cxx:28
Generated on
for ATLAS Offline Software by
1.17.0