Project
Loading...
Searching...
No Matches
ROFRecord.h
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
16
17#ifndef ALICEO2_MCH_ROFRECORD_H
18#define ALICEO2_MCH_ROFRECORD_H
19
23
24#include <iosfwd>
25#include <utility>
26
27namespace o2
28{
29namespace mch
30{
31
35{
39
40 public:
41 ROFRecord() = default;
42 ROFRecord(const BCData& bc, int firstIdx, int nEntries) : mBCData(bc), mDataRef(firstIdx, nEntries) {}
43 ROFRecord(const BCData& bc, int firstIdx, int nEntries, int bcWidth) : mBCData(bc), mDataRef(firstIdx, nEntries), mBCWidth(bcWidth) {}
44
46 const BCData& getBCData() const { return mBCData; }
48 BCData& getBCData() { return mBCData; }
50 void setBCData(const BCData& bc) { mBCData = bc; }
51
52 std::pair<Time, bool> getTimeMUS(const BCData& startIR, uint32_t nOrbits = 128, bool printError = false) const;
53
55 int getNEntries() const { return mDataRef.getEntries(); }
57 int getFirstIdx() const { return mDataRef.getFirstEntry(); }
59 int getLastIdx() const { return mDataRef.getFirstEntry() + mDataRef.getEntries() - 1; }
61 void setDataRef(int firstIdx, int nEntries) { mDataRef.set(firstIdx, nEntries); }
62
64 int getBCWidth() const { return mBCWidth; }
65
66 bool operator==(const ROFRecord& other) const
67 {
68 return mBCData == other.mBCData &&
69 mDataRef == other.mDataRef &&
70 mBCWidth == other.mBCWidth;
71 }
72 bool operator!=(const ROFRecord& other) const { return !(*this == other); }
73 bool operator<(const ROFRecord& other) const
74 {
75 if (mBCData == other.mBCData) {
76 if (mBCWidth == other.mBCWidth) {
77 return mDataRef.getFirstEntry() < other.mDataRef.getFirstEntry();
78 } else {
79 return mBCWidth < other.mBCWidth;
80 }
81 }
82 return mBCData < other.mBCData;
83 }
84
85 private:
86 BCData mBCData{};
87 DataRef mDataRef{};
88 int mBCWidth{4};
89
90 ClassDefNV(ROFRecord, 2);
91};
92
93std::ostream& operator<<(std::ostream& os, const ROFRecord& rof);
94
95} // namespace mch
96} // namespace o2
97
98#endif // ALICEO2_MCH_ROFRECORD_H
uint64_t bc
Definition RawEventData.h:5
Class to refer to the 1st entry and N elements of some group in the continuous container.
ROFRecord(const BCData &bc, int firstIdx, int nEntries)
Definition ROFRecord.h:42
void setBCData(const BCData &bc)
set the interaction record
Definition ROFRecord.h:50
int getLastIdx() const
get the index of the last associated object
Definition ROFRecord.h:59
int getNEntries() const
get the number of associated objects
Definition ROFRecord.h:55
bool operator!=(const ROFRecord &other) const
Definition ROFRecord.h:72
const BCData & getBCData() const
get the interaction record
Definition ROFRecord.h:46
std::pair< Time, bool > getTimeMUS(const BCData &startIR, uint32_t nOrbits=128, bool printError=false) const
Definition ROFRecord.cxx:35
ROFRecord(const BCData &bc, int firstIdx, int nEntries, int bcWidth)
Definition ROFRecord.h:43
bool operator<(const ROFRecord &other) const
Definition ROFRecord.h:73
BCData & getBCData()
get the interaction record
Definition ROFRecord.h:48
int getFirstIdx() const
get the index of the first associated object
Definition ROFRecord.h:57
int getBCWidth() const
get the time span by this ROF, in BC unit
Definition ROFRecord.h:64
bool operator==(const ROFRecord &other) const
Definition ROFRecord.h:66
void setDataRef(int firstIdx, int nEntries)
set the number of associated objects and the index of the first one
Definition ROFRecord.h:61
std::ostream & operator<<(std::ostream &os, const o2::dataformats::MeanVertexObject &o)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
VectorOfTObjectPtrs other