Project
Loading...
Searching...
No Matches
ROC.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
30
31#ifndef AliceO2_TPC_ROC_H
32#define AliceO2_TPC_ROC_H
33
34#include "DataFormatsTPC/Defs.h"
35#include "TPCBase/Sector.h"
36
37namespace o2
38{
39namespace tpc
40{
41// enum RocType {IROC=0, OROC=1};
42
43class ROC
44{
45 public:
46 enum {
47 MaxROC = 72
48 };
49
51 ROC() = default;
52
55 ROC(unsigned char roc) : mROC(roc % MaxROC) { ; }
56
60 ROC(const Sector& sec, const RocType type) : mROC(sec.getSector() + (type == RocType::OROC) * 2 * SECTORSPERSIDE) {}
61
63 bool operator==(const ROC& other) { return mROC == other.mROC; }
64
66 bool operator!=(const ROC& other) { return mROC != other.mROC; }
67
69 bool operator<(const ROC& other) { return mROC < other.mROC; }
70
76 {
77 mLoop = ++mROC >= MaxROC;
78 mROC %= MaxROC;
79 return mLoop;
80 }
81
84 operator int() const { return int(mROC); }
85
88 unsigned char getRoc() const { return mROC; }
89
92 Side side() const { return (mROC / SECTORSPERSIDE) % SIDES ? Side::C : Side::A; }
93
96 RocType rocType() const { return mROC < MaxROC / SIDES ? RocType::IROC : RocType::OROC; }
97
99 bool isIROC() const { return mROC < MaxROC / SIDES; }
100
102 bool isOROC() const { return mROC >= MaxROC / SIDES; }
103
105 Sector getSector() const { return Sector(mROC); }
106
108 bool looped() const { return mLoop; }
109
110 private:
111 unsigned char mROC{0};
112 bool mLoop{false};
113};
114} // namespace tpc
115} // namespace o2
116
117#endif
uint32_t roc
Definition RawData.h:3
Side side() const
Definition ROC.h:92
bool operator<(const ROC &other)
smaller operator
Definition ROC.h:69
bool isIROC() const
If roc is an IROC.
Definition ROC.h:99
@ MaxROC
Definition ROC.h:47
ROC(unsigned char roc)
Definition ROC.h:55
ROC(const Sector &sec, const RocType type)
Definition ROC.h:60
bool isOROC() const
If roc is an OROC.
Definition ROC.h:102
bool looped() const
if increment operator went above MaxROC
Definition ROC.h:108
bool operator!=(const ROC &other)
unequal operator
Definition ROC.h:66
bool operator++()
Definition ROC.h:75
unsigned char getRoc() const
Definition ROC.h:88
Sector getSector() const
get sector
Definition ROC.h:105
RocType rocType() const
Definition ROC.h:96
ROC()=default
default constructor
bool operator==(const ROC &other)
comparison operator
Definition ROC.h:63
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
RocType
TPC ROC types.
Definition Defs.h:48
@ OROC
Definition Defs.h:49
@ IROC
Definition Defs.h:48
constexpr unsigned char SECTORSPERSIDE
Definition Defs.h:40
constexpr unsigned char SIDES
Definition Defs.h:41
Side
TPC readout sidE.
Definition Defs.h:35
@ A
Definition Defs.h:35
@ C
Definition Defs.h:36
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
VectorOfTObjectPtrs other