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{
30{
31 if (mCTFCoder.finaliseCCDB<CTF>(matcher, obj)) {
32 return;
33 }
34}
35
37{
38 mCTFCoder.init<CTF>(ic);
39}
40
42{
43 auto cput = mTimer.CpuTime();
44 mTimer.Start(false);
45 o2::ctf::CTFIOSize iosize;
46
47 mCTFCoder.updateTimeDependentParams(pc, true);
48 auto buff = pc.inputs().get<gsl::span<o2::ctf::BufferType>>("ctf_TPC");
49
50 auto& compclusters = pc.outputs().make<std::vector<char>>(OutputRef{"output"});
51 auto& triggers = pc.outputs().make<std::vector<o2::tpc::TriggerInfoDLBZS>>(OutputRef{"trigger"});
52 if (buff.size()) {
53 const auto ctfImage = o2::tpc::CTF::getImage(buff.data());
54 iosize = mCTFCoder.decode(ctfImage, compclusters, triggers);
55 }
56 pc.outputs().snapshot({"ctfrep", 0}, iosize);
57 mTimer.Stop();
58 LOG(info) << "Decoded " << buff.size() * sizeof(o2::ctf::BufferType) << " encoded bytes to "
59 << compclusters.size() << " bytes, (" << iosize.asString() << ") in " << mTimer.CpuTime() - cput << " s";
60}
61
63{
64 LOGF(info, "TPC Entropy Decoding total timing: Cpu: %.3e Real: %.3e s in %d slots",
65 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
66}
67
68DataProcessorSpec getEntropyDecoderSpec(int verbosity, unsigned int sspec, const std::string& ctfdictOpt)
69{
70 std::vector<InputSpec> inputs;
71 inputs.emplace_back("ctf_TPC", "TPC", "CTFDATA", sspec, Lifetime::Timeframe);
72
73 if (ctfdictOpt.empty() || ctfdictOpt == "ccdb") {
74 inputs.emplace_back("ctfdict_TPC", "TPC", "CTFDICT", 0, Lifetime::Condition, ccdbParamSpec("TPC/Calib/CTFDictionaryTree"));
75 }
76 inputs.emplace_back("trigoffset", "CTP", "Trig_Offset", 0, Lifetime::Condition, ccdbParamSpec("CTP/Config/TriggerOffsets"));
77
78 return DataProcessorSpec{
79 "tpc-entropy-decoder",
80 inputs,
81 Outputs{OutputSpec{{"output"}, "TPC", "COMPCLUSTERSFLAT", 0, Lifetime::Timeframe},
82 OutputSpec{{"trigger"}, "TPC", "TRIGGERWORDS", 0, Lifetime::Timeframe},
83 OutputSpec{{"ctfrep"}, "TPC", "CTFDECREP", 0, Lifetime::Timeframe}},
84 AlgorithmSpec{adaptFromTask<EntropyDecoderSpec>(verbosity, ctfdictOpt)},
85 Options{{"ans-version", VariantType::String, {"version of ans entropy coder implementation to use"}}}};
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.
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, const std::string &ctfdictOpt="none")
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