Project
Loading...
Searching...
No Matches
DecodedDataAggregatorSpec.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
16
17
#include "
MIDWorkflow/DecodedDataAggregatorSpec.h
"
18
19
#include <chrono>
20
#include "
Framework/ConfigParamRegistry.h
"
21
#include "
Framework/ControlService.h
"
22
#include <
Framework/Logger.h
>
23
#include "
Framework/Output.h
"
24
#include "
Framework/Task.h
"
25
#include "
DataFormatsMID/ColumnData.h
"
26
#include "
MIDRaw/DecodedDataAggregator.h
"
27
28
namespace
of
=
o2::framework
;
29
30
namespace
o2
31
{
32
namespace
mid
33
{
34
35
class
DecodedDataAggregatorDeviceDPL
36
{
37
public
:
38
void
init
(
of::InitContext
& ic)
39
{
40
auto
stop = [
this
]() {
41
double
scaleFactor = (mNROFs == 0) ? 0. : 1.e6 / mNROFs;
42
LOG
(info) <<
"Processing time / "
<< mNROFs <<
" ROFs: full: "
<< mTimer.count() * scaleFactor <<
" aggregating: "
<< mTimerAlgo.count() * scaleFactor <<
" us"
;
43
};
44
ic.
services
().
get
<
of::CallbackService
>().set<of::CallbackService::Id::Stop>(stop);
45
}
46
47
void
run
(
of::ProcessingContext
& pc)
48
{
49
auto
tStart = std::chrono::high_resolution_clock::now();
50
51
auto
msg
= pc.
inputs
().
get
(
"mid_decoded"
);
52
auto
data
= of::DataRefUtils::as<const ROBoard>(
msg
);
53
54
auto
msgROF = pc.
inputs
().
get
(
"mid_decoded_rof"
);
55
auto
inROFRecords = of::DataRefUtils::as<const ROFRecord>(msgROF);
56
57
auto
tAlgoStart = std::chrono::high_resolution_clock::now();
58
mAggregator.
process
(
data
, inROFRecords);
59
mTimerAlgo += std::chrono::high_resolution_clock::now() - tAlgoStart;
60
61
for
(
o2::header::DataHeader::SubSpecificationType
subSpec = 0; subSpec < 3; ++subSpec) {
62
EventType
evtType =
static_cast<
EventType
>
(subSpec);
63
pc.
outputs
().
snapshot
(
of::Output
{
o2::header::gDataOriginMID
,
"DATA"
, subSpec}, mAggregator.
getData
(evtType));
64
pc.
outputs
().
snapshot
(
of::Output
{
o2::header::gDataOriginMID
,
"DATAROF"
, subSpec}, mAggregator.
getROFRecords
(evtType));
65
}
66
67
mTimer += std::chrono::high_resolution_clock::now() - tStart;
68
mNROFs += mAggregator.
getROFRecords
().size();
69
}
70
71
private
:
72
DecodedDataAggregator
mAggregator{};
73
std::chrono::duration<double> mTimer{0};
74
std::chrono::duration<double> mTimerAlgo{0};
75
unsigned
int
mNROFs{0};
76
};
77
78
framework::DataProcessorSpec
getDecodedDataAggregatorSpec
()
79
{
80
std::vector<of::InputSpec> inputSpecs{
of::InputSpec
{
"mid_decoded"
,
header::gDataOriginMID
,
"DECODED"
},
of::InputSpec
{
"mid_decoded_rof"
,
header::gDataOriginMID
,
"DECODEDROF"
}};
81
std::vector<of::OutputSpec> outputSpecs;
82
for
(
o2::header::DataHeader::SubSpecificationType
subSpec = 0; subSpec < 3; ++subSpec) {
83
outputSpecs.emplace_back(
of::OutputSpec
{
header::gDataOriginMID
,
"DATA"
, subSpec});
84
outputSpecs.emplace_back(
of::OutputSpec
{
header::gDataOriginMID
,
"DATAROF"
, subSpec});
85
}
86
87
return
of::DataProcessorSpec
{
88
"MIDDecodedDataAggregator"
,
89
{inputSpecs},
90
{outputSpecs},
91
of::AlgorithmSpec
{of::adaptFromTask<o2::mid::DecodedDataAggregatorDeviceDPL>()}};
92
}
93
}
// namespace mid
94
}
// namespace o2
ColumnData.h
Strip pattern (aka digits)
ConfigParamRegistry.h
ControlService.h
DecodedDataAggregatorSpec.h
Data processor spec for MID decoded data aggregator devices.
DecodedDataAggregator.h
MID decoded raw data aggregator.
Logger.h
Output.h
Task.h
o2::framework::CallbackService
Definition
CallbackService.h:35
o2::framework::DataAllocator::snapshot
void snapshot(const Output &spec, T const &object)
Definition
DataAllocator.h:325
o2::framework::InitContext
Definition
InitContext.h:25
o2::framework::InitContext::services
ServiceRegistryRef services()
Definition
InitContext.h:34
o2::framework::InputRecord::get
decltype(auto) get(R binding, int part=0) const
Definition
InputRecord.h:248
o2::framework::ProcessingContext
Definition
ProcessingContext.h:27
o2::framework::ProcessingContext::outputs
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
Definition
ProcessingContext.h:41
o2::framework::ProcessingContext::inputs
InputRecord & inputs()
The inputs associated with this processing context.
Definition
ProcessingContext.h:37
o2::framework::ServiceRegistryRef::get
T & get() const
Definition
ServiceRegistryRef.h:85
o2::mid::DecodedDataAggregatorDeviceDPL
Definition
DecodedDataAggregatorSpec.cxx:36
o2::mid::DecodedDataAggregatorDeviceDPL::run
void run(of::ProcessingContext &pc)
Definition
DecodedDataAggregatorSpec.cxx:47
o2::mid::DecodedDataAggregatorDeviceDPL::init
void init(of::InitContext &ic)
Definition
DecodedDataAggregatorSpec.cxx:38
o2::mid::DecodedDataAggregator
Definition
DecodedDataAggregator.h:32
o2::mid::DecodedDataAggregator::getROFRecords
const std::vector< ROFRecord > & getROFRecords(EventType eventType=EventType::Standard)
Gets the vector of data RO frame records.
Definition
DecodedDataAggregator.h:40
o2::mid::DecodedDataAggregator::process
void process(gsl::span< const ROBoard > localBoards, gsl::span< const ROFRecord > rofRecords)
Definition
DecodedDataAggregator.cxx:66
o2::mid::DecodedDataAggregator::getData
const std::vector< ColumnData > & getData(EventType eventType=EventType::Standard)
Gets the vector of data.
Definition
DecodedDataAggregator.h:37
data
GLboolean * data
Definition
glcorearb.h:298
o2::header::gDataOriginMID
constexpr o2::header::DataOrigin gDataOriginMID
Definition
DataHeader.h:573
o2::framework
Defining PrimaryVertex explicitly as messageable.
Definition
TFIDInfo.h:20
o2::mid::EventType
EventType
Definition
ROFRecord.h:32
o2::mid::getDecodedDataAggregatorSpec
framework::DataProcessorSpec getDecodedDataAggregatorSpec()
Definition
DecodedDataAggregatorSpec.cxx:78
o2
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Definition
BitstreamReader.h:24
o2::framework::AlgorithmSpec
Definition
AlgorithmSpec.h:43
o2::framework::DataProcessorSpec
Definition
DataProcessorSpec.h:41
o2::framework::InputSpec
Definition
InputSpec.h:31
o2::framework::OutputSpec
Definition
OutputSpec.h:33
o2::framework::Output
Definition
Output.h:27
o2::header::DataHeader::SubSpecificationType
uint32_t SubSpecificationType
Definition
DataHeader.h:620
LOG
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
msg
uint64_t const void const *restrict const msg
Definition
x9.h:153
Detectors
MUON
MID
Workflow
src
DecodedDataAggregatorSpec.cxx
Generated on Tue Feb 25 2025 17:03:07 for Project by
1.9.8