Project
Loading...
Searching...
No Matches
Road.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.
15
16#ifndef TRACKINGCA_INCLUDE_ROAD_H
17#define TRACKINGCA_INCLUDE_ROAD_H
18
19#ifndef GPUCA_GPUCODE_DEVICE
20#include <array>
21#endif
22
24#include "GPUCommonDef.h"
25
26namespace o2
27{
28namespace its
29{
30
31template <unsigned char maxRoadSize = 5>
32class Road final
33{
34 public:
35 GPUhd() Road() : mCellIds{}, mRoadSize{}, mIsFakeRoad{} { resetRoad(); }
36 GPUhd() Road(int cellLayer, int cellId) : Road() { addCell(cellLayer, cellId); }
37
38 GPUhd() int getRoadSize() const;
39 int getLabel() const;
40 void setLabel(const int);
41 GPUhd() bool isFakeRoad() const;
42 void setFakeRoad(const bool);
43 GPUhd() int& operator[](const int&);
44 GPUhd() int operator[](const int&) const;
45
46 GPUhd() void resetRoad()
47 {
48 for (int i = 0; i < maxRoadSize; i++) {
50 }
51 mRoadSize = 0;
52 }
53
54 GPUhd() void addCell(int cellLayer, int cellId)
55 {
56 if (mCellIds[cellLayer] == constants::its::UnusedIndex) {
57 ++mRoadSize;
58 }
59
60 mCellIds[cellLayer] = cellId;
61 }
62
63 private:
64 int mCellIds[maxRoadSize];
65 // int mLabel;
66 unsigned char mRoadSize;
67 bool mIsFakeRoad;
68};
69
70template <unsigned char maxRoadSize>
71GPUhdi() int Road<maxRoadSize>::getRoadSize() const
72{
73 return mRoadSize;
74}
75
76template <unsigned char maxRoadSize>
77GPUhdi() int& Road<maxRoadSize>::operator[](const int& i)
78{
79 return mCellIds[i];
80}
81
82template <unsigned char maxRoadSize>
83GPUhdi() int Road<maxRoadSize>::operator[](const int& i) const
84{
85 return mCellIds[i];
86}
87
88template <unsigned char maxRoadSize>
89GPUhdi() bool Road<maxRoadSize>::isFakeRoad() const
90{
91 return mIsFakeRoad;
92}
93
94template <unsigned char maxRoadSize>
95inline void Road<maxRoadSize>::setFakeRoad(const bool isFakeRoad)
96{
97 mIsFakeRoad = isFakeRoad;
98}
99} // namespace its
100} // namespace o2
101
102#endif
int32_t i
GPUhd() int getRoadSize() const
int getLabel() const
GPUhd() Road()
Definition Road.h:35
GPUhd() void addCell(int cellLayer
void setFakeRoad(const bool)
void setLabel(const int)
int cellId
Definition Road.h:36
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
constexpr int UnusedIndex
Definition Constants.h:52
GPUhdi() Cell
Definition Cell.h:55
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...