Project
Loading...
Searching...
No Matches
RawDataReaderSpec.h
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#ifndef O2_FDD_RAWDATAREADERSPEC_H
15#define O2_FDD_RAWDATAREADERSPEC_H
16
19#include "Framework/Task.h"
23#include "Framework/Lifetime.h"
24#include "Framework/Output.h"
29
30#include <iostream>
31#include <vector>
32#include <gsl/span>
33using namespace o2::framework;
34
35namespace o2
36{
37namespace fdd
38{
39template <typename RawReader>
40class RawDataReaderSpec : public Task
41{
42 public:
43 RawDataReaderSpec(const RawReader& rawReader) : mRawReader(rawReader) {}
44 RawDataReaderSpec() = default;
45 ~RawDataReaderSpec() override = default;
46 void init(InitContext& ic) final { o2::fdd::SingleLUT::Instance().printFullMap(); }
47 void run(ProcessingContext& pc) final
48 {
49 DPLRawParser parser(pc.inputs());
50 mRawReader.clear();
51 LOG(info) << "FDD RawDataReaderSpec";
52 uint64_t count = 0;
53 for (auto it = parser.begin(), end = parser.end(); it != end; ++it) {
54 //Proccessing each page
55 count++;
56 auto rdhPtr = reinterpret_cast<const o2::header::RDHAny*>(it.raw());
57 gsl::span<const uint8_t> payload(it.data(), it.size());
58 mRawReader.process(payload, o2::raw::RDHUtils::getLinkID(rdhPtr), int(0));
59 }
60 LOG(info) << "Pages: " << count;
61 mRawReader.accumulateDigits();
62 mRawReader.makeSnapshot(pc);
63 }
64 RawReader mRawReader;
65};
66
67template <typename RawReader>
69{
70 LOG(info) << "DataProcessorSpec initDataProcSpec() for RawReaderFDD";
71 std::vector<OutputSpec> outputSpec;
72 RawReader::prepareOutputSpec(outputSpec);
73 return DataProcessorSpec{
74 "fdd-datareader-dpl",
75 o2::framework::select("TF:FDD/RAWDATA"),
76 outputSpec,
77 adaptFromTask<RawDataReaderSpec<RawReader>>(rawReader),
78 Options{}};
79}
80
81} // namespace fdd
82} // namespace o2
83
84#endif /* O2_FDDDATAREADERDPL_H */
A raw page parser for DPL input.
Type wrappers for enfording a specific serialization method.
~RawDataReaderSpec() override=default
RawDataReaderSpec(const RawReader &rawReader)
void run(ProcessingContext &pc) final
void init(InitContext &ic) final
static SingleLUT & Instance(const Table_t *table=nullptr, long timestamp=-1)
The parser handles transparently input in the format of raw pages.
const_iterator end() const
const_iterator begin() const
GLint GLsizei count
Definition glcorearb.h:399
GLuint GLuint end
Definition glcorearb.h:469
framework::DataProcessorSpec getFDDRawDataReaderSpec(const RawReader &rawReader)
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > select(char const *matcher="")
struct o2::upgrades_utils::@459 fdd
Collision labels.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"