ATLAS Offline Software
Loading...
Searching...
No Matches
TOBTextReader.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_TOBTEXTREADER_H
5#define GLOBALSIM_TOBTEXTREADER_H
6
7/*
8 Reads a hex text file of TOB test vectors and produces a container of
9 objects carrying the decoded fields: one line per event, one token per TOB,
10 each token the whole word in hex.
11
12 The mirror of TOBTextWriter, and it works the same way: the bit layout is
13 chosen by name through the BitSpec property and looked up in SpecRegistry, so
14 the reader holds no knowledge of field positions and adding a TOB type needs
15 no change here at all.
16
17 Tokens are kept as text until they are used, rather than being parsed into
18 integers up front, so that the reader is not limited to words that fit in
19 64 bits.
20*/
21
25
26#include <cstddef>
27#include <functional>
28#include <string>
29#include <vector>
30
31namespace GlobalSim {
32
34 public:
35 using AthReentrantAlgorithm::AthReentrantAlgorithm;
36
37 virtual StatusCode initialize() override;
38 virtual StatusCode execute(const EventContext& ctx) const override;
39
40 private:
41 Gaudi::Property<std::string> m_inputFile{
42 this, "InputFile", "",
43 "Test-vector file: one event per line, space-separated hex words"};
44
45 Gaudi::Property<std::string> m_specName{
46 this, "BitSpec", "",
47 "Name of the BitSpec giving the bit layout, e.g. topoc_pu_type"};
48
50 this, "Output", "",
51 "Container of decoded TOBs to write to StoreGate"};
52
53 // Taken from the registry in initialize().
54 std::function<void(SG::AuxElement&, const std::string&)> m_unpack;
55 std::size_t m_width{0};
56
57 // The whole file, read once: one entry per event, each a list of tokens.
58 // Read-only after initialize(), which is what lets execute() stay const.
59 std::vector<std::vector<std::string>> m_events;
60 };
61
62} // namespace GlobalSim
63
64#endif // GLOBALSIM_TOBTEXTREADER_H
Property holding a SG store/key/clid from which a WriteHandle is made.
An algorithm that can be simultaneously executed in multiple threads.
SG::WriteHandleKey< xAOD::BaseContainer > m_outKey
std::vector< std::vector< std::string > > m_events
Gaudi::Property< std::string > m_specName
virtual StatusCode initialize() override
Gaudi::Property< std::string > m_inputFile
std::function< void(SG::AuxElement &, const std::string &)> m_unpack
virtual StatusCode execute(const EventContext &ctx) const override
Property holding a SG store/key/clid from which a WriteHandle is made.
AlgTool to read in LArStripNeighborhoods, and run the BDT Algorithm.
Definition BitSpec.h:23
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.