ATLAS Offline Software
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 
20 namespace 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) ),
30  m_RoIBResultL1Topo()
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) ),
39  m_RoIBResultL1Topo() {
40 
41  }
42 
43  RoIBResult::RoIBResult( CTPResult&& ctp, std::vector< EMTauResult >&& emtau )
44  : m_RoIBResultMuCTPI(), m_RoIBResultCTP( std::move(ctp) ),
45  m_RoIBResultJetEnergy(), m_RoIBResultEMTau( std::move(emtau) ),
46  m_RoIBResultL1Topo() {
47  }
48 
50  : m_RoIBResultMuCTPI(), m_RoIBResultCTP( std::move(ctp) ),
51  m_RoIBResultJetEnergy(), m_RoIBResultEMTau(),
52  m_RoIBResultL1Topo() {
53 
54  }
55 
57  return m_RoIBResultMuCTPI;
58  }
59 
61  return m_RoIBResultCTP;
62  }
63 
64  const std::vector< JetEnergyResult >& RoIBResult::jetEnergyResult() const {
65  return m_RoIBResultJetEnergy;
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 
126  void RoIBResult::dumpData() const
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;
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) {
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;
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
ROIB::RoIBResult::jLink
constexpr static unsigned int jLink[2]
Definition: RoIBResult.h:105
ROIB::RoIBResult::MU_SUP1
@ MU_SUP1
Definition: RoIBResult.h:95
ROIB::RoIBResult::m_RoIBResultL1Topo
std::vector< L1TopoResult > m_RoIBResultL1Topo
result from L1Topo
Definition: RoIBResult.h:144
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
ROIB::MuCTPIResult::dumpData
void dumpData() const
Function dumping the stored information to the message stream.
Definition: MuCTPIResult.cxx:140
ROIB::Trailer::statusInfo
uint32_t statusInfo() const
get info status word (LVL1 trailer assumes only on word)
ROIB::EMTauResult
Definition: EMTauResult.h:25
ROIB::RoIBResult::dumpData
void dumpData() const
print object content to default message stream
Definition: RoIBResult.cxx:126
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
RoIBResult.h
ROIB::RoIBResult::jetEnergyResult
const std::vector< JetEnergyResult > & jetEnergyResult() const
Gets the jet/energy part of the L1 RDO.
Definition: RoIBResult.cxx:64
ROIB::MuCTPIResult::print
const std::string print(const bool longFormat=false) const
print object content in a human readable format to string
Definition: MuCTPIResult.cxx:88
ROIB::RoIBResult::eMTauResult
const std::vector< EMTauResult > & eMTauResult() const
Gets the egamma part of the L1 RDO.
Definition: RoIBResult.cxx:68
ROIB::CTPResult
Class holding the LVL1 CTP result used by the RoIBuilder.
Definition: CTPResult.h:52
ROIB::RoIBResult::m_RoIBResultJetEnergy
std::vector< JetEnergyResult > m_RoIBResultJetEnergy
result from calo system: JetEnergy
Definition: RoIBResult.h:142
ROIB::CTPResult::dump
const std::string dump() const
dump raw object content to string
Definition: CTPResult.cxx:56
ROIB
Namespace of the LVL1 RoIB simulation.
Definition: ILvl1ResultAccessTool.h:19
ROIB::RoIBResult::dump
const std::string dump() const
dump raw object content to string
Definition: RoIBResult.cxx:80
ROIB::JetEnergyResult
Definition: JetEnergyResult.h:24
ROIB::RoIBResult::MU_SUP2
@ MU_SUP2
Definition: RoIBResult.h:95
ROIB::RoIBResult::RoIBResult
RoIBResult()=default
default constructor: empty object
ROIB::RoIBResult::m_RoIBResultMuCTPI
MuCTPIResult m_RoIBResultMuCTPI
result from muon system
Definition: RoIBResult.h:140
ROIB::RoIBResult::l1TopoResult
const std::vector< L1TopoResult > & l1TopoResult() const
Gets the L1Topo part of the L1 RDO.
Definition: RoIBResult.cxx:72
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
ROIB::MuCTPIResult::trailer
const Trailer & trailer() const
Member function returning the trailer.
Definition: MuCTPIResult.cxx:60
lumiFormat.i
int i
Definition: lumiFormat.py:85
ROIB::RoIBResult::print
const std::string print(const bool longFormat=false) const
print object content in a human readable format to string
Definition: RoIBResult.cxx:98
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ROIB::MuCTPIResult::dump
const std::string dump() const
dump raw object content to string
Definition: MuCTPIResult.cxx:73
ROIB::RoIBResult::GetOverflowMask
unsigned int GetOverflowMask(bool setMu, bool setEM, bool setJE) const
Definition: RoIBResult.cxx:145
ROIB::MuCTPIResult
Class holding the RoIs from the MuCTPI collected by the RoIB.
Definition: MuCTPIResult.h:44
ROIB::RoIBResult::cTPResult
const CTPResult & cTPResult() const
Gets the CTP part of the L1 RDO.
Definition: RoIBResult.cxx:60
ROIB::RoIBResult::m_RoIBResultEMTau
std::vector< EMTauResult > m_RoIBResultEMTau
result from calo system: EmTauResult
Definition: RoIBResult.h:143
ROIB::RoIBResult::emLink
constexpr static unsigned int emLink[4]
Definition: RoIBResult.h:104
ROIB::Trailer
ROIB::Trailer models the LVL1 ROD Trailer.
Definition: Trailer.h:37
item
Definition: ItemListSvc.h:43
TriggerTest.ctp
ctp
Retrieve trigger EDM objects.
Definition: TriggerTest.py:14
ROIB::RoIBResult::MU_DOFL
@ MU_DOFL
Definition: RoIBResult.h:95
ROIB::RoIBResult::SUP1_bitMask
constexpr static unsigned int SUP1_bitMask
Definition: RoIBResult.h:98
ROIB::CTPResult::print
const std::string print(const bool longFormat=false) const
print object content in a human readable format to string
Definition: CTPResult.cxx:71
ROIB::CTPResult::dumpData
void dumpData() const
print object content to default message stream
Definition: CTPResult.cxx:156
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
ROIB::RoIBResult::muCTPIResult
const MuCTPIResult & muCTPIResult() const
Gets the MuCTPI part of the L1 RDO.
Definition: RoIBResult.cxx:56
ROIB::RoIBResult::m_RoIBResultCTP
CTPResult m_RoIBResultCTP
result from CTP
Definition: RoIBResult.h:141