Project
Loading...
Searching...
No Matches
CTFCoder.cxx
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
15
19#include <TTree.h>
20
21using namespace o2::fv0;
22
24// Register encoded data in the tree (Fill is not called, will be done by caller)
25void CTFCoder::appendToTree(TTree& tree, CTF& ec)
26{
28}
29
31// extract and decode data from the tree
32void CTFCoder::readFromTree(TTree& tree, int entry,
33 std::vector<Digit>& digitVec, std::vector<ChannelData>& channelVec)
34{
35 assert(entry >= 0 && entry < tree.GetEntries());
36 CTF ec;
38 decode(ec, digitVec, channelVec);
39}
41void CTFCoder::assignDictVersion(o2::ctf::CTFDictHeader& h) const
42{
44 h = mExtHeader;
45 } else {
46 h.majorVersion = 1;
47 h.minorVersion = 1;
48 }
49}
50
52void CTFCoder::createCoders(const std::vector<char>& bufVec, o2::ctf::CTFCoderBase::OpType op)
53{
54 const auto ctf = CTF::getImage(bufVec.data());
55 CompressedDigits cd; // just to get member types
56#define MAKECODER(part, slot) createCoder(op, std::get<rans::RenormedDenseHistogram<decltype(part)::value_type>>(ctf.getDictionary<decltype(part)::value_type>(slot, mANSVersion)), int(slot))
57 // clang-format off
61
65 //
66 // extra slots were added in the end
69 // clang-format on
70}
71
73size_t CTFCoder::estimateCompressedSize(const CompressedDigits& cd)
74{
75 size_t sz = 0;
76 // RS FIXME this is very crude estimate, instead, an empirical values should be used
77 sz += estimateBufferSize(static_cast<int>(CTF::BLC_trigger), cd.trigger);
78 sz += estimateBufferSize(static_cast<int>(CTF::BLC_bcInc), cd.bcInc);
79 sz += estimateBufferSize(static_cast<int>(CTF::BLC_orbitInc), cd.orbitInc);
80 sz += estimateBufferSize(static_cast<int>(CTF::BLC_nChan), cd.nChan);
81
82 sz += estimateBufferSize(static_cast<int>(CTF::BLC_idChan), cd.idChan);
83 sz += estimateBufferSize(static_cast<int>(CTF::BLC_qtcChain), cd.qtcChain);
84 sz += estimateBufferSize(static_cast<int>(CTF::BLC_cfdTime), cd.cfdTime);
85 sz += estimateBufferSize(static_cast<int>(CTF::BLC_qtcAmpl), cd.qtcAmpl);
86
87 LOG(debug) << "Estimated output size is " << sz << " bytes";
88 return sz;
89};
#define MAKECODER(part, slot)
class for entropy encoding/decoding of FV0 digits data
Configurable digitization parameters.
uint32_t op
std::ostringstream debug
Class for time synchronization of RawReader instances.
CTFDictHeader mExtHeader
size_t estimateBufferSize(size_t slot, source_IT samplesBegin, source_IT samplesEnd)
void readFromTree(TTree &tree, const std::string &name, int ev=0)
read from tree to non-flat object
static auto getImage(const void *newHead)
get const image of the container wrapper, with pointers in the image relocated to new head
size_t appendToTree(TTree &tree, const std::string &name) const
attach to tree
static constexpr const char * getName(ID id)
names of defined detectors
Definition DetID.h:145
o2::ctf::CTFIOSize decode(const CTF::base &ec, VDIG &digitVec, VCHAN &channelVec)
entropy decode clusters from buffer with CTF
Definition CTFCoder.h:123
void createCoders(const std::vector< char > &bufVec, o2::ctf::CTFCoderBase::OpType op) final
Definition CTFCoder.cxx:52
GLuint entry
Definition glcorearb.h:5735
Detector header base.
bool isValidDictTimeStamp() const
wrapper for the Entropy-encoded clusters of the TF
Definition CTF.h:62
@ BLC_orbitInc
Definition CTF.h:67
@ BLC_bcInc
Definition CTF.h:66
@ BLC_idChan
Definition CTF.h:70
@ BLC_qtcAmpl
Definition CTF.h:72
@ BLC_cfdTime
Definition CTF.h:71
@ BLC_nChan
Definition CTF.h:68
@ BLC_trigger
Definition CTF.h:75
@ BLC_qtcChain
Definition CTF.h:76
Intermediate, compressed but not yet entropy-encoded digits.
Definition CTF.h:38
std::vector< uint8_t > qtcChain
Definition CTF.h:52
std::vector< int16_t > qtcAmpl
Definition CTF.h:51
std::vector< int16_t > bcInc
Definition CTF.h:44
std::vector< uint8_t > nChan
Definition CTF.h:46
std::vector< uint8_t > idChan
Definition CTF.h:49
std::vector< int16_t > cfdTime
Definition CTF.h:50
std::vector< uint8_t > trigger
Definition CTF.h:43
std::vector< int32_t > orbitInc
Definition CTF.h:45
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))