ATLAS Offline Software
TrigT1Result/src/Header.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 
6 // this header file
7 #include "TrigT1Result/Header.h"
8 
9 // STL includes
10 #include <sstream>
11 #include <iomanip>
12 
13 // Local include(s):
15 
16 // gaudi includes
17 #include "GaudiKernel/Bootstrap.h"
18 #include "GaudiKernel/ISvcLocator.h"
19 #include "GaudiKernel/IMessageSvc.h"
20 #include "GaudiKernel/MsgStream.h"
21 
22 #include "eformat/eformat.h"
23 
24 namespace ROIB {
25 
26  Header::Header( const uint32_t i1, const uint32_t i2, const uint32_t i3 ) {
27 
28  m_header.push_back( eformat::ROD ); // start of header marker
29  m_header.push_back( 8 ); // header size xxx needs update to adjusted
30  m_header.push_back( i3 ); // format version number
31  m_header.push_back( i1 ); // source identifier
32  m_header.push_back( i2 ); // extended level 1 ID
33  m_header.push_back( 0 ); // bunch crossing ID
34  m_header.push_back( 0 ); // level 1 trigger type
35  m_header.push_back( 0 ); // detector event type
36 
37  // m_header.push_back( 0 ); // run number xxx needs to be added for eformat v3
38  }
39 
40  Header::Header( const uint32_t i1, const uint32_t i2 ) {
41 
42  m_header.push_back( eformat::ROD ); // start of header marker
43  m_header.push_back( 8 ); // header size xxx needs update
44  m_header.push_back( eformat::DEFAULT_VERSION ); // format version number
45  m_header.push_back( i1 ); // source identifier
46  m_header.push_back( i2 ); // extended level 1 ID
47  m_header.push_back( 0 ); // bunch crossing ID
48  m_header.push_back( 0 ); // level 1 trigger type
49  m_header.push_back( 0 ); // detector event type
50 
51  // m_header.push_back( 0 ); // run number xxx needs to be added for eformat v3
52  }
53 
56 
57  m_header.push_back( eformat::ROD ); // start of header marker
58  m_header.push_back( 8 ); // header size xxx needs update
59  m_header.push_back( eformat::DEFAULT_VERSION ); // format version number
60  m_header.push_back( i ); // source identifier
61  m_header.push_back( 0 ); // extended level 1 ID
62  m_header.push_back( 0 ); // bunch crossing ID
63  m_header.push_back( 0 ); // level 1 trigger type
64  m_header.push_back( 0 ); // detector event type
65 
66  // m_header.push_back( 0 ); // run number xxx needs to be added for eformat v3
67  }
68 
69  const std::string Header::dump() const
70  {
71  std::ostringstream s;
72 
73  for (std::vector< uint32_t >::size_type i(0); i < m_header.size(); ++i) {
75  }
76 
77  return s.str();
78  }
79 
80  const std::string Header::print(const bool longFormat) const
81  {
82  std::ostringstream s;
83 
84  if (longFormat) {
85  s << "Size: " << size() << std::endl;
86  s << std::setw(2) << 0 << "Marker:" << headerMarker() << std::endl;
87  s << std::setw(2) << 1 << "Size:" << headerSize() << std::endl;
88  s << std::setw(2) << 2 << "Version:" << formatVersion() << std::endl;
89  s << std::setw(2) << 3 << "SourceID:" << sourceID() << std::endl;
90  s << std::setw(2) << 4 << "L1ID:" << L1ID() << std::endl;
91  s << std::setw(2) << 5 << "BCID:" << BCID() << std::endl;
92  s << std::setw(2) << 6 << "TriggerType:" << triggerType() << std::endl;
93  s << std::setw(2) << 7 << "EventType:" << eventType() << std::endl;
94  } else {
95  for (size_t i(0); i < m_header.size(); ++i) {
97  }
98  }
99 
100  return s.str();
101  }
102 
103  void Header::dumpData() const
104  {
105  SmartIF<IMessageSvc> msgSvc{Gaudi::svcLocator()->service("MessageSvc")};
106  if ( !msgSvc ) {
107  return;
108  }
109  MsgStream log(msgSvc, "ROIB::Header");
110  dumpData(log);
111  }
112 
113  void Header::dumpData(MsgStream& log) const
114  {
115  log << MSG::DEBUG << "*BEGIN* ROIB::Header" << endmsg;
116  log << MSG::DEBUG << "Header marker : " << MSG::hex << headerMarker() << MSG::dec << endmsg;
117  log << MSG::DEBUG << "Header size : " << headerSize() << endmsg;
118  log << MSG::DEBUG << "Source ID : 0x" << MSG::hex << sourceID() << MSG::dec << endmsg;
119  log << MSG::DEBUG << "Ext. LVL1 ID : " << L1ID() << endmsg;
120  log << MSG::DEBUG << "BCID : " << BCID() << endmsg;
121  log << MSG::DEBUG << "Trigger type : " << triggerType() << endmsg;
122  log << MSG::DEBUG << "Det. event type : " << eventType() << endmsg;
123  log << MSG::DEBUG << "*END* ROIB::Header" << endmsg;
124  }
125 } // namespace ROIB
ROIB::Header::sourceID
uint32_t sourceID() const
get sub detector source ID
ROIB::Header::eventType
uint32_t eventType() const
get LVL1 event type
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
ROIB::Header::formatVersion
uint32_t formatVersion() const
get version of header format
ROIB::Header::print
const std::string print(const bool longFormat=false) const
print object content in a human readable format to string
Definition: TrigT1Result/src/Header.cxx:80
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
ROIB::Header::size
int size() const
get header(data) size
ROIB::Header::L1ID
uint32_t L1ID() const
get extended LVL1 ID
ROIB
Namespace of the LVL1 RoIB simulation.
Definition: ILvl1ResultAccessTool.h:19
LVL1CTP::convertToHex
const std::string convertToHex(const uint32_t word)
helper function to dump a number in hex format
Definition: TrigT1CTPDefs.h:41
ROIB::Header::headerMarker
uint32_t headerMarker() const
get header marker word
ROIB::Header::BCID
uint32_t BCID() const
get bunch crossing ID
ROIB::Header::triggerType
uint32_t triggerType() const
get LVL1 trigger type
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:85
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ROIB::Header::dump
const std::string dump() const
dump raw object content to string
Definition: TrigT1Result/src/Header.cxx:69
ROIB::Header::Header
Header()
default constructor: empty object
Definition: TrigT1Result/TrigT1Result/Header.h:46
Header.h
ROIB::Header::m_header
std::vector< uint32_t > m_header
vector of unsigned ints - the only data member
Definition: TrigT1Result/TrigT1Result/Header.h:120
ROIB::Header::dumpData
void dumpData() const
print object content to default message stream
Definition: TrigT1Result/src/Header.cxx:103
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
ROIB::Header::headerSize
uint32_t headerSize() const
get number of words in header
TrigT1CTPDefs.h