ATLAS Offline Software
Loading...
Searching...
No Matches
GlobalSim::CommonSortSelectAlgTool Class Reference

AlgTool to count GlobalSim::IOBitwise::eEmTOB objects. More...

#include <CommonSortSelectAlgTool.h>

Inheritance diagram for GlobalSim::CommonSortSelectAlgTool:
Collaboration diagram for GlobalSim::CommonSortSelectAlgTool:

Public Member Functions

 CommonSortSelectAlgTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~CommonSortSelectAlgTool () override=default
virtual StatusCode initialize () override
 Initialize function running before first event.
virtual StatusCode run (const std::unique_ptr< IDataCollector > &, const EventContext &) const override
virtual std::string toString () const override

Private Attributes

std::unique_ptr< ICommonSelectorm_c_selector {nullptr}
SG::ReadHandleKey< GlobalSim::IOBitwise::CommonTOBContainerm_inTOBContainerKey
SG::WriteHandleKey< GlobalSim::IOBitwise::CommonTOBContainerm_outTOBContainerKey
Gaudi::Property< std::string > m_et_low_str
Gaudi::Property< std::string > m_et_high_str
Gaudi::Property< std::string > m_eta_low_str
Gaudi::Property< std::string > m_eta_high_str
Gaudi::Property< std::string > m_phi_low_str
Gaudi::Property< std::string > m_phi_high_str
Gaudi::Property< std::size_t > m_maxTOBs
Gaudi::Property< std::string > m_menu_name
Gaudi::Property< bool > m_enableDump

Detailed Description

AlgTool to count GlobalSim::IOBitwise::eEmTOB objects.

Definition at line 31 of file CommonSortSelectAlgTool.h.

Constructor & Destructor Documentation

◆ CommonSortSelectAlgTool()

GlobalSim::CommonSortSelectAlgTool::CommonSortSelectAlgTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 14 of file CommonSortSelectAlgTool.cxx.

16 :
17 base_class(type, name, parent) {
18 }

◆ ~CommonSortSelectAlgTool()

virtual GlobalSim::CommonSortSelectAlgTool::~CommonSortSelectAlgTool ( )
overridevirtualdefault

Member Function Documentation

◆ initialize()

StatusCode GlobalSim::CommonSortSelectAlgTool::initialize ( )
overridevirtual

Initialize function running before first event.

Definition at line 22 of file CommonSortSelectAlgTool.cxx.

22 {
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,
34 );
35
36 return StatusCode::SUCCESS;
37 }
#define CHECK(...)
Evaluate an expression and check for errors.
Gaudi::Property< std::string > m_phi_low_str
Gaudi::Property< std::string > m_eta_high_str
Gaudi::Property< std::string > m_eta_low_str
Gaudi::Property< std::string > m_et_high_str
std::unique_ptr< ICommonSelector > m_c_selector
SG::WriteHandleKey< GlobalSim::IOBitwise::CommonTOBContainer > m_outTOBContainerKey
Gaudi::Property< std::string > m_et_low_str
Gaudi::Property< std::string > m_phi_high_str
SG::ReadHandleKey< GlobalSim::IOBitwise::CommonTOBContainer > m_inTOBContainerKey

◆ run()

StatusCode GlobalSim::CommonSortSelectAlgTool::run ( const std::unique_ptr< IDataCollector > & dc,
const EventContext & ctx ) const
overridevirtual

Definition at line 41 of file CommonSortSelectAlgTool.cxx.

42 {
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 }
#define ATH_MSG_DEBUG(x)
Gaudi::Property< std::size_t > m_maxTOBs
int r
Definition globals.cxx:22
l
Printing final latex table to .tex output file.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ toString()

std::string GlobalSim::CommonSortSelectAlgTool::toString ( ) const
overridevirtual

Definition at line 97 of file CommonSortSelectAlgTool.cxx.

97 {
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 }
static Double_t ss
Gaudi::Property< std::string > m_menu_name

Member Data Documentation

◆ m_c_selector

std::unique_ptr<ICommonSelector> GlobalSim::CommonSortSelectAlgTool::m_c_selector {nullptr}
private

Definition at line 48 of file CommonSortSelectAlgTool.h.

48{nullptr};

◆ m_enableDump

Gaudi::Property<bool> GlobalSim::CommonSortSelectAlgTool::m_enableDump
private
Initial value:
{
this,
"enable_dump",
false,
"flag to enable debug dumps"
}

Definition at line 116 of file CommonSortSelectAlgTool.h.

116 {
117 this,
118 "enable_dump",
119 false,
120 "flag to enable debug dumps"
121 };

◆ m_et_high_str

Gaudi::Property<std::string> GlobalSim::CommonSortSelectAlgTool::m_et_high_str
private
Initial value:
{
this,
"et_high",
"inf",
"et high for window selector"}

Definition at line 72 of file CommonSortSelectAlgTool.h.

72 {
73 this,
74 "et_high",
75 "inf",
76 "et high for window selector"};

◆ m_et_low_str

Gaudi::Property<std::string> GlobalSim::CommonSortSelectAlgTool::m_et_low_str
private
Initial value:
{
this,
"et_low",
"0",
"et low for window selector"}

Definition at line 66 of file CommonSortSelectAlgTool.h.

66 {
67 this,
68 "et_low",
69 "0",
70 "et low for window selector"};

◆ m_eta_high_str

Gaudi::Property<std::string> GlobalSim::CommonSortSelectAlgTool::m_eta_high_str
private
Initial value:
{
this,
"eta_high",
"inf",
"eta high for window selector"}

Definition at line 84 of file CommonSortSelectAlgTool.h.

84 {
85 this,
86 "eta_high",
87 "inf",
88 "eta high for window selector"};

◆ m_eta_low_str

Gaudi::Property<std::string> GlobalSim::CommonSortSelectAlgTool::m_eta_low_str
private
Initial value:
{
this,
"eta_low",
"0",
"eta low for window selector"}

Definition at line 78 of file CommonSortSelectAlgTool.h.

78 {
79 this,
80 "eta_low",
81 "0",
82 "eta low for window selector"};

◆ m_inTOBContainerKey

SG::ReadHandleKey<GlobalSim::IOBitwise::CommonTOBContainer> GlobalSim::CommonSortSelectAlgTool::m_inTOBContainerKey
private
Initial value:
{
this,
"inTOBs",
"inTOBs",
"Key for GlobalSim CommonTOB container"}

Definition at line 51 of file CommonSortSelectAlgTool.h.

51 {
52 this,
53 "inTOBs",
54 "inTOBs",
55 "Key for GlobalSim CommonTOB container"};

◆ m_maxTOBs

Gaudi::Property<std::size_t> GlobalSim::CommonSortSelectAlgTool::m_maxTOBs
private
Initial value:
{
this,
"maxTOBs",
10,
"max number of TOBs in to be passed to client"}

Definition at line 103 of file CommonSortSelectAlgTool.h.

103 {
104 this,
105 "maxTOBs",
106 10,
107 "max number of TOBs in to be passed to client"};

◆ m_menu_name

Gaudi::Property<std::string> GlobalSim::CommonSortSelectAlgTool::m_menu_name
private
Initial value:
{
this,
"menu_name",
"unknown",
"name from json menu file"
}

Definition at line 109 of file CommonSortSelectAlgTool.h.

109 {
110 this,
111 "menu_name",
112 "unknown",
113 "name from json menu file"
114 };

◆ m_outTOBContainerKey

SG::WriteHandleKey<GlobalSim::IOBitwise::CommonTOBContainer> GlobalSim::CommonSortSelectAlgTool::m_outTOBContainerKey
private
Initial value:
{
this,
"outTOBs",
"outTOBs",
"Key for GlobalSim CommonTOB container"}

Definition at line 59 of file CommonSortSelectAlgTool.h.

59 {
60 this,
61 "outTOBs",
62 "outTOBs",
63 "Key for GlobalSim CommonTOB container"};

◆ m_phi_high_str

Gaudi::Property<std::string> GlobalSim::CommonSortSelectAlgTool::m_phi_high_str
private
Initial value:
{
this,
"phi_high",
"inf",
"phi high for window selector"}

Definition at line 96 of file CommonSortSelectAlgTool.h.

96 {
97 this,
98 "phi_high",
99 "inf",
100 "phi high for window selector"};

◆ m_phi_low_str

Gaudi::Property<std::string> GlobalSim::CommonSortSelectAlgTool::m_phi_low_str
private
Initial value:
{
this,
"phi_low",
"0",
"phi low for window selector"}

Definition at line 90 of file CommonSortSelectAlgTool.h.

90 {
91 this,
92 "phi_low",
93 "0",
94 "phi low for window selector"};

The documentation for this class was generated from the following files: