forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRawDataDecoder.h
More file actions
102 lines (97 loc) · 4.82 KB
/
RawDataDecoder.h
File metadata and controls
102 lines (97 loc) · 4.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file RawDataDecoder.h
/// \brief Digits tw Raw translation
/// \author Roman Lietava
#ifndef ALICEO2_CTP_RAWDATADECODER_H_
#define ALICEO2_CTP_RAWDATADECODER_H_
#include <vector>
#include <map>
#include <deque>
#include "Framework/InputRecord.h"
#include "DataFormatsCTP/Digits.h"
#include "DataFormatsCTP/LumiInfo.h"
#include "DataFormatsCTP/Configuration.h"
namespace o2
{
namespace ctp
{
class RawDataDecoder
{
public:
RawDataDecoder() = default;
~RawDataDecoder() = default;
static void makeGBTWordInverse(std::vector<gbtword80_t>& diglets, gbtword80_t& GBTWord, gbtword80_t& remnant, uint32_t& size_gbt, uint32_t Npld);
int addCTPDigit(uint32_t linkCRU, uint32_t triggerOrbit, gbtword80_t& diglet, gbtword80_t& pldmask, std::map<o2::InteractionRecord, CTPDigit>& digits);
int decodeRaw(o2::framework::InputRecord& inputs, std::vector<o2::framework::InputSpec>& filter, o2::pmr::vector<CTPDigit>& digits, std::vector<LumiInfo>& lumiPointsHBF1);
int decodeRawFatal(o2::framework::InputRecord& inputs, std::vector<o2::framework::InputSpec>& filter);
int decodeRaw(o2::framework::InputRecord& inputs, std::vector<o2::framework::InputSpec>& filter, std::vector<CTPDigit>& digits, std::vector<LumiInfo>& lumiPointsHBF1);
void setDecodeInps(bool decodeinps) { mDecodeInps = decodeinps; }
void setDoLumi(bool lumi) { mDoLumi = lumi; }
void setDoDigits(bool digi) { mDoDigits = digi; }
void setVerbose(bool v) { mVerbose = v; }
void setMAXErrors(int m) { mErrorMax = m; }
int setLumiInp(int lumiinp, std::string inp);
void setCTPConfig(CTPConfiguration cfg) { mCTPConfig = std::move(cfg); };
void setCheckConsistency(bool check) { mCheckConsistency = check; }
uint32_t getIRRejected() const { return mIRRejected; }
uint32_t getTCRRejected() const { return mTCRRejected; }
std::vector<uint32_t>& getTFOrbits() { return mTFOrbits; }
int getErrorIR() { return mErrorIR; }
int getErrorTCR() { return mErrorTCR; }
CTPConfiguration& getCTPConfig() { return mCTPConfig; }
int init();
static int shiftNew(const o2::InteractionRecord& irin, uint32_t TFOrbit, std::bitset<48>& inpmask, int64_t shift, int level, std::map<o2::InteractionRecord, CTPDigit>& digmap);
static int shiftInputs(std::map<o2::InteractionRecord, CTPDigit>& digitsMap, o2::pmr::vector<CTPDigit>& digits, uint32_t TFOrbit, uint64_t trgclassmask = 0xffffffffffffffff);
int checkReadoutConsistentncy(o2::pmr::vector<CTPDigit>& digits, uint64_t trgclassmask = 0xffffffffffffffff, uint64_t trigclassmaskNoTrgDets = 0xffffffffffffffff);
std::array<uint64_t, o2::ctp::CTP_NCLASSES> getClassErrorsA() { return mClassErrorsA; }
std::array<uint64_t, o2::ctp::CTP_NCLASSES> getClassErrorsB() { return mClassErrorsB; }
std::array<uint64_t, o2::ctp::CTP_NCLASSES> getClassCountersA() { return mClassCountersA; }
std::array<uint64_t, o2::ctp::CTP_NCLASSES> getClassCountersB() { return mClassCountersB; }
int getLostDueToShift() { return mLostDueToShift; }
private:
static constexpr uint32_t TF_TRIGGERTYPE_MASK = 0x800;
static constexpr uint32_t HB_TRIGGERTYPE_MASK = 0x2;
// true: full inps decoding includine latency shifts here; false: latency shifts in CTF decoder
bool mDecodeInps = false;
bool mCheckConsistency = false;
// for digits
bool mDoDigits = true;
std::vector<CTPDigit> mOutputDigits;
// for lumi
bool mDoLumi = true;
//
static constexpr std::bitset<o2::ctp::CTP_NINPUTS> LMMASKInputs = 0xfff;
static constexpr std::bitset<o2::ctp::CTP_NINPUTS> L0MASKInputs = 0xfff000;
static constexpr std::bitset<o2::ctp::CTP_NINPUTS> L1MASKInputs = (0xffffffull << 24);
gbtword80_t mTVXMask = 0x4; // TVX is 3rd input
gbtword80_t mVBAMask = 0x20; // VBA is 6 th input
bool mVerbose = false;
uint32_t mIRRejected = 0;
uint32_t mTCRRejected = 0;
bool mPadding = true;
uint32_t mTFOrbit = 0;
std::vector<uint32_t> mTFOrbits;
// error verbosness
int mErrorIR = 0;
int mErrorTCR = 0;
int mErrorMax = 5;
bool mStickyError = false;
std::array<uint64_t, o2::ctp::CTP_NCLASSES> mClassErrorsA{};
std::array<uint64_t, o2::ctp::CTP_NCLASSES> mClassErrorsB{}; // from inputs
std::array<uint64_t, o2::ctp::CTP_NCLASSES> mClassCountersA{};
std::array<uint64_t, o2::ctp::CTP_NCLASSES> mClassCountersB{}; // from inputs
int mLostDueToShift = 0;
CTPConfiguration mCTPConfig;
};
} // namespace ctp
} // namespace o2
#endif