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

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

#include <eEmMultAlgTool.h>

Inheritance diagram for GlobalSim::eEmMultAlgTool:
Collaboration diagram for GlobalSim::eEmMultAlgTool:

Public Member Functions

 eEmMultAlgTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~eEmMultAlgTool () override=default
virtual StatusCode initialize () override
 Initialize function running before first event.
virtual StatusCode updateTIP (std::bitset< s_nbits_TIP > &, 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}
std::unique_ptr< IeEmSelectorm_e_selector {nullptr}
SG::ReadHandleKey< GlobalSim::IOBitwise::eEmTOBContainerm_eEmTOBContainerKey
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::string > m_rhad_str
Gaudi::Property< std::string > m_rhad_op
Gaudi::Property< std::string > m_reta_str
Gaudi::Property< std::string > m_reta_op
Gaudi::Property< std::string > m_wstot_str
Gaudi::Property< std::string > m_wstot_op
Gaudi::Property< int > m_TIP_position
Gaudi::Property< int > m_n_multbits
Gaudi::Property< std::string > m_menu_name
Gaudi::Property< bool > m_enableDump
ulong m_maxtob {0}

Detailed Description

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

Definition at line 26 of file eEmMultAlgTool.h.

Constructor & Destructor Documentation

◆ eEmMultAlgTool()

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

Definition at line 13 of file eEmMultAlgTool.cxx.

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

◆ ~eEmMultAlgTool()

virtual GlobalSim::eEmMultAlgTool::~eEmMultAlgTool ( )
overridevirtualdefault

Member Function Documentation

◆ dump()

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

◆ initialize()

StatusCode GlobalSim::eEmMultAlgTool::initialize ( )
overridevirtual

Initialize function running before first event.

Definition at line 21 of file eEmMultAlgTool.cxx.

21 {
22
23 CHECK(m_eEmTOBContainerKey.initialize());
24
25 if (m_n_multbits < 0) {
26 ATH_MSG_ERROR("number of bits to write to TIP is negative");
27 return StatusCode::FAILURE;
28 }
29
30 int max_tip_pos = s_nbits_TIP - m_n_multbits;
31
33 ATH_MSG_ERROR("TIP word out of bounds " << m_TIP_position);
34 return StatusCode::FAILURE;
35 }
36
37 // create the necessary selector objects
38 m_c_selector = std::make_unique<CommonSelector>(m_et_low_str,
44 );
45
46 try {
47 m_e_selector = std::make_unique<eEmSelector>(std::stoul(m_rhad_str),
49 std::stoul(m_reta_str),
51 std::stoul(m_wstot_str),
53 );
54 } catch (const std::exception& e) {
55
56 ATH_MSG_ERROR("Error initialising eEMSelector " << e.what());
57 return StatusCode::FAILURE;
58 }
59
60
61
62 if (m_n_multbits == 0){
63 m_maxtob = 0;
64 } else {
65 ulong maxtob = 1;
66 for (ulong i = m_n_multbits; i != 0; --i) { maxtob *= 2;}
67 m_maxtob = maxtob - 1;
68 }
69
70 return StatusCode::SUCCESS;
71 }
#define ATH_MSG_ERROR(x)
#define CHECK(...)
Evaluate an expression and check for errors.
Gaudi::Property< std::string > m_reta_str
Gaudi::Property< std::string > m_rhad_op
Gaudi::Property< std::string > m_et_high_str
Gaudi::Property< std::string > m_rhad_str
std::unique_ptr< IeEmSelector > m_e_selector
Gaudi::Property< std::string > m_eta_high_str
Gaudi::Property< std::string > m_wstot_op
Gaudi::Property< std::string > m_eta_low_str
Gaudi::Property< std::string > m_et_low_str
Gaudi::Property< std::string > m_phi_low_str
std::unique_ptr< ICommonSelector > m_c_selector
Gaudi::Property< std::string > m_phi_high_str
Gaudi::Property< int > m_TIP_position
SG::ReadHandleKey< GlobalSim::IOBitwise::eEmTOBContainer > m_eEmTOBContainerKey
Gaudi::Property< std::string > m_reta_op
Gaudi::Property< std::string > m_wstot_str
Gaudi::Property< int > m_n_multbits

◆ toString()

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

Definition at line 134 of file eEmMultAlgTool.cxx.

134 {
135 std::stringstream ss;
136 ss <<name () << ": " <<m_menu_name << ' '
137 << "eEmMultAlgTool read, select, count and report number of related eEmTOBS\n"
138 << m_c_selector->to_string() << '\n'
139 << m_e_selector->to_string() << '\n'
140 << m_TIP_position << ' ' << m_n_multbits;
141
142 return ss.str();
143 }
static Double_t ss
Gaudi::Property< std::string > m_menu_name

◆ updateTIP()

StatusCode GlobalSim::eEmMultAlgTool::updateTIP ( std::bitset< s_nbits_TIP > & word,
const EventContext & ctx ) const
overridevirtual

Definition at line 74 of file eEmMultAlgTool.cxx.

75 {
76 auto tobs =
77 SG::ReadHandle<GlobalSim::IOBitwise::eEmTOBContainer>(m_eEmTOBContainerKey,
78 ctx);
79
80 CHECK(tobs.isValid());
81
82 // check if any of the incoming tobs is selected.
83
84 auto selected = std::make_unique<bool>(false);
85
86 ulong tob_count{0};
87 std::vector<bool> tob_pass(tobs->size(), false);
88 for (const GlobalSim::IOBitwise::eEmTOB* t : *tobs){
89 if (m_c_selector->select(*t) and m_e_selector->select(*t)) {
90 tob_pass[tob_count] = true;
91 if (++tob_count == m_maxtob){
92 tob_pass[tob_count] = true;
93 break;
94 }
95 }
96 }
97
98
99
100 ATH_MSG_DEBUG("no of passing TOBS" << tob_count);
101
102 auto count_bits = std::bitset<s_nbits_TIP>(tob_count);
103
104 int p0{0};
105 int p1{m_TIP_position};
106
107 const int& mxb = m_n_multbits;
108
109 for (; p0 != mxb; ++p0, ++p1) {
110 if (count_bits.test(p0)) {word.set(p1);}
111 }
112
113 ATH_MSG_DEBUG("TIP word " << word);
114
115
116 if (m_enableDump) {
117 std::stringstream ss;
118 ss << "\nRun " << ctx <<' ' << "TIP:\n" << word << '\n';
119 std::size_t ind{0};
120 for (const GlobalSim::IOBitwise::eEmTOB* tob : *tobs) {
121 ss << tob->to_string() << ' ' << std::boolalpha << " pass " << tob_pass[ind++] << '\n';
122 }
123 ss << "tob count " << tob_count << '\n';
124
125 std::ofstream out(name() + ".log", std::ios_base::app);
126 out << ss.str();
127 out.close();
128 }
129
130
131 return StatusCode::SUCCESS;
132 }
#define ATH_MSG_DEBUG(x)
Gaudi::Property< bool > m_enableDump

Member Data Documentation

◆ m_c_selector

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

Definition at line 45 of file eEmMultAlgTool.h.

45{nullptr};

◆ m_e_selector

std::unique_ptr<IeEmSelector> GlobalSim::eEmMultAlgTool::m_e_selector {nullptr}
private

Definition at line 46 of file eEmMultAlgTool.h.

46{nullptr};

◆ m_eEmTOBContainerKey

SG::ReadHandleKey<GlobalSim::IOBitwise::eEmTOBContainer> GlobalSim::eEmMultAlgTool::m_eEmTOBContainerKey
private
Initial value:
{
this,
"eEmTOBs",
"eEmTOBs",
"Key for GlobalSim eEmTOB container"}

Definition at line 49 of file eEmMultAlgTool.h.

49 {
50 this,
51 "eEmTOBs",
52 "eEmTOBs",
53 "Key for GlobalSim eEmTOB container"};

◆ m_enableDump

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

Definition at line 147 of file eEmMultAlgTool.h.

147 {
148 this,
149 "enable_dump",
150 false,
151 "flag to enable debug dumps"
152 };

◆ m_et_high_str

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

Definition at line 61 of file eEmMultAlgTool.h.

61 {
62 this,
63 "et_high",
64 "inf",
65 "et high for window selector"};

◆ m_et_low_str

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

Definition at line 55 of file eEmMultAlgTool.h.

55 {
56 this,
57 "et_low",
58 "0",
59 "et low for window selector"};

◆ m_eta_high_str

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

Definition at line 73 of file eEmMultAlgTool.h.

73 {
74 this,
75 "eta_high",
76 "inf",
77 "eta high for window selector"};

◆ m_eta_low_str

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

Definition at line 67 of file eEmMultAlgTool.h.

67 {
68 this,
69 "eta_low",
70 "0",
71 "eta low for window selector"};

◆ m_maxtob

ulong GlobalSim::eEmMultAlgTool::m_maxtob {0}
private

Definition at line 155 of file eEmMultAlgTool.h.

155{0};

◆ m_menu_name

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

Definition at line 140 of file eEmMultAlgTool.h.

140 {
141 this,
142 "menu_name",
143 "unknown",
144 "name from json menu file"
145 };

◆ m_n_multbits

Gaudi::Property<int> GlobalSim::eEmMultAlgTool::m_n_multbits
private
Initial value:
{
this,
"n_multbits",
3,
"number of bits to write into the TIP"}

Definition at line 134 of file eEmMultAlgTool.h.

134 {
135 this,
136 "n_multbits",
137 3,
138 "number of bits to write into the TIP"};

◆ m_phi_high_str

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

Definition at line 85 of file eEmMultAlgTool.h.

85 {
86 this,
87 "phi_high",
88 "inf",
89 "phi high for window selector"};

◆ m_phi_low_str

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

Definition at line 79 of file eEmMultAlgTool.h.

79 {
80 this,
81 "phi_low",
82 "0",
83 "phi low for window selector"};

◆ m_reta_op

Gaudi::Property<std::string> GlobalSim::eEmMultAlgTool::m_reta_op
private
Initial value:
{
this,
"reta_op",
"unknown",
"reta cut operator"}

Definition at line 109 of file eEmMultAlgTool.h.

109 {
110 this,
111 "reta_op",
112 "unknown",
113 "reta cut operator"};

◆ m_reta_str

Gaudi::Property<std::string> GlobalSim::eEmMultAlgTool::m_reta_str
private
Initial value:
{
this,
"reta",
"0",
"reta cut value"}

Definition at line 103 of file eEmMultAlgTool.h.

103 {
104 this,
105 "reta",
106 "0",
107 "reta cut value"};

◆ m_rhad_op

Gaudi::Property<std::string> GlobalSim::eEmMultAlgTool::m_rhad_op
private
Initial value:
{
this,
"rhad_op",
"unknown",
"rhad cut operator"}

Definition at line 97 of file eEmMultAlgTool.h.

97 {
98 this,
99 "rhad_op",
100 "unknown",
101 "rhad cut operator"};

◆ m_rhad_str

Gaudi::Property<std::string> GlobalSim::eEmMultAlgTool::m_rhad_str
private
Initial value:
{
this,
"rhad",
"0",
"rhad cut value"}

Definition at line 91 of file eEmMultAlgTool.h.

91 {
92 this,
93 "rhad",
94 "0",
95 "rhad cut value"};

◆ m_TIP_position

Gaudi::Property<int> GlobalSim::eEmMultAlgTool::m_TIP_position
private
Initial value:
{
this,
"TIPposition",
0,
"start position to write into the TIP"}

Definition at line 127 of file eEmMultAlgTool.h.

127 {
128 this,
129 "TIPposition",
130 0,
131 "start position to write into the TIP"};

◆ m_wstot_op

Gaudi::Property<std::string> GlobalSim::eEmMultAlgTool::m_wstot_op
private
Initial value:
{
this,
"wstot_op",
"unknown",
"wstot cut_operator"}

Definition at line 121 of file eEmMultAlgTool.h.

121 {
122 this,
123 "wstot_op",
124 "unknown",
125 "wstot cut_operator"};

◆ m_wstot_str

Gaudi::Property<std::string> GlobalSim::eEmMultAlgTool::m_wstot_str
private
Initial value:
{
this,
"wstot",
"0",
"wstot lcut_value"}

Definition at line 115 of file eEmMultAlgTool.h.

115 {
116 this,
117 "wstot",
118 "0",
119 "wstot lcut_value"};

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