ATLAS Offline Software
Loading...
Searching...
No Matches
GlobalSimulationAlg.cxx
Go to the documentation of this file.
1// Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2
5
7
8#include <fstream>
9
10namespace GlobalSim {
11
13 ISvcLocator *pSvcLocator):
14 AthReentrantAlgorithm(name, pSvcLocator) {
15 }
16
18
19 ATH_MSG_INFO("number of TOB creators " << m_algTools.size());
20 ATH_MSG_INFO("number of TIP writers " << m_TIPwriters.size());
21
22 CHECK(m_tipWordKey.initialize());
23
24 if (m_enableDumps) {
25 std::stringstream ss;
26 ss << "\nTOB creators\n";
27 for (const auto& tool : m_algTools) {
28 ss << tool->toString() << '\n';
29 ss << "=========\n";
30 }
31 ss << "\nTIP writers\n";
32 for (const auto& tool : m_TIPwriters) {
33 ss << tool->toString() << '\n';
34 ss << "=========\n";
35 }
36
37 std::ofstream out(name() + "_init.log");
38 out << ss.str();
39 out.close();
40 }
41
42 return StatusCode::SUCCESS;
43 }
44
45
46
47 StatusCode GlobalSimulationAlg::execute(const EventContext& ctx) const {
48 ATH_MSG_DEBUG("Executing ...");
49
50
51 using TipWord = std::bitset<ITIPwriterAlgTool::s_nbits_TIP>;
52
53 for (const auto& tool : m_algTools) {
54 ATH_MSG_DEBUG("Running Algtool " << tool.name());
55 CHECK(tool -> run(ctx));
56 }
57
58 auto tipword = std::make_unique<TipWord>(); // all zeros
59 for (const auto& tool : m_TIPwriters) {
60 ATH_MSG_DEBUG("Collecting TIP bits " << tool.name());
61 CHECK(tool -> updateTIP(*tipword, ctx));
62 }
63
64 if (m_enableDumps) {
65 std::stringstream ss;
66 ss << "\nRun " << ctx <<' ' << "TIP:\n" << *tipword << '\n';
67
68
69 std::ofstream out(name() + "_tip.log", std::ios_base::app);
70 out << ss.str();
71 out.close();
72 }
73
74 ATH_MSG_DEBUG("TIP " << *tipword);
75
76 // write out the selection result
78 CHECK(h_write.record(std::move(tipword)));
79
80 return StatusCode::SUCCESS;
81 }
82}
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
#define CHECK(...)
Evaluate an expression and check for errors.
static Double_t ss
Define macros for attributes used to control the static checker.
An algorithm that can be simultaneously executed in multiple threads.
virtual StatusCode initialize() override
ToolHandleArray< ITIPwriterAlgTool > m_TIPwriters
Gaudi::Property< bool > m_enableDumps
GlobalSimulationAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::WriteHandleKey< TIPword > m_tipWordKey
virtual StatusCode execute(const EventContext &ctx) const override
ToolHandleArray< IGlobalSimAlgTool > m_algTools
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
AlgTool that to test whether expected the TIP values generated by data supplied by eEmMultTestBench c...
Definition run.py:1