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

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

#include <CommonMultAlgTool.h>

Inheritance diagram for GlobalSim::CommonMultAlgTool:
Collaboration diagram for GlobalSim::CommonMultAlgTool:

Public Member Functions

 CommonMultAlgTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~CommonMultAlgTool () override=default
virtual StatusCode initialize () override
 Initialize function running before first event.
virtual StatusCode countPassingTOBs (const EventContext &, const std::unique_ptr< IDataCollector > &dc, unsigned int &N_pass_tobs) const override
virtual std::string toString () const override
virtual StatusCode updateTIP (std::bitset< s_nbits_TIP > &, const std::unique_ptr< IDataCollector > &, const EventContext &) const override

Private Attributes

std::unique_ptr< ICommonSelectorm_c_selector {nullptr}
SG::ReadHandleKey< IOBitwise::CommonTOBContainerm_CommonTOBContainerKey
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_menu_name
Gaudi::Property< bool > m_enableDump

Detailed Description

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

Cutting on the et/eta/phi values

Definition at line 24 of file CommonMultAlgTool.h.

Constructor & Destructor Documentation

◆ CommonMultAlgTool()

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

Definition at line 12 of file CommonMultAlgTool.cxx.

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

◆ ~CommonMultAlgTool()

virtual GlobalSim::CommonMultAlgTool::~CommonMultAlgTool ( )
overridevirtualdefault

Member Function Documentation

◆ countPassingTOBs()

StatusCode GlobalSim::CommonMultAlgTool::countPassingTOBs ( const EventContext & ctx,
const std::unique_ptr< IDataCollector > & dc,
unsigned int & N_pass_tobs ) const
overridevirtual

Definition at line 40 of file CommonMultAlgTool.cxx.

43 {
44 auto tobs =
45 SG::ReadHandle<GlobalSim::IOBitwise::CommonTOBContainer>(m_CommonTOBContainerKey,
46 ctx);
47
48 CHECK(tobs.isValid());
49
50 if(dc){
51 std::stringstream ss;
52 ss << "number of tobs "<< tobs->size() << '\n';
53 dc->collect(*this, ss.str());
54 for (const GlobalSim::IOBitwise::CommonTOB* t : *tobs){
55 dc->collect(*this, t->to_string());
56 }
57 }
58
59 // check if any of the incoming tobs is selected.
60 N_pass_tobs = 0;
61 std::vector<bool> tob_pass(tobs->size(), false);
62 for (int tob_it = 0; const GlobalSim::IOBitwise::CommonTOB* t : *tobs){
63 if (m_c_selector->select(*t)) {
64 tob_pass[tob_it] = true;
65 if (++N_pass_tobs == m_maxtob){
66 break;
67 }
68 }
69 tob_it++;
70 }
71
72 if (m_enableDump) {
73 std::stringstream ss;
74 ss << "\nRun " << ctx << '\n';
75 std::size_t ind{0};
76 for (const GlobalSim::IOBitwise::CommonTOB* tob : *tobs) {
77 ss << tob->to_string() << ' ' << std::boolalpha << " pass " << tob_pass[ind++] << '\n';
78 }
79 ss << "tob count " << N_pass_tobs << '\n';
80
81 std::ofstream out(name() + ".log", std::ios_base::app);
82 out << ss.str();
83 out.close();
84 }
85
86 return StatusCode::SUCCESS;
87 }
#define CHECK(...)
Evaluate an expression and check for errors.
static Double_t ss
SG::ReadHandleKey< IOBitwise::CommonTOBContainer > m_CommonTOBContainerKey
Gaudi::Property< bool > m_enableDump
std::unique_ptr< ICommonSelector > m_c_selector

◆ initialize()

StatusCode GlobalSim::CommonMultAlgTool::initialize ( )
overridevirtual

Initialize function running before first event.

Definition at line 20 of file CommonMultAlgTool.cxx.

20 {
21
23
24 CHECK(m_CommonTOBContainerKey.initialize());
25
26 // create the necessary selector objects
27 m_c_selector = std::make_unique<CommonSelector>(m_et_low_str,
33 );
34
35 return StatusCode::SUCCESS;
36 }
#define ATH_CHECK
Evaluate an expression and check for errors.
Gaudi::Property< std::string > m_et_high_str
Gaudi::Property< std::string > m_eta_low_str
Gaudi::Property< std::string > m_et_low_str
Gaudi::Property< std::string > m_phi_low_str
Gaudi::Property< std::string > m_eta_high_str
Gaudi::Property< std::string > m_phi_high_str
virtual StatusCode initialize() override
Initialize function running before first event.

◆ toString()

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

Definition at line 89 of file CommonMultAlgTool.cxx.

89 {
90 std::stringstream ss;
91 ss <<name () << ": " <<m_menu_name << ' '
92 << "CommonMultAlgTool read, select, count and report number of related CommonTOBS\n"
93 << m_c_selector->to_string() << '\n'
94 << m_TIP_position << ' ' << m_TIP_width;
95
96 return ss.str();
97 }
Gaudi::Property< std::string > m_menu_name

◆ updateTIP()

StatusCode GlobalSim::TIPWriterAlgTool::updateTIP ( std::bitset< s_nbits_TIP > & word,
const std::unique_ptr< IDataCollector > & dc,
const EventContext & ctx ) const
override

Definition at line 34 of file TIPWriterAlgTool.cxx.

42 {
43
44 if (dc){dc->collect(*this, "start");}
45
46 unsigned int N_pass_tobs{0};
47 ATH_CHECK( countPassingTOBs(ctx, dc, N_pass_tobs) );
48 ATH_MSG_DEBUG("no of passing TOBS" << N_pass_tobs);
49
50 auto count_bits = std::bitset<s_nbits_TIP>(N_pass_tobs);
51 word |= (count_bits << m_TIP_position);
52
53 ATH_MSG_DEBUG("TIP word " << word);
54 if (dc){dc->collect(*this, "end");}
55
56 return StatusCode::SUCCESS;
57 }
#define ATH_MSG_DEBUG(x,...)
virtual StatusCode countPassingTOBs(const EventContext &, const std::unique_ptr< IDataCollector > &dc, unsigned int &N_pass_tobs) const override

Member Data Documentation

◆ m_c_selector

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

Definition at line 47 of file CommonMultAlgTool.h.

47{nullptr};

◆ m_CommonTOBContainerKey

SG::ReadHandleKey<IOBitwise::CommonTOBContainer> GlobalSim::CommonMultAlgTool::m_CommonTOBContainerKey
private
Initial value:
{
this,
"CommonTOBsKey",
"CommonTOBs",
"Key for GlobalSim CommonTOB container"}

Definition at line 49 of file CommonMultAlgTool.h.

49 {
50 this,
51 "CommonTOBsKey",
52 "CommonTOBs",
53 "Key for GlobalSim CommonTOB container"};

◆ m_enableDump

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

Definition at line 98 of file CommonMultAlgTool.h.

98 {
99 this,
100 "enable_dump",
101 false,
102 "flag to enable debug dumps"
103 };

◆ m_et_high_str

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

Definition at line 61 of file CommonMultAlgTool.h.

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

◆ m_et_low_str

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

Definition at line 55 of file CommonMultAlgTool.h.

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

◆ m_eta_high_str

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

Definition at line 73 of file CommonMultAlgTool.h.

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

◆ m_eta_low_str

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

Definition at line 67 of file CommonMultAlgTool.h.

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

◆ m_menu_name

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

Definition at line 91 of file CommonMultAlgTool.h.

91 {
92 this,
93 "menu_name",
94 "unknown",
95 "name from json menu file"
96 };

◆ m_phi_high_str

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

Definition at line 85 of file CommonMultAlgTool.h.

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

◆ m_phi_low_str

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

Definition at line 79 of file CommonMultAlgTool.h.

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

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