Loading [MathJax]/jax/input/TeX/config.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
TRT_RodDecoder.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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 EventContext& ctx,
78  const std::vector<IdentifierHash>* vecHash = 0) const override;
79 
80 
81  private:
82 
84 
85  /*
86  * Do we look for Front-End Errors at all?
87  */
89 
90  /*
91  * Do we look for these types of Front-End Errors?
92  */
98 
101  std::vector<int> m_LoadCompressTableVersions;
104 
105  const TRT_ID* m_trt_id;
107 
108  BooleanProperty m_TB04_RawData; // true to create TRT_TB04_RawData RDOs
109  BooleanProperty m_LoLumRawData; // true to create TRT_LoLumRawData RDOs
110 
111  bool m_eventTypeIsSim; // look at first event to decide if RODBlockVersion
112  // is incorrect.
113 
114  uint32_t m_escape_marker; // Straw word that means escaped literal
115 
116  bool m_sortCollections{}; // sort collections by identifiers if required
117 
118 #define CTABLE_FC_LENGTH 33
119 #define CTABLE_LI_LENGTH 33
120  typedef struct {
121  // The TableVersion is a compression scheme.
122  // There are presently 6 TableVersions for the different run periods of ATLAS.
123  // Any IoV of /TRT/onl/ROD/Compress has one (and only one) of these as an attribute.
124  // The code takes advantage of this and caches locally any TableVersion that is encountered
126  int m_firstcode[CTABLE_FC_LENGTH];
127  int m_lengths_integral[CTABLE_FC_LENGTH]; // ..[i] = Sum(numl[0,i-1])
128  std::unique_ptr<unsigned int[]> m_syms; // Array of symbols (straw data words)
130  } t_CompressTable;
131 
132  std::vector<CxxUtils::CachedUniquePtr<t_CompressTable> > m_CompressionTables;
133 
134  mutable std::atomic<uint32_t> m_Nrdos; // Number of RDOs created
135 
136  mutable std::atomic<int> m_err_count_fillCollection{0};
137  mutable std::atomic<int> m_err_count_int_fillMinimalCompress{0};
138  mutable std::atomic<int> m_err_count_int_fillFullCompress{0};
139 
140  // This replaces the IOVCALLBACK
141  SG::ReadCondHandleKey<CondAttrListCollection> m_CompressKey{this,"keyName","/TRT/Onl/ROD/Compress","in-key"};
142  StatusCode update(const EventContext& ctx) const;
143 
145 private:
148  TRT_RDO_Container* rodIdc, DataPool<TRT_LoLumRawData>* dataItemsPool,
149  const std::vector<IdentifierHash>* vecHash = 0) const;
150 
153  TRT_RDO_Container* rdoIdo, DataPool<TRT_LoLumRawData>* dataItemsPool,
154  const std::vector<IdentifierHash>* vecHash = 0) const;
155 
158  TRT_RDO_Container* rdoIdo, DataPool<TRT_LoLumRawData>* dataItemsPool,
159  const t_CompressTable& Ctable,
160  const std::vector<IdentifierHash>* vecHash = 0) const;
161 
162  StatusCode ReadCompressTableFile(const std::string& TableFilename);
164 
166  m_lastPrint ATLAS_THREAD_SAFE;
167 
168  mutable std::atomic<unsigned int> m_skip{};
169  mutable std::atomic<unsigned int> m_accept{};
170 };
171 
172 #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:114
TRT_RodDecoder::m_lookAtL1idErrors
bool m_lookAtL1idErrors
Definition: TRT_RodDecoder.h:95
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:137
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TRT_RodDecoder::m_LoadCompressTableVersions
std::vector< int > m_LoadCompressTableVersions
Definition: TRT_RodDecoder.h:101
TRT_RodDecoder::m_loadCompressTableFile
bool m_loadCompressTableFile
Definition: TRT_RodDecoder.h:99
TRT_RodDecoder::m_lookAtMissingErrors
bool m_lookAtMissingErrors
Definition: TRT_RodDecoder.h:97
TRT_RodDecoder::m_err_count_fillCollection
std::atomic< int > m_err_count_fillCollection
Definition: TRT_RodDecoder.h:136
TRT_RodDecoder::m_skip
std::atomic< unsigned int > m_skip
Definition: TRT_RodDecoder.h:168
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:132
TRT_RodDecoder::m_lookAtSidErrors
bool m_lookAtSidErrors
Definition: TRT_RodDecoder.h:93
TRT_RodDecoder::ReadCompressTableFile
StatusCode ReadCompressTableFile(const std::string &TableFilename)
Definition: TRT_RodDecoder.cxx:1093
TRT_RodDecoder
Definition: TRT_RodDecoder.h:60
TRT_RodDecoder::m_trt_id
const TRT_ID * m_trt_id
Definition: TRT_RodDecoder.h:105
TRT_RodDecoder::initialize
virtual StatusCode initialize() override
initialize
Definition: TRT_RodDecoder.cxx:80
InDetRawDataContainer
Definition: InDetRawDataContainer.h:27
TRT_RodDecoder::m_err_count_int_fillFullCompress
std::atomic< int > m_err_count_int_fillFullCompress
Definition: TRT_RodDecoder.h:138
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
TRT_RodDecoder::m_maxCompressionVersion
const int m_maxCompressionVersion
Definition: TRT_RodDecoder.h:102
TRT_BSErrContainer
Definition: TRT_BSErrContainer.h:20
TRT_RodDecoder::m_LoLumRawData
BooleanProperty m_LoLumRawData
Definition: TRT_RodDecoder.h:109
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:129
AthAlgTool.h
CachedUniquePtr.h
Cached unique_ptr with atomic update.
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TRT_RodDecoder::m_sortCollections
bool m_sortCollections
Definition: TRT_RodDecoder.h:116
TRT_RodDecoder::m_loadCompressTableDB
bool m_loadCompressTableDB
Definition: TRT_RodDecoder.h:100
TRT_RodDecoder::m_CablingSvc
ServiceHandle< ITRT_CablingSvc > m_CablingSvc
Definition: TRT_RodDecoder.h:83
ReadCondHandleKey.h
TRT_RodDecoder::finalize
virtual StatusCode finalize() override
finalize
Definition: TRT_RodDecoder.cxx:154
ITRT_CablingSvc.h
TRT_RodDecoder::m_CompressKey
SG::ReadCondHandleKey< CondAttrListCollection > m_CompressKey
Definition: TRT_RodDecoder.h:141
TRT_RodDecoder::update
StatusCode update(const EventContext &ctx) const
Definition: TRT_RodDecoder.cxx:1480
TRT_RodDecoder::ATLAS_THREAD_SAFE
SG::SlotSpecificObj< std::atomic< EventContext::ContextEvt_t > > m_lastPrint ATLAS_THREAD_SAFE
Definition: TRT_RodDecoder.h:166
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
TRT_RodDecoder::t_CompressTable::m_TableVersion
int m_TableVersion
Definition: TRT_RodDecoder.h:125
TRT_RodDecoder::m_straw_layer_context
IdContext m_straw_layer_context
Definition: TRT_RodDecoder.h:106
CTABLE_FC_LENGTH
#define CTABLE_FC_LENGTH
Definition: TRT_RodDecoder.h:118
TRT_RodDecoder::m_forceRodVersion
int m_forceRodVersion
Definition: TRT_RodDecoder.h:103
TRT_RodDecoder::m_lookAtBcidErrors
bool m_lookAtBcidErrors
Definition: TRT_RodDecoder.h:96
TRT_RodDecoder::t_CompressTable
Definition: TRT_RodDecoder.h:120
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:601
TRT_RodDecoder::m_accept
std::atomic< unsigned int > m_accept
Definition: TRT_RodDecoder.h:169
TRT_RodDecoder::m_lookAtErrorErrors
bool m_lookAtErrorErrors
Definition: TRT_RodDecoder.h:94
TRT_RodDecoder::t_CompressTable::m_syms
std::unique_ptr< unsigned int[]> m_syms
Definition: TRT_RodDecoder.h:128
plotBeamSpotVxVal.bserr
float bserr
Definition: plotBeamSpotVxVal.py:283
TRT_RodDecoder::m_recordBSErrors
bool m_recordBSErrors
Definition: TRT_RodDecoder.h:88
DataPool
a typed memory pool that saves time spent allocation small object. This is typically used by containe...
Definition: DataPool.h:63
TRT_RodDecoder::m_eventTypeIsSim
bool m_eventTypeIsSim
Definition: TRT_RodDecoder.h:111
SlotSpecificObj.h
Maintain a set of objects, one per slot.
TRT_RodDecoder::m_Nrdos
std::atomic< uint32_t > m_Nrdos
Definition: TRT_RodDecoder.h:134
TRT_RodDecoder::fillCollection
virtual StatusCode fillCollection(const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment *robFrag, TRT_RDO_Container *rdoIdc, TRT_BSErrContainer *bserr, DataPool< TRT_LoLumRawData > *dataItemsPool, const EventContext &ctx, const std::vector< IdentifierHash > *vecHash=0) const override
the method to fill the IDC
Definition: TRT_RodDecoder.cxx:180
TRT_RodDecoder::ReadCompressTableDB
StatusCode ReadCompressTableDB(std::string Tag)
checker_macros.h
Define macros for attributes used to control the static checker.
IdContext
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition: IdContext.h:26
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:417
TRT_RodDecoder::m_TB04_RawData
BooleanProperty m_TB04_RawData
Definition: TRT_RodDecoder.h:108
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:830
ServiceHandle< ITRT_CablingSvc >