Project
Loading...
Searching...
No Matches
CompCluster.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#ifndef ALICEO2_ITSMFT_COMPCLUSTER_H
15#define ALICEO2_ITSMFT_COMPCLUSTER_H
16
17#include <Rtypes.h>
18#include <iosfwd>
19
20namespace o2
21{
22namespace itsmft
23{
24
27
29{
30 public:
31 static constexpr int NBitsRow = 9; // number of bits for the row
32 static constexpr int NBitsCol = 10; // number of bits for the column
33 static constexpr int NBitsPattID = 11; // number of bits for the pattern ID
34 private:
35 static constexpr UInt_t RowMask = (0x1 << NBitsRow) - 1;
36 static constexpr UInt_t ColMask = (0x1 << NBitsCol) - 1;
37 static constexpr UInt_t PattIDMask = (0x1 << NBitsPattID) - 1;
38 static constexpr UInt_t FlagBit = 0x1 << (NBitsRow + NBitsCol + NBitsPattID);
39 //
41 UInt_t mData;
42
43 void sanityCheck();
44
45 public:
46 static constexpr unsigned short InvalidPatternID = (0x1 << NBitsPattID) - 1; // All 11 bits of pattern ID are 1
47 CompCluster(UShort_t row = 0, UShort_t col = 0, UShort_t patt = 0)
48 {
49 set(row, col, patt);
50 }
51
52 void set(UShort_t row, UShort_t col, UShort_t patt)
53 {
54 mData = (row & RowMask) | ((col & ColMask) << NBitsRow) | ((patt & PattIDMask) << (NBitsRow + NBitsCol));
55 }
56
57 UShort_t getRow() const { return mData & RowMask; }
58 UShort_t getCol() const { return (mData >> NBitsRow) & ColMask; }
59 UShort_t getPatternID() const { return (mData >> (NBitsRow + NBitsCol)) & PattIDMask; }
60 bool getFlag() const { return (mData & FlagBit) == FlagBit; }
61
62 void setRow(UShort_t r)
63 {
64 mData &= ~RowMask;
65 mData |= (r & RowMask);
66 }
67 void setCol(UShort_t c)
68 {
69 mData &= ~(ColMask << NBitsRow);
70 mData |= (c & ColMask) << NBitsRow;
71 };
72 void setPatternID(UShort_t p)
73 {
74 mData &= ~(PattIDMask << (NBitsRow + NBitsCol));
75 mData |= (p & PattIDMask) << (NBitsRow + NBitsCol);
76 }
77 void setFlag(bool v)
78 {
79 mData &= ~FlagBit;
80 if (v) {
81 mData |= FlagBit;
82 }
83 }
84
85 bool operator==(const CompCluster& cl) const
86 {
87 return mData == cl.mData;
88 }
89
90 void print() const;
91
93};
94
98{
99 private:
100 UShort_t mChipID;
101
102 public:
103 CompClusterExt(UShort_t row = 0, UShort_t col = 0, UShort_t patt = 0, UShort_t chipID = 0) : CompCluster(row, col, patt), mChipID(chipID)
104 {
105 }
106
107 void set(UShort_t row, UShort_t col, UShort_t patt, UShort_t chipID)
108 {
109 CompCluster::set(row, col, patt);
110 mChipID = chipID;
111 }
112
113 UShort_t getChipID() const { return mChipID; }
114 UShort_t getSensorID() const { return mChipID; } // to have the same signature as BaseCluster
115
116 void setChipID(UShort_t c) { mChipID = c; }
117
118 void print() const;
119
121};
122
123} // namespace itsmft
124} // namespace o2
125
126std::ostream& operator<<(std::ostream& stream, const o2::itsmft::CompCluster& cl);
127std::ostream& operator<<(std::ostream& stream, const o2::itsmft::CompClusterExt& cl);
128
129#endif /* ALICEO2_ITSMFT_COMPACTCLUSTER_H */
std::ostream & operator<<(std::ostream &stream, const o2::itsmft::CompCluster &cl)
uint32_t col
Definition RawData.h:4
uint32_t c
Definition RawData.h:2
UShort_t getChipID() const
void set(UShort_t row, UShort_t col, UShort_t patt, UShort_t chipID)
ClassDefNV(CompClusterExt, 1)
CompClusterExt(UShort_t row=0, UShort_t col=0, UShort_t patt=0, UShort_t chipID=0)
void setChipID(UShort_t c)
UShort_t getSensorID() const
static constexpr int NBitsRow
Definition CompCluster.h:31
UShort_t getRow() const
Definition CompCluster.h:57
UShort_t getPatternID() const
Definition CompCluster.h:59
UShort_t getCol() const
Definition CompCluster.h:58
bool operator==(const CompCluster &cl) const
Definition CompCluster.h:85
static constexpr int NBitsPattID
Definition CompCluster.h:33
void setCol(UShort_t c)
Definition CompCluster.h:67
CompCluster(UShort_t row=0, UShort_t col=0, UShort_t patt=0)
Definition CompCluster.h:47
void setRow(UShort_t r)
Definition CompCluster.h:62
void set(UShort_t row, UShort_t col, UShort_t patt)
Definition CompCluster.h:52
void setPatternID(UShort_t p)
Definition CompCluster.h:72
static constexpr int NBitsCol
Definition CompCluster.h:32
static constexpr unsigned short InvalidPatternID
Definition CompCluster.h:46
ClassDefNV(CompCluster, 2)
const GLdouble * v
Definition glcorearb.h:832
GLboolean r
Definition glcorearb.h:1233
GLuint GLuint stream
Definition glcorearb.h:1806
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::vector< int > row