ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
Global
GlobalSimulation
src
Hypothesis
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
5
#include "
./CommonMultAlgTool.h
"
6
#include "
./CommonSelector.h
"
7
8
#include <fstream>
9
10
namespace
GlobalSim
{
11
12
CommonMultAlgTool::CommonMultAlgTool
(
const
std::string&
type
,
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
20
StatusCode
CommonMultAlgTool::initialize
() {
21
22
ATH_CHECK
(
TIPWriterAlgTool::initialize
() );
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
,
28
m_et_high_str
,
29
m_eta_low_str
,
30
m_eta_high_str
,
31
m_phi_low_str
,
32
m_phi_high_str
33
);
34
35
return
StatusCode::SUCCESS;
36
}
37
38
39
StatusCode
40
CommonMultAlgTool::countPassingTOBs
(
const
EventContext& ctx,
41
const
std::unique_ptr<IDataCollector>& dc,
42
43
unsigned
int
& N_pass_tobs)
const
{
44
auto
tobs =
45
SG::ReadHandle<GlobalSim::IOBitwise::CommonTOBContainer>
(
m_CommonTOBContainerKey
,
46
ctx);
47
48
CHECK
(tobs.isValid());
49
50
if
(dc){
51
std::stringstream
ss
;
52
ss
<<
"number of tobs "
<< tobs->size() <<
'\n'
;
53
dc->collect(*
this
,
ss
.str());
54
for
(
const
GlobalSim::IOBitwise::CommonTOB
* t : *tobs){
55
dc->collect(*
this
, t->to_string());
56
}
57
}
58
59
// check if any of the incoming tobs is selected.
60
N_pass_tobs = 0;
61
std::vector<bool> tob_pass(tobs->size(),
false
);
62
for
(
int
tob_it = 0;
const
GlobalSim::IOBitwise::CommonTOB
* t : *tobs){
63
if
(
m_c_selector
->select(*t)) {
64
tob_pass[tob_it] =
true
;
65
if
(++N_pass_tobs == m_maxtob){
66
break
;
67
}
68
}
69
tob_it++;
70
}
71
72
if
(
m_enableDump
) {
73
std::stringstream
ss
;
74
ss
<<
"\nRun "
<< ctx <<
'\n'
;
75
std::size_t ind{0};
76
for
(
const
GlobalSim::IOBitwise::CommonTOB
* tob : *tobs) {
77
ss
<< tob->to_string() <<
' '
<< std::boolalpha <<
" pass "
<< tob_pass[ind++] <<
'\n'
;
78
}
79
ss
<<
"tob count "
<< N_pass_tobs <<
'\n'
;
80
81
std::ofstream out(name() +
".log"
, std::ios_base::app);
82
out <<
ss
.str();
83
out.close();
84
}
85
86
return
StatusCode::SUCCESS;
87
}
88
89
std::string
CommonMultAlgTool::toString
()
const
{
90
std::stringstream
ss
;
91
ss
<<name () <<
": "
<<
m_menu_name
<<
' '
92
<<
"CommonMultAlgTool read, select, count and report number of related CommonTOBS\n"
93
<<
m_c_selector
->to_string() <<
'\n'
94
<< m_TIP_position <<
' '
<< m_TIP_width;
95
96
return
ss
.str();
97
}
98
99
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
CommonMultAlgTool.h
CommonSelector.h
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
ss
static Double_t ss
Definition
LArPhysWaveHECTool.cxx:37
GlobalSim::CommonMultAlgTool::m_CommonTOBContainerKey
SG::ReadHandleKey< IOBitwise::CommonTOBContainer > m_CommonTOBContainerKey
Definition
CommonMultAlgTool.h:49
GlobalSim::CommonMultAlgTool::m_et_high_str
Gaudi::Property< std::string > m_et_high_str
Definition
CommonMultAlgTool.h:61
GlobalSim::CommonMultAlgTool::m_eta_low_str
Gaudi::Property< std::string > m_eta_low_str
Definition
CommonMultAlgTool.h:67
GlobalSim::CommonMultAlgTool::m_menu_name
Gaudi::Property< std::string > m_menu_name
Definition
CommonMultAlgTool.h:91
GlobalSim::CommonMultAlgTool::m_et_low_str
Gaudi::Property< std::string > m_et_low_str
Definition
CommonMultAlgTool.h:55
GlobalSim::CommonMultAlgTool::m_phi_low_str
Gaudi::Property< std::string > m_phi_low_str
Definition
CommonMultAlgTool.h:79
GlobalSim::CommonMultAlgTool::toString
virtual std::string toString() const override
Definition
CommonMultAlgTool.cxx:89
GlobalSim::CommonMultAlgTool::CommonMultAlgTool
CommonMultAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
CommonMultAlgTool.cxx:12
GlobalSim::CommonMultAlgTool::m_eta_high_str
Gaudi::Property< std::string > m_eta_high_str
Definition
CommonMultAlgTool.h:73
GlobalSim::CommonMultAlgTool::m_enableDump
Gaudi::Property< bool > m_enableDump
Definition
CommonMultAlgTool.h:98
GlobalSim::CommonMultAlgTool::m_c_selector
std::unique_ptr< ICommonSelector > m_c_selector
Definition
CommonMultAlgTool.h:47
GlobalSim::CommonMultAlgTool::initialize
virtual StatusCode initialize() override
Initialize function running before first event.
Definition
CommonMultAlgTool.cxx:20
GlobalSim::CommonMultAlgTool::countPassingTOBs
virtual StatusCode countPassingTOBs(const EventContext &, const std::unique_ptr< IDataCollector > &dc, unsigned int &N_pass_tobs) const override
Definition
CommonMultAlgTool.cxx:40
GlobalSim::CommonMultAlgTool::m_phi_high_str
Gaudi::Property< std::string > m_phi_high_str
Definition
CommonMultAlgTool.h:85
GlobalSim::IOBitwise::CommonTOB
Definition
CommonTOB.h:22
GlobalSim::TIPWriterAlgTool::initialize
virtual StatusCode initialize() override
Initialize function running before first event.
Definition
TIPWriterAlgTool.cxx:20
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
GlobalSim
AlgTool to read in LArStripNeighborhoods, and run the BDT Algorithm.
Definition
BitSpec.h:23
type
Generated on
for ATLAS Offline Software by
1.17.0