ATLAS Offline Software
Loading...
Searching...
No Matches
CpByteStreamTool.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_CPBYTESTREAMTOOL_H
6#define TRIGT1CALOBYTESTREAM_CPBYTESTREAMTOOL_H
7
8#include <stdint.h>
9
10#include <map>
11#include <string>
12#include <vector>
13
14#include "L1CaloSrcIdMap.h"
20#include "eformat/SourceIdentifier.h"
21#include "GaudiKernel/ToolHandle.h"
22
23class IInterface;
24class InterfaceID;
25class StatusCode;
26
27template <typename> class FullEventAssembler;
28
29namespace LVL1 {
30 class CMMCPHits;
31 class CPMHits;
32 class CPMTower;
33 class CPBSCollection;
35 class TriggerTowerKey;
36}
37
38namespace LVL1BS {
39
40class CmmCpSubBlock;
41class CpmSubBlock;
43class L1CaloSrcIdMap;
44
52
54
55 public:
56 CpByteStreamTool(const std::string& type, const std::string& name,
57 const IInterface* parent);
58 virtual ~CpByteStreamTool();
59
61 static const InterfaceID& interfaceID();
62
63 virtual StatusCode initialize() override;
64
66 StatusCode convert(const std::string& sgKey,
67 const IROBDataProviderSvc::VROBFRAG& robFrags,
68 DataVector<LVL1::CPMTower>* ttCollection) const;
70 StatusCode convert(const std::string& sgKey,
71 const IROBDataProviderSvc::VROBFRAG& robFrags,
72 DataVector<LVL1::CPMHits>* hitCollection) const;
74 StatusCode convert(const std::string& sgKey,
75 const IROBDataProviderSvc::VROBFRAG& robFrags,
76 DataVector<LVL1::CMMCPHits>* hitCollection) const;
77
79 StatusCode convert(const LVL1::CPBSCollection* cp) const;
80
82 const std::vector<uint32_t>& sourceIDs() const;
83
84 private:
86 { this, "ByteStreamCnvSvc", "ByteStreamCnvSvc" };
87
88 struct LocalData
89 {
93 unsigned int rodErr = 0;
95 std::vector<unsigned int> hitsVec0;
97 std::vector<unsigned int> hitsVec1;
99 std::vector<int> errVec0;
101 std::vector<int> errVec1;
103 std::vector<int> emVec;
105 std::vector<int> hadVec;
107 std::vector<int> emErrVec;
109 std::vector<int> hadErrVec;
112 };
113
115
119 typedef std::map<unsigned int, LVL1::CPMTower*> CpmTowerMap;
120 typedef std::map<unsigned int, const LVL1::CPMTower*> ConstCpmTowerMap;
121 typedef std::map<int, LVL1::CPMHits*> CpmHitsMap;
122 typedef std::map<int, const LVL1::CPMHits*> ConstCpmHitsMap;
123 typedef std::map<int, LVL1::CMMCPHits*> CmmCpHitsMap;
124 typedef std::map<int, const LVL1::CMMCPHits*> ConstCmmCpHitsMap;
125 typedef IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator;
128
130 {
132 : m_collection(collection){}
134 };
156
158 std::vector<uint32_t> makeSourceIDs() const;
159
161 StatusCode convertBs(const std::string& sgKey,
162 const IROBDataProviderSvc::VROBFRAG& robFrags,
165 void decodeCmmCp(CmmCpSubBlock* subBlock, int trigCmm, CmmHitsData& data,
166 LocalData& ld) const;
168 void decodeCpm(CpmSubBlock* subBlock, int trigCpm, CpByteStreamToolData& data,
169 LocalData& ld) const;
170
172 const LVL1::CPMTower* findCpmTower(unsigned int key,
173 const ConstCpmTowerMap& ttMap) const;
174 LVL1::CPMTower* findCpmTower(const CpmTowerData& data, unsigned int key) const;
176 const LVL1::CPMHits* findCpmHits(int crate, int module,
177 const ConstCpmHitsMap& hitsMap) const;
178 LVL1::CPMHits* findCpmHits(const CpmHitsData& data, int crate, int module) const;
180 const LVL1::CMMCPHits* findCmmCpHits(int crate, int dataID,
181 const ConstCmmCpHitsMap& cmmHitsMap) const;
183 int crate, int dataID) const;
184
186 void setupCpmTowerMap(const CpmTowerCollection* ttCollection,
187 ConstCpmTowerMap& ttMap,
188 LVL1::TriggerTowerKey& towerKey) const;
190 void setupCpmHitsMap(const CpmHitsCollection* hitCollection,
191 ConstCpmHitsMap& hitsMap) const;
193 void setupCmmCpHitsMap(const CmmCpHitsCollection* hitCollection,
194 ConstCmmCpHitsMap& cmmHitsMap) const;
195
197 bool slinkSlices(int crate, int module, int modulesPerSlink,
198 int& timeslices, int& trigJem,
199 const ConstCpmTowerMap& ttMap,
200 const ConstCpmHitsMap& hitsMap,
201 const ConstCmmCpHitsMap& cmmHitsMap,
202 LVL1::TriggerTowerKey& towerKey) const;
203
205 ToolHandle<LVL1::IL1CaloMappingTool> m_cpmMaps;
207 ToolHandle<LVL1BS::L1CaloErrorByteStreamTool> m_errorTool;
208
218 const int m_channels;
220 const int m_crates;
222 const int m_modules;
230 std::vector<uint32_t> m_sourceIDsProp;
232 const eformat::SubDetector m_subDetector;
235};
236
237} // end namespace
238
239#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 CMM-CP data.
std::vector< uint32_t > m_sourceIDsProp
Property: ROB source IDs.
virtual StatusCode initialize() override
DataVector< LVL1::CPMTower > CpmTowerCollection
std::map< int, LVL1::CPMHits * > CpmHitsMap
int m_dataFormat
Property: Data compression format.
StatusCode convert(const std::string &sgKey, const IROBDataProviderSvc::VROBFRAG &robFrags, DataVector< LVL1::CPMTower > *ttCollection) const
Convert ROB fragments to CPM towers.
void setupCmmCpHitsMap(const CmmCpHitsCollection *hitCollection, ConstCmmCpHitsMap &cmmHitsMap) const
Set up CMM-CP hits map.
void decodeCmmCp(CmmCpSubBlock *subBlock, int trigCmm, CmmHitsData &data, LocalData &ld) const
Unpack CMM-CP sub-block.
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
int m_dfltSlices
Property: Default number of slices in simulation.
ToolHandle< LVL1::IL1CaloMappingTool > m_cpmMaps
Property: Channel mapping tool.
const LVL1::CMMCPHits * findCmmCpHits(int crate, int dataID, const ConstCmmCpHitsMap &cmmHitsMap) const
Find CMM-CP hits for given crate, data ID.
std::map< unsigned int, LVL1::CPMTower * > CpmTowerMap
int m_slinks
Property: Number of slinks per crate when writing out bytestream.
OFFLINE_FRAGMENTS_NAMESPACE::PointerType ROBPointer
const LVL1::CPMTower * findCpmTower(unsigned int key, const ConstCpmTowerMap &ttMap) const
Find a CPM tower for given key.
bool slinkSlices(int crate, int module, int modulesPerSlink, int &timeslices, int &trigJem, const ConstCpmTowerMap &ttMap, const ConstCpmHitsMap &hitsMap, const ConstCmmCpHitsMap &cmmHitsMap, LVL1::TriggerTowerKey &towerKey) const
Get number of slices and triggered slice offset for next slink.
void setupCpmTowerMap(const CpmTowerCollection *ttCollection, ConstCpmTowerMap &ttMap, LVL1::TriggerTowerKey &towerKey) const
Set up CPM tower map.
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.
OFFLINE_FRAGMENTS_NAMESPACE::PointerType RODPointer
int m_version
Property: Sub_block header version.
std::vector< uint32_t > makeSourceIDs() const
Create list of all source IDs.
int m_crateOffsetSw
Property: Software crate number offset.
int m_forceSlices
Property: Force number of slices in bytestream.
const L1CaloSrcIdMap m_srcIdMap
Source ID converter.
const int m_channels
Number of channels per module.
ToolHandle< LVL1BS::L1CaloErrorByteStreamTool > m_errorTool
Error collection tool.
void setupCpmHitsMap(const CpmHitsCollection *hitCollection, ConstCpmHitsMap &hitsMap) const
Set up CPM hits map.
IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator
std::map< int, LVL1::CMMCPHits * > CmmCpHitsMap
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
const LVL1::CPMHits * findCpmHits(int crate, int module, const ConstCpmHitsMap &hitsMap) const
Find CPM hits for given crate, module.
std::map< int, const LVL1::CPMHits * > ConstCpmHitsMap
int m_crateOffsetHw
Property: Hardware crate number offset.
CpByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
std::map< int, const LVL1::CMMCPHits * > ConstCmmCpHitsMap
DataVector< LVL1::CPMHits > CpmHitsCollection
const int m_crates
Number of crates.
void decodeCpm(CpmSubBlock *subBlock, int trigCpm, CpByteStreamToolData &data, LocalData &ld) const
Unpack CPM sub-block.
std::map< unsigned int, const LVL1::CPMTower * > ConstCpmTowerMap
const std::vector< uint32_t > & sourceIDs() const
Return reference to vector with all possible Source Identifiers.
const int m_modules
Number of CPM modules per crate.
DataVector< LVL1::CMMCPHits > CmmCpHitsCollection
Sub-Block class for CPM data.
Definition CpmSubBlock.h:23
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 received by the merger modules.
Cluster Processor container for writing bytestream.
The CPMHits object contains the hit data produced by a given Cluster Processor Module,...
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
CmmHitsData(CmmCpHitsCollection *const hitCollection)
CmmCpHitsCollection *const m_cmmHitCollection
CpByteStreamToolData(const CollectionType collection)
CpmHitsData(CpmHitsCollection *const hitCollection)
CpmHitsCollection *const m_hitCollection
CpmTowerCollection *const m_ttCollection
CpmTowerData(CpmTowerCollection *const ttCollection)
std::vector< int > emErrVec
EM error data vector for unpacking.
int coreOverlap
Tower channels to accept (1=Core, 2=Overlap)
std::vector< int > errVec0
Error0 vector for unpacking.
std::vector< int > hadVec
Had data vector for unpacking.
std::vector< int > errVec1
Error1 vector for unpacking.
std::vector< unsigned int > hitsVec1
Hits1 vector for unpacking.
std::vector< unsigned int > hitsVec0
Hits0 vector for unpacking.
unsigned int rodErr
Unpacking error code.
std::vector< int > emVec
EM data vector for unpacking.
std::vector< int > hadErrVec
Had error data vector for unpacking.
LVL1::TriggerTowerKey * towerKey
Trigger tower key provider.