Project
Loading...
Searching...
No Matches
CTFHelper.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
15
16#include "MIDCTF/CTFHelper.h"
18
19using namespace o2::mid;
20
22{
23 uint32_t nDone = 0, idx[NEvTypes] = {};
24 uint32_t sizes[NEvTypes] = {
25 uint32_t(rofData[size_t(EventType::Standard)].size()),
26 uint32_t(rofData[size_t(EventType::Calib)].size()),
27 uint32_t(rofData[size_t(EventType::FET)].size())};
28 uint64_t rofBC[NEvTypes] = {};
29 auto fillNextROFBC = [&nDone, &rofBC, &idx, &sizes, this](int it) {
30 if (idx[it] < sizes[it]) {
31 rofBC[it] = this->rofData[it][idx[it]].interactionRecord.toLong();
32 } else {
33 rofBC[it] = -1;
34 nDone++;
35 }
36 };
37 for (uint32_t it = 0; it < NEvTypes; it++) {
38 fillNextROFBC(it);
39 }
40 while (nDone < NEvTypes) { // find next ROFRecord with smallest BC, untill all 3 spans are traversed
41 int selT = rofBC[0] <= rofBC[1] ? (rofBC[0] <= rofBC[2] ? 0 : 2) : (rofBC[1] <= rofBC[2] ? 1 : 2);
42 if (!irSelector.isSet() || irSelector.check(rofData[selT][idx[selT]].interactionRecord) >= 0) {
43 rofDataRefs.emplace_back(idx[selT], selT);
44 for (uint32_t ic = rofData[selT][idx[selT]].firstEntry; ic < rofData[selT][idx[selT]].getEndIndex(); ic++) {
45 colDataRefs.emplace_back(ic, selT); // register indices of corresponding column data
46 }
47 }
48 ++idx[selT]; // increment used index
49 fillNextROFBC(selT);
50 }
51}
Class to check if give InteractionRecord or IRFrame is selected by the external IRFrame vector.
Helper for MID CTF creation.
long check(o2::dataformats::IRFrame fr, size_t bwd=0, size_t fwd=0)
GLsizeiptr size
Definition glcorearb.h:659
GLuint GLsizei const GLuint const GLintptr const GLsizeiptr * sizes
Definition glcorearb.h:2595
constexpr uint32_t NEvTypes
Definition ROFRecord.h:37
std::vector< OrderRef > rofDataRefs
Definition CTFHelper.h:41
std::array< gsl::span< const o2::mid::ROFRecord >, NEvTypes > rofData
Definition CTFHelper.h:43
void buildReferences(o2::utils::IRFrameSelector &irSelector)
Definition CTFHelper.cxx:21
std::vector< OrderRef > colDataRefs
Definition CTFHelper.h:40
o2::utils::IRFrameSelector irSelector