Project
Loading...
Searching...
No Matches
DigitIOBaseTask.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
14#include "DigitIOBaseTask.h"
15#include "DigitSink.h"
16#include <fmt/format.h>
19#include "Framework/Logger.h"
20#include "Framework/Variant.h"
21#include "ProgOptions.h"
22#include <iostream>
23#include <sstream>
24#include <string>
25
26using namespace o2::framework;
27
28namespace o2::mch::io
29{
30void DigitIOBaseTask::init(InitContext& ic)
31{
37 if (mPrintDigits || mPrintTFs) {
38 fair::Logger::SetConsoleColor(true);
39 }
40}
41
42void DigitIOBaseTask::printFull(gsl::span<const Digit> digits,
43 gsl::span<const ROFRecord> rofs) const
44{
45 if (mPrintDigits) {
46 std::stringstream str;
48 dw.write(digits, rofs);
49 for (std::string line; std::getline(str, line);) {
50 LOG(info) << line;
51 }
52 }
53}
54
55void DigitIOBaseTask::printSummary(gsl::span<const Digit> digits,
56 gsl::span<const ROFRecord> rofs,
57 const char* suffix) const
58{
59 if (mPrintTFs) {
60 LOGP(info, "TF {:5d} {:4d} rofs - {:6d} digits - {}", mTFid, rofs.size(), digits.size(), suffix);
61 }
62}
63
64bool DigitIOBaseTask::shouldProcess() const
65{
67}
68
69void DigitIOBaseTask::incNofProcessedTFs()
70{
72}
73
74void DigitIOBaseTask::incTFid()
75{
76 ++mTFid;
77}
78
79std::vector<ConfigParamSpec> getCommonOptions()
80{
81 return {
82 {OPTNAME_MAX_NOF_TFS, VariantType::Int, std::numeric_limits<int>::max(), {OPTHELP_MAX_NOF_TFS}},
83 {OPTNAME_FIRST_TF, VariantType::Int, 0, {OPTHELP_FIRST_TF}},
84 {OPTNAME_PRINT_DIGITS, VariantType::Bool, false, {OPTHELP_PRINT_DIGITS}},
85 {OPTNAME_PRINT_TFS, VariantType::Bool, false, {OPTHELP_PRINT_TFS}}};
86}
87
88} // namespace o2::mch::io
Definition of the MCH ROFrame record.
constexpr const char * OPTHELP_MAX_NOF_TFS
Definition ProgOptions.h:20
constexpr const char * OPTHELP_FIRST_TF
Definition ProgOptions.h:23
constexpr const char * OPTNAME_PRINT_DIGITS
Definition ProgOptions.h:25
constexpr const char * OPTNAME_PRINT_TFS
Definition ProgOptions.h:28
constexpr const char * OPTHELP_PRINT_TFS
Definition ProgOptions.h:29
constexpr const char * OPTHELP_PRINT_DIGITS
Definition ProgOptions.h:26
constexpr const char * OPTNAME_MAX_NOF_TFS
Definition ProgOptions.h:19
constexpr const char * OPTNAME_FIRST_TF
Definition ProgOptions.h:22
ConfigParamRegistry const & options()
Definition InitContext.h:33
bool write(gsl::span< const Digit > digits, gsl::span< const ROFRecord > rofs={})
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< ConfigParamSpec > getCommonOptions()
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< Digit > digits
const std::string str