Project
Loading...
Searching...
No Matches
CfFragment.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_CF_FRAGMENT_H
16#define O2_GPU_CF_FRAGMENT_H
17
18#include "clusterFinderDefs.h"
19#include "GPUCommonMath.h"
20
21namespace o2::gpu
22{
23
24struct CfFragment {
25
26 enum : tpccf::TPCTime {
28 };
29
30 // Time offset of this sub sector within the entire time sector
32 // Number of time bins to process in this sector
34
35 size_t digitsStart = 0; // Start digits in this fragment. Only used when zero suppression is skipped
36
37 uint32_t index = 0;
38
39 bool hasBacklog = false;
40 bool hasFuture = false;
43
44 GPUdDefault() CfFragment() = default;
45
46 GPUd() CfFragment(tpccf::TPCTime totalSectorLen, tpccf::TPCFragmentTime maxSubSectorLen) : CfFragment(0, false, 0, totalSectorLen, maxSubSectorLen) {}
47
48 GPUdi() bool isEnd() const { return length == 0; }
49
54
55 GPUdi() uint32_t count() const
56 {
58 }
59
60 GPUdi() tpccf::TPCTime first() const
61 {
62 return start;
63 }
64
65 GPUdi() tpccf::TPCTime last() const
66 {
67 return start + length;
68 }
69
70 GPUdi() bool contains(tpccf::TPCTime t) const
71 {
72 return first() <= t && t < last();
73 }
74
75 // Wether a timebin falls into backlog or future
76 GPUdi() bool isOverlap(tpccf::TPCFragmentTime t) const
77 {
78 return (hasBacklog ? t < OverlapTimebins : false) || (hasFuture ? t >= (length - OverlapTimebins) : false);
79 }
80
81 GPUdi() tpccf::TPCFragmentTime lengthWithoutOverlap() const
82 {
84 }
85
86 GPUdi() tpccf::TPCFragmentTime firstNonOverlapTimeBin() const
87 {
88 return (hasBacklog ? OverlapTimebins : 0);
89 }
90
91 GPUdi() tpccf::TPCFragmentTime lastNonOverlapTimeBin() const
92 {
93 return length - (hasFuture ? OverlapTimebins : 0);
94 }
95
96 GPUdi() tpccf::TPCFragmentTime toLocal(tpccf::TPCTime t) const
97 {
98 return t - first();
99 }
100
101 GPUdi() tpccf::TPCTime toGlobal(tpccf::TPCFragmentTime t) const
102 {
103 return t + first();
104 }
105
106 private:
107 GPUd() CfFragment(uint32_t index_, bool hasBacklog_, tpccf::TPCTime start_, tpccf::TPCTime totalSectorLen, tpccf::TPCFragmentTime maxSubSectorLen)
108 {
109 this->index = index_;
110 this->hasBacklog = hasBacklog_;
111 this->start = start_;
112 tpccf::TPCTime remainder = totalSectorLen - start;
113 this->hasFuture = remainder > tpccf::TPCTime(maxSubSectorLen);
114 this->length = hasFuture ? maxSubSectorLen : remainder;
115 this->totalSectorLength = totalSectorLen;
116 this->maxSubSectorLength = maxSubSectorLen;
117 }
118};
119
120} // namespace o2::gpu
121
122#endif
GLint GLsizei count
Definition glcorearb.h:399
GLuint index
Definition glcorearb.h:781
GLint first
Definition glcorearb.h:399
GLuint GLsizei GLsizei * length
Definition glcorearb.h:790
GLuint start
Definition glcorearb.h:469
GPUdi() CfFragment next() const
Definition CfFragment.h:50
GPUdi() bool isEnd() const
Definition CfFragment.h:48
tpccf::TPCFragmentTime length
Definition CfFragment.h:33
GPUdi() uint32_t count() const
Definition CfFragment.h:55
tpccf::TPCFragmentTime maxSubSectorLength
Definition CfFragment.h:42
GPUdDefault() CfFragment()=default
GPUd() CfFragment(tpccf
Definition CfFragment.h:46
tpccf::TPCTime totalSectorLength
Definition CfFragment.h:41
tpccf::TPCTime start
Definition CfFragment.h:31