Project
Loading...
Searching...
No Matches
raw-debug-workflow.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
21
22#include <iostream>
27#include "Framework/Task.h"
28
31
35
36using namespace o2::framework;
37
38void customize(std::vector<ConfigParamSpec>& workflowOptions)
39{
40 workflowOptions.push_back(ConfigParamSpec{"dataspec", VariantType::String, "TF:MCH/RAWDATA", {"selection string for the input data"}});
41}
42
44
45using namespace o2;
46using namespace o2::framework;
48
49namespace o2
50{
51namespace mch
52{
53namespace raw
54{
55
56//=======================
57// Data parser
59{
60 public:
61 DataParserTask(std::string spec) : mInputSpec(spec) {}
62
63 //_________________________________________________________________________________________________
65 {
66 }
67
68 void decodeBuffer(gsl::span<const std::byte> page){};
69
70 //_________________________________________________________________________________________________
72 {
73 // get the input buffer
74 DPLRawParser parser(pc.inputs(), o2::framework::select(mInputSpec.c_str()));
75
76 int nRDH = 0;
77
78 const std::byte* raw = nullptr;
79 for (auto it = parser.begin(), end = parser.end(); it != end; ++it) {
80 raw = reinterpret_cast<const std::byte*>(it.raw());
81 if (!raw) {
82 continue;
83 }
84
85 auto* rdh = reinterpret_cast<const RDH*>(raw);
86
87 if (nRDH == 0) {
88 std::cout << std::endl
89 << "---------------" << std::endl;
91 //std::cout << "......." << std::endl;
92 }
93 nRDH += 1;
94 }
95
96 if (false && raw) {
97 auto* rdh = reinterpret_cast<const RDH*>(raw);
99 }
100 std::cout << "---------------" << std::endl;
101 }
102
103 private:
104 std::string mInputSpec;
105};
106
107} // namespace raw
108} // namespace mch
109} // end namespace o2
110
112{
113 auto inputSpec = config.options().get<std::string>("dataspec");
114
115 WorkflowSpec specs;
116
117 o2::mch::raw::DataParserTask task(inputSpec);
118 DataProcessorSpec parser{
119 "RawParser",
120 o2::framework::select(inputSpec.c_str()),
121 Outputs{},
122 AlgorithmSpec{adaptFromTask<o2::mch::raw::DataParserTask>(std::move(task))},
123 Options{}};
124
125 specs.push_back(parser);
126
127 return specs;
128}
A raw page parser for DPL input.
Definition of the RAW Data Header.
ConfigParamRegistry & options() const
The parser handles transparently input in the format of raw pages.
const_iterator end() const
const_iterator begin() const
InputRecord & inputs()
The inputs associated with this processing context.
void run(framework::ProcessingContext &pc)
void decodeBuffer(gsl::span< const std::byte > page)
void init(framework::InitContext &ic)
GLuint GLuint end
Definition glcorearb.h:469
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< DataProcessorSpec > WorkflowSpec
std::vector< InputSpec > select(char const *matcher="")
std::vector< OutputSpec > Outputs
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
WorkflowSpec defineDataProcessing(const ConfigContext &config)
void customize(std::vector< ConfigParamSpec > &workflowOptions)
static void printRDH(const RDHv4 &rdh)
Definition RDHUtils.cxx:26