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