Project
Loading...
Searching...
No Matches
EntropyDecoderSpec.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
13
14#include <vector>
15
22
23using namespace o2::framework;
24
25namespace o2
26{
27namespace tpc
28{
29
31{
32 if (mCTFCoder.finaliseCCDB<CTF>(matcher, obj)) {
33 return;
34 }
35}
36
38{
39 mCTFCoder.init<CTF>(ic);
40}
41
43{
44 auto cput = mTimer.CpuTime();
45 mTimer.Start(false);
46 o2::ctf::CTFIOSize iosize;
47
48 mCTFCoder.updateTimeDependentParams(pc, true);
49 auto buff = pc.inputs().get<gsl::span<o2::ctf::BufferType>>("ctf_TPC");
50
51 auto& compclusters = pc.outputs().make<std::vector<char>>(OutputRef{"output"});
52 auto& triggers = pc.outputs().make<std::vector<o2::tpc::TriggerInfoDLBZS>>(OutputRef{"trigger"});
53 if (buff.size()) {
54 const auto ctfImage = o2::tpc::CTF::getImage(buff.data());
55 iosize = mCTFCoder.decode(ctfImage, compclusters, triggers);
56 }
57 pc.outputs().snapshot({"ctfrep", 0}, iosize);
58 mTimer.Stop();
59 LOG(info) << "Decoded " << buff.size() * sizeof(o2::ctf::BufferType) << " encoded bytes to "
60 << compclusters.size() << " bytes, (" << iosize.asString() << ") in " << mTimer.CpuTime() - cput << " s";
61}
62
64{
65 LOGF(info, "TPC Entropy Decoding total timing: Cpu: %.3e Real: %.3e s in %d slots",
66 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
67}
68
70{
71 std::vector<InputSpec> inputs;
72 inputs.emplace_back("ctf_TPC", "TPC", "CTFDATA", sspec, Lifetime::Timeframe);
73 inputs.emplace_back("ctfdict_TPC", "TPC", "CTFDICT", 0, Lifetime::Condition, ccdbParamSpec("TPC/Calib/CTFDictionaryTree"));
74 inputs.emplace_back("trigoffset", "CTP", "Trig_Offset", 0, Lifetime::Condition, ccdbParamSpec("CTP/Config/TriggerOffsets"));
75
76 return DataProcessorSpec{
77 "tpc-entropy-decoder",
78 inputs,
79 Outputs{OutputSpec{{"output"}, "TPC", "COMPCLUSTERSFLAT", 0, Lifetime::Timeframe},
80 OutputSpec{{"trigger"}, "TPC", "TRIGGERWORDS", 0, Lifetime::Timeframe},
81 OutputSpec{{"ctfrep"}, "TPC", "CTFDECREP", 0, Lifetime::Timeframe}},
82 AlgorithmSpec{adaptFromTask<EntropyDecoderSpec>(verbosity)},
83 Options{{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
84 {"ans-version", VariantType::String, {"version of ans entropy coder implementation to use"}}}};
85}
86
87} // namespace tpc
88} // namespace o2
#define verbosity
Container to store compressed TPC cluster data.
Definitions of TPC Zero Suppression Data Headers.
void updateTimeDependentParams(o2::framework::ProcessingContext &pc, bool askTree=false)
void init(o2::framework::InitContext &ic)
bool finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj)
static auto getImage(const void *newHead)
get const image of the container wrapper, with pointers in the image relocated to new head
void snapshot(const Output &spec, T const &object)
decltype(auto) make(const Output &spec, Args... args)
decltype(auto) get(R binding, int part=0) const
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
o2::ctf::CTFIOSize decode(const CTF::base &ec, VEC &buff, TRIGVEC &buffTrig)
decode entropy-encoded bloks to TPC CompressedClusters into the externally provided vector (e....
Definition CTFCoder.h:325
void finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj) final
void init(o2::framework::InitContext &ic) final
void endOfStream(o2::framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void run(o2::framework::ProcessingContext &pc) final
uint8_t BufferType
This is the type of the vector to be used for the EncodedBlocks buffer allocation.
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
std::vector< ConfigParamSpec > Options
std::vector< OutputSpec > Outputs
framework::DataProcessorSpec getEntropyDecoderSpec(int verbosity, unsigned int sspec)
create a processor spec
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string asString() const
Definition CTFIOSize.cxx:19
wrapper for the Entropy-encoded clusters of the TF
Definition CTF.h:36
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
auto * ctfImage