ATLAS Offline Software
RoIBResultByteStreamTool.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 #ifndef TRIGT1RESULTBYTESTREAM_ROIBRESULTBYTESTREAMTOOL_H
6 #define TRIGT1RESULTBYTESTREAM_ROIBRESULTBYTESTREAMTOOL_H
7 
8 // Trigger includes
9 #include "L1TopoRDO/L1TopoRDO.h"
11 #include "TrigT1Result/Header.h"
12 #include "TrigT1Result/Trailer.h"
14 
15 // Athena includes:
19 
20 // System includes
21 #include <vector>
22 
23 // Forward declaration(s):
24 namespace ROIB {
25  class RoIBResult;
26 }
27 
39 class RoIBResultByteStreamTool : public extends<AthAlgTool, IL1TriggerByteStreamTool> {
40 
41 public:
43  RoIBResultByteStreamTool( const std::string& type, const std::string& name,
44  const IInterface* parent );
46  virtual ~RoIBResultByteStreamTool() = default;
47 
49  virtual StatusCode initialize() override;
50 
52  virtual StatusCode convertFromBS(const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& vrobf,
53  const EventContext& eventContext) const override;
54 
56  virtual StatusCode convertToBS(std::vector<OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment*>& vrobf,
57  const EventContext& eventContext) override;
58 
60  virtual const std::vector<uint32_t>& robIds() const override {return m_configuredROBIds;}
61 
62 private:
63 
64  // ------------------------- Private types -----------------------------------
66  struct DataStatus {
67  bool rob_error {false};
68  bool rod_error {false};
71  };
72 
73  // ------------------------- Private methods ---------------------------------
79  ROIB::Header roibHeader(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& rob, DataStatus& dataStatus) const;
80 
86  template<typename RoIType> std::vector<RoIType> roibContent(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment& rob) const;
87 
94 
100  ROIB::Trailer roibTrailer(const DataStatus& dataStatus, const uint32_t dataSize) const;
101 
102  // ------------------------- Properties --------------------------------------
106  Gaudi::Property<uint16_t> m_ctpModuleID {
107  this, "CTPModuleId", 1,
108  "Module ID of CTP ROB with RoI information. Value 0xFF disables CTP decoding/encoding in this tool."
109  };
111  Gaudi::Property<uint16_t> m_muCTPIModuleID {
112  this, "MUCTPIModuleId", 1,
113  "Module ID of MUCTPI ROB with RoI information. Value 0xFF disables MUCTPI decoding/encoding in this tool."
114  };
116  Gaudi::Property<std::vector<uint16_t>> m_jetModuleID {
117  this, "JetModuleIds", {0xac, 0xad},
118  "Vector of module IDs of Jet RoI ROBs. Empty vector disables Jet/Energy decoding/encoding in this tool."
119  };
121  Gaudi::Property<std::vector<uint16_t>> m_emModuleID {
122  this, "EMModuleIds", {0xa8, 0xa9, 0xaa, 0xab},
123  "Vector of module IDs of EM RoI ROBs. Empty vector disables EMTau decoding/encoding in this tool."
124  };
126  Gaudi::Property<std::vector<uint16_t>> m_l1TopoModuleID {
127  this, "L1TopoModuleIds", {0x81,0x91},
128  "Vector of module IDs of L1Topo RoI ROBs. Empty vector disables L1Topo decoding/encoding in this tool."
129  };
131 
133  Gaudi::Property<uint16_t> m_detEvType {
134  this, "DetEvType", 1, // RB: It was hard-coded to 1 in the past, no idea why
135  "Detector event type to write when converting to ByteStream"
136  };
137 
141  this, "RoIBResultWriteKey", "",
142  "Write handle key to RoIBResult for conversion from ByteStream"
143  };
145  this, "RoIBResultReadKey", "",
146  "Read handle key to RoIBResult for conversion to ByteStream"
147  };
149 
150  // ------------------------- Other private members ---------------------------
152  std::vector<uint32_t> m_configuredROBIds;
154  SmartIF<IByteStreamEventAccess> m_byteStreamEventAccess;
157  bool m_doCTP {true};
158  bool m_doMuon {true};
159  bool m_doJetEnergy {true};
160  bool m_doEMTau {true};
161  bool m_doTopo {true};
163 
164 }; // class RoIBResultByteStreamTool
165 
166 #endif // TRIGT1RESULTBYTESTREAM_ROIBRESULTBYTESTREAMTOOL_H
RoIBResultByteStreamTool::DataStatus::rob_error
bool rob_error
Definition: RoIBResultByteStreamTool.h:67
L1TopoRDO
The class that represents the raw data received from an L1Topo board.
Definition: L1TopoRDO.h:29
RoIBResultByteStreamTool::m_emModuleID
Gaudi::Property< std::vector< uint16_t > > m_emModuleID
EM Module IDs to decode.
Definition: RoIBResultByteStreamTool.h:121
RoIBResultByteStreamTool::m_jetModuleID
Gaudi::Property< std::vector< uint16_t > > m_jetModuleID
Jet Module IDs to decode.
Definition: RoIBResultByteStreamTool.h:116
RoIBResultByteStreamTool::initialize
virtual StatusCode initialize() override
Function to initialise the tool.
Definition: RoIBResultByteStreamTool.cxx:41
RoIBResultByteStreamTool::roibHeader
ROIB::Header roibHeader(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &rob, DataStatus &dataStatus) const
Helper method to extract ROD header information @in rob ROBFragment from which data are extracted @ou...
Definition: RoIBResultByteStreamTool.cxx:443
Trailer.h
L1TopoRDO.h
RoIBResultByteStreamTool::m_byteStreamEventAccess
SmartIF< IByteStreamEventAccess > m_byteStreamEventAccess
Interface to get raw event pointer for updating event header when writing to BS.
Definition: RoIBResultByteStreamTool.h:154
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
RoIBResultByteStreamTool::m_doTopo
bool m_doTopo
Definition: RoIBResultByteStreamTool.h:161
IL1TriggerByteStreamTool.h
RoIBResultByteStreamTool::convertToBS
virtual StatusCode convertToBS(std::vector< OFFLINE_FRAGMENTS_NAMESPACE_WRITE::ROBFragment * > &vrobf, const EventContext &eventContext) override
Convert RoIBResult to ByteStream.
Definition: RoIBResultByteStreamTool.cxx:129
IByteStreamEventAccess.h
SG::ReadHandleKey< ROIB::RoIBResult >
ROIB
Namespace of the LVL1 RoIB simulation.
Definition: ILvl1ResultAccessTool.h:19
RoIBResultByteStreamTool::convertFromBS
virtual StatusCode convertFromBS(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &vrobf, const EventContext &eventContext) const override
Convert ROB fragments to RoIBResult.
Definition: RoIBResultByteStreamTool.cxx:241
RoIBResultByteStreamTool::m_roibResultWriteKey
SG::WriteHandleKey< ROIB::RoIBResult > m_roibResultWriteKey
Definition: RoIBResultByteStreamTool.h:140
TrigT1StoreGateKeys.h
RoIBResultByteStreamTool::m_doJetEnergy
bool m_doJetEnergy
Definition: RoIBResultByteStreamTool.h:159
SG::WriteHandleKey< ROIB::RoIBResult >
eformat::ROBFragment
Definition: L1CaloBsDecoderUtil.h:12
ROIB::Header
Header models the LVL1 ROD Header.
Definition: TrigT1Result/TrigT1Result/Header.h:37
RawEvent.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
RoIBResultByteStreamTool::m_detEvType
Gaudi::Property< uint16_t > m_detEvType
Detector event type to write when converting to ByteStream.
Definition: RoIBResultByteStreamTool.h:133
AthAlgTool.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
RoIBResultByteStreamTool::m_l1TopoModuleID
Gaudi::Property< std::vector< uint16_t > > m_l1TopoModuleID
L1Topo Module IDs to decode.
Definition: RoIBResultByteStreamTool.h:126
RoIBResultByteStreamTool::m_doMuon
bool m_doMuon
Definition: RoIBResultByteStreamTool.h:158
RoIBResultByteStreamTool::m_doCTP
bool m_doCTP
Definition: RoIBResultByteStreamTool.h:157
RoIBResultByteStreamTool::DataStatus::status_word
uint32_t status_word
Definition: RoIBResultByteStreamTool.h:69
RoIBResultByteStreamTool::robIds
virtual const std::vector< uint32_t > & robIds() const override
Vector of ROB IDs corresponding to the modules configured for decoding.
Definition: RoIBResultByteStreamTool.h:60
RoIBResultByteStreamTool::m_muCTPIModuleID
Gaudi::Property< uint16_t > m_muCTPIModuleID
MUCTPI Module ID to decode.
Definition: RoIBResultByteStreamTool.h:111
RoIBResultByteStreamTool::~RoIBResultByteStreamTool
virtual ~RoIBResultByteStreamTool()=default
Default destructor.
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
PayloadHelpers::dataSize
size_t dataSize(TDA::PayloadIterator start)
Size in bytes of the buffer that is needed to decode next fragment data content.
Definition: TriggerEDMDeserialiserAlg.cxx:188
RoIBResultByteStreamTool::m_configuredROBIds
std::vector< uint32_t > m_configuredROBIds
Vector of ROB IDs corresponding to the modules configured for decoding.
Definition: RoIBResultByteStreamTool.h:152
RoIBResultByteStreamTool::m_doEMTau
bool m_doEMTau
Definition: RoIBResultByteStreamTool.h:160
Header.h
ROIB::Trailer
ROIB::Trailer models the LVL1 ROD Trailer.
Definition: Trailer.h:37
RoIBResultByteStreamTool::roibContent
std::vector< RoIType > roibContent(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &rob) const
Helper method to extract ROD payload @in ndata Number of data words @in data Data words.
RoIBResultByteStreamTool::l1topoContent
L1TopoRDO l1topoContent(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment &rob) const
Helper method to extract ROD payload for L1Topo (different interface from other RoI data) @in ndata N...
Definition: RoIBResultByteStreamTool.cxx:524
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
RoIBResultByteStreamTool::RoIBResultByteStreamTool
RoIBResultByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.
Definition: RoIBResultByteStreamTool.cxx:32
RoIBResultByteStreamTool::DataStatus::rod_error
bool rod_error
Definition: RoIBResultByteStreamTool.h:68
RoIBResultByteStreamTool::DataStatus::status_info
uint32_t status_info
Definition: RoIBResultByteStreamTool.h:70
RoIBResultByteStreamTool::m_roibResultReadKey
SG::ReadHandleKey< ROIB::RoIBResult > m_roibResultReadKey
Definition: RoIBResultByteStreamTool.h:144
RoIBResultByteStreamTool::DataStatus
Structure holding the status words and rob/rod error flags.
Definition: RoIBResultByteStreamTool.h:66
RoIBResultByteStreamTool::roibTrailer
ROIB::Trailer roibTrailer(const DataStatus &dataStatus, const uint32_t dataSize) const
Helper method to extract ROD trailer information @in dataStatus Structure to flag data errors (extrac...
Definition: RoIBResultByteStreamTool.cxx:499
RoIBResultByteStreamTool
Tool doing the RoIBResult <-> ByteStream conversion.
Definition: RoIBResultByteStreamTool.h:39
RoIBResultByteStreamTool::m_ctpModuleID
Gaudi::Property< uint16_t > m_ctpModuleID
Definition: RoIBResultByteStreamTool.h:106