ATLAS Offline Software
Loading...
Searching...
No Matches
gFexByteStreamTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5//***************************************************************************
6// gFexByteStreamTool - description
7// -------------------
8// begin : 20 07 2022
9// email : cecilia.tosciri@cern.ch
10// ***************************************************************************/
11
12#ifndef GFEXBYTESTREAMTOOL_H
13#define GFEXBYTESTREAMTOOL_H
14
15// Trigger includes
17
21
25#include "TrigConfData/L1Menu.h"
27
28// Athena includes
32
33// Gaudi includes
34#include "Gaudi/Property.h"
35
36// STL includes
37#include <array>
38#include <cstdint> //for uint32_t etc
39#include <vector>
40
45class gFexByteStreamTool : public extends<AthAlgTool, IL1TriggerByteStreamTool> {
46 public:
47 gFexByteStreamTool(const std::string& type, const std::string& name, const IInterface* parent);
48 virtual ~gFexByteStreamTool() override = default;
49
50 // ------------------------- IAlgTool methods --------------------------------
51 virtual StatusCode initialize() override;
52 virtual StatusCode start() override;
53
54 // ------------------------- IL1TriggerByteStreamTool methods ----------------------
56 virtual StatusCode convertFromBS(const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vrobf, const EventContext& eventContext)const override;
57
59 virtual StatusCode convertToBS(std::vector<OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment*>& vrobf,
61 const EventContext& eventContext) override;
62
64 virtual const std::vector<uint32_t>& robIds() const override {
65 return m_robIds.value();
66 }
67
68 private:
69 // ------------------------- Properties --------------------------------------
70 ToolHandle<GenericMonitoringTool> m_monTool{this,"MonTool","","Monitoring tool"};
71 bool m_UseMonitoring = false;
72
73
74 // ROBIDs property required by the interface
75 Gaudi::Property<std::vector<uint32_t>> m_robIds {this, "ROBIDs", {}, "List of ROB IDs required for conversion to/from xAOD RoI"};
76 Gaudi::Property<bool> m_saveExtendedTOBs {this, "SaveExtendedTOBs", false, "Decode and write xTOBs instead of TOBs"};
77
78 int m_gJ_scale = 0;
79 int m_gLJ_scale = 0;
80 int m_gXE_scale = 0;
81 int m_gTE_scale = 0;
82
83 // Write handle keys for the L1Calo EDMs for BS->xAOD mode of operation
84 SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexRhoWriteKey {this,"gFexRhoOutputContainerWriteKey","L1_gFexRhoRoI","Write gFEX EDM gFexRho container"};
85 SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexBlockWriteKey {this,"gFexSRJetOutputContainerWriteKey","L1_gFexSRJetRoI","Write gFEX EDM gFexBlock container"};
86 SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexJetWriteKey {this,"gFexLRJetOutputContainerWriteKey","L1_gFexLRJetRoI","Write gFEX EDM gFexJet container"};
87 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarEJwojWriteKey {this,"gScalarEJwojOutputContainerWriteKey","L1_gScalarEJwoj","Write gFEX EDM Scalar MET and SumET (JwoJ) container"};
88 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gEspressoWriteKey {this,"gEspressoOutputContainerWriteKey","L1_gEspresso","Write gFEX EDM gEspresso container"};
89 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gRistrettoWriteKey {this,"gRistrettoOutputContainerWriteKey","L1_gRistretto","Write gFEX EDM gRistretto container"};
90 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsJwojWriteKey {this,"gMETComponentsJwojOutputContainerWriteKey","L1_gMETComponentsJwoj","Write gFEX EDM total MET components (JwoJ) container"};
91 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMHTComponentsJwojWriteKey {this,"gMHTComponentsJwojOutputContainerWriteKey","L1_gMHTComponentsJwoj","Write gFEX EDM hard MET components (JwoJ) container"};
92 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMSTComponentsJwojWriteKey {this,"gMSTComponentsJwojOutputContainerWriteKey","L1_gMSTComponentsJwoj","Write gFEX EDM soft MET components (JwoJ) container"};
93 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsNoiseCutWriteKey {this,"gMETComponentsNoiseCutOutputContainerWriteKey","L1_gMETComponentsNoiseCut","Write gFEX EDM total MET components (NoiseCut) container"};
94 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsRmsWriteKey {this,"gMETComponentsRmsOutputContainerWriteKey","L1_gMETComponentsRms","Write gFEX EDM total MET components (RMS) container"};
95 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarENoiseCutWriteKey {this,"gScalarENoiseCutOutputContainerWriteKey","L1_gScalarENoiseCut","Write gFEX EDM Scalar MET and SumET (NoiseCut) container"};
96 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarERmsWriteKey {this,"gScalarERmsOutputContainerWriteKey","L1_gScalarERms","Write gFEX EDM Scalar MET and SumET (RMS) container"};
97
98 // Multi-slice (out-of-time) write handle keys for Jet TOBs
99 SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexRhoSliceWriteKey {this,"gFexRhoSliceContainerWriteKey","","Write gFEX EDM gFexRho out-of-time container"};
100 SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexBlockSliceWriteKey {this,"gFexSRJetSliceContainerWriteKey","","Write gFEX EDM gFexBlock out-of-time container"};
101 SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexJetSliceWriteKey {this,"gFexLRJetSliceContainerWriteKey","","Write gFEX EDM gFexJet out-of-time container"};
102 // Multi-slice (out-of-time) write handle keys for Global TOBs
103 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarEJwojSliceWriteKey {this,"gScalarEJwojSliceContainerWriteKey","","Write gFEX EDM Scalar (JwoJ) out-of-time container"};
104 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsJwojSliceWriteKey{this,"gMETComponentsJwojSliceContainerWriteKey","","Write gFEX EDM MET (JwoJ) out-of-time container"};
105 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMHTComponentsJwojSliceWriteKey{this,"gMHTComponentsJwojSliceContainerWriteKey","","Write gFEX EDM MHT (JwoJ) out-of-time container"};
106 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMSTComponentsJwojSliceWriteKey{this,"gMSTComponentsJwojSliceContainerWriteKey","","Write gFEX EDM MST (JwoJ) out-of-time container"};
107 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gEspressoSliceWriteKey {this,"gEspressoSliceContainerWriteKey","","Write gFEX EDM gEspresso out-of-time container"};
108 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gRistrettoSliceWriteKey {this,"gRistrettoSliceContainerWriteKey","","Write gFEX EDM gRistretto out-of-time container"};
109 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsNoiseCutSliceWriteKey{this,"gMETComponentsNoiseCutSliceContainerWriteKey","","Write gFEX EDM MET (NoiseCut) out-of-time container"};
110 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarENoiseCutSliceWriteKey {this,"gScalarENoiseCutSliceContainerWriteKey","","Write gFEX EDM Scalar (NoiseCut) out-of-time container"};
111 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsRmsSliceWriteKey {this,"gMETComponentsRmsSliceContainerWriteKey","","Write gFEX EDM MET (Rms) out-of-time container"};
112 SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarERmsSliceWriteKey {this,"gScalarERmsSliceContainerWriteKey","","Write gFEX EDM Scalar (Rms) out-of-time container"};
113
114 // Slice number decoration keys for out-of-time containers only
115 // L1A containers always contain slice 0, so decoration is redundant there
116 // Out-of-time containers mix TOBs from slices 1,2,3,... so decoration is needed to identify which BC
117 // Jet TOB decorations (out-of-time containers)
118 SG::WriteDecorHandleKey<xAOD::gFexJetRoIContainer> m_gFexRhoOOTDecorKey {this,"gFexRhoOOTDecorKey",m_gFexRhoSliceWriteKey,"sliceNumber","Slice number decoration for gFexRho out-of-time"};
119 SG::WriteDecorHandleKey<xAOD::gFexJetRoIContainer> m_gFexBlockOOTDecorKey {this,"gFexBlockOOTDecorKey",m_gFexBlockSliceWriteKey,"sliceNumber","Slice number decoration for gFexBlock out-of-time"};
120 SG::WriteDecorHandleKey<xAOD::gFexJetRoIContainer> m_gFexJetOOTDecorKey {this,"gFexJetOOTDecorKey",m_gFexJetSliceWriteKey,"sliceNumber","Slice number decoration for gFexJet out-of-time"};
121 // Global TOB decorations (out-of-time containers)
122 SG::WriteDecorHandleKey<xAOD::gFexGlobalRoIContainer> m_gScalarEJwojOOTDecorKey {this,"gScalarEJwojOOTDecorKey",m_gScalarEJwojSliceWriteKey,"sliceNumber","Slice number decoration for gScalarEJwoj out-of-time"};
123 SG::WriteDecorHandleKey<xAOD::gFexGlobalRoIContainer> m_gMETComponentsJwojOOTDecorKey {this,"gMETComponentsJwojOOTDecorKey",m_gMETComponentsJwojSliceWriteKey,"sliceNumber","Slice number decoration for gMETComponentsJwoj out-of-time"};
124 SG::WriteDecorHandleKey<xAOD::gFexGlobalRoIContainer> m_gMHTComponentsJwojOOTDecorKey {this,"gMHTComponentsJwojOOTDecorKey",m_gMHTComponentsJwojSliceWriteKey,"sliceNumber","Slice number decoration for gMHTComponentsJwoj out-of-time"};
125 SG::WriteDecorHandleKey<xAOD::gFexGlobalRoIContainer> m_gMSTComponentsJwojOOTDecorKey {this,"gMSTComponentsJwojOOTDecorKey",m_gMSTComponentsJwojSliceWriteKey,"sliceNumber","Slice number decoration for gMSTComponentsJwoj out-of-time"};
126 SG::WriteDecorHandleKey<xAOD::gFexGlobalRoIContainer> m_gEspressoOOTDecorKey {this,"gEspressoOOTDecorKey",m_gEspressoSliceWriteKey,"sliceNumber","Slice number decoration for gEspresso out-of-time"};
127 SG::WriteDecorHandleKey<xAOD::gFexGlobalRoIContainer> m_gRistrettoOOTDecorKey {this,"gRistrettoOOTDecorKey",m_gRistrettoSliceWriteKey,"sliceNumber","Slice number decoration for gRistretto out-of-time"};
128 SG::WriteDecorHandleKey<xAOD::gFexGlobalRoIContainer> m_gMETComponentsNoiseCutOOTDecorKey{this,"gMETComponentsNoiseCutOOTDecorKey",m_gMETComponentsNoiseCutSliceWriteKey,"sliceNumber","Slice number decoration for gMETComponentsNoiseCut out-of-time"};
129 SG::WriteDecorHandleKey<xAOD::gFexGlobalRoIContainer> m_gScalarENoiseCutOOTDecorKey {this,"gScalarENoiseCutOOTDecorKey",m_gScalarENoiseCutSliceWriteKey,"sliceNumber","Slice number decoration for gScalarENoiseCut out-of-time"};
130 SG::WriteDecorHandleKey<xAOD::gFexGlobalRoIContainer> m_gMETComponentsRmsOOTDecorKey {this,"gMETComponentsRmsOOTDecorKey",m_gMETComponentsRmsSliceWriteKey,"sliceNumber","Slice number decoration for gMETComponentsRms out-of-time"};
131 SG::WriteDecorHandleKey<xAOD::gFexGlobalRoIContainer> m_gScalarERmsOOTDecorKey {this,"gScalarERmsOOTDecorKey",m_gScalarERmsSliceWriteKey,"sliceNumber","Slice number decoration for gScalarERms out-of-time"};
132
133 // xAOD->BS mode reads RoI containers via ElementLinks inside the TrigCompositeContainer
134 // passed to convertToBS(), so no ReadHandleKey is required for the encoder side.
135
136 //Read handle key for the L1Menu
137 SG::ReadHandleKey<TrigConf::L1Menu> m_l1MenuKey {this, "L1TriggerMenu", "DetectorStore+L1TriggerMenu","Name of the L1Menu object to read configuration from"};
138
139 // Encoder-side helper: build the 1-word block header
140 // bits 31..28 = blockType, bits 23..22 = headerSize (=1), bit 12 = errorFlag (=0),
141 // bits 11..0 = dataSize (= numSlices * WORDS_PER_SLICE).
142 uint32_t buildBlockHeader(uint32_t blockType, uint32_t numSlices) const;
143
144 void decodeGfexTobSlice( const uint32_t dataArray[], uint32_t blockType) const;
145
146 void printError(const std::string& location, const std::string& title, MSG::Level type, const std::string& detail) const;
147
148 int16_t fillGlobal(const std::array<uint32_t, 3> &tob, const int type, SG::WriteHandle<xAOD::gFexGlobalRoIContainer> &container, uint32_t sliceNumber, int16_t scalar = -1) const;
149
150 static constexpr uint8_t m_DEBUG=0;
151 static constexpr uint8_t m_WARNING=1;
152 static constexpr uint8_t m_ERROR=2;
153 static constexpr uint8_t m_FATAL=3;
154
155};
156
157#endif // GFEXBYTESTREAMTOOL_H
void printError()
static Double_t tc
Header file to be included by clients of the Monitored infrastructure.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsRmsWriteKey
virtual StatusCode start() override
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsNoiseCutWriteKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gRistrettoSliceWriteKey
virtual StatusCode convertToBS(std::vector< OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment * > &vrobf, const xAOD::TrigCompositeContainer *tc, const EventContext &eventContext) override
xAOD->BS conversion
virtual StatusCode initialize() override
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarENoiseCutSliceWriteKey
static constexpr uint8_t m_FATAL
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarERmsSliceWriteKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gMSTComponentsJwojOOTDecorKey
Gaudi::Property< bool > m_saveExtendedTOBs
uint32_t buildBlockHeader(uint32_t blockType, uint32_t numSlices) const
xAOD->BS conversion
virtual StatusCode convertFromBS(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vrobf, const EventContext &eventContext) const override
BS->xAOD conversion.
SG::WriteDecorHandleKey< xAOD::gFexJetRoIContainer > m_gFexRhoOOTDecorKey
virtual const std::vector< uint32_t > & robIds() const override
Declare ROB IDs for conversion.
SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexRhoSliceWriteKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gRistrettoOOTDecorKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gEspressoSliceWriteKey
gFexByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
SG::ReadHandleKey< TrigConf::L1Menu > m_l1MenuKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMSTComponentsJwojSliceWriteKey
SG::WriteDecorHandleKey< xAOD::gFexJetRoIContainer > m_gFexJetOOTDecorKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMSTComponentsJwojWriteKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarEJwojSliceWriteKey
ToolHandle< GenericMonitoringTool > m_monTool
static constexpr uint8_t m_WARNING
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gRistrettoWriteKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarENoiseCutOOTDecorKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMHTComponentsJwojWriteKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMHTComponentsJwojSliceWriteKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsNoiseCutSliceWriteKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarENoiseCutWriteKey
int16_t fillGlobal(const std::array< uint32_t, 3 > &tob, const int type, SG::WriteHandle< xAOD::gFexGlobalRoIContainer > &container, uint32_t sliceNumber, int16_t scalar=-1) const
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gMHTComponentsJwojOOTDecorKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarERmsOOTDecorKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsJwojWriteKey
virtual ~gFexByteStreamTool() override=default
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarEJwojWriteKey
SG::WriteDecorHandleKey< xAOD::gFexJetRoIContainer > m_gFexBlockOOTDecorKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsRmsOOTDecorKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gEspressoOOTDecorKey
Gaudi::Property< std::vector< uint32_t > > m_robIds
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarEJwojOOTDecorKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gEspressoWriteKey
SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexJetWriteKey
SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexBlockWriteKey
void decodeGfexTobSlice(const uint32_t dataArray[], uint32_t blockType) const
static constexpr uint8_t m_ERROR
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gScalarERmsWriteKey
SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexRhoWriteKey
SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexJetSliceWriteKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsJwojSliceWriteKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsNoiseCutOOTDecorKey
SG::WriteHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsRmsSliceWriteKey
SG::WriteHandleKey< xAOD::gFexJetRoIContainer > m_gFexBlockSliceWriteKey
SG::WriteDecorHandleKey< xAOD::gFexGlobalRoIContainer > m_gMETComponentsJwojOOTDecorKey
static constexpr uint8_t m_DEBUG
TrigCompositeContainer_v1 TrigCompositeContainer
Declare the latest version of the container.