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 EventContext &) const override
virtual std::string toString () const override

Private Member Functions

void dump () const

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 30 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

◆ dump()

void GlobalSim::CommonSortSelectAlgTool::dump ( ) const
private

◆ 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 EventContext & ctx) const
overridevirtual

Definition at line 40 of file CommonSortSelectAlgTool.cxx.

40 {
41 auto tobs =
42 SG::ReadHandle<GlobalSim::IOBitwise::CommonTOBContainer>(m_inTOBContainerKey,
43 ctx);
44
45 CHECK(tobs.isValid());
46
47 // copy selected tobs to the output container
48
49 auto out_tobs =
50 std::make_unique<IOBitwise::CommonTOBContainer>(tobs->size());
51
52
53 auto tmp_tobs =
54 std::vector<IOBitwise::CommonTOB*>(tobs->size());
55
56 std::transform(std::begin(*tobs),
57 std::end(*tobs),
58 std::back_inserter(tmp_tobs),
59 [](const auto& tobptr) {
60 return new IOBitwise::CommonTOB(*tobptr);
61 });
62
63 std::copy_if(std::begin(tmp_tobs),
64 std::end(tmp_tobs),
65 std::back_inserter(*out_tobs),
66 [&selector=m_c_selector](const auto& tob) {
67 return selector->select(*tob);});
68
69
70 ATH_MSG_DEBUG("no of TOBS in, selected: " << tobs->size()
71 << " " << out_tobs->size());
72
73 std::size_t maxTOBs{m_maxTOBs};
74 out_tobs->resize(std::min(maxTOBs, out_tobs->size()));
75
76 std::sort(std::begin(*out_tobs),
77 std::end(*out_tobs),
78 [](const auto& l, const auto& r) {
79 return l->et_bits().to_ulong() < r->et_bits().to_ulong();
80 });
81
82 SG::WriteHandle<IOBitwise::CommonTOBContainer>
83 h_out(m_outTOBContainerKey, ctx);
84
85 CHECK(h_out.record(std::move(out_tobs)));
86
87 return StatusCode::SUCCESS;
88 }
#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 90 of file CommonSortSelectAlgTool.cxx.

90 {
91 std::stringstream ss;
92 ss <<name () << ": " <<m_menu_name << ' '
93 << "CommonSortSelectAlgTool read, select, and sort CommonTOBS\n"
94 << m_c_selector->to_string() << '\n';
95 return ss.str();
96 }
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 46 of file CommonSortSelectAlgTool.h.

46{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 114 of file CommonSortSelectAlgTool.h.

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

◆ 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 70 of file CommonSortSelectAlgTool.h.

70 {
71 this,
72 "et_high",
73 "inf",
74 "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 64 of file CommonSortSelectAlgTool.h.

64 {
65 this,
66 "et_low",
67 "0",
68 "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 82 of file CommonSortSelectAlgTool.h.

82 {
83 this,
84 "eta_high",
85 "inf",
86 "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 76 of file CommonSortSelectAlgTool.h.

76 {
77 this,
78 "eta_low",
79 "0",
80 "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 49 of file CommonSortSelectAlgTool.h.

49 {
50 this,
51 "inTOBs",
52 "inTOBs",
53 "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 101 of file CommonSortSelectAlgTool.h.

101 {
102 this,
103 "maxTOBs",
104 10,
105 "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 107 of file CommonSortSelectAlgTool.h.

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

◆ 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 57 of file CommonSortSelectAlgTool.h.

57 {
58 this,
59 "outTOBs",
60 "outTOBs",
61 "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 94 of file CommonSortSelectAlgTool.h.

94 {
95 this,
96 "phi_high",
97 "inf",
98 "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 88 of file CommonSortSelectAlgTool.h.

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

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