ATLAS Offline Software
Loading...
Searching...
No Matches
CommonMultAlgTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "./CommonSelector.h"
7
8#include <fstream>
9
10namespace GlobalSim {
11
13 const std::string& name,
14 const IInterface* parent) :
15 base_class(type, name, parent) {
16 }
17
18
19 // Initialize function running before first event
21
23
24 CHECK(m_CommonTOBContainerKey.initialize());
25
26 // create the necessary selector objects
27 m_c_selector = std::make_unique<CommonSelector>(m_et_low_str,
33 );
34
35 return StatusCode::SUCCESS;
36 }
37
38
39 StatusCode CommonMultAlgTool::countPassingTOBs(const EventContext& ctx, unsigned int& N_pass_tobs) const {
40 auto tobs =
42 ctx);
43
44 CHECK(tobs.isValid());
45
46 // check if any of the incoming tobs is selected.
47 N_pass_tobs = 0;
48 std::vector<bool> tob_pass(tobs->size(), false);
49 for (int tob_it = 0; const GlobalSim::IOBitwise::CommonTOB* t : *tobs){
50 if (m_c_selector->select(*t)) {
51 tob_pass[tob_it] = true;
52 if (++N_pass_tobs == m_maxtob){
53 break;
54 }
55 }
56 tob_it++;
57 }
58
59 if (m_enableDump) {
60 std::stringstream ss;
61 ss << "\nRun " << ctx << '\n';
62 std::size_t ind{0};
63 for (const GlobalSim::IOBitwise::CommonTOB* tob : *tobs) {
64 ss << tob->to_string() << ' ' << std::boolalpha << " pass " << tob_pass[ind++] << '\n';
65 }
66 ss << "tob count " << N_pass_tobs << '\n';
67
68 std::ofstream out(name() + ".log", std::ios_base::app);
69 out << ss.str();
70 out.close();
71 }
72
73 return StatusCode::SUCCESS;
74 }
75
76 std::string CommonMultAlgTool::toString() const {
77 std::stringstream ss;
78 ss <<name () << ": " <<m_menu_name << ' '
79 << "CommonMultAlgTool read, select, count and report number of related CommonTOBS\n"
80 << m_c_selector->to_string() << '\n'
81 << m_TIP_position << ' ' << m_TIP_width;
82
83 return ss.str();
84 }
85
86}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define CHECK(...)
Evaluate an expression and check for errors.
static Double_t ss
SG::ReadHandleKey< IOBitwise::CommonTOBContainer > m_CommonTOBContainerKey
Gaudi::Property< std::string > m_et_high_str
Gaudi::Property< std::string > m_eta_low_str
virtual StatusCode countPassingTOBs(const EventContext &, unsigned int &N_pass_tobs) const override
Gaudi::Property< std::string > m_menu_name
Gaudi::Property< std::string > m_et_low_str
Gaudi::Property< std::string > m_phi_low_str
virtual std::string toString() const override
CommonMultAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Gaudi::Property< std::string > m_eta_high_str
Gaudi::Property< bool > m_enableDump
std::unique_ptr< ICommonSelector > m_c_selector
virtual StatusCode initialize() override
Initialize function running before first event.
Gaudi::Property< std::string > m_phi_high_str
virtual StatusCode initialize() override
Initialize function running before first event.
AlgTool to read in LArStripNeighborhoods, and run the BDT Algorithm.