ATLAS Offline Software
Loading...
Searching...
No Matches
ByteStreamMetadata.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
10
12
13#include "EventStorage/DataReader.h"
14
15#include <bitset>
16#include <ostream>
17
18/******************************************************************************/
20 : m_runNumber(0U)
21 , m_numEvents(0U)
22 , m_maxEvents(0U)
23 , m_recEnable(0U)
24 , m_triggerType(0U)
25 , m_detectorMask(0L)
26 , m_detectorMask2(0L)
27 , m_beamType(0U)
28 , m_beamEnergy(0U)
29 , m_guid()
30 , m_stream()
31 , m_project()
32 , m_lumiBlock(0U)
34{}
35
36
37/******************************************************************************/
39 unsigned int numEvents,
40 unsigned int maxEvents,
41 unsigned int recEnable,
42 unsigned int triggerType,
43 uint64_t detectorMask,
44 unsigned int beamType,
45 unsigned int beamEnergy,
46 const std::string& guid,
47 const std::string& stream,
48 const std::string& project,
49 unsigned int lumiBlock,
50 const std::vector<std::string>& freeMetaDataStrings)
51 : m_runNumber(runNumber)
52 , m_numEvents(numEvents)
53 , m_maxEvents(maxEvents)
54 , m_recEnable(recEnable)
55 , m_triggerType(triggerType)
56 , m_detectorMask(detectorMask)
58 , m_beamType(beamType)
59 , m_beamEnergy(beamEnergy)
60 , m_guid(guid)
61 , m_stream(stream)
63 , m_lumiBlock(lumiBlock)
64 , m_freeMetaDataStrings(freeMetaDataStrings)
65{}
66
67
68/******************************************************************************/
70 unsigned int runNumber,
71 unsigned int numEvents,
72 unsigned int maxEvents,
73 unsigned int recEnable,
74 unsigned int triggerType,
75 uint64_t detectorMask,
76 uint64_t detectorMask2,
77 unsigned int beamType,
78 unsigned int beamEnergy,
79 const std::string& guid,
80 const std::string& stream,
81 const std::string& project,
82 unsigned int lumiBlock,
83 const std::vector<std::string>& freeMetaDataStrings)
84 : m_runNumber(runNumber)
85 , m_numEvents(numEvents)
86 , m_maxEvents(maxEvents)
87 , m_recEnable(recEnable)
88 , m_triggerType(triggerType)
89 , m_detectorMask(detectorMask)
90 , m_detectorMask2(detectorMask2)
91 , m_beamType(beamType)
92 , m_beamEnergy(beamEnergy)
93 , m_guid(guid)
94 , m_stream(stream)
96 , m_lumiBlock(lumiBlock)
97 , m_freeMetaDataStrings(freeMetaDataStrings)
98{}
99
100
101/******************************************************************************/
102ByteStreamMetadata::ByteStreamMetadata(EventStorage::DataReader& reader)
103 : m_runNumber (reader.runNumber())
104 , m_numEvents (reader.eventsInFile())
105 , m_maxEvents (reader.maxEvents())
106 , m_recEnable (reader.recEnable())
107 , m_triggerType (reader.triggerType())
108 , m_detectorMask (0)
109 , m_detectorMask2 (0)
110 , m_beamType (reader.beamType())
111 , m_beamEnergy (reader.beamEnergy())
112 , m_guid (reader.GUID())
113 , m_stream (reader.stream())
114 , m_project (reader.projectTag())
115 , m_lumiBlock (reader.lumiblockNumber())
116 , m_freeMetaDataStrings(reader.freeMetaDataStrings())
117{
118 // default goes into ByteStreamMetadata
119 std::bitset<64> word1;
120 std::bitset<64> word2;
121 for (unsigned int i=0; i<64; ++i) {
122 word1[i] = reader.detectorMask()[i];
123 word2[i] = reader.detectorMask()[i+64];
124 }
125 m_detectorMask = word1.to_ulong();
126 m_detectorMask2 = word2.to_ulong();
127}
128
129
130/******************************************************************************/
132
133
134/******************************************************************************/
135// TODO: inline these getters
136unsigned int
139
140unsigned int
143
144unsigned int
147
148unsigned int
151
152unsigned int
155
156uint64_t
159
160uint64_t
163
164unsigned int
167
168unsigned int
171
172const std::string&
175
176const std::string&
179
180const std::string&
183
184unsigned int
187
188const std::vector<std::string>&
191
192
193/******************************************************************************/
194std::ostream& operator<<(std::ostream& os, const ByteStreamMetadata& bsmd) {
195 std::bitset<64> word1(bsmd.getDetectorMask());
196 std::bitset<64> word2(bsmd.getDetectorMask2());
197
198 os << " runNumber: " << bsmd.getRunNumber() << '\n'
199 << " numEvents: " << bsmd.getNumEvents() << '\n'
200 << " m_maxEvents: " << bsmd.getMaxEvents() << '\n'
201 << " recEnable: " << bsmd.getRecEnable() << '\n'
202 << " triggerType: " << bsmd.getTriggerType() << '\n'
203 << " detectorMask: " << word1 << '\n'
204 << " detectorMask2: " << word2 << '\n'
205 << " beamType: " << bsmd.getBeamType() << '\n'
206 << " beamEnergy: " << bsmd.getBeamEnergy() << '\n'
207 << " guid: " << bsmd.getGuid() << '\n'
208 << " stream: " << bsmd.getStream() << '\n'
209 << " project: " << bsmd.getProject() << '\n'
210 << " lumiBlock: " << bsmd.getLumiBlock() << '\n';
211
212 os << " freeMetaDataStrings: ";
213 for (const std::string& key : bsmd.getFreeMetaDataStrings())
214 os << key << " ";
215
216 return os;
217}
std::ostream & operator<<(std::ostream &os, const ByteStreamMetadata &bsmd)
pretty print bytestream metadata content
This file contains the class definition for the ByteStreamMetadata class.
T_ResultType project(ParameterMapping::type< N > parameter_map, const T_Matrix &matrix)
This class is the StoreGate data object for bytestream metadata.
uint64_t getDetectorMask() const
unsigned int getBeamType() const
const std::string & getGuid() const
const std::string & getStream() const
unsigned int getMaxEvents() const
unsigned int getRecEnable() const
unsigned int getRunNumber() const
unsigned int getTriggerType() const
unsigned int getNumEvents() const
unsigned int getBeamEnergy() const
unsigned int getLumiBlock() const
const std::vector< std::string > & getFreeMetaDataStrings() const
const std::string & getProject() const
std::vector< std::string > m_freeMetaDataStrings
uint64_t getDetectorMask2() const