ATLAS Offline Software
Loading...
Searching...
No Matches
JET1Alg.cxx
Go to the documentation of this file.
1/*
2 * Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3 */
4
5#include "JET1Alg.h"
9
10namespace GlobalSim {
11
12 StatusCode JET1Alg::initialize() {
13
14 CHECK( m_inputTowersKey.initialize() );
15 CHECK( m_outputKey.initialize() );
16
17 return StatusCode::SUCCESS;
18 }
19
20 StatusCode JET1Alg::execute(const EventContext& ctx) const {
21
22 ATH_MSG_DEBUG("Building WTAConeJets");
23 // Read the GlobalCellTowers
24 auto towers = SG::makeHandle(m_inputTowersKey, ctx);
25 CHECK(towers.isValid());
26 auto nTowers = towers->size();
27 ATH_MSG_DEBUG("Reading " << nTowers << " cell towers from xAOD::BaseContainer");
28
29 std::vector<WTATrigObj> input_towers;
30 for(size_t i = 0; i < nTowers; i++){
31 Object<Tower> tower( *towers->at(i) );
32 WTATrigObj this_tower(tower.ptt.bits().to_ulong(), tower.eta.bits().to_ulong(), tower.phi.bits().to_ulong(), 0, i);
33 input_towers.push_back(this_tower);
34 }
35
36 // Do the usual
37 std::unique_ptr<WTAConeMaker> MyWTAConeMaker = std::make_unique<WTACone2PassMaker>();
38 WTAParameters MyWTAParameters = WTAParameters(
39 8, // const_et_cut = 2 GeV
40 20, // seed_et_cut = 5 GeV
41 4 // jet_dR = 4
42 );
43
44 MyWTAConeMaker->m_WTAConeMakerParameter = MyWTAParameters; // Pass the WTAConeParameters
45 WTAConeParallelHelper wta_parallel_helper;
46 wta_parallel_helper.SetBlockN(4);
47 wta_parallel_helper.CreateBlocks(input_towers);
48 wta_parallel_helper.RunParallelWTA(MyWTAConeMaker);
49 wta_parallel_helper.CheckJetInCore();
50 std::vector<WTAJet> WTAJetList = wta_parallel_helper.GetAllJets(); // Bitwise Jets
51
52 //Write out as an xAOD::BaseContainer of SG::AuxElements
53 auto jets = SG::makeHandle(m_outputKey, ctx);
54 CHECK( jets.record( std::make_unique<xAOD::BaseContainer>(), std::make_unique<xAOD::AuxContainerBase>()) );
55
56 for(const auto& WTAJet: WTAJetList){
57 jets->push_back( std::make_unique<SG::AuxElement>() );
58 auto jet = Object<JET1Jet>( *jets->back());
59
60 // Assigned through the bits overload, not the value one: ptt carries a 0.25 encoder,
61 // so handing it the raw count would store a count where a physical value is expected
62 // and multiply it by four on the way back out. The reference implementation writes
63 // the count straight into the field (GoldenGate: obj.pt() & 0x1FFF).
64 jet.ptt = std::bitset<jet.ptt.width>(WTAJet.pt());
65 jet.eta = std::bitset<jet.eta.width>(WTAJet.eta());
66 jet.phi = std::bitset<jet.phi.width>(WTAJet.phi());
68 jet.ring_zero_ptt = ering_info.ring0_Et;
69 jet.ring_one_ptt = ering_info.ring1_Et;
70 jet.ring_two_ptt = ering_info.ring2_Et;
71 jet.ring_three_ptt = ering_info.ring3_Et;
72 jet.ring_four_ptt = ering_info.ring4_Et;
73 jet.total_tobs = ering_info.total_TobN;
74 jet.ring_one_tobs = ering_info.ring1_TobN;
75 jet.ring_two_tobs = ering_info.ring2_TobN;
76 jet.ring_three_tobs = ering_info.ring3_TobN;
77 jet.ring_four_tobs = ering_info.ring4_TobN;
78 // The WTA engine does not provide the flags yet, so they are written as
79 // false. The fields still have to be filled: without them the aux variable
80 // does not exist and packing the word throws. Note et_overflow is genuinely
81 // set in the reference data, so this is a placeholder, not a final value.
82 jet.flag_et_overflow = false;
83 jet.flag_error = false;
84 jet.flag_next_tob_same_et = false;
85 jet.flag_truncate = false;
86 }
87
88 return StatusCode::SUCCESS;
89 }
90
91
92}
#define ATH_MSG_DEBUG(x,...)
#define CHECK(...)
Evaluate an expression and check for errors.
SG::WriteHandleKey< xAOD::BaseContainer > m_outputKey
Key for the output jets.
Definition JET1Alg.h:38
SG::ReadHandleKey< xAOD::BaseContainer > m_inputTowersKey
Key for the Input cell towers.
Definition JET1Alg.h:35
virtual StatusCode initialize() override
initialize function running before first event
Definition JET1Alg.cxx:12
virtual StatusCode execute(const EventContext &) const override
execute function running for every event
Definition JET1Alg.cxx:20
Spec::bitset_type bits() const
Definition Object.h:57
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)
const WTA4JetERingInfo & GetERingInfo() const
Definition WTAObject.h:176
eta_t eta() const
Definition WTAObject.h:33
phi_t phi() const
Definition WTAObject.h:35
pt_t pt() const
Definition WTAObject.h:31
AlgTool to read in LArStripNeighborhoods, and run the BDT Algorithm.
Definition BitSpec.h:24
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
ring4_tobn_t ring4_TobN
Definition WTAObject.h:147
ring1_tobn_t ring1_TobN
Definition WTAObject.h:144
ring2_tobn_t ring2_TobN
Definition WTAObject.h:145
ring3_tobn_t ring3_TobN
Definition WTAObject.h:146