16#ifndef O2_MCH_CTFCODER_H
17#define O2_MCH_CTFCODER_H
44 template <typename VEC>
48 template <typename VROF, typename VCOL>
49 o2::ctf::CTFIOSize
decode(const
CTF::base& ec, VROF& rofVec, VCOL& digVec);
54 template <typename VEC>
56 void appendToTree(TTree&
tree,
CTF& ec);
64template <typename VEC>
70 for (
const auto& rof :
rofData) {
72 mROFRecFilt.push_back(rof);
73 auto digIt = digData.begin() + rof.getFirstIdx();
74 auto& rofC = mROFRecFilt.back();
75 rofC.setDataRef((
int)mDigDataFilt.size(), rof.getNEntries());
76 std::copy(digIt, digIt + rofC.getNEntries(), std::back_inserter(mDigDataFilt));
79 return encode_impl(buff, mROFRecFilt, mDigDataFilt);
81 return encode_impl(buff,
rofData, digData);
84template <
typename VEC>
85o2::ctf::CTFIOSize CTFCoder::encode_impl(VEC& buff,
const gsl::span<const ROFRecord>&
rofData,
const gsl::span<const Digit>& digData)
100 CTFHelper helper(
rofData, digData);
102 auto szIni =
sizeof(CTFHeader) + helper.getSize() * 2. / 3;
108 ec->setHeader(helper.createHeader());
113#define ENCODEMCH(beg, end, slot, bits) CTF::get(buff.data())->encode(beg, end, int(slot), bits, optField[int(slot)], &buff, mCoders[int(slot)], getMemMarginFactor());
127 finaliseCTFOutput<CTF>(buff);
133template <
typename VROF,
typename VCOL>
140 std::vector<uint16_t> nSamples;
141 std::vector<uint32_t> ADC, nDigits;
142 std::vector<int32_t> orbitInc;
143 std::vector<int32_t> tfTime;
144 std::vector<int16_t> bcInc, detID, padID;
145 std::vector<uint8_t> isSaturated;
148#define DECODEMCH(part, slot) ec.decode(part, int(slot), mCoders[int(slot)])
164 rofVec.reserve(header.nROFs);
165 digVec.reserve(header.nDigits);
167 uint32_t firstEntry = 0, rofCount = 0, digCount = 0;
170 for (uint32_t irof = 0; irof < header.nROFs; irof++) {
172 if (orbitInc[irof]) {
176 ir.
bc += bcInc[irof];
179 firstEntry = digVec.size();
180 for (
auto ic = 0; ic < nDigits[irof]; ic++) {
181 digVec.emplace_back(
Digit{detID[digCount], padID[digCount], ADC[digCount], tfTime[digCount], nSamples[digCount]});
182 digVec.back().setSaturated(isSaturated[digCount]);
185 rofVec.emplace_back(
ROFRecord{
ir,
int(firstEntry),
static_cast<int>(nDigits[irof])});
187 assert(rofVec.size() == header.nROFs);
188 assert(digCount == header.nDigits);
Declarations for CTFCoderBase class (support of external dictionaries)
#define ENCODEMCH(beg, end, slot, bits)
#define DECODEMCH(part, slot)
Helper for MCH CTF creation.
void checkDictVersion(const CTFDictHeader &h) const
ctf::ANSHeader mANSVersion
std::string getPrefix() const
o2::utils::IRFrameSelector mIRFrameSelector
virtual void assignDictVersion(CTFDictHeader &h) const
<<======================== Auxiliary classes =======================<<
static auto get(void *head)
cast arbitrary buffer head to container class. Head is supposed to respect the alignment
const H & getHeader() const
void print(const std::string &prefix="", int verbosity=1) const
print itself
static constexpr int getNBlocks()
EncodedBlocks< CTFHeader, N, uint32_t > base
static auto create(void *head, size_t sz)
create container from arbitrary buffer of predefined size (in bytes!!!). Head is supposed to respect ...
Static class with identifiers, bitmasks and names for ALICE detectors.
o2::ctf::CTFIOSize decode(const CTF::base &ec, VROF &rofVec, VCOL &digVec)
entropy decode data from buffer with CTF
void createCoders(const std::vector< char > &bufVec, o2::ctf::CTFCoderBase::OpType op) final
~CTFCoder() final=default
o2::ctf::CTFIOSize encode(VEC &buff, const gsl::span< const ROFRecord > &rofData, const gsl::span< const Digit > &digData)
entropy-encode data to buffer with CTF
CTFCoder(o2::ctf::CTFCoderBase::OpType op)
MCH digit implementation.
long check(o2::dataformats::IRFrame fr, size_t bwd=0, size_t fwd=0)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Defining DataPointCompositeObject explicitly as copiable.
uint16_t bc
bunch crossing ID of interaction
wrapper for the Entropy-encoded clusters of the TF
o2::InteractionRecord ir(0, 0)
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))
std::array< std::vector< ROFRecord >, NEvTypes > rofData