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

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

#include <eEmEg1BDTMultAlgTool.h>

Inheritance diagram for GlobalSim::eEmEg1BDTMultAlgTool:
Collaboration diagram for GlobalSim::eEmEg1BDTMultAlgTool:

Public Member Functions

 eEmEg1BDTMultAlgTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~eEmEg1BDTMultAlgTool () 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 Attributes

std::unique_ptr< ICommonSelectorm_c_selector {nullptr}
std::unique_ptr< IeEmEg1BDTSelectorm_bdt_selector {nullptr}
SG::ReadHandleKey< IOBitwise::eEmEg1BDTTOBContainerm_eEmEg1BDTTOBContainerKey
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_Eg1BDT_str
Gaudi::Property< std::string > m_Eg1BDT_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::eEmEg1BDTTOB objects.

Cutting on the eEmEg1BDT score

Definition at line 26 of file eEmEg1BDTMultAlgTool.h.

Constructor & Destructor Documentation

◆ eEmEg1BDTMultAlgTool()

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

Definition at line 14 of file eEmEg1BDTMultAlgTool.cxx.

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

◆ ~eEmEg1BDTMultAlgTool()

virtual GlobalSim::eEmEg1BDTMultAlgTool::~eEmEg1BDTMultAlgTool ( )
overridevirtualdefault

Member Function Documentation

◆ initialize()

StatusCode GlobalSim::eEmEg1BDTMultAlgTool::initialize ( )
overridevirtual

Initialize function running before first event.

Definition at line 22 of file eEmEg1BDTMultAlgTool.cxx.

22 {
23
25
26 if (m_n_multbits < 0) {
27 ATH_MSG_ERROR("number of bits to write to TIP is negative");
28 return StatusCode::FAILURE;
29 }
30
31 int max_tip_pos = s_nbits_TIP - m_n_multbits;
32
34 ATH_MSG_ERROR("TIP word out of bounds " << m_TIP_position);
35 return StatusCode::FAILURE;
36 }
37
38 // create the necessary selector objects
39 m_c_selector = std::make_unique<CommonSelector>(m_et_low_str,
45 );
46
47 try {
48 m_bdt_selector = std::make_unique<eEmEg1BDTSelector>(std::stoul(m_Eg1BDT_str),
50 );
51 } catch (const std::exception& e) {
52
53 ATH_MSG_ERROR("Error initialising eEmEg1BDTSelector " << e.what());
54 return StatusCode::FAILURE;
55 }
56
57
58
59 if (m_n_multbits == 0){
60 m_maxtob = 0;
61 } else {
62 ulong maxtob = 1;
63 for (ulong i = m_n_multbits; i != 0; --i) { maxtob *= 2;}
64 m_maxtob = maxtob - 1;
65 }
66
67 return StatusCode::SUCCESS;
68 }
#define ATH_MSG_ERROR(x)
#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_et_low_str
std::unique_ptr< ICommonSelector > m_c_selector
Gaudi::Property< std::string > m_Eg1BDT_str
Gaudi::Property< std::string > m_Eg1BDT_op
Gaudi::Property< std::string > m_phi_high_str
Gaudi::Property< std::string > m_eta_low_str
SG::ReadHandleKey< IOBitwise::eEmEg1BDTTOBContainer > m_eEmEg1BDTTOBContainerKey
Gaudi::Property< std::string > m_et_high_str
std::unique_ptr< IeEmEg1BDTSelector > m_bdt_selector

◆ toString()

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

Definition at line 127 of file eEmEg1BDTMultAlgTool.cxx.

127 {
128 std::stringstream ss;
129 ss <<name () << ": " <<m_menu_name << ' '
130 << "eEmEg1BDTMultAlgTool read, select, count and report number of related eEmEg1BDTTOBS\n"
131 << m_c_selector->to_string() << '\n'
132 << m_bdt_selector->to_string() << '\n'
133 << m_TIP_position << ' ' << m_n_multbits;
134
135 return ss.str();
136 }
static Double_t ss
Gaudi::Property< std::string > m_menu_name

◆ updateTIP()

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

Definition at line 71 of file eEmEg1BDTMultAlgTool.cxx.

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

Member Data Documentation

◆ m_bdt_selector

std::unique_ptr<IeEmEg1BDTSelector> GlobalSim::eEmEg1BDTMultAlgTool::m_bdt_selector {nullptr}
private

Definition at line 46 of file eEmEg1BDTMultAlgTool.h.

46{nullptr};

◆ m_c_selector

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

Definition at line 45 of file eEmEg1BDTMultAlgTool.h.

45{nullptr};

◆ m_eEmEg1BDTTOBContainerKey

SG::ReadHandleKey<IOBitwise::eEmEg1BDTTOBContainer> GlobalSim::eEmEg1BDTMultAlgTool::m_eEmEg1BDTTOBContainerKey
private
Initial value:
{
this,
"eEmEg1BDTTOBContainerKey",
"eEmEg1BDTTOBContainer",
"Key for GlobalSim eEmEg1BDTTOB container"}

Definition at line 49 of file eEmEg1BDTMultAlgTool.h.

49 {
50 this,
51 "eEmEg1BDTTOBContainerKey",
52 "eEmEg1BDTTOBContainer",
53 "Key for GlobalSim eEmEg1BDTTOB container"};

◆ m_Eg1BDT_op

Gaudi::Property<std::string> GlobalSim::eEmEg1BDTMultAlgTool::m_Eg1BDT_op
private
Initial value:
{
this,
"Eg1BDT_op",
"unknown",
"Eg1BDT cut_operator"}

Definition at line 98 of file eEmEg1BDTMultAlgTool.h.

98 {
99 this,
100 "Eg1BDT_op",
101 "unknown",
102 "Eg1BDT cut_operator"};

◆ m_Eg1BDT_str

Gaudi::Property<std::string> GlobalSim::eEmEg1BDTMultAlgTool::m_Eg1BDT_str
private
Initial value:
{
this,
"Eg1BDT",
"0",
"Eg1BDT lcut_value"}

Definition at line 92 of file eEmEg1BDTMultAlgTool.h.

92 {
93 this,
94 "Eg1BDT",
95 "0",
96 "Eg1BDT lcut_value"};

◆ m_enableDump

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

Definition at line 124 of file eEmEg1BDTMultAlgTool.h.

124 {
125 this,
126 "enable_dump",
127 false,
128 "flag to enable debug dumps"
129 };

◆ m_et_high_str

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

Definition at line 61 of file eEmEg1BDTMultAlgTool.h.

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

◆ m_et_low_str

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

Definition at line 55 of file eEmEg1BDTMultAlgTool.h.

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

◆ m_eta_high_str

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

Definition at line 73 of file eEmEg1BDTMultAlgTool.h.

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

◆ m_eta_low_str

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

Definition at line 67 of file eEmEg1BDTMultAlgTool.h.

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

◆ m_maxtob

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

Definition at line 132 of file eEmEg1BDTMultAlgTool.h.

132{0};

◆ m_menu_name

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

Definition at line 117 of file eEmEg1BDTMultAlgTool.h.

117 {
118 this,
119 "menu_name",
120 "unknown",
121 "name from json menu file"
122 };

◆ m_n_multbits

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

Definition at line 111 of file eEmEg1BDTMultAlgTool.h.

111 {
112 this,
113 "n_multbits",
114 3,
115 "number of bits to write into the TIP"};

◆ m_phi_high_str

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

Definition at line 85 of file eEmEg1BDTMultAlgTool.h.

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

◆ m_phi_low_str

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

Definition at line 79 of file eEmEg1BDTMultAlgTool.h.

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

◆ m_TIP_position

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

Definition at line 104 of file eEmEg1BDTMultAlgTool.h.

104 {
105 this,
106 "TIPposition",
107 0,
108 "start position to write into the TIP"};

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