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::IeEmTOBContainerm_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 30 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
SG::ReadHandleKey< GlobalSim::IOBitwise::IeEmTOBContainer > m_eEmTOBContainerKey
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
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::IeEmTOBContainer>(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::IeEmTOB* 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::IeEmTOB* tob : *tobs) {
121 ss << *tob << ' ' << 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 49 of file eEmMultAlgTool.h.

49{nullptr};

◆ m_e_selector

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

Definition at line 50 of file eEmMultAlgTool.h.

50{nullptr};

◆ m_eEmTOBContainerKey

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

Definition at line 53 of file eEmMultAlgTool.h.

53 {
54 this,
55 "eEmTOBs",
56 "eEmTOBs",
57 "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 151 of file eEmMultAlgTool.h.

151 {
152 this,
153 "enable_dump",
154 false,
155 "flag to enable debug dumps"
156 };

◆ 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 65 of file eEmMultAlgTool.h.

65 {
66 this,
67 "et_high",
68 "inf",
69 "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 59 of file eEmMultAlgTool.h.

59 {
60 this,
61 "et_low",
62 "0",
63 "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 77 of file eEmMultAlgTool.h.

77 {
78 this,
79 "eta_high",
80 "inf",
81 "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 71 of file eEmMultAlgTool.h.

71 {
72 this,
73 "eta_low",
74 "0",
75 "eta low for window selector"};

◆ m_maxtob

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

Definition at line 159 of file eEmMultAlgTool.h.

159{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 144 of file eEmMultAlgTool.h.

144 {
145 this,
146 "menu_name",
147 "unknown",
148 "name from json menu file"
149 };

◆ 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 138 of file eEmMultAlgTool.h.

138 {
139 this,
140 "n_multbits",
141 3,
142 "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 89 of file eEmMultAlgTool.h.

89 {
90 this,
91 "phi_high",
92 "inf",
93 "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 83 of file eEmMultAlgTool.h.

83 {
84 this,
85 "phi_low",
86 "0",
87 "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 113 of file eEmMultAlgTool.h.

113 {
114 this,
115 "reta_op",
116 "unknown",
117 "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 107 of file eEmMultAlgTool.h.

107 {
108 this,
109 "reta",
110 "0",
111 "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 101 of file eEmMultAlgTool.h.

101 {
102 this,
103 "rhad_op",
104 "unknown",
105 "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 95 of file eEmMultAlgTool.h.

95 {
96 this,
97 "rhad",
98 "0",
99 "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 131 of file eEmMultAlgTool.h.

131 {
132 this,
133 "TIPposition",
134 0,
135 "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 125 of file eEmMultAlgTool.h.

125 {
126 this,
127 "wstot_op",
128 "unknown",
129 "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 119 of file eEmMultAlgTool.h.

119 {
120 this,
121 "wstot",
122 "0",
123 "wstot lcut_value"};

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