ATLAS Offline Software
Loading...
Searching...
No Matches
CpByteStreamV2Tool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGT1CALOBYTESTREAM_CPBYTESTREAMV2TOOL_H
6#define TRIGT1CALOBYTESTREAM_CPBYTESTREAMV2TOOL_H
7
8#include <stdint.h>
9
10#include <map>
11#include <string>
12#include <vector>
13
15#include "L1CaloSrcIdMap.h"
21#include "eformat/SourceIdentifier.h"
22#include "GaudiKernel/ToolHandle.h"
23
24class IInterface;
25class InterfaceID;
26class StatusCode;
27
28template <typename> class FullEventAssembler;
29
30namespace LVL1 {
31 class CMXCPHits;
32 class CMXCPTob;
33 class CPMTower;
34 class CPBSCollectionV2;
36 class TriggerTowerKey;
37}
38
39namespace LVL1BS {
40
41class CmxCpSubBlock;
42class CpmSubBlockV2;
44class L1CaloSrcIdMap;
45
53
55
56 public:
57 CpByteStreamV2Tool(const std::string& type, const std::string& name,
58 const IInterface* parent);
59 virtual ~CpByteStreamV2Tool();
60
62 static const InterfaceID& interfaceID();
63
64 virtual StatusCode initialize() override;
65
67 StatusCode convert(const EventContext& ctx,
68 const std::string& sgKey,
69 DataVector<LVL1::CPMTower>* ttCollection) const;
70 StatusCode convert(const std::string& sgKey,
71 const IROBDataProviderSvc::VROBFRAG& robFrags,
72 DataVector<LVL1::CPMTower>* ttCollection) const;
74 StatusCode convert(const EventContext& ctx,
75 const std::string& sgKey,
76 DataVector<LVL1::CMXCPTob>* tobCollection) const;
77 StatusCode convert(const std::string& sgKey,
78 const IROBDataProviderSvc::VROBFRAG& robFrags,
79 DataVector<LVL1::CMXCPTob>* tobCollection) const;
81 StatusCode convert(const EventContext& ctx,
82 const std::string& sgKey,
83 DataVector<LVL1::CMXCPHits>* hitCollection) const;
84 StatusCode convert(const std::string& sgKey,
85 const IROBDataProviderSvc::VROBFRAG& robFrags,
86 DataVector<LVL1::CMXCPHits>* hitCollection) const;
87
89 StatusCode convert(const LVL1::CPBSCollectionV2* cp) const;
90
92 const std::vector<uint32_t>& sourceIDs() const;
93
94 private:
95 // Need option to disable dependency on offline ByteStreamCnvSvc to be able to run
96 // decoding in online HLT framework (which uses TrigByteStreamCnvSvc)
97 Gaudi::Property<bool> m_enableEncoding{
98 this, "enableEncoding", true, "Enable conversion from RDO to ByteStream"};
99 SmartIF<IByteStreamCnvSvc> m_byteStreamCnvSvc;
100
102 {
104 int coreOverlap = 0;
106 unsigned int rodErr = 0;
108 std::vector<int> energyVec;
110 std::vector<int> isolVec;
112 std::vector<int> errorVec;
114 std::vector<unsigned int> presenceMapVec;
116 std::vector<unsigned int> hitsVec0;
118 std::vector<unsigned int> hitsVec1;
120 std::vector<int> errVec0;
122 std::vector<int> errVec1;
124 std::vector<int> emVec;
126 std::vector<int> hadVec;
128 std::vector<int> emErrVec;
130 std::vector<int> hadErrVec;
133 };
134
136
140 typedef std::map<unsigned int, LVL1::CPMTower*> CpmTowerMap;
141 typedef std::map<unsigned int, const LVL1::CPMTower*> ConstCpmTowerMap;
142 typedef std::map<int, LVL1::CMXCPTob*> CmxCpTobMap;
143 typedef std::map<int, const LVL1::CMXCPTob*> ConstCmxCpTobMap;
144 typedef std::map<int, LVL1::CMXCPHits*> CmxCpHitsMap;
145 typedef std::map<int, const LVL1::CMXCPHits*> ConstCmxCpHitsMap;
146 typedef IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator;
149
151 {
153 : m_collection(collection){}
155 };
177
179 std::vector<uint32_t> makeSourceIDs() const;
180
182 StatusCode convertBs(const std::string& sgKey,
183 const IROBDataProviderSvc::VROBFRAG& robFrags,
186 void decodeCmxCp(CmxCpSubBlock* subBlock, int trigCpm, CpByteStreamToolData& data,
187 LocalData& ld) const;
189 void decodeCpm(CpmSubBlockV2* subBlock, int trigCpm, CpmTowerData& data,
190 LocalData& ld) const;
191
193 const LVL1::CPMTower* findCpmTower(unsigned int key,
194 const ConstCpmTowerMap& ttMap) const;
195 LVL1::CPMTower* findCpmTower(const CpmTowerData& data, unsigned int key) const;
197 const LVL1::CMXCPTob* findCmxCpTob(int key,
198 const ConstCmxCpTobMap& tobMap) const;
199 LVL1::CMXCPTob* findCmxCpTob(const CmxCpTobData& data, int key) const;
201 const LVL1::CMXCPHits* findCmxCpHits(int key,
202 const ConstCmxCpHitsMap& hitsMap) const;
203 LVL1::CMXCPHits* findCmxCpHits(const CmxCpHitsData& data, int key) const;
204
206 void setupCpmTowerMap(const CpmTowerCollection* ttCollection,
207 ConstCpmTowerMap& ttMap,
208 LVL1::TriggerTowerKey& towerKey) const;
210 void setupCmxCpTobMap(const CmxCpTobCollection* tobCollection,
211 ConstCmxCpTobMap& tobMap) const;
213 void setupCmxCpHitsMap(const CmxCpHitsCollection* hitCollection,
214 ConstCmxCpHitsMap& hitsMap) const;
215
217 int tobKey(int crate, int cmx, int cpm, int chip, int loc) const;
219 int hitsKey(int crate, int cmx, int source) const;
220
222 bool slinkSlices(int crate, int module, int modulesPerSlink,
223 int& timeslices, int& trigJem,
224 const ConstCpmTowerMap& ttMap,
225 const ConstCmxCpTobMap& tobMap,
226 const ConstCmxCpHitsMap& hitsMap,
227 LVL1::TriggerTowerKey& towerKey) const;
228
230 ToolHandle<LVL1::IL1CaloMappingTool> m_cpmMaps;
232 ToolHandle<LVL1BS::L1CaloErrorByteStreamTool> m_errorTool;
243 const int m_channels;
247 const int m_modules;
249 const int m_cmxs;
251 const int m_maxTobs;
253 const int m_chips;
255 const int m_locs;
267 const eformat::SubDetector m_subDetector;
271 std::vector<uint32_t> m_sourceIDsProp;
272};
273
274} // end namespace
275
276#endif
An STL vector of pointers that by default owns its pointed-to elements.
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Derived DataVector<T>.
Definition DataVector.h:795
Template class for assembling a full atlas raw event from subfragments.
std::vector< const ROBF * > VROBFRAG
Sub-Block class for CMX-CP data post LS1.
const LVL1::CPMTower * findCpmTower(unsigned int key, const ConstCpmTowerMap &ttMap) const
Find a CPM tower for given key.
const eformat::SubDetector m_subDetector
Sub-detector type.
StatusCode convertBs(const std::string &sgKey, const IROBDataProviderSvc::VROBFRAG &robFrags, CpByteStreamToolData &data) const
Convert bytestream to given container type.
const int m_cmxs
Number of CMXs per crate.
void decodeCmxCp(CmxCpSubBlock *subBlock, int trigCpm, CpByteStreamToolData &data, LocalData &ld) const
Unpack CMX-CP sub-block.
CpByteStreamV2Tool(const std::string &type, const std::string &name, const IInterface *parent)
const LVL1::CMXCPHits * findCmxCpHits(int key, const ConstCmxCpHitsMap &hitsMap) const
Find CMX-CP hits for given key.
void setupCpmTowerMap(const CpmTowerCollection *ttCollection, ConstCpmTowerMap &ttMap, LVL1::TriggerTowerKey &towerKey) const
Set up CPM tower map.
DataVector< LVL1::CPMTower > CpmTowerCollection
IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator
int hitsKey(int crate, int cmx, int source) const
Key for Hits.
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
const int m_channels
Number of channels per module.
int m_crateMax
Property: Maximum crate number when writing out bytestream.
int m_crateMin
Property: Minimum crate number when writing out bytestream.
const int m_maxTobs
Maximum number of TOBS per module.
std::vector< uint32_t > makeSourceIDs() const
Create list of all source IDs.
const int m_locs
Number of Local coordinates.
int m_version
Property: Sub_block header version.
int m_dataFormat
Property: Data compression format.
const std::vector< uint32_t > & sourceIDs() const
Return reference to vector with all possible Source Identifiers.
DataVector< LVL1::CMXCPHits > CmxCpHitsCollection
ToolHandle< LVL1BS::L1CaloErrorByteStreamTool > m_errorTool
Error collection tool.
int m_forceSlices
Property: Force number of slices in bytestream.
const L1CaloSrcIdMap m_srcIdMap
Source ID converter.
SmartIF< IByteStreamCnvSvc > m_byteStreamCnvSvc
const LVL1::CMXCPTob * findCmxCpTob(int key, const ConstCmxCpTobMap &tobMap) const
Find CMX-CP TOB for given key.
int m_slinks
Property: Number of slinks per crate when writing out bytestream.
int m_crateOffsetHw
Property: Hardware crate number offset.
Gaudi::Property< bool > m_enableEncoding
std::map< unsigned int, const LVL1::CPMTower * > ConstCpmTowerMap
DataVector< LVL1::CMXCPTob > CmxCpTobCollection
std::map< int, const LVL1::CMXCPHits * > ConstCmxCpHitsMap
int m_dfltSlices
Property: Default number of slices in simulation.
const int m_chips
Number of chips.
StatusCode convert(const EventContext &ctx, const std::string &sgKey, DataVector< LVL1::CPMTower > *ttCollection) const
Convert ROB fragments to CPM towers.
OFFLINE_FRAGMENTS_NAMESPACE::PointerType RODPointer
void decodeCpm(CpmSubBlockV2 *subBlock, int trigCpm, CpmTowerData &data, LocalData &ld) const
Unpack CPM sub-block.
void setupCmxCpHitsMap(const CmxCpHitsCollection *hitCollection, ConstCmxCpHitsMap &hitsMap) const
Set up CMX-CP hits map.
const int m_modules
Number of CPM modules per crate.
int m_crates
Property: Number of crates.
void setupCmxCpTobMap(const CmxCpTobCollection *tobCollection, ConstCmxCpTobMap &tobMap) const
Set up CMX-CP TOB map.
int m_crateOffsetSw
Property: Software crate number offset.
OFFLINE_FRAGMENTS_NAMESPACE::PointerType ROBPointer
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
std::map< int, const LVL1::CMXCPTob * > ConstCmxCpTobMap
std::map< unsigned int, LVL1::CPMTower * > CpmTowerMap
std::vector< uint32_t > m_sourceIDsProp
Property: ROB source IDs.
bool slinkSlices(int crate, int module, int modulesPerSlink, int &timeslices, int &trigJem, const ConstCpmTowerMap &ttMap, const ConstCmxCpTobMap &tobMap, const ConstCmxCpHitsMap &hitsMap, LVL1::TriggerTowerKey &towerKey) const
Get number of slices and triggered slice offset for next slink.
std::map< int, LVL1::CMXCPHits * > CmxCpHitsMap
int tobKey(int crate, int cmx, int cpm, int chip, int loc) const
Key for TOBs.
virtual StatusCode initialize() override
ToolHandle< LVL1::IL1CaloMappingTool > m_cpmMaps
Channel mapping tool.
std::map< int, LVL1::CMXCPTob * > CmxCpTobMap
Sub-Block class for CPM data post LS1.
Tool to accumulate ROB/ROD unpacking errors.
This class provides conversion between Lower level Source ID to higher level source ID for L1Calo Byt...
Summary of CP (EM/tau) hits produced by the merger modules.
TOB data received by the merger modules.
Cluster Processor container for writing bytestream.
The CPMTower class contains the TriggerTower information received by the Cluster Processor Modules.
The TriggerTowerKey object provides the key for each trigger tower depending on its eta-phi coords.
::StatusCode StatusCode
StatusCode definition for legacy code.
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
const DataType * PointerType
Definition RawEvent.h:25
CmxCpHitsData(CmxCpHitsCollection *const hitCollection)
CmxCpTobData(CmxCpTobCollection *const tobCollection)
CpByteStreamToolData(const CollectionType collection)
CpmTowerData(CpmTowerCollection *const ttCollection)
std::vector< int > emErrVec
EM error data vector for unpacking.
std::vector< int > hadVec
Had data vector for unpacking.
std::vector< int > errorVec
TOB error vector for unpacking.
int coreOverlap
Tower channels to accept (1=Core, 2=Overlap).
unsigned int rodErr
Unpacking error code.
std::vector< int > isolVec
Isolation vector for unpacking.
LVL1::TriggerTowerKey towerKey
Trigger tower key provider.
std::vector< int > errVec1
Error1 vector for unpacking.
std::vector< unsigned int > hitsVec1
Hits1 vector for unpacking.
std::vector< int > errVec0
Error0 vector for unpacking.
std::vector< int > emVec
EM data vector for unpacking.
std::vector< unsigned int > presenceMapVec
Presence map vector for unpacking.
std::vector< unsigned int > hitsVec0
Hits0 vector for unpacking.
std::vector< int > hadErrVec
Had error data vector for unpacking.
std::vector< int > energyVec
Energy vector for unpacking.