ATLAS Offline Software
TRT_RodDecoder.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRT_RAWDATABYTESTREAM_TRT_RODDECODER_H
6 #define TRT_RAWDATABYTESTREAM_TRT_RODDECODER_H
7 
8 
9 /*
10  * Base class
11  */
13 
14 /*
15  * Interface class for this Tool
16  */
18 
19 /*
20  * TRT Tools we use
21  */
23 
24 /*
25  * Framework Headers
26  * Service & Tool Handles
27  */
28 #include "GaudiKernel/ServiceHandle.h"
29 #include "GaudiKernel/ToolHandle.h"
30 #include "GaudiKernel/ContextSpecificPtr.h"
31 #include "GaudiKernel/ThreadLocalContext.h"
32 #include "GaudiKernel/ICondSvc.h"
36 
37 #include "CoralBase/Attribute.h"
38 
39 /*
40  * Identifier
41  */
42 #include "InDetIdentifier/TRT_ID.h"
43 
44 /*
45  * For cache
46  */
49 
50 /*
51  * STL
52  */
53 #include <atomic>
54 #include <map>
55 #include <vector>
56 
57 // the tool to decode a ROB frament
58 
59 class TRT_RodDecoder : public extends<AthAlgTool, ITRT_RodDecoder>
60 {
61 public:
63  TRT_RodDecoder(const std::string& type, const std::string& name,
64  const IInterface* parent ) ;
66  virtual ~TRT_RodDecoder();
68  virtual StatusCode initialize() override;
70  virtual StatusCode finalize() override;
71 
74  TRT_RDO_Container* rdoIdc,
76  DataPool<TRT_LoLumRawData>* dataItemsPool,
77  const std::vector<IdentifierHash>* vecHash = 0) const override;
78 
79 
80  private:
81 
83 
84  /*
85  * Do we look for Front-End Errors at all?
86  */
88 
89  /*
90  * Do we look for these types of Front-End Errors?
91  */
97 
100  std::vector<int> m_LoadCompressTableVersions;
103 
104  const TRT_ID* m_trt_id;
106 
107  BooleanProperty m_TB04_RawData; // true to create TRT_TB04_RawData RDOs
108  BooleanProperty m_LoLumRawData; // true to create TRT_LoLumRawData RDOs
109 
110  bool m_eventTypeIsSim; // look at first event to decide if RODBlockVersion
111  // is incorrect.
112 
113  uint32_t m_escape_marker; // Straw word that means escaped literal
114 
115 #define CTABLE_FC_LENGTH 33
116 #define CTABLE_LI_LENGTH 33
117  typedef struct {
118  // The TableVersion is a compression scheme.
119  // There are presently 6 TableVersions for the different run periods of ATLAS.
120  // Any IoV of /TRT/onl/ROD/Compress has one (and only one) of these as an attribute.
121  // The code takes advantage of this and caches locally any TableVersion that is encountered
123  int m_firstcode[CTABLE_FC_LENGTH];
124  int m_lengths_integral[CTABLE_FC_LENGTH]; // ..[i] = Sum(numl[0,i-1])
125  std::unique_ptr<unsigned int[]> m_syms; // Array of symbols (straw data words)
127  } t_CompressTable;
128 
129  std::vector<CxxUtils::CachedUniquePtr<t_CompressTable> > m_CompressionTables;
130 
131  mutable std::atomic<uint32_t> m_Nrdos; // Number of RDOs created
132 
133  mutable std::atomic<int> m_err_count_fillCollection{0};
134  mutable std::atomic<int> m_err_count_int_fillMinimalCompress{0};
135  mutable std::atomic<int> m_err_count_int_fillFullCompress{0};
136 
137  // This replaces the IOVCALLBACK
138  SG::ReadCondHandleKey<CondAttrListCollection> m_CompressKey{this,"keyName","/TRT/Onl/ROD/Compress","in-key"};
139  StatusCode update() const;
140 
142 private:
145  TRT_RDO_Container* rodIdc, DataPool<TRT_LoLumRawData>* dataItemsPool,
146  const std::vector<IdentifierHash>* vecHash = 0) const;
147 
150  TRT_RDO_Container* rdoIdo, DataPool<TRT_LoLumRawData>* dataItemsPool,
151  const std::vector<IdentifierHash>* vecHash = 0) const;
152 
155  TRT_RDO_Container* rdoIdo, DataPool<TRT_LoLumRawData>* dataItemsPool,
156  const t_CompressTable& Ctable,
157  const std::vector<IdentifierHash>* vecHash = 0) const;
158 
159  StatusCode ReadCompressTableFile(const std::string& TableFilename);
161 
163  m_lastPrint ATLAS_THREAD_SAFE;
164 
165  mutable std::atomic<unsigned int> m_skip{};
166  mutable std::atomic<unsigned int> m_accept{};
167 };
168 
169 #endif
ITRT_RodDecoder.h
athena_checkUpload.Tag
string Tag
Definition: athena_checkUpload.py:189
TRT_RodDecoder::m_escape_marker
uint32_t m_escape_marker
Definition: TRT_RodDecoder.h:113
TRT_RodDecoder::m_lookAtL1idErrors
bool m_lookAtL1idErrors
Definition: TRT_RodDecoder.h:94
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
TRT_RodDecoder::m_err_count_int_fillMinimalCompress
std::atomic< int > m_err_count_int_fillMinimalCompress
Definition: TRT_RodDecoder.h:134
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TRT_RodDecoder::m_LoadCompressTableVersions
std::vector< int > m_LoadCompressTableVersions
Definition: TRT_RodDecoder.h:100
TRT_RodDecoder::m_loadCompressTableFile
bool m_loadCompressTableFile
Definition: TRT_RodDecoder.h:98
TRT_RodDecoder::m_lookAtMissingErrors
bool m_lookAtMissingErrors
Definition: TRT_RodDecoder.h:96
TRT_RodDecoder::m_err_count_fillCollection
std::atomic< int > m_err_count_fillCollection
Definition: TRT_RodDecoder.h:133
TRT_RodDecoder::m_skip
std::atomic< unsigned int > m_skip
Definition: TRT_RodDecoder.h:165
TRT_ID.h
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
TRT_RodDecoder::m_CompressionTables
std::vector< CxxUtils::CachedUniquePtr< t_CompressTable > > m_CompressionTables
Definition: TRT_RodDecoder.h:129
TRT_RodDecoder::m_lookAtSidErrors
bool m_lookAtSidErrors
Definition: TRT_RodDecoder.h:92
TRT_RodDecoder::ReadCompressTableFile
StatusCode ReadCompressTableFile(const std::string &TableFilename)
Definition: TRT_RodDecoder.cxx:1062
TRT_RodDecoder
Definition: TRT_RodDecoder.h:60
TRT_RodDecoder::m_trt_id
const TRT_ID * m_trt_id
Definition: TRT_RodDecoder.h:104
TRT_RodDecoder::initialize
virtual StatusCode initialize() override
initialize
Definition: TRT_RodDecoder.cxx:79
InDetRawDataContainer
Definition: InDetRawDataContainer.h:27
TRT_RodDecoder::m_err_count_int_fillFullCompress
std::atomic< int > m_err_count_int_fillFullCompress
Definition: TRT_RodDecoder.h:135
TRT_RodDecoder::m_maxCompressionVersion
const int m_maxCompressionVersion
Definition: TRT_RodDecoder.h:101
TRT_BSErrContainer
Definition: TRT_BSErrContainer.h:20
TRT_RodDecoder::m_LoLumRawData
BooleanProperty m_LoLumRawData
Definition: TRT_RodDecoder.h:108
SG::SlotSpecificObj
Maintain a set of objects, one per slot.
Definition: AthenaKernel/AthenaKernel/SlotSpecificObj.h:70
TRT_RodDecoder::~TRT_RodDecoder
virtual ~TRT_RodDecoder()
destructor
eformat::ROBFragment
Definition: L1CaloBsDecoderUtil.h:12
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TRT_RodDecoder::t_CompressTable::m_Nsymbols
int m_Nsymbols
Definition: TRT_RodDecoder.h:126
AthAlgTool.h
CachedUniquePtr.h
Cached unique_ptr with atomic update.
TRT_RodDecoder::update
StatusCode update() const
Definition: TRT_RodDecoder.cxx:1449
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TRT_RodDecoder::m_loadCompressTableDB
bool m_loadCompressTableDB
Definition: TRT_RodDecoder.h:99
TRT_RodDecoder::m_CablingSvc
ServiceHandle< ITRT_CablingSvc > m_CablingSvc
Definition: TRT_RodDecoder.h:82
ReadCondHandleKey.h
TRT_RodDecoder::finalize
virtual StatusCode finalize() override
finalize
Definition: TRT_RodDecoder.cxx:153
ITRT_CablingSvc.h
TRT_RodDecoder::m_CompressKey
SG::ReadCondHandleKey< CondAttrListCollection > m_CompressKey
Definition: TRT_RodDecoder.h:138
TRT_RodDecoder::ATLAS_THREAD_SAFE
SG::SlotSpecificObj< std::atomic< EventContext::ContextEvt_t > > m_lastPrint ATLAS_THREAD_SAFE
Definition: TRT_RodDecoder.h:163
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TRT_RodDecoder::t_CompressTable::m_TableVersion
int m_TableVersion
Definition: TRT_RodDecoder.h:122
TRT_RodDecoder::m_straw_layer_context
IdContext m_straw_layer_context
Definition: TRT_RodDecoder.h:105
CTABLE_FC_LENGTH
#define CTABLE_FC_LENGTH
Definition: TRT_RodDecoder.h:115
TRT_RodDecoder::m_forceRodVersion
int m_forceRodVersion
Definition: TRT_RodDecoder.h:102
TRT_RodDecoder::m_lookAtBcidErrors
bool m_lookAtBcidErrors
Definition: TRT_RodDecoder.h:95
TRT_RodDecoder::t_CompressTable
Definition: TRT_RodDecoder.h:117
TRT_RodDecoder::TRT_RodDecoder
TRT_RodDecoder(const std::string &type, const std::string &name, const IInterface *parent)
constructor
Definition: TRT_RodDecoder.cxx:35
SG::ReadCondHandleKey< CondAttrListCollection >
TRT_ID
Definition: TRT_ID.h:84
TRT_RodDecoder::int_fillMinimalCompress
StatusCode int_fillMinimalCompress(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *robFrag, TRT_RDO_Container *rdoIdo, DataPool< TRT_LoLumRawData > *dataItemsPool, const std::vector< IdentifierHash > *vecHash=0) const
Definition: TRT_RodDecoder.cxx:590
TRT_RodDecoder::m_accept
std::atomic< unsigned int > m_accept
Definition: TRT_RodDecoder.h:166
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TRT_RodDecoder::m_lookAtErrorErrors
bool m_lookAtErrorErrors
Definition: TRT_RodDecoder.h:93
TRT_RodDecoder::t_CompressTable::m_syms
std::unique_ptr< unsigned int[]> m_syms
Definition: TRT_RodDecoder.h:125
plotBeamSpotVxVal.bserr
float bserr
Definition: plotBeamSpotVxVal.py:283
TRT_RodDecoder::m_recordBSErrors
bool m_recordBSErrors
Definition: TRT_RodDecoder.h:87
DataPool
a typed memory pool that saves time spent allocation small object. This is typically used by containe...
Definition: DataPool.h:47
TRT_RodDecoder::m_eventTypeIsSim
bool m_eventTypeIsSim
Definition: TRT_RodDecoder.h:110
SlotSpecificObj.h
Maintain a set of objects, one per slot.
TRT_RodDecoder::m_Nrdos
std::atomic< uint32_t > m_Nrdos
Definition: TRT_RodDecoder.h:131
TRT_RodDecoder::ReadCompressTableDB
StatusCode ReadCompressTableDB(std::string Tag)
checker_macros.h
Define macros for attributes used to control the static checker.
TRT_RodDecoder::fillCollection
virtual StatusCode fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *robFrag, TRT_RDO_Container *rdoIdc, TRT_BSErrContainer *bserr, DataPool< TRT_LoLumRawData > *dataItemsPool, const std::vector< IdentifierHash > *vecHash=0) const override
the method to fill the IDC
Definition: TRT_RodDecoder.cxx:179
IdContext
class IdContext
Definition: IdContext.h:34
TRT_RodDecoder::int_fillExpanded
StatusCode int_fillExpanded(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *robFrag, TRT_RDO_Container *rodIdc, DataPool< TRT_LoLumRawData > *dataItemsPool, const std::vector< IdentifierHash > *vecHash=0) const
private methods
Definition: TRT_RodDecoder.cxx:416
TRT_RodDecoder::m_TB04_RawData
BooleanProperty m_TB04_RawData
Definition: TRT_RodDecoder.h:107
TRT_RodDecoder::int_fillFullCompress
StatusCode int_fillFullCompress(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *robFrag, TRT_RDO_Container *rdoIdo, DataPool< TRT_LoLumRawData > *dataItemsPool, const t_CompressTable &Ctable, const std::vector< IdentifierHash > *vecHash=0) const
Definition: TRT_RodDecoder.cxx:809
ServiceHandle< ITRT_CablingSvc >