Project
Loading...
Searching...
No Matches
HBFUtils.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 "Framework/Logger.h"
14#include <fairlogger/Logger.h>
15#include <bitset>
16#include <cassert>
17#include <exception>
18
19using namespace o2::raw;
20
22
23//_________________________________________________
24uint32_t HBFUtils::getHBF(const IR& rec) const
25{
27 auto diff = rec.differenceInBC(getFirstIR());
28 if (diff < 0) {
29 LOG(error) << "IR " << rec.bc << '/' << rec.orbit << " is ahead of the reference IR "
30 << "0/" << orbitFirst;
31 throw std::runtime_error("Requested IR is ahead of the reference IR");
32 }
34}
35
36//_________________________________________________
37int HBFUtils::fillHBIRvector(std::vector<IR>& dst, const IR& fromIR, const IR& toIR) const
38{
39 // Fill provided vector (cleaned) by interaction records (bc/orbit) for HBFs, considering
40 // BCs between interaction records "fromIR" and "toIR" (inclusive).
41 dst.clear();
42 int hb0 = getHBF(fromIR), hb1 = getHBF(toIR);
43 if (fromIR.bc != 0) { // unless we are just starting the HBF of fromIR, it was already counted
44 hb0++;
45 }
46 for (int ihb = hb0; ihb <= hb1; ihb++) {
47 dst.emplace_back(getIRHBF(ihb));
48 }
49 return dst.size();
50}
51
52//_________________________________________________
54{
56 auto s = fmt::format("1st sampled orbit ({}) < 1st orbit of run ({})", orbitFirstSampled, orbitFirst);
57 LOG(error) << s;
58 throw std::runtime_error(s);
59 }
60}
#define O2ParamImpl(classname)
GLenum GLenum dst
Definition glcorearb.h:1767
constexpr int LHCMaxBunches
GPUReconstruction * rec
uint16_t bc
bunch crossing ID of interaction
void checkConsistency() const
Definition HBFUtils.cxx:53
uint32_t getHBF(const IR &rec) const
get TF ID corresponding to this IR
Definition HBFUtils.cxx:24
IR getFirstIR() const
Definition HBFUtils.h:47
IR getIRHBF(uint32_t hbf) const
get IR corresponding to start of the TF
Definition HBFUtils.h:52
uint32_t orbitFirstSampled
1st orbit sampled in the MC
Definition HBFUtils.h:142
int fillHBIRvector(std::vector< IR > &dst, const IR &fromIR, const IR &toIR) const
Definition HBFUtils.cxx:37
uint32_t orbitFirst
orbit of 1st TF of the run
Definition HBFUtils.h:140
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"