ATLAS Offline Software
Loading...
Searching...
No Matches
JepByteStreamV2Tool.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_JEPBYTESTREAMV2TOOL_H
6#define TRIGT1CALOBYTESTREAM_JEPBYTESTREAMV2TOOL_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
24#include "CmxEnergySubBlock.h"
25
26class IInterface;
27class InterfaceID;
28class StatusCode;
29
30template <class T> class FullEventAssembler;
31
32namespace LVL1 {
33 class CMXJetHits;
34 class CMXJetTob;
35 class CMXEtSums;
37 class JEMEtSums;
39 class JetElement;
40 class JetElementKey;
41}
42
43namespace LVL1BS {
44
45class CmxJetSubBlock;
46class JemSubBlockV2;
48class L1CaloSrcIdMap;
49
57
59
60 public:
61 JepByteStreamV2Tool(const std::string& type, const std::string& name,
62 const IInterface* parent);
63 virtual ~JepByteStreamV2Tool();
64
66 static const InterfaceID& interfaceID();
67
68 virtual StatusCode initialize() override;
69 virtual StatusCode finalize() override;
70
72 StatusCode convert(const std::string& name,
73 DataVector<LVL1::JetElement>* jeCollection) const;
74 StatusCode convert(const std::string& sgKey,
75 const IROBDataProviderSvc::VROBFRAG& robFrags,
76 DataVector<LVL1::JetElement>* jeCollection) const;
78 StatusCode convert(const std::string& name,
79 DataVector<LVL1::JEMEtSums>* etCollection) const;
80 StatusCode convert(const std::string& sgKey,
81 const IROBDataProviderSvc::VROBFRAG& robFrags,
82 DataVector<LVL1::JEMEtSums>* etCollection) const;
84 StatusCode convert(const std::string& name,
85 DataVector<LVL1::CMXJetTob>* tobCollection) const;
86 StatusCode convert(const std::string& sgKey,
87 const IROBDataProviderSvc::VROBFRAG& robFrags,
88 DataVector<LVL1::CMXJetTob>* tobCollection) const;
90 StatusCode convert(const std::string& name,
91 DataVector<LVL1::CMXJetHits>* hitCollection) const;
92 StatusCode convert(const std::string& sgKey,
93 const IROBDataProviderSvc::VROBFRAG& robFrags,
94 DataVector<LVL1::CMXJetHits>* hitCollection) const;
96 StatusCode convert(const std::string& name,
97 DataVector<LVL1::CMXEtSums>* etCollection) const;
98 StatusCode convert(const std::string& sgKey,
99 const IROBDataProviderSvc::VROBFRAG& robFrags,
100 DataVector<LVL1::CMXEtSums>* etCollection) const;
101
103 StatusCode convert(const LVL1::JEPBSCollectionV2* jep) const;
104
106 const std::vector<uint32_t>& sourceIDs() const;
107
108 private:
109 // Need option to disable dependency on offline ByteStreamCnvSvc to be able to run
110 // decoding in online HLT framework (which uses TrigByteStreamCnvSvc)
111 Gaudi::Property<bool> m_enableEncoding{
112 this, "enableEncoding", true, "Enable conversion from RDO to ByteStream"};
113 SmartIF<IByteStreamCnvSvc> m_byteStreamCnvSvc;
114
116 {
118 int coreOverlap = 0;
119 // Unpacking error code
120 unsigned int rodErr = 0;
122 std::vector<unsigned int> uintVec0;
124 std::vector<unsigned int> uintVec1;
126 std::vector<unsigned int> uintVec2;
128 std::vector<int> intVec0;
130 std::vector<int> intVec1;
132 std::vector<int> intVec2;
133 // Jet element key provider
135 };
136
139
145 typedef std::map<unsigned int, LVL1::JetElement*> JetElementMap;
146 typedef std::map<unsigned int, const LVL1::JetElement*> ConstJetElementMap;
147 typedef std::map<int, LVL1::JEMEtSums*> EnergySumsMap;
148 typedef std::map<int, const LVL1::JEMEtSums*> ConstEnergySumsMap;
149 typedef std::map<int, LVL1::CMXJetTob*> CmxTobMap;
150 typedef std::map<int, const LVL1::CMXJetTob*> ConstCmxTobMap;
151 typedef std::map<int, LVL1::CMXJetHits*> CmxHitsMap;
152 typedef std::map<int, const LVL1::CMXJetHits*> ConstCmxHitsMap;
153 typedef std::map<int, LVL1::CMXEtSums*> CmxSumsMap;
154 typedef std::map<int, const LVL1::CMXEtSums*> ConstCmxSumsMap;
155
156 typedef IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator;
159
161 {
163 : m_collection(collection){}
165 };
201
203 StatusCode convertBs(const std::string& sgKey,
204 const IROBDataProviderSvc::VROBFRAG& robFrags,
207 void decodeCmxEnergy(CmxEnergySubBlock* subBlock, int trigJem, CmxSumsData& data,
208 LocalData& ld) const;
210 void decodeCmxJet(CmxJetSubBlock* subBlock, int trigJem,
212 LocalData& ld) const;
214 void decodeJem(JemSubBlockV2* subBlock, int trigJem,
216 LocalData& ld) const;
217
219 int tobKey(int crate, int jem, int frame, int loc) const;
221 const LVL1::JetElement* findJetElement(double eta, double phi,
222 const ConstJetElementMap& jeMap,
223 LVL1::JetElementKey& elementKey) const;
225 LVL1::JetElementKey& elementKey) const;
227 const LVL1::JEMEtSums* findEnergySums(int crate, int module,
228 const ConstEnergySumsMap& etMap) const;
229 LVL1::JEMEtSums* findEnergySums(const EnergySumsData& data, int crate, int module) const;
231 const LVL1::CMXJetTob* findCmxTob(int key,
232 const ConstCmxTobMap& cmxTobMap) const;
233 LVL1::CMXJetTob* findCmxTob(const CmxTobData& data, int key) const;
235 const LVL1::CMXJetHits* findCmxHits(int crate, int source,
236 const ConstCmxHitsMap& cmxHitsMap) const;
237 LVL1::CMXJetHits* findCmxHits(const CmxHitsData& data, int crate, int source) const;
239 const LVL1::CMXEtSums* findCmxSums(int crate, int source,
240 const ConstCmxSumsMap& cmxEtMap) const;
241 LVL1::CMXEtSums* findCmxSums(const CmxSumsData& data, int crate, int source) const;
242
243 std::vector<uint32_t> makeSourceIDs() const;
244
246 void setupJeMap(const JetElementCollection* jeCollection,
247 ConstJetElementMap& jeMap,
248 LVL1::JetElementKey& elementKey) const;
250 void setupEtMap(const EnergySumsCollection* enCollection,
251 ConstEnergySumsMap& etMap) const;
253 void setupCmxTobMap(const CmxTobCollection* tobCollection,
254 ConstCmxTobMap& cmxTobMap) const;
256 void setupCmxHitsMap(const CmxHitsCollection* hitCollection,
257 ConstCmxHitsMap& cmxHitsMap) const;
259 void setupCmxEtMap(const CmxSumsCollection* enCollection,
260 ConstCmxSumsMap& cmxEtMap) const;
261
263 bool slinkSlices(int crate, int module, int modulesPerSlink,
264 int& timeslices, int& trigJem,
265 const ConstJetElementMap& jeMap,
266 const ConstEnergySumsMap& etMap,
267 const ConstCmxTobMap& cmxTobMap,
268 const ConstCmxHitsMap& cmxHitsMap,
269 const ConstCmxSumsMap& cmxEtMap,
270 LVL1::JetElementKey& elementKey) const;
272 void energySubBlockTypes(int source,
275 CmxEnergySubBlock::HitsType& hitType) const;
277 int jetSubBlockSourceId(int source) const;
278
281 ToolHandle<LVL1::IL1CaloMappingTool> m_jemMaps;
283 ToolHandle<LVL1BS::L1CaloErrorByteStreamTool> m_errorTool;
284
294 const int m_channels;
296 const int m_crates;
298 const int m_modules;
300 const int m_frames;
302 const int m_locations;
304 const int m_maxTobs;
316 std::vector<uint32_t> m_sourceIDsProp;
318 const eformat::SubDetector m_subDetector;
321};
322
323} // end namespace
324
325#endif
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
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-Energy data post LS1.
Sub-Block class for CMX-Jet data post LS1.
Sub-Block class for JEM data post LS1.
void decodeCmxJet(CmxJetSubBlock *subBlock, int trigJem, JepByteStreamToolData &data, LocalData &ld) const
Unpack CMX-Jet sub-block.
std::map< int, LVL1::JEMEtSums * > EnergySumsMap
void energySubBlockTypes(int source, CmxEnergySubBlock::SourceType &srcType, CmxEnergySubBlock::SumType &sumType, CmxEnergySubBlock::HitsType &hitType) const
Get energy subBlock types from CMXEtSums source type.
DataVector< LVL1::CMXJetTob > CmxTobCollection
int m_version
Property:Sub_block header version.
const int m_modules
Number of JEM modules per crate.
DataVector< LVL1::CMXEtSums > CmxSumsCollection
int m_crateMax
Property: Maximum crate number when writing out bytestream.
DataVector< LVL1::JetElement > JetElementCollection
const LVL1::CMXJetHits * findCmxHits(int crate, int source, const ConstCmxHitsMap &cmxHitsMap) const
Find CMX hits for given crate, source.
StatusCode convertBs(const std::string &sgKey, const IROBDataProviderSvc::VROBFRAG &robFrags, JepByteStreamToolData &data) const
Convert bytestream to given container type.
const LVL1::CMXJetTob * findCmxTob(int key, const ConstCmxTobMap &cmxTobMap) const
Find CMX TOB for given key.
virtual StatusCode finalize() override
std::map< int, LVL1::CMXJetTob * > CmxTobMap
bool slinkSlices(int crate, int module, int modulesPerSlink, int &timeslices, int &trigJem, const ConstJetElementMap &jeMap, const ConstEnergySumsMap &etMap, const ConstCmxTobMap &cmxTobMap, const ConstCmxHitsMap &cmxHitsMap, const ConstCmxSumsMap &cmxEtMap, LVL1::JetElementKey &elementKey) const
Get number of slices and triggered slice offset for next slink.
SmartIF< IByteStreamCnvSvc > m_byteStreamCnvSvc
std::map< unsigned int, const LVL1::JetElement * > ConstJetElementMap
int m_dataFormat
Property:Data compression format.
std::map< int, const LVL1::CMXJetTob * > ConstCmxTobMap
const L1CaloSrcIdMap m_srcIdMap
Source ID converter.
const std::vector< uint32_t > & sourceIDs() const
Return reference to vector with all possible Source Identifiers.
int m_forceSlices
Property: Force number of slices in bytestream.
std::map< int, LVL1::CMXJetHits * > CmxHitsMap
ToolHandle< LVL1::IL1CaloMappingTool > m_jemMaps
Property: Channel mapping tool.
ToolHandle< LVL1BS::L1CaloErrorByteStreamTool > m_errorTool
Property:Error collection tool.
std::map< int, const LVL1::JEMEtSums * > ConstEnergySumsMap
std::map< int, const LVL1::CMXEtSums * > ConstCmxSumsMap
int m_crateOffsetSw
Property:Software crate number offset.
void setupCmxTobMap(const CmxTobCollection *tobCollection, ConstCmxTobMap &cmxTobMap) const
Set up CMX TOB map.
IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator
JepByteStreamV2Tool(const std::string &type, const std::string &name, const IInterface *parent)
OFFLINE_FRAGMENTS_NAMESPACE::PointerType RODPointer
const int m_crates
Number of crates.
virtual StatusCode initialize() override
const int m_locations
Number of RoI locations.
const int m_maxTobs
Maximum number of TOBs per module.
const LVL1::CMXEtSums * findCmxSums(int crate, int source, const ConstCmxSumsMap &cmxEtMap) const
Find CMX energy sums for given crate, source.
const eformat::SubDetector m_subDetector
Sub-detector type.
StatusCode convert(const std::string &name, DataVector< LVL1::JetElement > *jeCollection) const
Convert ROB fragments to jet elements.
void decodeCmxEnergy(CmxEnergySubBlock *subBlock, int trigJem, CmxSumsData &data, LocalData &ld) const
Unpack CMX-Energy sub-block.
std::map< int, const LVL1::CMXJetHits * > ConstCmxHitsMap
OFFLINE_FRAGMENTS_NAMESPACE::PointerType ROBPointer
int jetSubBlockSourceId(int source) const
Get jet hits subBlock source ID from CMXJetHits source type.
void setupJeMap(const JetElementCollection *jeCollection, ConstJetElementMap &jeMap, LVL1::JetElementKey &elementKey) const
Set up jet element map.
void decodeJem(JemSubBlockV2 *subBlock, int trigJem, JepByteStreamToolData &data, LocalData &ld) const
Unpack JEM sub-block.
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
void setupCmxEtMap(const CmxSumsCollection *enCollection, ConstCmxSumsMap &cmxEtMap) const
Set up CMX energy sums map.
int m_dfltSlices
Property: Default number of slices in simulation.
std::vector< uint32_t > makeSourceIDs() const
const LVL1::JEMEtSums * findEnergySums(int crate, int module, const ConstEnergySumsMap &etMap) const
Find energy sums for given crate, module.
void setupEtMap(const EnergySumsCollection *enCollection, ConstEnergySumsMap &etMap) const
Set up energy sums map.
std::map< int, LVL1::CMXEtSums * > CmxSumsMap
DataVector< LVL1::JEMEtSums > EnergySumsCollection
std::map< unsigned int, LVL1::JetElement * > JetElementMap
int m_slinks
Property: Number of slinks per crate when writing out bytestream.
void setupCmxHitsMap(const CmxHitsCollection *hitCollection, ConstCmxHitsMap &cmxHitsMap) const
Set up CMX hits map.
int m_crateMin
Property: Minimum crate number when writing out bytestream.
DataVector< LVL1::CMXJetHits > CmxHitsCollection
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
std::vector< uint32_t > m_sourceIDsProp
Property:ROB source IDs.
int m_crateOffsetHw
Property:Hardware crate number offset.
int tobKey(int crate, int jem, int frame, int loc) const
Find TOB map key for given crate, jem, frame, loc.
const int m_channels
Number of channels per module.
const int m_frames
Number of RoI frames.
Gaudi::Property< bool > m_enableEncoding
const LVL1::JetElement * findJetElement(double eta, double phi, const ConstJetElementMap &jeMap, LVL1::JetElementKey &elementKey) const
Find a jet element given eta, phi.
Tool to accumulate ROB/ROD unpacking errors.
This class provides conversion between Lower level Source ID to higher level source ID for L1Calo Byt...
CMXEtSums object stores Et sums from the Energy CMXs.
Summary of JEP (Jet) hits produced by the merger modules.
TOB data received by the merger modules.
Jet/Energy Processor container for writing bytestream post-LS1.
The JetElementKey object provides the key for each JetElement depending on its eta,...
Jet elements are the inputs to the Jet, ETmiss and ETsum triggers.
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
const DataType * PointerType
Definition RawEvent.h:25
CmxHitsData(CmxHitsCollection *const hitCollection)
CmxSumsData(CmxSumsCollection *const etCollection)
CmxTobData(CmxTobCollection *const tobCollection)
EnergySumsData(EnergySumsCollection *const etCollection)
JetElementData(JetElementCollection *const jeCollection)
std::vector< unsigned int > uintVec2
Unsigned int unpacking vector 2.
std::vector< int > intVec1
Int unpacking vector 1.
std::vector< int > intVec2
Int unpacking vector 2.
int coreOverlap
Jet elements to accept (0=Core, 1=Overlap)
std::vector< unsigned int > uintVec1
Unsigned int unpacking vector 1.
std::vector< unsigned int > uintVec0
Unsigned int unpacking vector 0.
std::vector< int > intVec0
Int unpacking vector 0.