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

#include <GlobalJet1AlgTool.h>

Inheritance diagram for GlobalSim::GlobalJet1AlgTool:
Collaboration diagram for GlobalSim::GlobalJet1AlgTool:

Public Member Functions

 GlobalJet1AlgTool (const std::string &type, const std::string &name, const IInterface *parent)
 Main constructor.
 ~GlobalJet1AlgTool () override=default
 Main destructor (explicitly defaulted).
virtual StatusCode initialize () override
 Initialize function running before first event.
virtual StatusCode run (const std::unique_ptr< IDataCollector > &, const EventContext &ctx) const override
 Main functional block running for each event.
virtual std::string toString () const override
 Overriding toString function from base class.

Private Attributes

SG::ReadHandleKey< IOBitwise::CommonTOBContainerm_gblCellTowers
 Read key for the output cell towers as a GenericTobContainer.
SG::WriteHandleKey< IOBitwise::CommonTOBContainerm_gblJet1JetsContainerKey
 Write key for the output Jet1Jets as a GenericTobContainer.

Detailed Description

Definition at line 33 of file GlobalJet1AlgTool.h.

Constructor & Destructor Documentation

◆ GlobalJet1AlgTool()

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

Main constructor.

Definition at line 15 of file GlobalJet1AlgTool.cxx.

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

◆ ~GlobalJet1AlgTool()

GlobalSim::GlobalJet1AlgTool::~GlobalJet1AlgTool ( )
overridedefault

Main destructor (explicitly defaulted).

Member Function Documentation

◆ initialize()

StatusCode GlobalSim::GlobalJet1AlgTool::initialize ( )
overridevirtual

Initialize function running before first event.

Definition at line 21 of file GlobalJet1AlgTool.cxx.

21 {
22
23 CHECK(m_gblCellTowers.initialize());
24 CHECK(m_gblJet1JetsContainerKey.initialize());
25
26 return StatusCode::SUCCESS;
27 }
#define CHECK(...)
Evaluate an expression and check for errors.
SG::ReadHandleKey< IOBitwise::CommonTOBContainer > m_gblCellTowers
Read key for the output cell towers as a GenericTobContainer.
SG::WriteHandleKey< IOBitwise::CommonTOBContainer > m_gblJet1JetsContainerKey
Write key for the output Jet1Jets as a GenericTobContainer.

◆ run()

StatusCode GlobalSim::GlobalJet1AlgTool::run ( const std::unique_ptr< IDataCollector > & dc,
const EventContext & ctx ) const
overridevirtual

Main functional block running for each event.

Definition at line 31 of file GlobalJet1AlgTool.cxx.

32 {
33
34 ATH_MSG_DEBUG("Building WTAConeJets");
35 if (dc){dc->collect(*this, "start");}
36
37
38 // Read the GlobalCellTowers
39 auto h_towerTOBs = SG::makeHandle(m_gblCellTowers, ctx);
40 CHECK(h_towerTOBs.isValid());
41 const auto & towers = *h_towerTOBs;
42 const unsigned int inTopoTowersN = towers.size();
43 ATH_MSG_DEBUG("Reading " << inTopoTowersN << " cell towers as GenericTobs");
44
45 // Create bitwise towers
46 std::vector<WTATrigObj> input_towers;
47 for(unsigned int i = 0; i < inTopoTowersN; i++){
48 // Has constituent tracking feature
49 const IOBitwise::CommonTOB* tower = towers[i];
50 WTATrigObj this_tower(tower->et_bits().to_ulong(), tower->eta_bits().to_ulong(), tower->phi_bits().to_ulong(), 0, i);
51 input_towers.push_back(this_tower);
52 }
53
54 // Do the usual
55 std::unique_ptr<WTAConeMaker> MyWTAConeMaker = std::make_unique<WTACone2PassMaker>();
56 WTAParameters MyWTAParameters = WTAParameters(
57 8, // const_et_cut = 2 GeV
58 20, // seed_et_cut = 5 GeV
59 4 // jet_dR = 4
60 );
61 MyWTAConeMaker->m_WTAConeMakerParameter = MyWTAParameters; // Pass the WTAConeParameters
62 WTAConeParallelHelper wta_parallel_helper;
63 wta_parallel_helper.SetBlockN(4);
64 wta_parallel_helper.CreateBlocks(input_towers);
65 wta_parallel_helper.RunParallelWTA(MyWTAConeMaker);
66 wta_parallel_helper.CheckJetInCore();
67 std::vector<WTAJet> WTAJetList = wta_parallel_helper.GetAllJets(); // Bitwise Jets
68
69 auto h_Jet1TOBs = SG::makeHandle(m_gblJet1JetsContainerKey, ctx);
70 auto jets = std::make_unique<IOBitwise::CommonTOBContainer>();
71
72 for(const auto& WTAJet: WTAJetList){
73 int energyBits = std::clamp(static_cast<int>(WTAJet.pt()), 0, (1 << IOBitwise::CommonTOB::s_et_width) - 1);
74 int etaBits = std::clamp(static_cast<int>(WTAJet.eta()), 0, (1 << IOBitwise::CommonTOB::s_eta_width) - 1);
75 int phiBits = std::clamp(static_cast<int>(WTAJet.phi()), 0, (1 << IOBitwise::CommonTOB::s_phi_width) - 1);
76 jets->emplace_back(new IOBitwise::CommonTOB(std::bitset<IOBitwise::CommonTOB::s_et_width>(energyBits),
77 std::bitset<IOBitwise::CommonTOB::s_eta_width>(etaBits),
78 std::bitset<IOBitwise::CommonTOB::s_phi_width>(phiBits)));
79 // Print jet TOB
80 ATH_MSG_DEBUG("Returning Jet: " << jets->back()->to_string());
81 }
82
83 ATH_MSG_DEBUG("Built " << jets->size() << " WTAConeJets and stored them as GenericTobs");
84
85 CHECK(h_Jet1TOBs.record(std::move(jets)));
86
87 if (dc){dc->collect(*this, "end");}
88
89 return StatusCode::SUCCESS;
90 }
#define ATH_MSG_DEBUG(x)
static constexpr std::size_t s_eta_width
Size of the eta bitset.
Definition CommonTOB.h:30
static constexpr std::size_t s_et_width
Size of the eT bitset.
Definition CommonTOB.h:28
static constexpr std::size_t s_phi_width
Size of the phi bitset.
Definition CommonTOB.h:32
std::vector< WTAJet > GetAllJets()
void RunParallelWTA(std::unique_ptr< WTAClassType > &AnyWTAClass)
void CreateBlocks(const std::vector< WTATrigObj > &all_towers)
void SetBlockN(unsigned int block_n)
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())

◆ toString()

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

Overriding toString function from base class.

Definition at line 93 of file GlobalJet1AlgTool.cxx.

93 {
94 return {};
95 }

Member Data Documentation

◆ m_gblCellTowers

SG::ReadHandleKey<IOBitwise::CommonTOBContainer> GlobalSim::GlobalJet1AlgTool::m_gblCellTowers
private
Initial value:
{
this,
"GlobalCellTowersKey",
"GlobalCellTowers",
"Key to the container of generic TOBS containing the cell towers"}

Read key for the output cell towers as a GenericTobContainer.

Definition at line 57 of file GlobalJet1AlgTool.h.

57 {
58 this,
59 "GlobalCellTowersKey",
60 "GlobalCellTowers",
61 "Key to the container of generic TOBS containing the cell towers"};

◆ m_gblJet1JetsContainerKey

SG::WriteHandleKey<IOBitwise::CommonTOBContainer> GlobalSim::GlobalJet1AlgTool::m_gblJet1JetsContainerKey
private
Initial value:
{
this,
"GlobalJet1JetsKey",
"GlobalJet1Jets",
"Key to the container of generic TOBS containing the Jet1Jets"}

Write key for the output Jet1Jets as a GenericTobContainer.

Definition at line 65 of file GlobalJet1AlgTool.h.

65 {
66 this,
67 "GlobalJet1JetsKey",
68 "GlobalJet1Jets",
69 "Key to the container of generic TOBS containing the Jet1Jets"};

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