Project
Loading...
Searching...
No Matches
DecodedDataDumpSpec.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/RawDumpSpec.h
"
18
19
#include <fstream>
20
#include "
Framework/ConfigParamRegistry.h
"
21
#include "
Framework/ControlService.h
"
22
#include "
Framework/Logger.h
"
23
#include "
Framework/Task.h
"
24
#include "fmt/format.h"
25
#include "
DataFormatsMID/ROBoard.h
"
26
#include "
DataFormatsMID/ROFRecord.h
"
27
28
namespace
o2
29
{
30
namespace
mid
31
{
32
33
class
RawDumpDeviceDPL
34
{
35
public
:
36
void
init
(
o2::framework::InitContext
& ic)
37
{
38
auto
outFilename = ic.
options
().
get
<std::string>(
"mid-dump-outfile"
);
39
40
if
(!outFilename.empty()) {
41
mOutFile.open(outFilename.c_str());
42
}
43
}
44
45
void
46
run
(
o2::framework::ProcessingContext
& pc)
47
{
48
49
auto
data
= pc.
inputs
().
get
<gsl::span<ROBoard>>(
"mid_decoded"
);
50
auto
dataROFs = pc.
inputs
().
get
<gsl::span<ROFRecord>>(
"mid_decoded_rof"
);
51
std::stringstream ss;
52
for
(
auto
& rof : dataROFs) {
53
ss << fmt::format(
"BCid: 0x{:x} Orbit: 0x{:x} EvtType: {:d}"
, rof.interactionRecord.bc, rof.interactionRecord.orbit,
static_cast<
int
>
(rof.eventType)) << std::endl;
54
for
(
auto
colIt =
data
.begin() + rof.firstEntry,
end
=
data
.begin() + rof.getEndIndex(); colIt !=
end
; ++colIt) {
55
ss << *colIt << std::endl;
56
}
57
}
58
if
(mOutFile.is_open()) {
59
mOutFile << ss.str();
60
}
else
{
61
LOG
(info) << ss.str();
62
}
63
}
64
65
private
:
66
std::ofstream mOutFile;
67
};
68
69
framework::DataProcessorSpec
getRawDumpSpec
()
70
{
71
std::vector<o2::framework::InputSpec> inputSpecs{
72
o2::framework::InputSpec
{
"mid_decoded"
,
header::gDataOriginMID
,
"DECODED"
, 0, o2::framework::Lifetime::Timeframe},
73
o2::framework::InputSpec
{
"mid_decoded_rof"
,
header::gDataOriginMID
,
"DECODEDROF"
, 0, o2::framework::Lifetime::Timeframe}};
74
75
return
o2::framework::DataProcessorSpec
{
76
"MIDRawDataDumper"
,
77
{inputSpecs},
78
{},
79
o2::framework::AlgorithmSpec
{o2::framework::adaptFromTask<RawDumpDeviceDPL>()},
80
o2::framework::Options
{{
"mid-dump-outfile"
,
o2::framework::VariantType::String
,
""
, {
"Dump output to file"
}}}};
81
}
82
83
}
// namespace mid
84
}
// namespace o2
ConfigParamRegistry.h
ControlService.h
Logger.h
RawDumpSpec.h
Device to dump decoded raw data.
ROFRecord.h
Definition of the MID event record.
ROBoard.h
Structure to store the readout board information.
Task.h
o2::framework::ConfigParamRegistry::get
T get(const char *key) const
Definition
ConfigParamRegistry.h:98
o2::framework::InitContext
Definition
InitContext.h:25
o2::framework::InitContext::options
ConfigParamRegistry const & options()
Definition
InitContext.h:33
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::inputs
InputRecord & inputs()
The inputs associated with this processing context.
Definition
ProcessingContext.h:37
o2::mid::RawDumpDeviceDPL
Definition
DecodedDataDumpSpec.cxx:34
o2::mid::RawDumpDeviceDPL::run
void run(o2::framework::ProcessingContext &pc)
Definition
DecodedDataDumpSpec.cxx:46
o2::mid::RawDumpDeviceDPL::init
void init(o2::framework::InitContext &ic)
Definition
DecodedDataDumpSpec.cxx:36
end
GLuint GLuint end
Definition
glcorearb.h:469
data
GLboolean * data
Definition
glcorearb.h:298
o2::header::gDataOriginMID
constexpr o2::header::DataOrigin gDataOriginMID
Definition
DataHeader.h:573
o2::framework::VariantType::String
@ String
o2::framework::Options
std::vector< ConfigParamSpec > Options
Definition
DataProcessorSpec.h:31
o2::mid::getRawDumpSpec
framework::DataProcessorSpec getRawDumpSpec()
Definition
DecodedDataDumpSpec.cxx:69
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
LOG
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
Detectors
MUON
MID
Workflow
src
DecodedDataDumpSpec.cxx
Generated on Tue Feb 25 2025 17:03:07 for Project by
1.9.8