ATLAS Offline Software
ZdcL1CaloErrorByteStreamTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 
6 #include <utility>
7 
8 #include "GaudiKernel/IInterface.h"
9 #include "GaudiKernel/MsgStream.h"
10 #include "GaudiKernel/StatusCode.h"
11 
13 
14 //namespace LVL1BS {
15 
16 // Interface ID
17 
18 static const InterfaceID IID_IZdcL1CaloErrorByteStreamTool(
19  "L1CaloErrorByteStreamTool", 1, 1);
20 
22 {
23  return IID_IZdcL1CaloErrorByteStreamTool;
24 }
25 
26 // Constructor
27 
29  const std::string& name,
30  const IInterface* parent)
32 {
33  declareInterface<ZdcL1CaloErrorByteStreamTool>(this);
34 }
35 
36 
37 // Set ROB status error
38 
40  const unsigned int err) const
41 {
42  ErrorMaps& maps = *m_maps;
43  std::scoped_lock lock (maps.m_mutex);
44  if (err && maps.m_robMap.find(robid) == maps.m_robMap.end()) {
45  maps.m_robMap.insert(std::make_pair(robid, err));
46  }
47  return;
48 }
49 
50 // Set ROD unpacking error
51 
53  const unsigned int err) const
54 {
55  ErrorMaps& maps = *m_maps;
56  std::scoped_lock lock (maps.m_mutex);
57  if (err && maps.m_rodMap.find(robid) == maps.m_rodMap.end()) {
58  maps.m_rodMap.insert(std::make_pair(robid, err));
59  }
60  return;
61 }
62 
63 // Fill vector with accumulated errors and reset
64 
66  const errColl) const
67 {
68  ErrorMaps& maps = *m_maps;
69  std::scoped_lock lock (maps.m_mutex);
70  if (!maps.m_robMap.empty() || !maps.m_rodMap.empty()) {
71  errColl->push_back(maps.m_robMap.size());
72  ErrorMap::const_iterator iter = maps.m_robMap.begin();
73  ErrorMap::const_iterator iterE = maps.m_robMap.end();
74  for (; iter != iterE; ++iter) {
75  errColl->push_back(iter->first);
76  errColl->push_back(iter->second);
77  }
78  maps.m_robMap.clear();
79  iter = maps.m_rodMap.begin();
80  iterE = maps.m_rodMap.end();
81  for (; iter != iterE; ++iter) {
82  errColl->push_back(iter->first);
83  errColl->push_back(iter->second);
84  }
85  maps.m_rodMap.clear();
86  }
87  return StatusCode::SUCCESS;
88 }
89 
90 //} // end namespace
ZdcL1CaloErrorByteStreamTool::ErrorMaps::m_mutex
std::mutex m_mutex
Definition: ZdcL1CaloErrorByteStreamTool.h:54
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
ZdcL1CaloErrorByteStreamTool::ErrorMaps::m_rodMap
ErrorMap m_rodMap
Definition: ZdcL1CaloErrorByteStreamTool.h:53
ZdcL1CaloErrorByteStreamTool.h
ZdcL1CaloErrorByteStreamTool::ErrorMaps::m_robMap
ErrorMap m_robMap
Definition: ZdcL1CaloErrorByteStreamTool.h:52
ZdcL1CaloErrorByteStreamTool::interfaceID
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
Definition: ZdcL1CaloErrorByteStreamTool.cxx:21
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
ZdcL1CaloErrorByteStreamTool::rodError
void rodError(uint32_t robid, unsigned int err) const
Set ROD unpacking error.
Definition: ZdcL1CaloErrorByteStreamTool.cxx:52
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ZdcL1CaloErrorByteStreamTool::errors
StatusCode errors(std::vector< unsigned int > *errColl) const
Fill vector with accumulated errors and reset.
Definition: ZdcL1CaloErrorByteStreamTool.cxx:65
test_pyathena.parent
parent
Definition: test_pyathena.py:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ZdcL1CaloErrorByteStreamTool::ZdcL1CaloErrorByteStreamTool
ZdcL1CaloErrorByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: ZdcL1CaloErrorByteStreamTool.cxx:28
AthAlgTool
Definition: AthAlgTool.h:26
ZdcL1CaloErrorByteStreamTool::robError
void robError(uint32_t robid, unsigned int err) const
Set ROB status error.
Definition: ZdcL1CaloErrorByteStreamTool.cxx:39
ZdcL1CaloErrorByteStreamTool::ErrorMaps
Definition: ZdcL1CaloErrorByteStreamTool.h:50