ATLAS Offline Software
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 
7 
8 #include <fstream>
9 
10 namespace 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 
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 }
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:70
run
int run(int argc, char *argv[])
Definition: ttree2hdf5.cxx:28
GlobalSimulationAlg.h
GlobalSim::GlobalSimulationAlg::GlobalSimulationAlg
GlobalSimulationAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: GlobalSimulationAlg.cxx:12
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
GlobalSim::GlobalSimulationAlg::m_algTools
ToolHandleArray< IGlobalSimAlgTool > m_algTools
Definition: GlobalSimulationAlg.h:49
GlobalSim
AlgTool that to test whether expected the TIP values generated by data supplied by eEmMultTestBench c...
Definition: CommonSelector.cxx:8
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
GlobalSim::GlobalSimulationAlg::m_enableDumps
Gaudi::Property< bool > m_enableDumps
Definition: GlobalSimulationAlg.h:62
GlobalSim::GlobalSimulationAlg::m_tipWordKey
SG::WriteHandleKey< TIPword > m_tipWordKey
Definition: GlobalSimulationAlg.h:38
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:452
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
GlobalSim::GlobalSimulationAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: GlobalSimulationAlg.cxx:47
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
GlobalSim::GlobalSimulationAlg::m_TIPwriters
ToolHandleArray< ITIPwriterAlgTool > m_TIPwriters
Definition: GlobalSimulationAlg.h:55
L1Menu.h
checker_macros.h
Define macros for attributes used to control the static checker.
GlobalSim::GlobalSimulationAlg::initialize
virtual StatusCode initialize() override
Definition: GlobalSimulationAlg.cxx:17