ATLAS Offline Software
Loading...
Searching...
No Matches
CpByteStreamV2Tool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 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 std::string& sgKey, DataVector<LVL1::CPMTower>* ttCollection) const;
68 StatusCode convert(const std::string& sgKey,
69 const IROBDataProviderSvc::VROBFRAG& robFrags,
70 DataVector<LVL1::CPMTower>* ttCollection) const;
72 StatusCode convert(const std::string& sgKey,
73 DataVector<LVL1::CMXCPTob>* tobCollection) const;
74 StatusCode convert(const std::string& sgKey,
75 const IROBDataProviderSvc::VROBFRAG& robFrags,
76 DataVector<LVL1::CMXCPTob>* tobCollection) const;
78 StatusCode convert(const std::string& sgKey,
79 DataVector<LVL1::CMXCPHits>* hitCollection) const;
80 StatusCode convert(const std::string& sgKey,
81 const IROBDataProviderSvc::VROBFRAG& robFrags,
82 DataVector<LVL1::CMXCPHits>* hitCollection) const;
83
85 StatusCode convert(const LVL1::CPBSCollectionV2* cp) const;
86
88 const std::vector<uint32_t>& sourceIDs() const;
89
90 private:
91 // Need option to disable dependency on offline ByteStreamCnvSvc to be able to run
92 // decoding in online HLT framework (which uses TrigByteStreamCnvSvc)
93 Gaudi::Property<bool> m_enableEncoding{
94 this, "enableEncoding", true, "Enable conversion from RDO to ByteStream"};
95 SmartIF<IByteStreamCnvSvc> m_byteStreamCnvSvc;
96
97 struct LocalData
98 {
100 int coreOverlap = 0;
102 unsigned int rodErr = 0;
104 std::vector<int> energyVec;
106 std::vector<int> isolVec;
108 std::vector<int> errorVec;
110 std::vector<unsigned int> presenceMapVec;
112 std::vector<unsigned int> hitsVec0;
114 std::vector<unsigned int> hitsVec1;
116 std::vector<int> errVec0;
118 std::vector<int> errVec1;
120 std::vector<int> emVec;
122 std::vector<int> hadVec;
124 std::vector<int> emErrVec;
126 std::vector<int> hadErrVec;
129 };
130
132
136 typedef std::map<unsigned int, LVL1::CPMTower*> CpmTowerMap;
137 typedef std::map<unsigned int, const LVL1::CPMTower*> ConstCpmTowerMap;
138 typedef std::map<int, LVL1::CMXCPTob*> CmxCpTobMap;
139 typedef std::map<int, const LVL1::CMXCPTob*> ConstCmxCpTobMap;
140 typedef std::map<int, LVL1::CMXCPHits*> CmxCpHitsMap;
141 typedef std::map<int, const LVL1::CMXCPHits*> ConstCmxCpHitsMap;
142 typedef IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator;
145
147 {
149 : m_collection(collection){}
151 };
173
175 std::vector<uint32_t> makeSourceIDs() const;
176
178 StatusCode convertBs(const std::string& sgKey,
179 const IROBDataProviderSvc::VROBFRAG& robFrags,
182 void decodeCmxCp(CmxCpSubBlock* subBlock, int trigCpm, CpByteStreamToolData& data,
183 LocalData& ld) const;
185 void decodeCpm(CpmSubBlockV2* subBlock, int trigCpm, CpmTowerData& data,
186 LocalData& ld) const;
187
189 const LVL1::CPMTower* findCpmTower(unsigned int key,
190 const ConstCpmTowerMap& ttMap) const;
191 LVL1::CPMTower* findCpmTower(const CpmTowerData& data, unsigned int key) const;
193 const LVL1::CMXCPTob* findCmxCpTob(int key,
194 const ConstCmxCpTobMap& tobMap) const;
195 LVL1::CMXCPTob* findCmxCpTob(const CmxCpTobData& data, int key) const;
197 const LVL1::CMXCPHits* findCmxCpHits(int key,
198 const ConstCmxCpHitsMap& hitsMap) const;
199 LVL1::CMXCPHits* findCmxCpHits(const CmxCpHitsData& data, int key) const;
200
202 void setupCpmTowerMap(const CpmTowerCollection* ttCollection,
203 ConstCpmTowerMap& ttMap,
204 LVL1::TriggerTowerKey& towerKey) const;
206 void setupCmxCpTobMap(const CmxCpTobCollection* tobCollection,
207 ConstCmxCpTobMap& tobMap) const;
209 void setupCmxCpHitsMap(const CmxCpHitsCollection* hitCollection,
210 ConstCmxCpHitsMap& hitsMap) const;
211
213 int tobKey(int crate, int cmx, int cpm, int chip, int loc) const;
215 int hitsKey(int crate, int cmx, int source) const;
216
218 bool slinkSlices(int crate, int module, int modulesPerSlink,
219 int& timeslices, int& trigJem,
220 const ConstCpmTowerMap& ttMap,
221 const ConstCmxCpTobMap& tobMap,
222 const ConstCmxCpHitsMap& hitsMap,
223 LVL1::TriggerTowerKey& towerKey) const;
224
226 ToolHandle<LVL1::IL1CaloMappingTool> m_cpmMaps;
228 ToolHandle<LVL1BS::L1CaloErrorByteStreamTool> m_errorTool;
239 const int m_channels;
243 const int m_modules;
245 const int m_cmxs;
247 const int m_maxTobs;
249 const int m_chips;
251 const int m_locs;
263 const eformat::SubDetector m_subDetector;
267 std::vector<uint32_t> m_sourceIDsProp;
268};
269
270} // end namespace
271
272#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.
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
StatusCode convert(const std::string &sgKey, DataVector< LVL1::CPMTower > *ttCollection) const
Convert ROB fragments to CPM towers.
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.
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.