37 mOutFileName = ic.
options().
get<std::string>(
"tof-raw-outfile");
38 mOutDirName = ic.
options().
get<std::string>(
"tof-raw-outdir");
39 mFileFor = ic.
options().
get<std::string>(
"file-for");
40 mOldFormat = ic.
options().
get<
bool>(
"use-old-format");
41 LOG(
debug) <<
"Raw output file: " << mOutFileName.c_str();
44 if (!std::filesystem::exists(mOutDirName)) {
45 if (!std::filesystem::create_directories(mOutDirName)) {
46 LOG(fatal) <<
"could not create output directory " << mOutDirName;
48 LOG(
debug) <<
"created output directory " << mOutDirName;
55 auto digits = pc.
inputs().
get<std::vector<o2::tof::Digit>*>(
"tofdigits");
56 auto row = pc.
inputs().
get<std::vector<o2::tof::ReadoutWindowData>*>(
"readoutwin");
57 int nwindow =
row->size();
58 LOG(
debug) <<
"Encoding " << nwindow <<
" TOF readout windows";
60 int cache = 1024 * 1024;
70 encoder.
open(mOutFileName, mOutDirName, mFileFor);
75 int nwindowFilled = nwindow;
76 if (nwindowFilled % nwindowintimeframe) {
77 nwindowFilled = (nwindowFilled / nwindowintimeframe + 1) * nwindowintimeframe;
80 std::vector<o2::tof::Digit> emptyWindow;
82 std::vector<o2::tof::Digit> digitRO;
84 std::vector<std::vector<o2::tof::Digit>> digitWindows;
86 for (
int i = 0;
i < nwindow;
i += nwindowperorbit) {
88 printf(
"----------\nwindow = %d - %d\n----------\n",
i,
i + nwindowperorbit - 1);
94 for (
int j =
i;
j <
i + nwindowperorbit;
j++) {
97 for (
int id = 0;
id <
row->at(
j).
size();
id++) {
98 digitRO.push_back((*
digits)[
row->at(
j).first() +
id]);
100 digitWindows.push_back(digitRO);
102 digitWindows.push_back(emptyWindow);
106 encoder.
encode(digitWindows,
i);
116 std::vector<InputSpec> inputs;
120 int rdhDefaultVersion = o2::raw::RDHUtils::getVersion<o2::header::RAWDataHeader>();
128 {
"tof-raw-outfile", VariantType::String,
"tof.raw", {
"Name of the output file"}},
129 {
"tof-raw-outdir", VariantType::String,
".", {
"Name of the output dir"}},
130 {
"file-for", VariantType::String,
"cruendpoint", {
"Single file per: all,cruendpoint,link"}},
131 {
"use-old-format", VariantType::Bool, rdhDefaultVersion < 7, {
"expecting zeroes in words 2 and 3 of the CRU payload"}}}};
static const HBFUtils & Instance()
T get(const char *key) const
ConfigParamRegistry const & options()
InputRecord & inputs()
The inputs associated with this processing context.
static constexpr int NWINDOW_IN_ORBIT
void run(ProcessingContext &pc) final
void init(InitContext &ic) final
bool encode(std::vector< std::vector< o2::tof::Digit > > digitWindow, int tofwindow=0)
void setVerbose(bool val)
void setEncoderCRUZEROES(bool val=true)
bool open(const std::string &name, const std::string &path=".", const std::string &fileFor="cruendpoint")
constexpr o2::header::DataOrigin gDataOriginTOF
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
o2::framework::DataProcessorSpec getTOFRawWriterSpec()
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
int getNOrbitsPerTF() const
get IR corresponding to start of the HBF
static std::string concat_string(Ts const &... ts)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< Digit > digits