Project
Loading...
Searching...
No Matches
PackedCharge.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_PACKED_CHARGE_H
16
#define O2_GPU_PACKED_CHARGE_H
17
18
#include "
clusterFinderDefs.h
"
19
#include "
GPUCommonMath.h
"
20
21
namespace
o2::gpu
22
{
23
24
class
PackedCharge
25
{
26
public
:
27
using
BasicType
= uint16_t;
28
static_assert
(
sizeof
(
BasicType
) == 2);
29
30
enum
Constants
:
BasicType
{
31
Null
= 0,
32
ADCBits
= 10,
33
DecimalBits
= 4,
34
ChargeBits
=
ADCBits
+
DecimalBits
,
35
ChargeMask
= (1 <<
ChargeBits
) - 1,
36
MaxVal
=
ChargeMask
,
37
Has3x3PeakMask
= 1 <<
ChargeBits
,
38
IsSplitMask
= 1 << (
ChargeBits
+ 1),
39
};
40
41
GPUdDefault
()
PackedCharge
() = default;
42
GPUdi
() explicit
PackedCharge
(tpccf::Charge q) :
PackedCharge
(q, false, false) {}
43
GPUdi
()
PackedCharge
(tpccf::Charge q,
bool
peak3x3,
bool
wasSplit)
44
{
45
mVal = q *
tpccf::Charge
(1 <<
DecimalBits
);
46
mVal = CAMath::Min<BasicType>(
MaxVal
, mVal);
// ensure only lower 14 bits are set
47
mVal |= (peak3x3) ?
Has3x3PeakMask
:
Null
;
48
mVal |= (wasSplit) ?
IsSplitMask
:
Null
;
49
}
50
51
GPUdi
() tpccf::Charge unpack()
const
{
return
tpccf::Charge
(mVal &
ChargeMask
) /
tpccf::Charge
(1 <<
DecimalBits
); }
52
GPUdi
() bool has3x3Peak()
const
{
return
mVal &
Has3x3PeakMask
; }
53
GPUdi
() bool isSplit()
const
{
return
mVal &
IsSplitMask
; }
54
GPUdi
() bool isZero()
const
{
return
mVal == 0; }
55
56
private
:
57
BasicType
mVal;
58
};
59
60
}
// namespace o2::gpu
61
62
#endif
GPUCommonMath.h
o2::gpu::PackedCharge
Definition
PackedCharge.h:25
o2::gpu::PackedCharge::GPUdi
GPUdi() PackedCharge(tpccf
Definition
PackedCharge.h:43
o2::gpu::PackedCharge::GPUdi
GPUdi() explicit PackedCharge(tpccf
Definition
PackedCharge.h:42
o2::gpu::PackedCharge::GPUdDefault
GPUdDefault() PackedCharge()=default
o2::gpu::PackedCharge::BasicType
uint16_t BasicType
Definition
PackedCharge.h:27
o2::gpu::PackedCharge::Constants
Constants
Definition
PackedCharge.h:30
o2::gpu::PackedCharge::Has3x3PeakMask
@ Has3x3PeakMask
Definition
PackedCharge.h:37
o2::gpu::PackedCharge::MaxVal
@ MaxVal
Definition
PackedCharge.h:36
o2::gpu::PackedCharge::ADCBits
@ ADCBits
Definition
PackedCharge.h:32
o2::gpu::PackedCharge::ChargeBits
@ ChargeBits
Definition
PackedCharge.h:34
o2::gpu::PackedCharge::DecimalBits
@ DecimalBits
Definition
PackedCharge.h:33
o2::gpu::PackedCharge::IsSplitMask
@ IsSplitMask
Definition
PackedCharge.h:38
o2::gpu::PackedCharge::Null
@ Null
Definition
PackedCharge.h:31
o2::gpu::PackedCharge::ChargeMask
@ ChargeMask
Definition
PackedCharge.h:35
clusterFinderDefs.h
o2::gpu::tpccf::Charge
float Charge
Definition
clusterFinderDefs.h:68
o2::gpu
Definition
TrackTRD.h:35
GPU
GPUTracking
TPCClusterFinder
PackedCharge.h
Generated on Tue Feb 25 2025 17:03:27 for Project by
1.9.8