ATLAS Offline Software
Loading...
Searching...
No Matches
CpByteStreamV1Tool.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_CPBYTESTREAMV1TOOL_H
6#define TRIGT1CALOBYTESTREAM_CPBYTESTREAMV1TOOL_H
7
8#include <stdint.h>
9
10#include <map>
11#include <string>
12#include <vector>
13
14#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 CMMCPHits;
32 class CPMHits;
33 class CPMTower;
34 class CPBSCollectionV1;
36 class TriggerTowerKey;
37}
38
39namespace LVL1BS {
40
41class CmmCpSubBlock;
42class CpmSubBlockV1;
44class L1CaloSrcIdMap;
45
53
55
56 public:
57 CpByteStreamV1Tool(const std::string& type, const std::string& name,
58 const IInterface* parent);
59 virtual ~CpByteStreamV1Tool();
60
62 static const InterfaceID& interfaceID();
63
64 virtual StatusCode initialize() override;
65
67 StatusCode convert(const std::string& sgKey,
68 const IROBDataProviderSvc::VROBFRAG& robFrags,
69 DataVector<LVL1::CPMTower>* ttCollection) const;
71 StatusCode convert(const std::string& sgKey,
72 const IROBDataProviderSvc::VROBFRAG& robFrags,
73 DataVector<LVL1::CPMHits>* hitCollection) const;
75 StatusCode convert(const std::string& sgKey,
76 const IROBDataProviderSvc::VROBFRAG& robFrags,
77 DataVector<LVL1::CMMCPHits>* hitCollection) const;
78
80 StatusCode convert(const LVL1::CPBSCollectionV1* cp) const;
81
83 const std::vector<uint32_t>& sourceIDs() const;
84
85 private:
87 { this, "ByteStreamCnvSvc", "ByteStreamCnvSvc" };
88
89 struct LocalData
90 {
92 int coreOverlap = 0;
94 unsigned int rodErr = 0;
96 std::vector<unsigned int> hitsVec0;
98 std::vector<unsigned int> hitsVec1;
100 std::vector<int> errVec0;
102 std::vector<int> errVec1;
104 std::vector<int> emVec;
106 std::vector<int> hadVec;
108 std::vector<int> emErrVec;
110 std::vector<int> hadErrVec;
113 };
114
116
120 typedef std::map<unsigned int, const LVL1::CPMTower*> ConstCpmTowerMap;
121 typedef std::map<unsigned int, LVL1::CPMTower*> CpmTowerMap;
122 typedef std::map<int, const LVL1::CPMHits*> ConstCpmHitsMap;
123 typedef std::map<int, LVL1::CPMHits*> CpmHitsMap;
124 typedef std::map<int, const LVL1::CMMCPHits*> ConstCmmCpHitsMap;
125 typedef std::map<int, LVL1::CMMCPHits*> CmmCpHitsMap;
126 typedef IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator;
129
131 {
133 : m_collection(collection){}
135 };
157
159 std::vector<uint32_t> makeSourceIDs() const;
160
162 StatusCode convertBs(const std::string& sgKey,
163 const IROBDataProviderSvc::VROBFRAG& robFrags,
166 void decodeCmmCp(CmmCpSubBlock* subBlock, int trigCmm, CmmHitsData& data,
167 LocalData& ld) const;
169 void decodeCpm(CpmSubBlockV1* subBlock, int trigCpm, CpByteStreamToolData& data,
170 LocalData& ld) const;
171
173 const LVL1::CPMTower* findCpmTower(unsigned int key,
174 const ConstCpmTowerMap& ttMap) const;
175 LVL1::CPMTower* findCpmTower(const CpmTowerData& data, unsigned int key) const;
177 const LVL1::CPMHits* findCpmHits(int crate, int module,
178 const ConstCpmHitsMap& hitsMap) const;
179 LVL1::CPMHits* findCpmHits(const CpmHitsData& data, int crate, int module) const;
181 const LVL1::CMMCPHits* findCmmCpHits(int crate, int dataID,
182 const ConstCmmCpHitsMap& cmmHitsMap) const;
184 int crate, int dataID) const;
185
187 void setupCpmTowerMap(const CpmTowerCollection* ttCollection,
188 ConstCpmTowerMap& ttMap,
189 LVL1::TriggerTowerKey& towerKey) const;
191 void setupCpmHitsMap(const CpmHitsCollection* hitCollection,
192 ConstCpmHitsMap& hitsMap) const;
194 void setupCmmCpHitsMap(const CmmCpHitsCollection* hitCollection,
195 ConstCmmCpHitsMap& cmmHitsMap) const;
196
198 bool slinkSlices(int crate, int module, int modulesPerSlink,
199 int& timeslices, int& trigJem,
200 const ConstCpmTowerMap& ttMap,
201 const ConstCpmHitsMap& hitsMap,
202 const ConstCmmCpHitsMap& cmmHitsMap,
203 LVL1::TriggerTowerKey& towerKey) const;
204
206 ToolHandle<LVL1::IL1CaloMappingTool> m_cpmMaps;
208 ToolHandle<LVL1BS::L1CaloErrorByteStreamTool> m_errorTool;
209
219 const int m_channels;
223 const int m_modules;
235 std::vector<uint32_t> m_sourceIDsProp;
237 const eformat::SubDetector m_subDetector;
240};
241
242} // end namespace
243
244#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.
int m_slinks
Property: Number of slinks per crate when writing out bytestream.
CpByteStreamV1Tool(const std::string &type, const std::string &name, const IInterface *parent)
int m_dfltSlices
Property: Default number of slices in simulation.
int m_crates
Property: Number of crates.
void setupCpmHitsMap(const CpmHitsCollection *hitCollection, ConstCpmHitsMap &hitsMap) const
Set up CPM hits map.
ServiceHandle< IByteStreamCnvSvc > m_byteStreamCnvSvc
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.
std::map< int, const LVL1::CPMHits * > ConstCpmHitsMap
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
int m_crateOffsetSw
Property: Software crate number offset.
IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator
std::map< int, const LVL1::CMMCPHits * > ConstCmmCpHitsMap
const L1CaloSrcIdMap m_srcIdMap
Source ID converter.
int m_forceSlices
Property: Force number of slices in bytestream.
const LVL1::CPMHits * findCpmHits(int crate, int module, const ConstCpmHitsMap &hitsMap) const
Find CPM hits for given crate, module.
std::map< unsigned int, LVL1::CPMTower * > CpmTowerMap
void setupCmmCpHitsMap(const CmmCpHitsCollection *hitCollection, ConstCmmCpHitsMap &cmmHitsMap) const
Set up CMM-CP hits map.
std::vector< uint32_t > m_sourceIDsProp
Property: ROB source IDs.
void setupCpmTowerMap(const CpmTowerCollection *ttCollection, ConstCpmTowerMap &ttMap, LVL1::TriggerTowerKey &towerKey) const
Set up CPM tower map.
int m_version
Property: Sub_block header version.
std::vector< uint32_t > makeSourceIDs() const
Create list of all source IDs.
StatusCode convertBs(const std::string &sgKey, const IROBDataProviderSvc::VROBFRAG &robFrags, CpByteStreamToolData &data) const
Convert bytestream to given container type.
DataVector< LVL1::CPMHits > CpmHitsCollection
const LVL1::CPMTower * findCpmTower(unsigned int key, const ConstCpmTowerMap &ttMap) const
Find a CPM tower for given key.
std::map< unsigned int, const LVL1::CPMTower * > ConstCpmTowerMap
int m_crateMin
Property: Minimum crate number when writing out bytestream.
ToolHandle< LVL1::IL1CaloMappingTool > m_cpmMaps
Channel mapping tool.
std::map< int, LVL1::CMMCPHits * > CmmCpHitsMap
const std::vector< uint32_t > & sourceIDs() const
Return reference to vector with all possible Source Identifiers.
StatusCode convert(const std::string &sgKey, const IROBDataProviderSvc::VROBFRAG &robFrags, DataVector< LVL1::CPMTower > *ttCollection) const
Convert ROB fragments to CPM towers.
int m_dataFormat
Property: Data compression format.
const int m_channels
Number of channels per module.
const LVL1::CMMCPHits * findCmmCpHits(int crate, int dataID, const ConstCmmCpHitsMap &cmmHitsMap) const
Find CMM-CP hits for given crate, data ID.
ToolHandle< LVL1BS::L1CaloErrorByteStreamTool > m_errorTool
Error collection tool.
int m_crateOffsetHw
Property: Hardware crate number offset.
OFFLINE_FRAGMENTS_NAMESPACE::PointerType RODPointer
void decodeCmmCp(CmmCpSubBlock *subBlock, int trigCmm, CmmHitsData &data, LocalData &ld) const
Unpack CMM-CP sub-block.
int m_crateMax
Property: Maximum crate number when writing out bytestream.
virtual StatusCode initialize() override
const eformat::SubDetector m_subDetector
Sub-detector type.
void decodeCpm(CpmSubBlockV1 *subBlock, int trigCpm, CpByteStreamToolData &data, LocalData &ld) const
Unpack CPM sub-block.
std::map< int, LVL1::CPMHits * > CpmHitsMap
DataVector< LVL1::CMMCPHits > CmmCpHitsCollection
DataVector< LVL1::CPMTower > CpmTowerCollection
const int m_modules
Number of CPM modules per crate.
OFFLINE_FRAGMENTS_NAMESPACE::PointerType ROBPointer
Sub-Block class for CPM data.
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)
CpmTowerData(CpmTowerCollection *const ttCollection)
std::vector< int > errVec0
Error0 vector for unpacking.
unsigned int rodErr
Unpacking error code.
std::vector< unsigned int > hitsVec0
Hits0 vector for unpacking.
LVL1::TriggerTowerKey towerKey
Trigger tower key provider.
int coreOverlap
Tower channels to accept (1=Core, 2=Overlap)
std::vector< int > hadErrVec
Had error data vector for unpacking.
std::vector< unsigned int > hitsVec1
Hits1 vector for unpacking.
std::vector< int > emErrVec
EM error data vector for unpacking.
std::vector< int > errVec1
Error1 vector for unpacking.
std::vector< int > hadVec
Had data vector for unpacking.
std::vector< int > emVec
EM data vector for unpacking.