ATLAS Offline Software
Loading...
Searching...
No Matches
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
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
24namespace 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
55 Header::Header( const uint32_t i ) {
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
#define endmsg
const std::string print(const bool longFormat=false) const
print object content in a human readable format to string
Header()
default constructor: empty object
uint32_t headerSize() const
get number of words in header
uint32_t formatVersion() const
get version of header format
uint32_t eventType() const
get LVL1 event type
uint32_t triggerType() const
get LVL1 trigger type
void dumpData() const
print object content to default message stream
const std::string dump() const
dump raw object content to string
uint32_t headerMarker() const
get header marker word
uint32_t L1ID() const
get extended LVL1 ID
std::vector< uint32_t > m_header
vector of unsigned ints - the only data member
uint32_t sourceID() const
get sub detector source ID
uint32_t BCID() const
get bunch crossing ID
int size() const
get header(data) size
const std::string convertToHex(const uint32_t word)
helper function to dump a number in hex format
Namespace of the LVL1 RoIB simulation.