ATLAS Offline Software
L1CaloErrorByteStreamTool.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_IL1CaloErrorByteStreamTool(
19  "L1CaloErrorByteStreamTool", 1, 1);
20 
22 {
23  return IID_IL1CaloErrorByteStreamTool;
24 }
25 
26 // Constructor
27 
29  const std::string& name,
30  const IInterface* parent)
32 {
33  declareInterface<L1CaloErrorByteStreamTool>(this);
34 }
35 
36 // Destructor
37 
39 {
40 }
41 
42 // Initialize
43 
44 
46 {
47  msg(MSG::INFO) << "Initializing " << name() << endmsg;
48 
49  return StatusCode::SUCCESS;
50 }
51 
52 // Finalize
53 
55 {
56  return StatusCode::SUCCESS;
57 }
58 
59 // Set ROB status error
60 
62  const unsigned int err) const
63 {
64  ErrorMaps& maps = *m_maps;
65  std::scoped_lock lock (maps.m_mutex);
66  if (err && maps.m_robMap.find(robid) == maps.m_robMap.end()) {
67  maps.m_robMap.insert(std::make_pair(robid, err));
68  }
69  return;
70 }
71 
72 // Set ROD unpacking error
73 
75  const unsigned int err) const
76 {
77  ErrorMaps& maps = *m_maps;
78  std::scoped_lock lock (maps.m_mutex);
79  if (err && maps.m_rodMap.find(robid) == maps.m_rodMap.end()) {
80  maps.m_rodMap.insert(std::make_pair(robid, err));
81  }
82  return;
83 }
84 
85 // Fill vector with accumulated errors and reset
86 
88  const errColl) const
89 {
90  ErrorMaps& maps = *m_maps;
91  std::scoped_lock lock (maps.m_mutex);
92  if (!maps.m_robMap.empty() || !maps.m_rodMap.empty()) {
93  errColl->push_back(maps.m_robMap.size());
94  ErrorMap::const_iterator iter = maps.m_robMap.begin();
95  ErrorMap::const_iterator iterE = maps.m_robMap.end();
96  for (; iter != iterE; ++iter) {
97  errColl->push_back(iter->first);
98  errColl->push_back(iter->second);
99  }
100  maps.m_robMap.clear();
101  iter = maps.m_rodMap.begin();
102  iterE = maps.m_rodMap.end();
103  for (; iter != iterE; ++iter) {
104  errColl->push_back(iter->first);
105  errColl->push_back(iter->second);
106  }
107  maps.m_rodMap.clear();
108  }
109  return StatusCode::SUCCESS;
110 }
111 
112 } // end namespace
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
LVL1BS::L1CaloErrorByteStreamTool::ErrorMaps
Definition: L1CaloErrorByteStreamTool.h:53
LVL1BS::L1CaloErrorByteStreamTool::initialize
virtual StatusCode initialize() override
Definition: L1CaloErrorByteStreamTool.cxx:45
LVL1BS::L1CaloErrorByteStreamTool::errors
StatusCode errors(std::vector< unsigned int > *errColl) const
Fill vector with accumulated errors and reset.
Definition: L1CaloErrorByteStreamTool.cxx:87
LVL1BS::L1CaloErrorByteStreamTool::rodError
void rodError(uint32_t robid, unsigned int err) const
Set ROD unpacking error.
Definition: L1CaloErrorByteStreamTool.cxx:74
LVL1BS::L1CaloErrorByteStreamTool::~L1CaloErrorByteStreamTool
virtual ~L1CaloErrorByteStreamTool()
Definition: L1CaloErrorByteStreamTool.cxx:38
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:182
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LVL1BS::L1CaloErrorByteStreamTool::robError
void robError(uint32_t robid, unsigned int err) const
Set ROB status error.
Definition: L1CaloErrorByteStreamTool.cxx:61
test_pyathena.parent
parent
Definition: test_pyathena.py:15
LVL1BS::L1CaloErrorByteStreamTool::L1CaloErrorByteStreamTool
L1CaloErrorByteStreamTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: L1CaloErrorByteStreamTool.cxx:28
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
LVL1BS::L1CaloErrorByteStreamTool::ErrorMaps::m_mutex
std::mutex m_mutex
Definition: L1CaloErrorByteStreamTool.h:57
L1CaloErrorByteStreamTool.h
LVL1BS::L1CaloErrorByteStreamTool::finalize
virtual StatusCode finalize() override
Definition: L1CaloErrorByteStreamTool.cxx:54
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
LVL1BS
Definition: ZdcModifySlices.h:10
LVL1BS::L1CaloErrorByteStreamTool::interfaceID
static const InterfaceID & interfaceID()
AlgTool InterfaceID.
Definition: L1CaloErrorByteStreamTool.cxx:21
AthAlgTool
Definition: AthAlgTool.h:26
LVL1BS::L1CaloErrorByteStreamTool::ErrorMaps::m_robMap
ErrorMap m_robMap
Definition: L1CaloErrorByteStreamTool.h:55
LVL1BS::L1CaloErrorByteStreamTool::ErrorMaps::m_rodMap
ErrorMap m_rodMap
Definition: L1CaloErrorByteStreamTool.h:56