Project
Loading...
Searching...
No Matches
EntropyEncoderSpec.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
16#include <vector>
17
23
24using namespace o2::framework;
25
26namespace o2
27{
28namespace zdc
29{
30
31EntropyEncoderSpec::EntropyEncoderSpec(bool selIR) : mCTFCoder(o2::ctf::CTFCoderBase::OpType::Encoder), mSelIR(selIR)
32{
33 mTimer.Stop();
34 mTimer.Reset();
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 mCTFCoder.updateTimeDependentParams(pc, true);
54 auto bcdata = pc.inputs().get<gsl::span<o2::zdc::BCData>>("trig");
55 auto chans = pc.inputs().get<gsl::span<o2::zdc::ChannelData>>("chan");
56 auto peds = pc.inputs().get<gsl::span<o2::zdc::OrbitData>>("peds");
57 if (mSelIR) {
58 mCTFCoder.setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
59 }
60
61 auto& buffer = pc.outputs().make<std::vector<o2::ctf::BufferType>>(Output{"ZDC", "CTFDATA", 0});
62 auto iosize = mCTFCoder.encode(buffer, bcdata, chans, peds);
63 pc.outputs().snapshot({"ctfrep", 0}, iosize);
64 if (mSelIR) {
65 mCTFCoder.getIRFramesSelector().clear();
66 }
67 mTimer.Stop();
68 LOG(info) << iosize.asString() << " in " << mTimer.CpuTime() - cput << " s";
69}
70
72{
73 LOGF(info, "ZDC Entropy Encoding total timing: Cpu: %.3e Real: %.3e s in %d slots",
74 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
75}
76
78{
79 std::vector<InputSpec> inputs;
80 inputs.emplace_back("trig", "ZDC", "DIGITSBC", 0, Lifetime::Timeframe);
81 inputs.emplace_back("chan", "ZDC", "DIGITSCH", 0, Lifetime::Timeframe);
82 inputs.emplace_back("peds", "ZDC", "DIGITSPD", 0, Lifetime::Timeframe);
83 inputs.emplace_back("ctfdict", "ZDC", "CTFDICT", 0, Lifetime::Condition, ccdbParamSpec("ZDC/Calib/CTFDictionaryTree"));
84 if (selIR) {
85 inputs.emplace_back("selIRFrames", "CTF", "SELIRFRAMES", 0, Lifetime::Timeframe);
86 }
87 return DataProcessorSpec{
88 "zdc-entropy-encoder",
89 inputs,
90 Outputs{{"ZDC", "CTFDATA", 0, Lifetime::Timeframe},
91 {{"ctfrep"}, "ZDC", "CTFENCREP", 0, Lifetime::Timeframe}},
92 AlgorithmSpec{adaptFromTask<EntropyEncoderSpec>(selIR)},
93 Options{{"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
94 {"irframe-margin-bwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame lower boundary when selection is requested"}},
95 {"irframe-margin-fwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame upper boundary when selection is requested"}},
96 {"mem-factor", VariantType::Float, 1.f, {"Memory allocation margin factor"}},
97 {"ans-version", VariantType::String, {"version of ans entropy coder implementation to use"}}}};
98}
99
100} // namespace zdc
101} // namespace o2
Convert ZDC data to CTF (EncodedBlocks)
void updateTimeDependentParams(o2::framework::ProcessingContext &pc, bool askTree=false)
void init(o2::framework::InitContext &ic)
void setSelectedIRFrames(const SPAN &sp)
o2::utils::IRFrameSelector & getIRFramesSelector()
bool finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj)
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 encode(VEC &buff, const gsl::span< const BCData > &trgData, const gsl::span< const ChannelData > &chanData, const gsl::span< const OrbitData > &pedData)
entropy-encode data to buffer with CTF
Definition CTFCoder.h:67
void endOfStream(o2::framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void run(o2::framework::ProcessingContext &pc) final
void finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj) final
void init(o2::framework::InitContext &ic) final
GLuint buffer
Definition glcorearb.h:655
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
struct o2::upgrades_utils::@463 zdc
structure to keep FT0 information
framework::DataProcessorSpec getEntropyEncoderSpec(bool selIR=false)
create a processor spec
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:44
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"