Project
Loading...
Searching...
No Matches
Encoder.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16#ifndef O2_MID_ENCODER_H
17#define O2_MID_ENCODER_H
18
19#include <cstdint>
20#include <array>
21#include <map>
22#include <string_view>
23#include <vector>
24#include <gsl/gsl>
32#include "MIDRaw/FEEIdConfig.h"
34
35class RDHAny;
36
37namespace o2
38{
39namespace mid
40{
42{
43 public:
44 void init(std::string_view outDir = ".", std::string_view fileFor = "all", int verbosity = 0, std::vector<ROBoardConfig> configurations = makeDefaultROBoardConfig());
45 void process(gsl::span<const ColumnData> data, InteractionRecord ir, EventType eventType = EventType::Standard);
47 void setSuperpageSize(int maxSize) { mRawWriter.setSuperPageSize(maxSize); }
48
49 void finalize(bool closeFile = true);
50
51 auto& getWriter() { return mRawWriter; }
52
53 void emptyHBFMethod(const o2::header::RDHAny* rdh, std::vector<char>& toAdd) const;
54
55 private:
56 void completeWord(std::vector<char>& buffer);
57 void writePayload(uint16_t linkId, const InteractionRecord& ir, bool onlyNonEmpty = false);
58 void onOrbitChange(uint32_t orbit);
60 inline InteractionRecord getOrbitIR(uint32_t orbit) const { return {o2::constants::lhc::LHCMaxBunches - 1, orbit}; }
62 void initIR();
63
65
66 std::map<uint16_t, ROBoard> mROData;
67 ColumnDataToLocalBoard mConverter;
68 std::unordered_map<uint16_t, std::vector<ROBoard>> mGBTMap;
69 FEEIdConfig mFEEIdConfig;
70 InteractionRecord mLastIR;
71 ElectronicsDelay mElectronicsDelay;
72
73 std::array<GBTUserLogicEncoder, crateparams::sNGBTs> mGBTEncoders{};
74 std::array<std::vector<char>, 4> mOrbitResponse{};
75 std::array<std::vector<char>, 4> mOrbitResponseWord{};
76};
77} // namespace mid
78} // namespace o2
79
80#endif /* O2_MID_ENCODER_H */
#define verbosity
Converter from ColumnData to raw local boards.
Strip pattern (aka digits)
MID RO crate parameters.
Delay parameters for MID electronics.
Hardware Id to FeeId mapper.
uint64_t orbit
Definition RawEventData.h:6
Raw data encoder for MID GBT user logic.
Structure to store the readout board information.
Utility class to write detectors data to (multiple) raw data file(s) respecting CRU format.
auto & getWriter()
Definition Encoder.h:51
void finalize(bool closeFile=true)
Definition Encoder.cxx:131
void init(std::string_view outDir=".", std::string_view fileFor="all", int verbosity=0, std::vector< ROBoardConfig > configurations=makeDefaultROBoardConfig())
Definition Encoder.cxx:30
void emptyHBFMethod(const o2::header::RDHAny *rdh, std::vector< char > &toAdd) const
Definition Encoder.cxx:84
void setSuperpageSize(int maxSize)
Sets the maximum size of the superpage.
Definition Encoder.h:47
void setSuperPageSize(int nbytes)
GLuint buffer
Definition glcorearb.h:655
GLboolean * data
Definition glcorearb.h:298
constexpr o2::header::DataOrigin gDataOriginMID
Definition DataHeader.h:573
constexpr int LHCMaxBunches
std::vector< ROBoardConfig > makeDefaultROBoardConfig(uint16_t gbtUniqueId=0xFFFF)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
o2::InteractionRecord ir(0, 0)