ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
Global
GlobalSimulation
src
Hypothesis
eEmMultTestBench.cxx
Go to the documentation of this file.
1
// Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3
#include "
eEmMultTestBench.h
"
4
#include "
../IO/eEmTOB.h
"
5
#include "
../IO/CommonTOB.h
"
6
#include "
../IO/TipWord_clid.h
"
7
#include "
../Utilities/trim.h
"
8
9
#include "
PathResolver/PathResolver.h
"
10
#include <bitset>
11
#include <sstream>
12
13
namespace
GlobalSim
{
14
15
using namespace
GlobalSim::IOBitwise;
16
17
eEmMultTestBench::eEmMultTestBench
(
const
std::string& name,
18
ISvcLocator *pSvcLocator):
19
AthAlgorithm
(name, pSvcLocator) {
20
}
21
22
StatusCode
eEmMultTestBench::initialize
() {
23
ATH_MSG_DEBUG
(
"initialising"
);
24
CHECK
(
m_eEmTOBContainer_WriteKey
.initialize());
25
CHECK
(
m_TIPword_WriteKey
.initialize());
26
27
// initialisation is from a file of test vectors
28
29
std::string fn =
PathResolver::find_file
(
m_tobs_fileName
,
30
"DATAPATH"
);
31
if
(fn.empty()) {
32
ATH_MSG_FATAL
(
"Failure to find tob file "
<<
m_tobs_fileName
33
<<
" on "
<<
"$DATAPATH"
);
34
return
StatusCode::FAILURE;
35
}
36
37
m_tob_stream
= std::ifstream (fn);
38
39
if
(!
m_tob_stream
) {
40
ATH_MSG_FATAL
(
"Failure to open tob stream "
<< fn);
41
return
StatusCode::FAILURE;
42
}
43
44
if
(!
m_tob_stream
) {
45
ATH_MSG_FATAL
(
"Failure to initialise TOB stream "
<< fn);
46
return
StatusCode::FAILURE;
47
}
48
49
fn =
PathResolver::find_file
(
m_TIPword_fileName
,
50
"DATAPATH"
);
51
if
(fn.empty()) {
52
ATH_MSG_FATAL
(
"Failure to find TIP file "
<<
m_TIPword_fileName
53
<<
" on "
<<
"$DATAPATH"
);
54
return
StatusCode::FAILURE;
55
}
56
57
m_TIPword_stream
= std::make_unique<std::ifstream> (fn);
58
if
(!(*
m_TIPword_stream
)) {
59
std::stringstream
ss
;
60
ATH_MSG_FATAL
(
"Failure to initialise TIP word stream "
<< fn );
61
return
StatusCode::FAILURE;
62
}
63
64
65
return
StatusCode::SUCCESS;
66
}
67
68
69
StatusCode
eEmMultTestBench::execute
(
const
EventContext& ctx) {
70
ATH_MSG_DEBUG
(
"executing"
);
71
72
73
auto
padded_line = std::string();
74
auto
tobs = std::make_unique<GlobalSim::IOBitwise::eEmTOBContainer>();
75
76
while
(
true
) {
77
std::getline(
m_tob_stream
, padded_line);
78
auto
line =
trim
(padded_line);
79
80
if
(!
m_tob_stream
) {
81
ATH_MSG_ERROR
(
"input stream bad state "
<<
m_tobs_fileName
);
82
return
StatusCode::FAILURE;
83
}
84
85
if
(line ==
"EOE"
) {
break
;}
86
87
if
(line.starts_with(
"//"
)){
continue
;}
88
tobs->push_back(
make_tob
(line));
89
90
}
91
92
using
WH_TOB =
SG::WriteHandle<GlobalSim::IOBitwise::eEmTOBContainer>
;
93
auto
h_write_tobs = WH_TOB(
m_eEmTOBContainer_WriteKey
, ctx);
94
CHECK
(h_write_tobs.record(std::move(tobs)));
95
96
auto
h_write_TIPword =
SG::WriteHandle<TIPword>
(
m_TIPword_WriteKey
, ctx);
97
auto
twp =
TIPword_from_file
();
98
CHECK
(h_write_TIPword.record(std::move(twp)));
99
100
return
StatusCode::SUCCESS;
101
}
102
103
std::unique_ptr<TIPword>
eEmMultTestBench::TIPword_from_file
()
const
{
104
105
auto
line = std::string();
106
using
TIP = std::bitset<ITIPWriterAlgTool::s_nbits_TIP>;
107
std::getline(*
m_TIPword_stream
, line);
108
auto
twp = std::make_unique<TIP>(std::stoul(
trim
(std::move(line))));
109
return
twp;
110
}
111
112
113
114
eEmTOB
*
115
eEmMultTestBench::make_tob
(
const
std::string& trimmed_line)
const
{
116
ATH_MSG_INFO
(
"in make_tob> line: "
<<trimmed_line);
117
118
std::stringstream
ss
(trimmed_line);
119
std::string
et
,
eta
,
phi
, RHad, WsTot, REta, seed, UpNotDown, SeedIsMax;
120
ss
>>
et
;
121
122
const
auto
& s_et_width =
CommonTOB::s_et_width
;
123
const
auto
& s_eta_width =
CommonTOB::s_eta_width
;
124
const
auto
& s_phi_width =
CommonTOB::s_phi_width
;
125
126
auto
common
=
CommonTOB
(std::bitset<s_et_width>(
et
),
127
std::bitset<s_eta_width>(
eta
),
128
std::bitset<s_phi_width>(
phi
));
129
130
131
const
auto
& s_RHad_width =
eEmTOB::s_RHad_width
;
132
const
auto
& s_REta_width =
eEmTOB::s_REta_width
;
133
const
auto
& s_WsTot_width =
eEmTOB::s_WsTot_width
;
134
const
auto
& s_Seed_width =
eEmTOB::s_Seed_width
;
135
const
auto
& s_UpNotDown_width =
eEmTOB::s_UpNotDown_width
;
136
const
auto
& s_SeedIsMax_width =
eEmTOB::s_SeedIsMax_width
;
137
138
139
return
140
new
eEmTOB
(
common
,
141
std::bitset(std::bitset<s_RHad_width>(RHad)),
142
std::bitset(std::bitset<s_REta_width>(REta)),
143
std::bitset(std::bitset<s_WsTot_width>(WsTot)),
144
std::bitset(std::bitset<s_Seed_width>(seed)),
145
std::bitset(std::bitset<s_UpNotDown_width>(UpNotDown)),
146
std::bitset(std::bitset<s_SeedIsMax_width>(SeedIsMax)));
147
148
}
149
150
}
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CommonTOB.h
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
eEmTOB.h
ss
static Double_t ss
Definition
LArPhysWaveHECTool.cxx:37
PathResolver.h
TipWord_clid.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
GlobalSim::CommonTOB::s_eta_width
static constexpr std::size_t s_eta_width
Size of the eta bitset.
Definition
CommonTOB.h:30
GlobalSim::CommonTOB::s_et_width
static constexpr std::size_t s_et_width
Size of the eT bitset.
Definition
CommonTOB.h:28
GlobalSim::CommonTOB::s_phi_width
static constexpr std::size_t s_phi_width
Size of the phi bitset.
Definition
CommonTOB.h:32
GlobalSim::IOBitwise::CommonTOB
Definition
CommonTOB.h:22
GlobalSim::IOBitwise::eEmTOB
Definition
Global/GlobalSimulation/src/IO/eEmTOB.h:24
GlobalSim::eEmMultTestBench::eEmMultTestBench
eEmMultTestBench(const std::string &name, ISvcLocator *pSvcLocator)
Definition
eEmMultTestBench.cxx:17
GlobalSim::eEmMultTestBench::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
eEmMultTestBench.cxx:69
GlobalSim::eEmMultTestBench::m_eEmTOBContainer_WriteKey
SG::WriteHandleKey< GlobalSim::IOBitwise::eEmTOBContainer > m_eEmTOBContainer_WriteKey
Definition
eEmMultTestBench.h:47
GlobalSim::eEmMultTestBench::m_TIPword_fileName
Gaudi::Property< std::string > m_TIPword_fileName
Definition
eEmMultTestBench.h:69
GlobalSim::eEmMultTestBench::make_tob
GlobalSim::IOBitwise::eEmTOB * make_tob(const std::string &s) const
Definition
eEmMultTestBench.cxx:115
GlobalSim::eEmMultTestBench::initialize
virtual StatusCode initialize() override
Definition
eEmMultTestBench.cxx:22
GlobalSim::eEmMultTestBench::m_tobs_fileName
Gaudi::Property< std::string > m_tobs_fileName
Definition
eEmMultTestBench.h:63
GlobalSim::eEmMultTestBench::m_TIPword_WriteKey
SG::WriteHandleKey< TIPword > m_TIPword_WriteKey
Definition
eEmMultTestBench.h:55
GlobalSim::eEmMultTestBench::m_TIPword_stream
std::unique_ptr< std::ifstream > m_TIPword_stream
Definition
eEmMultTestBench.h:78
GlobalSim::eEmMultTestBench::TIPword_from_file
std::unique_ptr< TIPword > TIPword_from_file() const
Definition
eEmMultTestBench.cxx:103
GlobalSim::eEmMultTestBench::m_tob_stream
std::ifstream m_tob_stream
Definition
eEmMultTestBench.h:77
GlobalSim::eEmTOB::s_SeedIsMax_width
static constexpr std::size_t s_SeedIsMax_width
Count: Size of Seed supercell is a local maxima bit.
Definition
Global/GlobalSimulation/src/IO/eEmTOB.h:40
GlobalSim::eEmTOB::s_REta_width
static constexpr std::size_t s_REta_width
Count: Size of R0 thresholds satisfied bitset.
Definition
Global/GlobalSimulation/src/IO/eEmTOB.h:34
GlobalSim::eEmTOB::s_RHad_width
static constexpr std::size_t s_RHad_width
Count: Size of hadronic thresholds satisfied bitset.
Definition
Global/GlobalSimulation/src/IO/eEmTOB.h:30
GlobalSim::eEmTOB::s_WsTot_width
static constexpr std::size_t s_WsTot_width
Count: Size of WsTot algorithm thresholds satisfied bitset.
Definition
Global/GlobalSimulation/src/IO/eEmTOB.h:32
GlobalSim::eEmTOB::s_UpNotDown_width
static constexpr std::size_t s_UpNotDown_width
Count: Size of UpnotDown bit.
Definition
Global/GlobalSimulation/src/IO/eEmTOB.h:38
GlobalSim::eEmTOB::s_Seed_width
static constexpr std::size_t s_Seed_width
Count: Size of Seed eta position in the TOB bitset.
Definition
Global/GlobalSimulation/src/IO/eEmTOB.h:36
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
Definition
PathResolver.cxx:220
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
eEmMultTestBench.h
GlobalSim
AlgTool to read in LArStripNeighborhoods, and run the BDT Algorithm.
Definition
Trigger/TrigT1/Global/GlobalSimulation/src/Egamma1BDT/Egamma1BDT/BDT.h:11
GlobalSim::trim
std::string trim(std::string s)
Definition
trim.cxx:7
common
Definition
common.py:1
et
Extra patterns decribing particle interation process.
trim.h
Generated on
for ATLAS Offline Software by
1.17.0