ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
Global
GlobalSimulation
src
TOBTextWriter.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#ifndef GLOBALSIM_TOBTEXTWRITER_H
5
#define GLOBALSIM_TOBTEXTWRITER_H
6
7
/*
8
Writes a container of TOBs back out as a hex text file, in the same shape as
9
the firmware test vectors: one line per event, one token per TOB, each token
10
the whole word in hex (spec width / 4 characters).
11
12
The bit layout is chosen by name at configuration time through the BitSpec
13
property, and looked up in a registry of packing functions kept in the .cxx.
14
The writer itself holds no knowledge of field positions, and no knowledge of
15
which specs exist: adding a TOB type is one line in that registry, with no
16
new component and no new class.
17
18
Lines are written as the events arrive, so the algorithm is non-reentrant and
19
refuses to run if an event reaches it out of order: with more than one event
20
in flight the correspondence between line N and event N no longer holds, and
21
nothing else about the output would look wrong. Run these jobs with a single
22
concurrent event.
23
*/
24
25
#include "
AthenaBaseComps/AthAlgorithm.h
"
26
#include "
StoreGate/ReadHandleKey.h
"
27
#include "
xAODCore/BaseContainer.h
"
28
29
#include <cstdint>
30
#include <fstream>
31
#include <functional>
32
#include <string>
33
34
namespace
GlobalSim
{
35
36
class
TOBTextWriter
:
public
AthAlgorithm
{
37
public
:
38
using
AthAlgorithm::AthAlgorithm
;
39
40
virtual
StatusCode
initialize
()
override
;
41
virtual
StatusCode
execute
(
const
EventContext& ctx)
override
;
42
virtual
StatusCode
finalize
()
override
;
43
44
private
:
45
SG::ReadHandleKey<xAOD::BaseContainer>
m_inKey
{
46
this
,
"Input"
,
""
,
"Container of TOBs to write out"
};
47
48
Gaudi::Property<std::string>
m_specName
{
49
this
,
"BitSpec"
,
""
,
50
"Name of the BitSpec giving the bit layout, e.g. topoc_pu_type"
};
51
52
Gaudi::Property<std::string>
m_outFile
{
53
this
,
"OutputFile"
,
"globalsim_tobs.hex.txt"
,
54
"Output file: one line per event, space-separated hex words"
};
55
56
// Taken from the registry in initialize(). The width is kept only so that
57
// the startup message reports the token size, which is the quickest way to
58
// spot an instance pointed at the wrong spec.
59
std::function<std::string(
const
SG::AuxElement
&)>
m_pack
;
60
std::size_t
m_width
{0};
61
62
std::ofstream
m_out
;
63
64
// Guards line N == event N. The first event seen sets the start, so a job
65
// that skips events is still accepted; any gap after that is an error.
66
uint64_t
m_nextEvt
{0};
67
uint64_t
m_nWritten
{0};
68
};
69
70
}
// namespace GlobalSim
71
72
#endif
// GLOBALSIM_TOBTEXTWRITER_H
AthAlgorithm.h
BaseContainer.h
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
GlobalSim::TOBTextWriter
Definition
TOBTextWriter.h:36
GlobalSim::TOBTextWriter::m_outFile
Gaudi::Property< std::string > m_outFile
Definition
TOBTextWriter.h:52
GlobalSim::TOBTextWriter::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
TOBTextWriter.cxx:36
GlobalSim::TOBTextWriter::m_nWritten
uint64_t m_nWritten
Definition
TOBTextWriter.h:67
GlobalSim::TOBTextWriter::m_pack
std::function< std::string(const SG::AuxElement &)> m_pack
Definition
TOBTextWriter.h:59
GlobalSim::TOBTextWriter::m_out
std::ofstream m_out
Definition
TOBTextWriter.h:62
GlobalSim::TOBTextWriter::m_inKey
SG::ReadHandleKey< xAOD::BaseContainer > m_inKey
Definition
TOBTextWriter.h:45
GlobalSim::TOBTextWriter::m_nextEvt
uint64_t m_nextEvt
Definition
TOBTextWriter.h:66
GlobalSim::TOBTextWriter::m_width
std::size_t m_width
Definition
TOBTextWriter.h:60
GlobalSim::TOBTextWriter::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
GlobalSim::TOBTextWriter::initialize
virtual StatusCode initialize() override
Definition
TOBTextWriter.cxx:10
GlobalSim::TOBTextWriter::finalize
virtual StatusCode finalize() override
Definition
TOBTextWriter.cxx:76
GlobalSim::TOBTextWriter::m_specName
Gaudi::Property< std::string > m_specName
Definition
TOBTextWriter.h:48
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition
StoreGate/StoreGate/ReadHandleKey.h:40
GlobalSim
AlgTool to read in LArStripNeighborhoods, and run the BDT Algorithm.
Definition
BitSpec.h:23
SG::AuxElement
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.
Generated on
for ATLAS Offline Software by
1.17.0