ATLAS Offline Software
Loading...
Searching...
No Matches
RoIBResult.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include <iostream>
6
7// Local include(s):
9
10// STL includes
11#include <sstream>
12
13// Gaudi includes
14#include "GaudiKernel/Bootstrap.h"
15#include "GaudiKernel/ISvcLocator.h"
16#include "GaudiKernel/IMessageSvc.h"
17#include "GaudiKernel/MsgStream.h"
18
19
20namespace ROIB {
21
23 CTPResult&& ctp,
24 std::vector< JetEnergyResult >&& jetEnergy,
25 std::vector< EMTauResult >&& emtau )
26 : m_RoIBResultMuCTPI( std::move(muctpi) ),
27 m_RoIBResultCTP( std::move(ctp) ),
28 m_RoIBResultJetEnergy( std::move(jetEnergy) ),
29 m_RoIBResultEMTau( std::move(emtau) ),
31 {
32 }
33
35 std::vector< EMTauResult >&& emtau,
36 std::vector< JetEnergyResult >&& jetEnergy )
37 : m_RoIBResultMuCTPI(), m_RoIBResultCTP( std::move(ctp) ),
38 m_RoIBResultJetEnergy( std::move(jetEnergy) ), m_RoIBResultEMTau( std::move(emtau) ),
40
41 }
42
43 RoIBResult::RoIBResult( CTPResult&& ctp, std::vector< EMTauResult >&& emtau )
44 : m_RoIBResultMuCTPI(), m_RoIBResultCTP( std::move(ctp) ),
47 }
48
55
59
61 return m_RoIBResultCTP;
62 }
63
64 const std::vector< JetEnergyResult >& RoIBResult::jetEnergyResult() const {
66 }
67
68 const std::vector< EMTauResult >& RoIBResult::eMTauResult() const {
69 return m_RoIBResultEMTau;
70 }
71
72 const std::vector< L1TopoResult >& RoIBResult::l1TopoResult() const{
73 return m_RoIBResultL1Topo;
74 }
75
76 void RoIBResult::l1TopoResult(std::vector< L1TopoResult >&& vL1TopoResult) noexcept{
77 m_RoIBResultL1Topo = std::move(vL1TopoResult);
78 }
79
80 const std::string RoIBResult::dump() const
81 {
82 std::ostringstream s;
83
84 for (std::vector< EMTauResult >::size_type i(0); i < eMTauResult().size(); ++i) {
85 s << "EMTauResult [" << eMTauResult()[i].dump() << "] ";
86 }
87 for (std::vector< JetEnergyResult >::size_type i(0); i < jetEnergyResult().size(); ++i) {
88 s << "JetEnergyResult [" << jetEnergyResult()[i].dump() << "] ";
89 }
90 s << "MuCTPIResult [ " << muCTPIResult().dump() << "] ";
91 s << "CTPResult [ " << cTPResult().dump() << "] ";
92 for (auto & elem: l1TopoResult()){
93 s << "L1TopoResult [" << elem.dump() << "] ";
94 }
95 return s.str();
96 }
97
98 const std::string RoIBResult::print(const bool longFormat) const
99 {
100 std::ostringstream s;
101
102 for (std::vector< EMTauResult >::size_type i(0); i < eMTauResult().size(); ++i) {
103 if (i == 0 || longFormat) s << "\n EMTauResult ";
104 if (longFormat) s << std::setw(2) << i;
105 s << eMTauResult()[i].print(longFormat);
106 if (longFormat) s << std::endl;
107 }
108 for (std::vector< JetEnergyResult >::size_type i(0); i < jetEnergyResult().size(); ++i) {
109 if (i == 0 || longFormat) s << "\n JetEnergyResult ";
110 if (longFormat) s << std::setw(2) << i;
111 s << jetEnergyResult()[i].print(longFormat);
112 if (longFormat) s << std::endl;
113 }
114 s << "\n MuCTPIResult " << muCTPIResult().print(longFormat);
115 if (longFormat) s << std::endl;
116 s << "\n CTPResult " << cTPResult().print(longFormat);
117 if (longFormat) s << std::endl;
118 for (auto & elem: l1TopoResult()){
119 s << "L1TopoResult [" << elem.dump() << "] ";
120 }
121 if (longFormat) s << std::endl;
122
123 return s.str();
124 }
125
127 {
128 SmartIF<IMessageSvc> msgSvc{Gaudi::svcLocator()->service("MessageSvc")};
129 if ( !msgSvc ) {
130 return;
131 }
132 MsgStream log(msgSvc, "RoIBResult");
133 dumpData(log);
134 }
135
136 void RoIBResult::dumpData(MsgStream& log) const
137 {
138 log << MSG::DEBUG << "=================================================" << endmsg;
139 log << MSG::DEBUG << "Dump of available RoIB Results" << endmsg;
140 m_RoIBResultMuCTPI.dumpData(log);
141 m_RoIBResultCTP.dumpData(log);
142 log << MSG::DEBUG << "=================================================" << endmsg;
143 }
144
145 unsigned int RoIBResult::GetOverflowMask(bool setMu, bool setEM, bool setJE) const {
146
147 const static unsigned int LRS_bitMask = 1 << 1;
148 const static unsigned int SOFL_bitMask = 1 << 19;
149
150 unsigned int overflowMask = 0;
151
152 // uint32_t errorStatus = m_RoIBResultMuCTPI.trailer().errorStatus();
153
154
155 if(setMu) {
156 uint32_t statusInfo = m_RoIBResultMuCTPI.trailer().statusInfo();
157
158 overflowMask |= ((statusInfo & LRS_bitMask) != 0)? MU_DOFL : 0;
159 overflowMask |= ((statusInfo & SUP1_bitMask) != 0)? MU_SUP1 : 0;
160 //overflowMask |= ((statusInfo & SUP2_bitMask) != 0)? MU_SUP2 : 0;
161 // Kludge: use MU_SUP2 to indicate SOFL overflow instead to avoid changing pub interface
162 overflowMask |= ((statusInfo & SOFL_bitMask) != 0)? MU_SUP2 : 0;
163 }
164
165 if(setEM) {
166 int link = 0;
167
168 for (const EMTauResult& item : m_RoIBResultEMTau) {
169 const Trailer &trailer = item.trailer();
170 uint32_t statusInfo = trailer.statusInfo();
171
172 overflowMask |= ((statusInfo & LRS_bitMask) != 0)? emLink[link] : 0;
173
174 if(link == 3) break; // just to be sure
175 ++link;
176
177 }
178 }
179
180 if(setJE) {
181 int link = 0;
182 for (const JetEnergyResult& item : m_RoIBResultJetEnergy) {
183 const Trailer &trailer = item.trailer();
184 uint32_t statusInfo = trailer.statusInfo();
185
186 overflowMask |= ((statusInfo & LRS_bitMask) != 0)? jLink[link] : 0;
187
188 if(link == 1) break;
189
190 ++link;
191 }
192 }
193
194 return overflowMask;
195 }
196
197} // namespace ROIB
#define endmsg
Class holding the LVL1 CTP result used by the RoIBuilder.
const std::string print(const bool longFormat=false) const
print object content in a human readable format to string
Definition CTPResult.cxx:71
const std::string dump() const
dump raw object content to string
Definition CTPResult.cxx:56
Class holding the RoIs from the MuCTPI collected by the RoIB.
const std::string dump() const
dump raw object content to string
const std::string print(const bool longFormat=false) const
print object content in a human readable format to string
std::vector< JetEnergyResult > m_RoIBResultJetEnergy
result from calo system: JetEnergy
Definition RoIBResult.h:142
MuCTPIResult m_RoIBResultMuCTPI
result from muon system
Definition RoIBResult.h:140
std::vector< L1TopoResult > m_RoIBResultL1Topo
result from L1Topo
Definition RoIBResult.h:144
const std::vector< L1TopoResult > & l1TopoResult() const
Gets the L1Topo part of the L1 RDO.
void dumpData() const
print object content to default message stream
const std::vector< JetEnergyResult > & jetEnergyResult() const
Gets the jet/energy part of the L1 RDO.
const std::string print(const bool longFormat=false) const
print object content in a human readable format to string
static constexpr unsigned int emLink[4]
Definition RoIBResult.h:104
CTPResult m_RoIBResultCTP
result from CTP
Definition RoIBResult.h:141
const CTPResult & cTPResult() const
Gets the CTP part of the L1 RDO.
unsigned int GetOverflowMask(bool setMu, bool setEM, bool setJE) const
RoIBResult()=default
default constructor: empty object
static constexpr unsigned int jLink[2]
Definition RoIBResult.h:105
static constexpr unsigned int SUP1_bitMask
Definition RoIBResult.h:98
const std::vector< EMTauResult > & eMTauResult() const
Gets the egamma part of the L1 RDO.
const std::string dump() const
dump raw object content to string
std::vector< EMTauResult > m_RoIBResultEMTau
result from calo system: EmTauResult
Definition RoIBResult.h:143
const MuCTPIResult & muCTPIResult() const
Gets the MuCTPI part of the L1 RDO.
ROIB::Trailer models the LVL1 ROD Trailer.
Definition Trailer.h:37
uint32_t statusInfo() const
get info status word (LVL1 trailer assumes only on word)
Namespace of the LVL1 RoIB simulation.
STL namespace.