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
12
#include "
DataFormatsMCH/Digit.h
"
13
#include "
DataFormatsMCH/ROFRecord.h
"
14
#include "
DigitIOBaseTask.h
"
15
#include "
DigitSink.h
"
16
#include <fmt/format.h>
17
#include "
Framework/ConfigParamRegistry.h
"
18
#include "
Framework/InitContext.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
26
using namespace
o2::framework
;
27
28
namespace
o2::mch::io
29
{
30
void
DigitIOBaseTask::init(
InitContext
& ic)
31
{
32
mMaxNofTimeFrames
= ic.
options
().
get
<
int
>(
OPTNAME_MAX_NOF_TFS
);
33
mFirstTF
= ic.
options
().
get
<
int
>(
OPTNAME_FIRST_TF
);
34
mNofProcessedTFs
= 0;
35
mPrintDigits
= ic.
options
().
get
<
bool
>(
OPTNAME_PRINT_DIGITS
);
36
mPrintTFs
= ic.
options
().
get
<
bool
>(
OPTNAME_PRINT_TFS
);
37
if
(
mPrintDigits
||
mPrintTFs
) {
38
fair::Logger::SetConsoleColor(
true
);
39
}
40
}
41
42
void
DigitIOBaseTask::printFull(gsl::span<const Digit>
digits
,
43
gsl::span<const ROFRecord> rofs)
const
44
{
45
if
(
mPrintDigits
) {
46
std::stringstream
str
;
47
o2::mch::io::DigitSink
dw(
str
);
48
dw.
write
(
digits
, rofs);
49
for
(std::string line; std::getline(
str
, line);) {
50
LOG
(info) << line;
51
}
52
}
53
}
54
55
void
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
64
bool
DigitIOBaseTask::shouldProcess()
const
65
{
66
return
(
mTFid
>=
mFirstTF
&&
mNofProcessedTFs
<
mMaxNofTimeFrames
);
67
}
68
69
void
DigitIOBaseTask::incNofProcessedTFs()
70
{
71
++
mNofProcessedTFs
;
72
}
73
74
void
DigitIOBaseTask::incTFid()
75
{
76
++
mTFid
;
77
}
78
79
std::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
ConfigParamRegistry.h
Digit.h
DigitIOBaseTask.h
DigitSink.h
InitContext.h
Logger.h
ROFRecord.h
Definition of the MCH ROFrame record.
ProgOptions.h
OPTHELP_MAX_NOF_TFS
constexpr const char * OPTHELP_MAX_NOF_TFS
Definition
ProgOptions.h:20
OPTHELP_FIRST_TF
constexpr const char * OPTHELP_FIRST_TF
Definition
ProgOptions.h:23
OPTNAME_PRINT_DIGITS
constexpr const char * OPTNAME_PRINT_DIGITS
Definition
ProgOptions.h:25
OPTNAME_PRINT_TFS
constexpr const char * OPTNAME_PRINT_TFS
Definition
ProgOptions.h:28
OPTHELP_PRINT_TFS
constexpr const char * OPTHELP_PRINT_TFS
Definition
ProgOptions.h:29
OPTHELP_PRINT_DIGITS
constexpr const char * OPTHELP_PRINT_DIGITS
Definition
ProgOptions.h:26
OPTNAME_MAX_NOF_TFS
constexpr const char * OPTNAME_MAX_NOF_TFS
Definition
ProgOptions.h:19
OPTNAME_FIRST_TF
constexpr const char * OPTNAME_FIRST_TF
Definition
ProgOptions.h:22
Variant.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::mch::io::DigitIOBaseTask::mNofProcessedTFs
size_t mNofProcessedTFs
Definition
DigitIOBaseTask.h:44
o2::mch::io::DigitIOBaseTask::mMaxNofTimeFrames
size_t mMaxNofTimeFrames
Definition
DigitIOBaseTask.h:43
o2::mch::io::DigitIOBaseTask::mPrintDigits
bool mPrintDigits
Definition
DigitIOBaseTask.h:47
o2::mch::io::DigitIOBaseTask::mTFid
size_t mTFid
Definition
DigitIOBaseTask.h:46
o2::mch::io::DigitIOBaseTask::mFirstTF
size_t mFirstTF
Definition
DigitIOBaseTask.h:45
o2::mch::io::DigitIOBaseTask::mPrintTFs
bool mPrintTFs
Definition
DigitIOBaseTask.h:48
o2::mch::io::DigitSink
Definition
DigitSink.h:33
o2::mch::io::DigitSink::write
bool write(gsl::span< const Digit > digits, gsl::span< const ROFRecord > rofs={})
Definition
DigitSink.cxx:141
o2::framework
Defining PrimaryVertex explicitly as messageable.
Definition
TFIDInfo.h:20
o2::mch::io
Definition
DigitD0.h:19
o2::mch::io::getCommonOptions
std::vector< ConfigParamSpec > getCommonOptions()
Definition
DigitIOBaseTask.cxx:79
LOG
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
digits
std::vector< Digit > digits
Definition
test_ctf_io_hmpid.cxx:40
str
const std::string str
Definition
test_ransEncodeDecode.cxx:37
Detectors
MUON
MCH
DevIO
Digits
DigitIOBaseTask.cxx
Generated on Tue Feb 25 2025 23:16:22 for Project by
1.9.8