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

AlgTool to count GlobalSim::IOBitwise::CommonTOB Jet objects. More...

#include <JetMultAlgTool.h>

Inheritance diagram for GlobalSim::JetMultAlgTool:
Collaboration diagram for GlobalSim::JetMultAlgTool:

Public Member Functions

 JetMultAlgTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~JetMultAlgTool () 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}
SG::ReadHandleKey< IOBitwise::CommonTOBContainerm_JetTOBContainerKey
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< 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::CommonTOB Jet objects.

Cutting on the Jet score

Definition at line 25 of file JetMultAlgTool.h.

Constructor & Destructor Documentation

◆ JetMultAlgTool()

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

Definition at line 12 of file JetMultAlgTool.cxx.

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

◆ ~JetMultAlgTool()

virtual GlobalSim::JetMultAlgTool::~JetMultAlgTool ( )
overridevirtualdefault

Member Function Documentation

◆ initialize()

StatusCode GlobalSim::JetMultAlgTool::initialize ( )
overridevirtual

Initialize function running before first event.

Definition at line 20 of file JetMultAlgTool.cxx.

20 {
21
22 CHECK(m_JetTOBContainerKey.initialize());
23
24 if (m_n_multbits < 0) {
25 ATH_MSG_ERROR("number of bits to write to TIP is negative");
26 return StatusCode::FAILURE;
27 }
28
29 int max_tip_pos = s_nbits_TIP - m_n_multbits;
30
32 ATH_MSG_ERROR("TIP word out of bounds " << m_TIP_position);
33 return StatusCode::FAILURE;
34 }
35
36 // create the necessary selector objects
37 m_c_selector = std::make_unique<CommonSelector>(m_et_low_str,
43 );
44
45 if (m_n_multbits == 0){
46 m_maxtob = 0;
47 } else {
48 ulong maxtob = 1;
49 for (ulong i = m_n_multbits; i != 0; --i) { maxtob *= 2;}
50 m_maxtob = maxtob - 1;
51 }
52
53 return StatusCode::SUCCESS;
54 }
#define ATH_MSG_ERROR(x)
#define CHECK(...)
Evaluate an expression and check for errors.
Gaudi::Property< int > m_n_multbits
Gaudi::Property< int > m_TIP_position
Gaudi::Property< std::string > m_et_low_str
SG::ReadHandleKey< IOBitwise::CommonTOBContainer > m_JetTOBContainerKey
Gaudi::Property< std::string > m_eta_high_str
Gaudi::Property< std::string > m_phi_low_str
std::unique_ptr< ICommonSelector > m_c_selector
Gaudi::Property< std::string > m_et_high_str
Gaudi::Property< std::string > m_eta_low_str
Gaudi::Property< std::string > m_phi_high_str

◆ toString()

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

Definition at line 114 of file JetMultAlgTool.cxx.

114 {
115 std::stringstream ss;
116 ss <<name () << ": " <<m_menu_name << ' '
117 << "JetMultAlgTool read, select, count and report number of related Jet CommonTOBS\n"
118 << m_c_selector->to_string() << '\n'
119 << m_TIP_position << ' ' << m_n_multbits;
120
121 return ss.str();
122 }
static Double_t ss
Gaudi::Property< std::string > m_menu_name

◆ updateTIP()

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

Definition at line 57 of file JetMultAlgTool.cxx.

58 {
59 auto tobs =
60 SG::ReadHandle<GlobalSim::IOBitwise::CommonTOBContainer>(m_JetTOBContainerKey,
61 ctx);
62
63 CHECK(tobs.isValid());
64
65 // check if any of the incoming tobs is selected.
66
67 ulong tob_count{0};
68 std::vector<bool> tob_pass(tobs->size(), false);
69 for (int tob_it = 0; const GlobalSim::IOBitwise::CommonTOB* t : *tobs){
70 if (m_c_selector->select(*t)) {
71 tob_pass[tob_it] = true;
72 if (++tob_count == m_maxtob){
73 break;
74 }
75 }
76 tob_it++;
77 }
78
79 ATH_MSG_DEBUG("no of passing TOBS" << tob_count);
80
81
82 auto count_bits = std::bitset<s_nbits_TIP>(tob_count);
83
84 int p0{0};
85 int p1{m_TIP_position};
86
87 const int& mxb = m_n_multbits;
88
89 for (; p0 != mxb; ++p0, ++p1) {
90 if (count_bits.test(p0)) {word.set(p1);}
91 }
92
93 ATH_MSG_DEBUG("TIP word " << word);
94
95
96 if (m_enableDump) {
97 std::stringstream ss;
98 ss << "\nRun " << ctx <<' ' << "TIP:\n" << word << '\n';
99 std::size_t ind{0};
100 for (const GlobalSim::IOBitwise::CommonTOB* tob : *tobs) {
101 ss << tob->to_string() << ' ' << std::boolalpha << " pass " << tob_pass[ind++] << '\n';
102 }
103 ss << "tob count " << tob_count << '\n';
104
105 std::ofstream out(name() + ".log", std::ios_base::app);
106 out << ss.str();
107 out.close();
108 }
109
110
111 return StatusCode::SUCCESS;
112 }
#define ATH_MSG_DEBUG(x)
Gaudi::Property< bool > m_enableDump

Member Data Documentation

◆ m_c_selector

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

Definition at line 44 of file JetMultAlgTool.h.

44{nullptr};

◆ m_enableDump

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

Definition at line 108 of file JetMultAlgTool.h.

108 {
109 this,
110 "enable_dump",
111 false,
112 "flag to enable debug dumps"
113 };

◆ m_et_high_str

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

Definition at line 58 of file JetMultAlgTool.h.

58 {
59 this,
60 "et_high",
61 "inf",
62 "et high for window selector"};

◆ m_et_low_str

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

Definition at line 52 of file JetMultAlgTool.h.

52 {
53 this,
54 "et_low",
55 "0",
56 "et low for window selector"};

◆ m_eta_high_str

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

Definition at line 70 of file JetMultAlgTool.h.

70 {
71 this,
72 "eta_high",
73 "inf",
74 "eta high for window selector"};

◆ m_eta_low_str

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

Definition at line 64 of file JetMultAlgTool.h.

64 {
65 this,
66 "eta_low",
67 "0",
68 "eta low for window selector"};

◆ m_JetTOBContainerKey

SG::ReadHandleKey<IOBitwise::CommonTOBContainer> GlobalSim::JetMultAlgTool::m_JetTOBContainerKey
private
Initial value:
{
this,
"GlobalJet1JetsKey",
"GlobalJet1Jets",
"Key for GlobalSim Jet CommonTOB container"}

Definition at line 46 of file JetMultAlgTool.h.

46 {
47 this,
48 "GlobalJet1JetsKey",
49 "GlobalJet1Jets",
50 "Key for GlobalSim Jet CommonTOB container"};

◆ m_maxtob

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

Definition at line 116 of file JetMultAlgTool.h.

116{0};

◆ m_menu_name

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

Definition at line 101 of file JetMultAlgTool.h.

101 {
102 this,
103 "menu_name",
104 "unknown",
105 "name from json menu file"
106 };

◆ m_n_multbits

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

Definition at line 95 of file JetMultAlgTool.h.

95 {
96 this,
97 "n_multbits",
98 3,
99 "number of bits to write into the TIP"};

◆ m_phi_high_str

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

Definition at line 82 of file JetMultAlgTool.h.

82 {
83 this,
84 "phi_high",
85 "inf",
86 "phi high for window selector"};

◆ m_phi_low_str

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

Definition at line 76 of file JetMultAlgTool.h.

76 {
77 this,
78 "phi_low",
79 "0",
80 "phi low for window selector"};

◆ m_TIP_position

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

Definition at line 88 of file JetMultAlgTool.h.

88 {
89 this,
90 "TIPposition",
91 0,
92 "start position to write into the TIP"};

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