Project
Loading...
Searching...
No Matches
TPCPadBitMap.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 O2_GPU_TPC_PAD_BITMAP_H
16#define O2_GPU_TPC_PAD_BITMAP_H
17
18#include "clusterFinderDefs.h"
19#include "GPUCommonMath.h"
20
21namespace o2::tpc
22{
23template <class T>
24class CalDet;
25} // namespace o2::tpc
26
27namespace o2::gpu
28{
29
31 public:
32#ifndef GPUCA_GPUCODE
35
38#endif
39
40 GPUdi() void set(int32_t sector, tpccf::Row row, tpccf::Pad pad, bool c)
41 {
42 mBitMap[sector].set(globalPad(row, pad), c);
43 }
44
45 GPUdi() void set(int32_t sector, uint16_t globalPad, bool c)
46 {
47 mBitMap[sector].set(globalPad, c);
48 }
49
50 GPUdi() bool isSet(int32_t sector, tpccf::Row row, tpccf::Pad pad) const
51 {
52 return mBitMap[sector].get(globalPad(row, pad));
53 }
54
55 GPUdi() bool isSet(int32_t sector, uint16_t globalPad) const
56 {
57 return mBitMap[sector].get(globalPad);
58 }
59
60 GPUdi() uint16_t globalPad(tpccf::Row row, tpccf::Pad pad) const
61 {
62 return mPadOffsetPerRow[row] + pad;
63 }
64
65 private:
67 class SectorBitMap
68 {
69 public:
70 using T = uint32_t;
71 static constexpr int32_t NWORDS = (TPC_PADS_IN_SECTOR + sizeof(T) * 8 - 1) / sizeof(T);
72 GPUdi() SectorBitMap()
73 {
74 reset();
75 }
76
77 GPUdi() void set(uint16_t globalPad, bool c)
78 {
79 const auto word = globalPad / (sizeof(T) * 8);
80 const auto pos = globalPad % (sizeof(T) * 8);
81 const auto mask = T(1) << pos;
82 mDeadChannelMap[word] = (mDeadChannelMap[word] & ~mask) | (T(c) << pos);
83 }
84
85 GPUdi() bool get(uint16_t globalPad) const
86 {
87 const auto word = globalPad / (sizeof(T) * 8);
88 const auto pos = globalPad % (sizeof(T) * 8);
89 const auto mask = T(1) << pos;
90 return (mDeadChannelMap[word] & mask) == mask;
91 }
92
93 GPUd() void reset()
94 {
95 for (int32_t iword = 0; iword < NWORDS; ++iword) {
96 mDeadChannelMap[iword] = 0;
97 }
98 }
99
100 private:
101 T mDeadChannelMap[NWORDS];
102 };
103
105 SectorBitMap mBitMap[GPUCA_NSECTORS];
106};
107
108} // namespace o2::gpu
109
110#endif
#define GPUdi()
#define GPUd()
#define GPUCA_NSECTORS
#define GPUCA_ROW_COUNT
uint16_t pos
Definition RawData.h:3
uint32_t c
Definition RawData.h:2
#define TPC_PADS_IN_SECTOR
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLint GLuint mask
Definition glcorearb.h:291
Global TPC definitions and constants.
Definition SimTraits.h:167
GPUdi() void set(int32_t sector
tpccf::Row tpccf::Pad pad
GPUdi() uint16_t globalPad(tpccf uint16_t mPadOffsetPerRow[GPUCA_ROW_COUNT]
tpccf::Row tpccf::Pad bool c
SectorBitMap mBitMap[GPUCA_NSECTORS]
void setFromMap(const o2::tpc::CalDet< bool > &)
setting the stored values from CalDet