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 (" << m_algTools.size() << ")\n";
27 for (const auto& tool : m_algTools) {
28 ss << tool->toString() << '\n';
29 ss << "=========\n";
30 }
31 ss << "\nTIP writers (" << m_TIPwriters.size() << ")\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 if (m_enableDumps) {
51 ATH_MSG_INFO ("Dumping StoreGate\n" << evtStore()->dump());
52 }
53
54 using TipWord = std::bitset<ITIPwriterAlgTool::s_nbits_TIP>;
55
56 for (const auto& tool : m_algTools) {
57 ATH_MSG_DEBUG("Running Algtool " << tool.name());
58 CHECK(tool -> run(ctx));
59 }
60
61 auto tipword = std::make_unique<TipWord>(); // all zeros
62 for (const auto& tool : m_TIPwriters) {
63 ATH_MSG_DEBUG("Collecting TIP bits " << tool.name());
64 CHECK(tool -> updateTIP(*tipword, ctx));
65 }
66
67 if (m_enableDumps) {
68 std::stringstream ss;
69 ss << "\nRun " << ctx <<' ' << "TIP:\n" << *tipword << '\n';
70
71
72 std::ofstream out(name() + "_tip.log", std::ios_base::app);
73 out << ss.str();
74 out.close();
75 }
76
77 ATH_MSG_DEBUG("TIP " << *tipword);
78
79 // write out the selection result
81 CHECK(h_write.record(std::move(tipword)));
82
83 return StatusCode::SUCCESS;
84 }
85}
#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 to read in LArStripNeighborhoods, and run the eRatio Algorithm.
-event-from-file
int run(int argc, char *argv[])