ATLAS Offline Software
KeyWriterTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "KeyWriterTool.h"
5 
6 #include <limits>
7 
8 namespace TrigConf {
9 
10  KeyWriterTool::KeyWriterTool( const std::string& type,
11  const std::string& name,
12  const IInterface* parent ) :
13  base_class(type, name, parent)
14  {}
15 
21  renounce(m_hltMenuInputKey); // This is DetStore
22 
23  if (not m_includeBunchgroupKey) {
24  m_writeBgKey = "";
25  }
26 
27  ATH_CHECK( m_writeKeys.initialize( SG::AllowEmpty ) );
28  ATH_CHECK( m_writeBgKey.initialize( SG::AllowEmpty ) );
29 
30  return StatusCode::SUCCESS;
31  }
32 
33 
34  StatusCode KeyWriterTool::writeKeys(const EventContext& ctx) const {
35  uint32_t a, b, c; // Unused
36  return writeKeys(ctx, a, b, c);
37  }
38 
39 
40  StatusCode KeyWriterTool::writeKeys(const EventContext& ctx, uint32_t&smk, uint32_t& l1psk, uint32_t& hltpsk) const {
41 
44  ATH_CHECK( l1psRH.isValid() );
45  const TrigConf::L1PrescalesSet* l1PrescaleSet{*l1psRH};
46  l1psk = l1PrescaleSet->psk();
47  } else {
48  l1psk = 0;
49  }
50 
52  ATH_CHECK( hltpsRH.isValid() );
53  const TrigConf::HLTPrescalesSet* hltPrescaleSet{*hltpsRH};
54  hltpsk = hltPrescaleSet->psk();
55 
57  ATH_CHECK( hltRH.isValid() );
58  smk = hltRH->smk();
59 
60  if (!m_writeKeys.empty()) {
62  ATH_CHECK( writeKeys.record( std::make_unique<xAOD::TrigConfKeys>(smk, l1psk, hltpsk) ) );
63  }
64 
65  return StatusCode::SUCCESS;
66  }
67 
68 
69  StatusCode KeyWriterTool::writeBunchgroupKey(const EventContext& ctx, uint32_t&bgk) const {
70 
72  return StatusCode::SUCCESS; // Nothing to do
73  }
74 
76  ATH_CHECK( bgRH.isValid() );
77  const TrigConf::L1BunchGroupSet* l1BunchGroupSet{*bgRH};
78  bgk = l1BunchGroupSet->bgsk();
79 
80  if (!m_writeBgKey.empty()) {
82  ATH_CHECK( writeBgKey.record( std::make_unique<xAOD::BunchConfKey>(bgk) ) );
83  }
84 
85  return StatusCode::SUCCESS;
86  }
87 
88 
89  StatusCode KeyWriterTool::writeBunchgroupKey(const EventContext& ctx) const {
90  uint32_t a; // Unused
91  return writeBunchgroupKey(ctx, a);
92  }
93 
94 }
TrigConf::KeyWriterTool::m_hltMenuInputKey
SG::ReadHandleKey< TrigConf::HLTMenu > m_hltMenuInputKey
Definition: KeyWriterTool.h:55
TrigConf::KeyWriterTool::m_writeBgKey
SG::WriteHandleKey< xAOD::BunchConfKey > m_writeBgKey
Definition: KeyWriterTool.h:61
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigConf::HLTMenu::smk
unsigned int smk() const
setter and getter for the supermasterkey
Definition: HLTMenu.cxx:41
KeyWriterTool.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
RunEBWeightsComputation.smk
smk
Definition: RunEBWeightsComputation.py:87
SG::ReadCondHandle::isValid
bool isValid()
Definition: ReadCondHandle.h:205
TrigConf
Forward iterator to traverse the main components of the trigger configuration.
Definition: Config.h:22
TrigConf::KeyWriterTool::m_l1PrescaleSetInputKey
SG::ReadCondHandleKey< TrigConf::L1PrescalesSet > m_l1PrescaleSetInputKey
Definition: KeyWriterTool.h:52
TrigConf::KeyWriterTool::KeyWriterTool
KeyWriterTool()=delete
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrigConf::KeyWriterTool::writeBunchgroupKey
virtual StatusCode writeBunchgroupKey(const EventContext &ctx, uint32_t &bgk) const final
Definition: KeyWriterTool.cxx:69
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TrigConf::KeyWriterTool::m_includeL1PrescaleKey
Gaudi::Property< bool > m_includeL1PrescaleKey
Definition: KeyWriterTool.h:57
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TrigConf::KeyWriterTool::initialize
virtual StatusCode initialize() final
Definition: KeyWriterTool.cxx:16
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TrigConf::L1BunchGroupSet
L1 board configuration.
Definition: L1BunchGroupSet.h:71
TrigConf::KeyWriterTool::m_bgInputKey
SG::ReadCondHandleKey< TrigConf::L1BunchGroupSet > m_bgInputKey
Definition: KeyWriterTool.h:54
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TrigConf::name
Definition: HLTChainList.h:35
TrigConf::L1PrescalesSet
L1 menu configuration.
Definition: L1PrescalesSet.h:19
TrigConf::KeyWriterTool::m_writeKeys
SG::WriteHandleKey< xAOD::TrigConfKeys > m_writeKeys
Definition: KeyWriterTool.h:60
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
TrigConf::KeyWriterTool::m_hltPrescaleSetInputKey
SG::ReadCondHandleKey< TrigConf::HLTPrescalesSet > m_hltPrescaleSetInputKey
Definition: KeyWriterTool.h:53
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
a
TList * a
Definition: liststreamerinfos.cxx:10
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
xAOD::l1psk
l1psk
Definition: TriggerMenu_v1.cxx:29
TrigConf::L1BunchGroupSet::bgsk
unsigned int bgsk() const
setter and getter for the bunch group key
Definition: L1BunchGroupSet.h:95
TrigConf::HLTPrescalesSet::psk
unsigned int psk() const
setter and getter for the HLT prescale key
Definition: HLTPrescalesSet.cxx:75
TrigConf::HLTPrescalesSet
HLT menu configuration.
Definition: HLTPrescalesSet.h:19
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
TrigConf::KeyWriterTool::m_includeBunchgroupKey
Gaudi::Property< bool > m_includeBunchgroupKey
Definition: KeyWriterTool.h:58
python.compressB64.c
def c
Definition: compressB64.py:93
TrigConf::KeyWriterTool::writeKeys
virtual StatusCode writeKeys(const EventContext &ctx, uint32_t &smk, uint32_t &l1psk, uint32_t &hltpsk) const final
Definition: KeyWriterTool.cxx:40