Project
Loading...
Searching...
No Matches
Defs.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
16
18
19#ifndef AliceO2_TPC_Defs_H
20#define AliceO2_TPC_Defs_H
21
22#ifndef GPUCA_GPUCODE_DEVICE
23#include <cmath>
24#endif
25
26#include "GPUROOTCartesianFwd.h"
27#ifndef GPUCA_ALIGPUCODE
28#include "MathUtils/Cartesian.h"
29#endif
30
31namespace o2::tpc
32{
33
35enum Side { A = 0,
36 C = 1,
37 UNDEFINED = 2 };
38// enum class Side {A=0, C=1};
39// Problem with root cint. does not seem to support enum class ...
40constexpr unsigned char SECTORSPERSIDE = 18;
41constexpr unsigned char SIDES = 2;
42
43constexpr double PI = 3.14159265358979323846;
44constexpr double TWOPI = 2. * PI;
45constexpr double SECPHIWIDTH = TWOPI / 18.;
46
48enum RocType { IROC = 0,
49 OROC = 1 };
50// enum class RocType {IROC=0, OROC=1};
51
53enum GEMstack { IROCgem = 0,
56 OROC3gem = 3 };
57constexpr unsigned short GEMSTACKSPERSECTOR = 4;
58constexpr unsigned short GEMSPERSTACK = 4;
60constexpr unsigned short GEMSTACKS = GEMSTACKSPERSECTOR * SECTORSPERSIDE * SIDES;
61
63enum class PadSubset : char {
64 ROC,
65 Partition,
66 Region
67};
68
69// TPC dE/dx charge types
71 Max = 0,
72 Tot = 1
73};
74constexpr unsigned short CHARGETYPES = 2;
75
77struct StackID {
78 int sector{};
80
82 GPUdi() int getIndex() const
83 {
84 return sector + type * SECTORSPERSIDE * SIDES;
85 }
86 GPUdi() void setIndex(int index)
87 {
89 type = static_cast<GEMstack>((index / (SECTORSPERSIDE * SIDES)) % GEMSTACKSPERSECTOR);
90 }
91};
92
94enum class StatisticsType {
95 GausFit,
98};
99
100enum class PadFlags : unsigned short {
101 flagGoodPad = 1 << 0,
102 flagDeadPad = 1 << 1,
103 flagUnknownPad = 1 << 2,
104 flagSaturatedPad = 1 << 3,
105 flagHighPad = 1 << 4,
106 flagLowPad = 1 << 5,
107 flagSkip = 1 << 6,
108 flagFEC = 1 << 7,
109 flagNeighbour = 1 << 8,
111};
112
113inline PadFlags operator&(PadFlags a, PadFlags b) { return static_cast<PadFlags>(static_cast<int>(a) & static_cast<int>(b)); }
114inline PadFlags operator~(PadFlags a) { return static_cast<PadFlags>(~static_cast<int>(a)); }
115inline PadFlags operator|(PadFlags a, PadFlags b) { return static_cast<PadFlags>(static_cast<int>(a) | static_cast<int>(b)); }
116
117// default point definitions for PointND, PointNDlocal, PointNDglobal are in
118// MathUtils/CartesianND.h
119
121// For some reason cling does not like the nested using statement, typedef works ...
127
129typedef unsigned short GlobalPadNumber;
130
132typedef unsigned int TimeBin;
133
134// GlobalPosition3D LocalToGlobal(const LocalPosition3D pos, const float alpha)
135// {
136// const double cs=cos(alpha), sn=sin(alpha);
137// return GlobalPosition3D(pos.X()*cs-pos.Y()*sn,pos.X()*sn+pos.Y()*cs,pos.Z());
138// }
139
140// LocalPosition3D GlobalToLocal(const GlobalPosition3D& pos, const float alpha)
141// {
142// const double cs=cos(-alpha), sn=sin(-alpha);
143// return LocalPosition3D(pos.X()*cs-pos.Y()*sn,pos.X()*sn+pos.Y()*cs,pos.Z());
144// }
145
152template <typename T>
153class Enum
154{
155 public:
157 {
158 public:
159 Iterator(int value) : m_value(value) {}
160
161 T operator*() const { return (T)m_value; }
162
163 void operator++() { ++m_value; }
164
165 bool operator!=(Iterator rhs) { return m_value != rhs.m_value; }
166
167 private:
168 int m_value;
169 };
170};
171
172template <typename T>
174{
175 return typename Enum<T>::Iterator((int)T::First);
176}
177
178template <typename T>
180{
181 return typename Enum<T>::Iterator(((int)T::Last) + 1);
182}
183} // namespace o2::tpc
184
185#endif
Definition A.h:16
bool operator!=(Iterator rhs)
Definition Defs.h:165
Iterator(int value)
Definition Defs.h:159
T operator*() const
Definition Defs.h:161
GLuint GLuint end
Definition glcorearb.h:469
GLuint index
Definition glcorearb.h:781
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
Global TPC definitions and constants.
Definition SimTraits.h:167
GEMstack
TPC GEM stack types.
Definition Defs.h:53
@ IROCgem
Definition Defs.h:53
@ OROC1gem
Definition Defs.h:54
@ OROC3gem
Definition Defs.h:56
@ OROC2gem
Definition Defs.h:55
ChargeType
Definition Defs.h:70
@ Tot
Definition Defs.h:72
@ Max
Definition Defs.h:71
RocType
TPC ROC types.
Definition Defs.h:48
@ OROC
Definition Defs.h:49
@ IROC
Definition Defs.h:48
math_utils::Point2D< float > LocalPosition2D
Definition Defs.h:124
constexpr double PI
Definition Defs.h:43
constexpr double TWOPI
Definition Defs.h:44
constexpr unsigned short CHARGETYPES
Definition Defs.h:74
math_utils::Point3D< float > LocalPosition3D
Definition Defs.h:126
StatisticsType
Statistics type.
Definition Defs.h:94
@ GausFitFast
Use fast gaus fit (less accurate error treatment)
@ MeanStdDev
Use mean and standard deviation.
@ GausFit
Use slow gaus fit (better fit stability)
PadFlags operator|(PadFlags a, PadFlags b)
Definition Defs.h:115
constexpr double SECPHIWIDTH
Definition Defs.h:45
constexpr unsigned char SECTORSPERSIDE
Definition Defs.h:40
math_utils::Point2D< float > PadCentre
Pad centres as 2D float.
Definition Defs.h:122
constexpr unsigned short GEMSTACKS
Definition Defs.h:60
Enum< T >::Iterator begin(Enum< T >)
Definition Defs.h:173
math_utils::Point3D< float > GlobalPosition3D
Definition Defs.h:125
constexpr unsigned short GEMSPERSTACK
Definition Defs.h:58
constexpr unsigned char SIDES
Definition Defs.h:41
PadFlags operator&(PadFlags a, PadFlags b)
Definition Defs.h:113
PadSubset
Definition of the different pad subsets.
Definition Defs.h:63
@ Partition
Partitions (up to 36*5)
@ Region
Regions (up to 36*10)
Side
TPC readout sidE.
Definition Defs.h:35
@ C
Definition Defs.h:36
@ UNDEFINED
Definition Defs.h:37
unsigned short GlobalPadNumber
global pad number
Definition Defs.h:129
PadFlags
Definition Defs.h:100
@ flagUnknownPad
flag for unknown status binary 0100
@ flagLowPad
flag for pad with extremly low IDC value
@ flagNeighbour
flag if n neighbouring pads are outlier
@ flagGoodPad
flag for a good pad binary 0001
@ flagSkip
flag for defining a pad which is just ignored during the calculation of I1 and IDCDelta
@ flagDeadPad
flag for a dead pad binary 0010
@ flagHighPad
flag for pad with extremly high IDC value
@ flagFEC
flag for a whole masked FEC
@ flagSaturatedPad
flag for saturated status binary 0100
unsigned int TimeBin
global time bin
Definition Defs.h:132
constexpr unsigned short GEMSTACKSPERSECTOR
Definition Defs.h:57
math_utils::Point2D< float > GlobalPosition2D
Definition Defs.h:123
PadFlags operator~(PadFlags a)
Definition Defs.h:114
constexpr unsigned short GEMSTACKSPERSIDE
Definition Defs.h:59
GEM stack identification.
Definition Defs.h:77
GPUdi() int getIndex() const
Single number identification for the stacks.
Definition Defs.h:82
GPUdi() void setIndex(int index)
Definition Defs.h:86