ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
Global
GlobalSimulation
src
Hypothesis
CommonSortSelectAlgTool.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 "
./CommonSortSelectAlgTool.h
"
6
#include "
./CommonSelector.h
"
7
#include "
./eEmSelector.h
"
8
#include "
../IO//CommonTOB.h
"
9
10
#include <fstream>
11
12
namespace
GlobalSim
{
13
14
CommonSortSelectAlgTool::CommonSortSelectAlgTool
(
const
std::string&
type
,
15
const
std::string& name,
16
const
IInterface* parent) :
17
base_class(
type
, name, parent) {
18
}
19
20
21
// Initialize function running before first event
22
StatusCode
CommonSortSelectAlgTool::initialize
() {
23
24
CHECK
(
m_inTOBContainerKey
.initialize());
25
CHECK
(
m_outTOBContainerKey
.initialize());
26
27
// create the selector function object
28
m_c_selector
= std::make_unique<CommonSelector>(
m_et_low_str
,
29
m_et_high_str
,
30
m_eta_low_str
,
31
m_eta_high_str
,
32
m_phi_low_str
,
33
m_phi_high_str
34
);
35
36
return
StatusCode::SUCCESS;
37
}
38
39
40
StatusCode
41
CommonSortSelectAlgTool::run
(
const
std::unique_ptr<IDataCollector>& dc,
42
const
EventContext& ctx)
const
{
43
44
if
(dc){dc->collect(*
this
,
"start"
);}
45
46
auto
tobs =
47
SG::ReadHandle<GlobalSim::IOBitwise::CommonTOBContainer>
(
m_inTOBContainerKey
,
48
ctx);
49
50
CHECK
(tobs.isValid());
51
52
// copy selected tobs to the output container
53
54
auto
out_tobs =
55
std::make_unique<IOBitwise::CommonTOBContainer>(tobs->size());
56
57
58
auto
tmp_tobs =
59
std::vector<IOBitwise::CommonTOB*>(tobs->size());
60
61
std::transform(std::begin(*tobs),
62
std::end(*tobs),
63
std::back_inserter(tmp_tobs),
64
[](
const
auto
& tobptr) {
65
return
new
IOBitwise::CommonTOB
(*tobptr);
66
});
67
68
std::copy_if(std::begin(tmp_tobs),
69
std::end(tmp_tobs),
70
std::back_inserter(*out_tobs),
71
[&selector=
m_c_selector
](
const
auto
& tob) {
72
return
selector->select(*tob);});
73
74
75
ATH_MSG_DEBUG
(
"no of TOBS in, selected: "
<< tobs->size()
76
<<
" "
<< out_tobs->size());
77
78
std::size_t maxTOBs{
m_maxTOBs
};
79
out_tobs->resize(std::min(maxTOBs, out_tobs->size()));
80
81
std::sort
(std::begin(*out_tobs),
82
std::end(*out_tobs),
83
[](
const
auto
& l,
const
auto
&
r
) {
84
return
l->et_bits().to_ulong() <
r
->et_bits().to_ulong();
85
});
86
87
SG::WriteHandle<IOBitwise::CommonTOBContainer>
88
h_out(
m_outTOBContainerKey
, ctx);
89
90
CHECK
(h_out.record(std::move(out_tobs)));
91
92
if
(dc){dc->collect(*
this
,
"end"
);}
93
94
return
StatusCode::SUCCESS;
95
}
96
97
std::string
CommonSortSelectAlgTool::toString
()
const
{
98
std::stringstream
ss
;
99
ss
<<name () <<
": "
<<
m_menu_name
<<
' '
100
<<
"CommonSortSelectAlgTool read, select, and sort CommonTOBS\n"
101
<<
m_c_selector
->to_string() <<
'\n'
;
102
return
ss
.str();
103
}
104
105
}
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CommonSelector.h
CommonSortSelectAlgTool.h
CommonTOB.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::CommonSortSelectAlgTool::initialize
virtual StatusCode initialize() override
Initialize function running before first event.
Definition
CommonSortSelectAlgTool.cxx:22
GlobalSim::CommonSortSelectAlgTool::m_phi_low_str
Gaudi::Property< std::string > m_phi_low_str
Definition
CommonSortSelectAlgTool.h:90
GlobalSim::CommonSortSelectAlgTool::run
virtual StatusCode run(const std::unique_ptr< IDataCollector > &, const EventContext &) const override
Definition
CommonSortSelectAlgTool.cxx:41
GlobalSim::CommonSortSelectAlgTool::toString
virtual std::string toString() const override
Definition
CommonSortSelectAlgTool.cxx:97
GlobalSim::CommonSortSelectAlgTool::m_menu_name
Gaudi::Property< std::string > m_menu_name
Definition
CommonSortSelectAlgTool.h:109
GlobalSim::CommonSortSelectAlgTool::m_eta_high_str
Gaudi::Property< std::string > m_eta_high_str
Definition
CommonSortSelectAlgTool.h:84
GlobalSim::CommonSortSelectAlgTool::m_eta_low_str
Gaudi::Property< std::string > m_eta_low_str
Definition
CommonSortSelectAlgTool.h:78
GlobalSim::CommonSortSelectAlgTool::m_et_high_str
Gaudi::Property< std::string > m_et_high_str
Definition
CommonSortSelectAlgTool.h:72
GlobalSim::CommonSortSelectAlgTool::m_c_selector
std::unique_ptr< ICommonSelector > m_c_selector
Definition
CommonSortSelectAlgTool.h:48
GlobalSim::CommonSortSelectAlgTool::m_outTOBContainerKey
SG::WriteHandleKey< GlobalSim::IOBitwise::CommonTOBContainer > m_outTOBContainerKey
Definition
CommonSortSelectAlgTool.h:59
GlobalSim::CommonSortSelectAlgTool::m_et_low_str
Gaudi::Property< std::string > m_et_low_str
Definition
CommonSortSelectAlgTool.h:66
GlobalSim::CommonSortSelectAlgTool::m_phi_high_str
Gaudi::Property< std::string > m_phi_high_str
Definition
CommonSortSelectAlgTool.h:96
GlobalSim::CommonSortSelectAlgTool::m_maxTOBs
Gaudi::Property< std::size_t > m_maxTOBs
Definition
CommonSortSelectAlgTool.h:103
GlobalSim::CommonSortSelectAlgTool::m_inTOBContainerKey
SG::ReadHandleKey< GlobalSim::IOBitwise::CommonTOBContainer > m_inTOBContainerKey
Definition
CommonSortSelectAlgTool.h:51
GlobalSim::CommonSortSelectAlgTool::CommonSortSelectAlgTool
CommonSortSelectAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition
CommonSortSelectAlgTool.cxx:14
GlobalSim::IOBitwise::CommonTOB
Definition
CommonTOB.h:22
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
eEmSelector.h
r
int r
Definition
globals.cxx:22
GlobalSim
AlgTool to read in LArStripNeighborhoods, and run the BDT Algorithm.
Definition
Trigger/TrigT1/Global/GlobalSimulation/src/Egamma1BDT/Egamma1BDT/BDT.h:11
std::sort
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Definition
DVL_algorithms.h:554
type
Generated on
for ATLAS Offline Software by
1.17.0