ATLAS Offline Software
PpmByteStreamV1Tool.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_PPMBYTESTREAMV1TOOL_H
6 #define TRIGT1CALOBYTESTREAM_PPMBYTESTREAMV1TOOL_H
7 
8 #include <stdint.h>
9 
10 #include <map>
11 #include <string>
12 #include <vector>
13 #include <atomic>
14 #include <mutex>
15 
16 #include "L1CaloSrcIdMap.h"
17 #include "PpmSubBlockV1.h"
24 #include "eformat/SourceIdentifier.h"
25 #include "GaudiKernel/ServiceHandle.h"
26 #include "GaudiKernel/ToolHandle.h"
28 
29 class IInterface;
30 class InterfaceID;
31 class StatusCode;
32 class SegMemSvc;
33 
34 template <class T> class FullEventAssembler;
35 
36 namespace LVL1 {
37  class IL1CaloMappingTool;
38  class TriggerTower;
39  class TriggerTowerKey;
40 }
41 
42 namespace LVL1BS {
43 
44 class L1CaloErrorByteStreamTool;
45 class L1CaloSrcIdMap;
46 class PpmSubBlockV1;
47 
57 
58  public:
59  PpmByteStreamV1Tool(const std::string& type, const std::string& name,
60  const IInterface* parent);
61  virtual ~PpmByteStreamV1Tool();
62 
64  static const InterfaceID& interfaceID();
65 
66  virtual StatusCode initialize() override;
67  virtual StatusCode finalize() override;
68 
70  StatusCode convert(const std::string& sgKey,
71  const IROBDataProviderSvc::VROBFRAG& robFrags,
72  DataVector<LVL1::TriggerTower>* ttCollection) const;
73 
76  RawEventWrite* re) const;
77 
79  const std::vector<uint32_t>& sourceIDs(const std::string& sgKey) const;
80 
81  private:
82 
84  typedef std::vector<LVL1::TriggerTower*> TriggerTowerVector;
85  typedef std::map<unsigned int, int> TriggerTowerMap;
86  typedef std::map<unsigned int, const LVL1::TriggerTower*>
88  typedef std::vector<uint32_t> ChannelBitVector;
89  typedef IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator;
92 
94  void addCompStats(const std::vector<uint32_t>& stats) const;
96  void printCompStats() const;
97 
99  const LVL1::TriggerTower* findLayerTriggerTower(double eta, double phi,
100  int layer,
101  const TriggerTowerMapConst& ttEmMap,
102  const TriggerTowerMapConst& ttHadMap,
103  LVL1::TriggerTowerKey& towerKey) const;
105  void setupTTMaps(const TriggerTowerCollection* ttCollection,
106  TriggerTowerMapConst& ttEmMap,
107  TriggerTowerMapConst& ttHadMap,
108  LVL1::TriggerTowerKey& towerKey) const;
109 
111  bool slinkSlices(int crate, int module, int modulesPerSlink,
112  int& slicesLut, int& slicesFadc, int& trigLut, int& trigFadc,
113  const TriggerTowerMapConst& ttEmMap,
114  const TriggerTowerMapConst& ttHadMap,
115  LVL1::TriggerTowerKey& towerKey) const;
116 
117  std::vector<uint32_t>
118  makeSourceIDs (bool spareChannels, bool muonChannels) const;
119 
121  void printVec(const std::vector<int>& vec) const;
122 
123  struct SlotData
124  {
130  std::vector<int> m_ttPos;
146  };
148 
149 
151  ToolHandle<LVL1::IL1CaloMappingTool> m_ppmMaps;
153  ToolHandle<LVL1BS::L1CaloErrorByteStreamTool> m_errorTool;
156 
158  const int m_version;
162  const int m_compVers;
166  int m_slinks;
188  std::vector<uint32_t> m_sourceIDsProp;
190  const eformat::SubDetector m_subDetector;
194  static constexpr unsigned int MAXFORMATS = 10;
195  std::atomic<uint32_t> m_compStats[MAXFORMATS];
196 
197  static const int s_crates = 8;
198  static const int s_modules = 16;
199  static const int s_channels = 64;
200  static const int s_dataSize = 3584;
201 
202 };
203 
204 } // end namespace
205 
206 #endif
LVL1BS::PpmByteStreamV1Tool::SlotData::m_muonChan
ChannelBitVector m_muonChan
Definition: PpmByteStreamV1Tool.h:135
LVL1BS::PpmByteStreamV1Tool::m_dfltSlicesLut
int m_dfltSlicesLut
Property: Default number of LUT slices in simulation.
Definition: PpmByteStreamV1Tool.h:168
RawEventWrite
OFFLINE_FRAGMENTS_NAMESPACE_WRITE::FullEventFragment RawEventWrite
data type for writing raw event
Definition: RawEvent.h:39
LVL1BS::PpmByteStreamV1Tool::printCompStats
void printCompStats() const
Print compression stats.
Definition: PpmByteStreamV1Tool.cxx:1071
LVL1BS::PpmByteStreamV1Tool::TriggerTowerMapConst
std::map< unsigned int, const LVL1::TriggerTower * > TriggerTowerMapConst
Definition: PpmByteStreamV1Tool.h:87
LVL1BS::PpmByteStreamV1Tool::SlotData::m_dataChan
ChannelBitVector m_dataChan
Definition: PpmByteStreamV1Tool.h:133
LVL1BS::PpmByteStreamV1Tool::slinkSlices
bool slinkSlices(int crate, int module, int modulesPerSlink, int &slicesLut, int &slicesFadc, int &trigLut, int &trigFadc, const TriggerTowerMapConst &ttEmMap, const TriggerTowerMapConst &ttHadMap, LVL1::TriggerTowerKey &towerKey) const
Get number of slices and triggered slice offsets for next slink.
Definition: PpmByteStreamV1Tool.cxx:1147
LVL1BS::PpmByteStreamV1Tool::SlotData::m_spareMod
ChannelBitVector m_spareMod
Definition: PpmByteStreamV1Tool.h:137
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
LVL1BS::PpmByteStreamV1Tool::makeSourceIDs
std::vector< uint32_t > makeSourceIDs(bool spareChannels, bool muonChannels) const
Definition: PpmByteStreamV1Tool.cxx:1222
LVL1BS::PpmByteStreamV1Tool::SlotData::m_foundChan
ChannelBitVector m_foundChan
Definition: PpmByteStreamV1Tool.h:139
LVL1BS::PpmByteStreamV1Tool::m_ppmMaps
ToolHandle< LVL1::IL1CaloMappingTool > m_ppmMaps
Property: Channel mapping tool.
Definition: PpmByteStreamV1Tool.h:151
FullEventAssembler
Template class for assembling a full atlas raw event from subfragments.
Definition: FullEventAssembler.h:40
LVL1BS::PpmByteStreamV1Tool::m_sms
ServiceHandle< SegMemSvc > m_sms
Memory pool service.
Definition: PpmByteStreamV1Tool.h:155
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
LVL1BS::PpmByteStreamV1Tool::MAXFORMATS
static constexpr unsigned int MAXFORMATS
Vector for compression statistics.
Definition: PpmByteStreamV1Tool.h:194
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
LVL1BS::PpmByteStreamV1Tool::m_forceSlicesFadc
int m_forceSlicesFadc
Property: Force number of FADC slices in bytestream.
Definition: PpmByteStreamV1Tool.h:174
LVL1BS::L1CaloSrcIdMap
This class provides conversion between Lower level Source ID to higher level source ID for L1Calo Byt...
Definition: L1CaloSrcIdMap.h:22
LVL1BS::PpmByteStreamV1Tool::m_compStats
std::atomic< uint32_t > m_compStats[MAXFORMATS]
Definition: PpmByteStreamV1Tool.h:195
LVL1BS::PpmByteStreamV1Tool
Tool to perform ROB fragments to trigger towers and trigger towers to raw data conversions.
Definition: PpmByteStreamV1Tool.h:56
TriggerTowerKey.h
LVL1BS::PpmByteStreamV1Tool::findLayerTriggerTower
const LVL1::TriggerTower * findLayerTriggerTower(double eta, double phi, int layer, const TriggerTowerMapConst &ttEmMap, const TriggerTowerMapConst &ttHadMap, LVL1::TriggerTowerKey &towerKey) const
Find a trigger tower using separate layer maps.
Definition: PpmByteStreamV1Tool.cxx:1083
LVL1BS::PpmByteStreamV1Tool::sourceIDs
const std::vector< uint32_t > & sourceIDs(const std::string &sgKey) const
Return reference to vector with all possible Source Identifiers.
Definition: PpmByteStreamV1Tool.cxx:1256
LVL1BS::PpmByteStreamV1Tool::SlotData::m_mutex
std::mutex m_mutex
Definition: PpmByteStreamV1Tool.h:125
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
LVL1BS::PpmByteStreamV1Tool::SlotData::m_ppmBlocks
DataVector< PpmSubBlockV1 > m_ppmBlocks
Vector for current PPM sub-blocks.
Definition: PpmByteStreamV1Tool.h:141
LVL1BS::PpmByteStreamV1Tool::SlotData::m_chanLayer
ChannelBitVector m_chanLayer
Mapping vectors.
Definition: PpmByteStreamV1Tool.h:132
LVL1BS::PpmByteStreamV1Tool::~PpmByteStreamV1Tool
virtual ~PpmByteStreamV1Tool()
Definition: PpmByteStreamV1Tool.cxx:106
LVL1BS::PpmByteStreamV1Tool::m_dfltSlicesFadc
int m_dfltSlicesFadc
Property: Default number of FADC slices in simulation.
Definition: PpmByteStreamV1Tool.h:170
trigbs_dumpHLTContentInBS.stats
stats
Definition: trigbs_dumpHLTContentInBS.py:91
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition: ICMMCPHitsCnvTool.h:18
LVL1BS::PpmByteStreamV1Tool::PpmByteStreamV1Tool
PpmByteStreamV1Tool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: PpmByteStreamV1Tool.cxx:52
LVL1BS::PpmByteStreamV1Tool::TriggerTowerMap
std::map< unsigned int, int > TriggerTowerMap
Definition: PpmByteStreamV1Tool.h:85
LVL1BS::PpmByteStreamV1Tool::m_pedestal
int m_pedestal
Property: Pedestal value.
Definition: PpmByteStreamV1Tool.h:180
LVL1BS::PpmByteStreamV1Tool::m_sourceIDsProp
std::vector< uint32_t > m_sourceIDsProp
Property: ROB source IDs.
Definition: PpmByteStreamV1Tool.h:188
python.PyAthena.module
module
Definition: PyAthena.py:134
LVL1BS::PpmByteStreamV1Tool::m_crateMax
int m_crateMax
Property: Maximum crate number when writing out bytestream.
Definition: PpmByteStreamV1Tool.h:178
PpmSubBlockV1.h
OFFLINE_FRAGMENTS_NAMESPACE::PointerType
const DataType * PointerType
Definition: RawEvent.h:25
LVL1BS::PpmByteStreamV1Tool::s_channels
static const int s_channels
Definition: PpmByteStreamV1Tool.h:199
LVL1BS::PpmByteStreamV1Tool::s_crates
static const int s_crates
Definition: PpmByteStreamV1Tool.h:197
LVL1BS::PpmByteStreamV1Tool::SlotData::m_ttData
TriggerTowerVector m_ttData
TriggerTower pool vectors.
Definition: PpmByteStreamV1Tool.h:127
SG::SlotSpecificObj
Maintain a set of objects, one per slot.
Definition: AthenaKernel/AthenaKernel/SlotSpecificObj.h:70
LVL1BS::PpmByteStreamV1Tool::m_fadcBaseline
int m_fadcBaseline
Property: FADC baseline lower bound.
Definition: PpmByteStreamV1Tool.h:182
LVL1BS::PpmByteStreamV1Tool::finalize
virtual StatusCode finalize() override
Definition: PpmByteStreamV1Tool.cxx:126
LVL1BS::PpmByteStreamV1Tool::addCompStats
void addCompStats(const std::vector< uint32_t > &stats) const
Add compression stats to totals.
Definition: PpmByteStreamV1Tool.cxx:1058
RawEvent.h
LVL1BS::PpmByteStreamV1Tool::m_version
const int m_version
Sub_block header version.
Definition: PpmByteStreamV1Tool.h:158
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LVL1BS::PpmByteStreamV1Tool::m_subDetector
const eformat::SubDetector m_subDetector
Sub-detector type.
Definition: PpmByteStreamV1Tool.h:190
LVL1BS::PpmByteStreamV1Tool::SlotData::m_dataMod
ChannelBitVector m_dataMod
Definition: PpmByteStreamV1Tool.h:136
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
AthAlgTool.h
LVL1BS::PpmByteStreamV1Tool::m_zeroSuppress
int m_zeroSuppress
Property: Zero suppression on input.
Definition: PpmByteStreamV1Tool.h:186
LVL1BS::PpmByteStreamV1Tool::ATLAS_THREAD_SAFE
SG::SlotSpecificObj< SlotData > m_slotData ATLAS_THREAD_SAFE
Definition: PpmByteStreamV1Tool.h:147
LVL1BS::PpmByteStreamV1Tool::RODPointer
OFFLINE_FRAGMENTS_NAMESPACE::PointerType RODPointer
Definition: PpmByteStreamV1Tool.h:91
LVL1BS::PpmByteStreamV1Tool::printVec
void printVec(const std::vector< int > &vec) const
Print a vector.
Definition: PpmByteStreamV1Tool.cxx:1289
LVL1BS::PpmByteStreamV1Tool::SlotData::m_errorBlock
PpmSubBlockV1 m_errorBlock
Current error block.
Definition: PpmByteStreamV1Tool.h:143
test_pyathena.parent
parent
Definition: test_pyathena.py:15
LVL1BS::PpmByteStreamV1Tool::m_srcIdMap
const L1CaloSrcIdMap m_srcIdMap
Source ID converter.
Definition: PpmByteStreamV1Tool.h:192
IROBDataProviderSvc::VROBFRAG
std::vector< const ROBF * > VROBFRAG
Definition: IROBDataProviderSvc.h:29
DataVector< LVL1::TriggerTower >
LVL1BS::PpmByteStreamV1Tool::m_printCompStats
int m_printCompStats
Property: Compression statistics print flag.
Definition: PpmByteStreamV1Tool.h:164
LVL1BS::PpmByteStreamV1Tool::ROBIterator
IROBDataProviderSvc::VROBFRAG::const_iterator ROBIterator
Definition: PpmByteStreamV1Tool.h:89
LVL1BS::PpmByteStreamV1Tool::interfaceID
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
Definition: PpmByteStreamV1Tool.cxx:45
LVL1BS::PpmSubBlockV1
Sub-Block class for PPM data.
Definition: PpmSubBlockV1.h:20
LVL1::TriggerTower
Trigger towers are the inputs to all other parts of the calorimeter trigger.
Definition: Trigger/TrigT1/TrigT1CaloEvent/TrigT1CaloEvent/TriggerTower.h:45
LVL1BS::PpmByteStreamV1Tool::SlotData::m_ttMuon
TriggerTowerVector m_ttMuon
Definition: PpmByteStreamV1Tool.h:129
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
LVL1BS::PpmByteStreamV1Tool::s_dataSize
static const int s_dataSize
Definition: PpmByteStreamV1Tool.h:200
SegMemSvc
Service to access an arena caching allocator.
Definition: SegMemSvc.h:30
LVL1BS::PpmByteStreamV1Tool::TriggerTowerVector
std::vector< LVL1::TriggerTower * > TriggerTowerVector
Definition: PpmByteStreamV1Tool.h:84
LVL1BS::PpmByteStreamV1Tool::SlotData::m_towerKey
LVL1::TriggerTowerKey m_towerKey
Trigger tower key provider.
Definition: PpmByteStreamV1Tool.h:145
LVL1BS::PpmByteStreamV1Tool::SlotData::m_ttPos
std::vector< int > m_ttPos
Definition: PpmByteStreamV1Tool.h:130
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
LVL1BS::PpmByteStreamV1Tool::m_slinks
int m_slinks
Property: Number of slinks per crate when writing out bytestream.
Definition: PpmByteStreamV1Tool.h:166
LVL1BS::PpmByteStreamV1Tool::ChannelBitVector
std::vector< uint32_t > ChannelBitVector
Definition: PpmByteStreamV1Tool.h:88
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
re
const boost::regex re(r_e)
LVL1BS
Definition: ZdcByteStreamReadV1V2Tool.h:47
LVL1BS::PpmByteStreamV1Tool::SlotData::m_ttSpare
TriggerTowerVector m_ttSpare
Definition: PpmByteStreamV1Tool.h:128
SlotSpecificObj.h
Maintain a set of objects, one per slot.
LVL1BS::PpmByteStreamV1Tool::SlotData::m_muonMod
ChannelBitVector m_muonMod
Definition: PpmByteStreamV1Tool.h:138
LVL1BS::PpmByteStreamV1Tool::convert
StatusCode convert(const std::string &sgKey, const IROBDataProviderSvc::VROBFRAG &robFrags, DataVector< LVL1::TriggerTower > *ttCollection) const
Convert ROB fragments to trigger towers.
Definition: PpmByteStreamV1Tool.cxx:139
L1CaloSrcIdMap.h
LVL1BS::PpmByteStreamV1Tool::TriggerTowerCollection
DataVector< LVL1::TriggerTower > TriggerTowerCollection
Definition: PpmByteStreamV1Tool.h:83
LVL1BS::PpmByteStreamV1Tool::SlotData::m_spareChan
ChannelBitVector m_spareChan
Definition: PpmByteStreamV1Tool.h:134
LVL1BS::PpmByteStreamV1Tool::initialize
virtual StatusCode initialize() override
Definition: PpmByteStreamV1Tool.cxx:113
LVL1BS::PpmByteStreamV1Tool::m_crateMin
int m_crateMin
Property: Minimum crate number when writing out bytestream.
Definition: PpmByteStreamV1Tool.h:176
LVL1BS::PpmByteStreamV1Tool::m_fadcThreshold
int m_fadcThreshold
Property: FADC threshold for super-compressed format.
Definition: PpmByteStreamV1Tool.h:184
LVL1BS::PpmByteStreamV1Tool::m_forceSlicesLut
int m_forceSlicesLut
Property: Force number of LUT slices in bytestream.
Definition: PpmByteStreamV1Tool.h:172
AthAlgTool
Definition: AthAlgTool.h:26
LVL1BS::PpmByteStreamV1Tool::ROBPointer
OFFLINE_FRAGMENTS_NAMESPACE::PointerType ROBPointer
Definition: PpmByteStreamV1Tool.h:90
LVL1BS::PpmByteStreamV1Tool::SlotData
Definition: PpmByteStreamV1Tool.h:124
checker_macros.h
Define macros for attributes used to control the static checker.
LVL1BS::PpmByteStreamV1Tool::setupTTMaps
void setupTTMaps(const TriggerTowerCollection *ttCollection, TriggerTowerMapConst &ttEmMap, TriggerTowerMapConst &ttHadMap, LVL1::TriggerTowerKey &towerKey) const
Set up separate Em and Had trigger tower maps.
Definition: PpmByteStreamV1Tool.cxx:1107
LVL1BS::PpmByteStreamV1Tool::m_dataFormat
int m_dataFormat
Property: Data compression format.
Definition: PpmByteStreamV1Tool.h:160
LVL1::TriggerTowerKey
The TriggerTowerKey object provides the key for each trigger tower depending on its eta-phi coords.
Definition: TriggerTowerKey.h:56
LVL1BS::PpmByteStreamV1Tool::s_modules
static const int s_modules
Definition: PpmByteStreamV1Tool.h:198
IROBDataProviderSvc.h
xAOD::TriggerTower
TriggerTower_v2 TriggerTower
Define the latest version of the TriggerTower class.
Definition: Event/xAOD/xAODTrigL1Calo/xAODTrigL1Calo/TriggerTower.h:16
LVL1BS::PpmByteStreamV1Tool::m_compVers
const int m_compVers
Compression version.
Definition: PpmByteStreamV1Tool.h:162
ServiceHandle< SegMemSvc >
LVL1BS::PpmByteStreamV1Tool::m_errorTool
ToolHandle< LVL1BS::L1CaloErrorByteStreamTool > m_errorTool
Property: Error collection tool.
Definition: PpmByteStreamV1Tool.h:153