-
Notifications
You must be signed in to change notification settings - Fork 494
Expand file tree
/
Copy pathDigitIOBaseTask.h
More file actions
93 lines (78 loc) · 2.72 KB
/
DigitIOBaseTask.h
File metadata and controls
93 lines (78 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#ifndef O2_MCH_DEVIO_DIGITS_DIGIT_IO_BASE_TASK_H
#define O2_MCH_DEVIO_DIGITS_DIGIT_IO_BASE_TASK_H
#include "Framework/ConfigParamSpec.h"
#include <cstdint>
#include <gsl/span>
#include <numeric>
#include <vector>
namespace o2::framework
{
class InitContext;
} // namespace o2::framework
namespace o2::mch
{
class Digit;
class ROFRecord;
}; // namespace o2::mch
namespace o2::mch::io
{
/**
* DigitIOBaseTask implements the commonalities between reader and writer
* tasks, like the handling of the common options.
*/
class DigitIOBaseTask
{
protected:
size_t mMaxNofTimeFrames{std::numeric_limits<size_t>::max()}; // max number of timeframes to process
size_t mNofProcessedTFs{0}; // actual number of timeframes processed so far
size_t mFirstTF{0}; // first timeframe to process
size_t mTFid{0}; // current timeframe index
bool mPrintDigits = false; // print digits
bool mPrintTFs = false; // print number of rofs and digits per tf
public:
/**
* Init data members from options
*/
void init(o2::framework::InitContext& ic);
/**
* Make a full screen dump of the digits and rofs arrays.
*/
void printFull(gsl::span<const Digit> digits,
gsl::span<const ROFRecord> rofs) const;
/**
* Make a brief screen dump of the digits and rofs arrays (just showing
* number of items in each)
*/
void printSummary(gsl::span<const Digit> digits,
gsl::span<const ROFRecord> rofs,
const char* suffix = "") const;
/**
* Decide, depending on the current TFid being processed, if it should
* be processed or not.
*/
bool shouldProcess() const;
/**
* Increment the number of timeframes that have been processed so far.
*/
void incNofProcessedTFs();
/**
* Increment the timeframe id (last one that has been processed).
*/
void incTFid();
};
/**
* Define commonly used options, like max number of tfs, first tf, etc...
*/
std::vector<o2::framework::ConfigParamSpec> getCommonOptions();
} // namespace o2::mch::io
#endif