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
18
19#include <fstream>
22#include "Framework/Logger.h"
23#include "Framework/Task.h"
24#include "fmt/format.h"
27
28namespace o2
29{
30namespace mid
31{
32
34{
35 public:
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
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
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
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
Device to dump decoded raw data.
Definition of the MID event record.
Structure to store the readout board information.
ConfigParamRegistry const & options()
Definition InitContext.h:33
decltype(auto) get(R binding, int part=0) const
InputRecord & inputs()
The inputs associated with this processing context.
void run(o2::framework::ProcessingContext &pc)
void init(o2::framework::InitContext &ic)
GLuint GLuint end
Definition glcorearb.h:469
GLboolean * data
Definition glcorearb.h:298
constexpr o2::header::DataOrigin gDataOriginMID
Definition DataHeader.h:573
std::vector< ConfigParamSpec > Options
framework::DataProcessorSpec getRawDumpSpec()
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"