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
13
14#include <vector>
15
21
22using namespace o2::framework;
23
24namespace o2
25{
26namespace emcal
27{
28
29EntropyEncoderSpec::EntropyEncoderSpec(bool selIR) : mCTFCoder(o2::ctf::CTFCoderBase::OpType::Encoder), mSelIR(selIR)
30{
31 mTimer.Stop();
32 mTimer.Reset();
33}
34
36{
37 if (mCTFCoder.finaliseCCDB<CTF>(matcher, obj)) {
38 return;
39 }
40}
41
43{
44 mCTFCoder.init<CTF>(ic);
45}
46
48{
49 auto cput = mTimer.CpuTime();
50 mTimer.Start(false);
51 mCTFCoder.updateTimeDependentParams(pc, true);
52 auto triggers = pc.inputs().get<gsl::span<TriggerRecord>>("triggers");
53 auto cells = pc.inputs().get<gsl::span<Cell>>("cells");
54
55 auto& buffer = pc.outputs().make<std::vector<o2::ctf::BufferType>>(Output{"EMC", "CTFDATA", 0});
56 if (mSelIR) {
57 mCTFCoder.setSelectedIRFrames(pc.inputs().get<gsl::span<o2::dataformats::IRFrame>>("selIRFrames"));
58 }
59 auto iosize = mCTFCoder.encode(buffer, triggers, cells);
60 pc.outputs().snapshot({"ctfrep", 0}, iosize);
61 mTimer.Stop();
62 if (mSelIR) {
63 mCTFCoder.getIRFramesSelector().clear();
64 }
65 LOG(info) << iosize.asString() << " in " << mTimer.CpuTime() - cput << " s";
66}
67
69{
70 LOGF(info, "EMCAL Entropy Encoding total timing: Cpu: %.3e Real: %.3e s in %d slots",
71 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
72}
73
75{
76 std::vector<InputSpec> inputs;
77 inputs.emplace_back("triggers", "EMC", "CELLSTRGR", 0, Lifetime::Timeframe);
78 inputs.emplace_back("cells", "EMC", "CELLS", 0, Lifetime::Timeframe);
79 inputs.emplace_back("ctfdict", "EMC", "CTFDICT", 0, Lifetime::Condition, ccdbParamSpec("EMC/Calib/CTFDictionaryTree"));
80 if (selIR) {
81 inputs.emplace_back("selIRFrames", "CTF", "SELIRFRAMES", 0, Lifetime::Timeframe);
82 }
83 return DataProcessorSpec{
84 "emcal-entropy-encoder",
85 inputs,
86 Outputs{{"EMC", "CTFDATA", 0, Lifetime::Timeframe},
87 {{"ctfrep"}, "EMC", "CTFENCREP", 0, Lifetime::Timeframe}},
88 AlgorithmSpec{adaptFromTask<EntropyEncoderSpec>(selIR)},
89 Options{
90 {"ctf-dict", VariantType::String, "ccdb", {"CTF dictionary: empty or ccdb=CCDB, none=no external dictionary otherwise: local filename"}},
91 {"irframe-margin-bwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame lower boundary when selection is requested"}},
92 {"irframe-margin-fwd", VariantType::UInt32, 0u, {"margin in BC to add to the IRFrame upper boundary when selection is requested"}},
93 {"mem-factor", VariantType::Float, 1.f, {"Memory allocation margin factor"}},
94 {"ans-version", VariantType::String, {"version of ans entropy coder implementation to use"}}}};
95}
96
97} // namespace emcal
98} // namespace o2
Convert EMCAL 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)
o2::ctf::CTFIOSize encode(VEC &buff, const gsl::span< const TriggerRecord > &trigData, const gsl::span< const Cell > &cellData)
entropy-encode data to buffer with CTF
Definition CTFCoder.h:63
void endOfStream(o2::framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj) final
void init(o2::framework::InitContext &ic) final
void run(o2::framework::ProcessingContext &pc) final
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.
GLuint buffer
Definition glcorearb.h:655
framework::DataProcessorSpec getEntropyEncoderSpec(bool selIR=false)
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
std::vector< OutputSpec > Outputs
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
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< Cell > cells