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);
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
size_t maxSize
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
unsigned short int uint16_t
Raw data encoder for MID GBT user logic.
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to process
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)
constexpr o2::header::DataOrigin gDataOriginMID
Definition DataHeader.h:576
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)