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
20
21using namespace o2::framework;
22
23namespace o2
24{
25namespace cpv
26{
27
28EntropyDecoderSpec::EntropyDecoderSpec(int verbosity) : mCTFCoder(o2::ctf::CTFCoderBase::OpType::Decoder)
29{
30 mTimer.Stop();
31 mTimer.Reset();
32 mCTFCoder.setVerbosity(verbosity);
33 mCTFCoder.setSupportBCShifts(true);
34 mCTFCoder.setDictBinding("ctfdict_CPV");
35}
36
38{
39 if (mCTFCoder.finaliseCCDB<CTF>(matcher, obj)) {
40 return;
41 }
42}
43
45{
46 mCTFCoder.init<CTF>(ic);
47}
48
50{
51 auto cput = mTimer.CpuTime();
52 mTimer.Start(false);
53 o2::ctf::CTFIOSize iosize;
54
55 mCTFCoder.updateTimeDependentParams(pc, true);
56 auto buff = pc.inputs().get<gsl::span<o2::ctf::BufferType>>("ctf_CPV");
57
58 auto& triggers = pc.outputs().make<std::vector<TriggerRecord>>(OutputRef{"triggers"});
59 auto& clusters = pc.outputs().make<std::vector<Cluster>>(OutputRef{"clusters"});
60
61 // since the buff is const, we cannot use EncodedBlocks::relocate directly, instead we wrap its data to another flat object
62 if (buff.size()) {
63 const auto ctfImage = o2::cpv::CTF::getImage(buff.data());
64 iosize = mCTFCoder.decode(ctfImage, triggers, clusters);
65 }
66 pc.outputs().snapshot({"ctfrep", 0}, iosize);
67 mTimer.Stop();
68 LOG(info) << "Decoded " << clusters.size() << " CPV clusters in " << triggers.size() << " triggers, (" << iosize.asString() << ") in " << mTimer.CpuTime() - cput << " s";
69}
70
72{
73 LOGF(info, "CPV Entropy Decoding total timing: Cpu: %.3e Real: %.3e s in %d slots",
74 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
75}
76
78{
79 std::vector<OutputSpec> outputs{
80 OutputSpec{{"triggers"}, "CPV", "CLUSTERTRIGRECS", 0, Lifetime::Timeframe},
81 OutputSpec{{"clusters"}, "CPV", "CLUSTERS", 0, Lifetime::Timeframe},
82 OutputSpec{{"ctfrep"}, "CPV", "CTFDECREP", 0, Lifetime::Timeframe}};
83
84 std::vector<InputSpec> inputs;
85 inputs.emplace_back("ctf_CPV", "CPV", "CTFDATA", sspec, Lifetime::Timeframe);
86 inputs.emplace_back("ctfdict_CPV", "CPV", "CTFDICT", 0, Lifetime::Condition, ccdbParamSpec("CPV/Calib/CTFDictionaryTree"));
87 inputs.emplace_back("trigoffset", "CTP", "Trig_Offset", 0, Lifetime::Condition, ccdbParamSpec("CTP/Config/TriggerOffsets"));
88
89 return DataProcessorSpec{
90 "cpv-entropy-decoder",
91 inputs,
92 outputs,
93 AlgorithmSpec{adaptFromTask<EntropyDecoderSpec>(verbosity)},
94 Options{{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
95 {"ans-version", VariantType::String, {"version of ans entropy coder implementation to use"}}}};
96}
97
98} // namespace cpv
99} // namespace o2
#define verbosity
Convert CTF (EncodedBlocks) to CPV digit/channels strean.
o2::ctf::CTFIOSize decode(const CTF::base &ec, VTRG &trigVec, VCLUSTER &cluVec)
entropy decode data from buffer with CTF
Definition CTFCoder.h:130
void endOfStream(o2::framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void run(o2::framework::ProcessingContext &pc) final
void init(o2::framework::InitContext &ic) final
void finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj) final
void setSupportBCShifts(bool v=true)
void updateTimeDependentParams(o2::framework::ProcessingContext &pc, bool askTree=false)
void setDictBinding(const std::string &s)
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.
framework::DataProcessorSpec getEntropyDecoderSpec(int verbosity, unsigned int sspec)
create a processor spec
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
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
wrapper for the Entropy-encoded triggers and cells of the TF
Definition CTF.h:41
std::string asString() const
Definition CTFIOSize.cxx:19
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< Cluster > clusters
auto * ctfImage