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
14
15#ifndef ALICEO2_ITSMFT_ROFRECORD_H
16#define ALICEO2_ITSMFT_ROFRECORD_H
17
20#include <gsl/span>
21
22namespace o2
23{
24namespace itsmft
25{
26
29
31{
32
33 public:
34 enum { VtxStdMode = 0,
38 using ROFtype = unsigned int;
39
40 ROFRecord() = default;
41 ROFRecord(const BCData& bc, ROFtype rof, int idx, int n)
42 : mBCData(bc), mROFEntry(idx, n), mROFrame(rof) {}
43
44 void setBCData(const BCData& bc) { mBCData = bc; }
45 void setROFrame(ROFtype rof) { mROFrame = rof; }
46 void setEntry(EvIdx entry) { mROFEntry = entry; }
47 void setFirstEntry(int idx) { mROFEntry.setFirstEntry(idx); }
48 void setNEntries(int n) { mROFEntry.setEntries(n); }
49
50 uint32_t getFlags() const { return mBits; }
51 void setFlags(uint32_t flags) { mBits = flags; }
52 void setFlag(uint8_t flagIndex) { mBits |= (1 << flagIndex); }
53 void resetFlag(uint8_t flagIndex) { mBits &= ~(1 << flagIndex); }
54 bool getFlag(uint8_t flagIndex) const { return mBits & (1 << flagIndex); }
55 void clearAllFlags() { mBits = 0; }
56 void setAllFlags() { mBits = ~0; }
57
58 const BCData& getBCData() const { return mBCData; }
59 BCData& getBCData() { return mBCData; }
60 EvIdx getEntry() const { return mROFEntry; }
61 EvIdx& getEntry() { return mROFEntry; }
62 int getNEntries() const { return mROFEntry.getEntries(); }
63 int getFirstEntry() const { return mROFEntry.getFirstEntry(); }
64 ROFtype getROFrame() const { return mROFrame; }
65
66 void clear()
67 {
68 mROFEntry.clear();
69 mBCData.clear();
70 }
71
72 template <typename T>
73 gsl::span<const T> getROFData(const gsl::span<const T> tfdata) const
74 {
75 return getNEntries() ? gsl::span<const T>(&tfdata[getFirstEntry()], getNEntries()) : gsl::span<const T>();
76 }
77
78 template <typename T>
79 const T* getROFDataAt(int i, const gsl::span<const T> tfdata) const
80 {
81 return i < getNEntries() ? &tfdata[getFirstEntry() + i] : nullptr;
82 }
83
84 template <typename T>
85 gsl::span<const T> getROFData(const std::vector<T>& tfdata) const
86 {
87 return getNEntries() ? gsl::span<const T>(&tfdata[getFirstEntry()], getNEntries()) : gsl::span<const T>();
88 }
89
90 template <typename T>
91 const T* getROFDataAt(int i, const std::vector<T>& tfdata) const
92 {
93 return i < getNEntries() ? &tfdata[getFirstEntry() + i] : nullptr;
94 }
95
96 std::string asString() const;
97 void print() const;
98 friend std::ostream& operator<<(std::ostream& output, const ROFRecord& rec);
99
100 private:
101 o2::InteractionRecord mBCData; // BC data for given trigger
102 EvIdx mROFEntry; //< reference on the 1st object of the ROF in data
103 ROFtype mROFrame = 0; //< frame ID
104 uint32_t mBits = 0;
105 ClassDefNV(ROFRecord, 3);
106};
107
111 using ROFtype = unsigned int;
112
113 int eventRecordID = -1;
114 int rofRecordID = 0;
117
118 MC2ROFRecord() = default;
119 MC2ROFRecord(int evID, int rofRecID, ROFtype mnrof, ROFtype mxrof) : eventRecordID(evID), rofRecordID(rofRecID), minROF(mnrof), maxROF(mxrof) {}
120 int getNROFs() const { return (rofRecordID < 0 || minROF > maxROF) ? 0 : (maxROF - minROF); }
121 std::string asString() const;
122 void print() const;
123 friend std::ostream& operator<<(std::ostream& output, const MC2ROFRecord& rec);
124
126};
127} // namespace itsmft
128} // namespace o2
129
130#endif
uint64_t bc
Definition RawEventData.h:5
int32_t i
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
Class to refer to the 1st entry and N elements of some group in the continuous container.
void setNEntries(int n)
Definition ROFRecord.h:48
unsigned int ROFtype
Definition ROFRecord.h:38
void setBCData(const BCData &bc)
Definition ROFRecord.h:44
const T * getROFDataAt(int i, const std::vector< T > &tfdata) const
Definition ROFRecord.h:91
int getNEntries() const
Definition ROFRecord.h:62
const T * getROFDataAt(int i, const gsl::span< const T > tfdata) const
Definition ROFRecord.h:79
EvIdx getEntry() const
Definition ROFRecord.h:60
void setFlag(uint8_t flagIndex)
Definition ROFRecord.h:52
friend std::ostream & operator<<(std::ostream &output, const ROFRecord &rec)
Definition ROFRecord.cxx:28
const BCData & getBCData() const
Definition ROFRecord.h:58
gsl::span< const T > getROFData(const gsl::span< const T > tfdata) const
Definition ROFRecord.h:73
void resetFlag(uint8_t flagIndex)
Definition ROFRecord.h:53
std::string asString() const
Definition ROFRecord.cxx:18
ROFRecord(const BCData &bc, ROFtype rof, int idx, int n)
Definition ROFRecord.h:41
bool getFlag(uint8_t flagIndex) const
Definition ROFRecord.h:54
void setFirstEntry(int idx)
Definition ROFRecord.h:47
gsl::span< const T > getROFData(const std::vector< T > &tfdata) const
Definition ROFRecord.h:85
int getFirstEntry() const
Definition ROFRecord.h:63
uint32_t getFlags() const
Definition ROFRecord.h:50
void setFlags(uint32_t flags)
Definition ROFRecord.h:51
void setROFrame(ROFtype rof)
Definition ROFRecord.h:45
o2::dataformats::RangeReference< int, int > EvIdx
Definition ROFRecord.h:36
BCData & getBCData()
Definition ROFRecord.h:59
void setEntry(EvIdx entry)
Definition ROFRecord.h:46
ROFtype getROFrame() const
Definition ROFRecord.h:64
GLdouble n
Definition glcorearb.h:1982
GLuint entry
Definition glcorearb.h:5735
GLbitfield flags
Definition glcorearb.h:1570
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
GPUReconstruction * rec
friend std::ostream & operator<<(std::ostream &output, const MC2ROFRecord &rec)
Definition ROFRecord.cxx:44
std::string asString() const
Definition ROFRecord.cxx:34
ROFtype maxROF
last ROF event contributed
Definition ROFRecord.h:116
ClassDefNV(MC2ROFRecord, 1)
int rofRecordID
1st entry in the ROFRecords vector
Definition ROFRecord.h:114
int eventRecordID
MCevent entry in the EventRecord.
Definition ROFRecord.h:113
MC2ROFRecord(int evID, int rofRecID, ROFtype mnrof, ROFtype mxrof)
Definition ROFRecord.h:119
ROFtype minROF
1st ROFrame it contributed
Definition ROFRecord.h:115