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#include "GPUCommonDef.h"
23
24#ifndef GPUCA_GPUCODE_DEVICE
25#include <cmath>
26#endif
27
28#include "GPUROOTCartesianFwd.h"
29#ifndef GPUCA_ALIGPUCODE
30#include "MathUtils/Cartesian.h"
31#endif
32
33namespace o2::tpc
34{
35
37enum Side { A = 0,
38 C = 1,
39 UNDEFINED = 2 };
40// enum class Side {A=0, C=1};
41// Problem with root cint. does not seem to support enum class ...
42GPUglobalconstexpr() unsigned char SECTORSPERSIDE = 18;
43GPUglobalconstexpr() unsigned char SIDES = 2;
44
45GPUglobalconstexpr() double PI = 3.14159265358979323846;
46GPUglobalconstexpr() double TWOPI = 2. * PI;
47GPUglobalconstexpr() double SECPHIWIDTH = TWOPI / 18.;
48
50enum RocType { IROC = 0,
51 OROC = 1 };
52// enum class RocType {IROC=0, OROC=1};
53
55enum GEMstack { IROCgem = 0,
58 OROC3gem = 3 };
59GPUglobalconstexpr() unsigned short GEMSTACKSPERSECTOR = 4;
60GPUglobalconstexpr() unsigned short GEMSPERSTACK = 4;
61GPUglobalconstexpr() unsigned short GEMSTACKSPERSIDE = GEMSTACKSPERSECTOR * SECTORSPERSIDE;
62GPUglobalconstexpr() unsigned short GEMSTACKS = GEMSTACKSPERSECTOR * SECTORSPERSIDE * SIDES;
63
65enum class PadSubset : char {
66 ROC,
67 Partition,
68 Region
69};
70
71// TPC dE/dx charge types
73 Max = 0,
74 Tot = 1
75};
76GPUglobalconstexpr() unsigned short CHARGETYPES = 2;
77
79struct StackID {
80 int sector{};
82
84 GPUdi() int getIndex() const
85 {
86 return sector + type * SECTORSPERSIDE * SIDES;
87 }
88 GPUdi() void setIndex(int index)
89 {
90 sector = index % (SECTORSPERSIDE * SIDES);
91 type = static_cast<GEMstack>((index / (SECTORSPERSIDE * SIDES)) % GEMSTACKSPERSECTOR);
92 }
93};
94
96enum class StatisticsType {
97 GausFit,
100};
101
102// default point definitions for PointND, PointNDlocal, PointNDglobal are in
103// MathUtils/CartesianND.h
104
106// For some reason cling does not like the nested using statement, typedef works ...
107typedef math_utils::Point2D<float> PadCentre;
108typedef math_utils::Point2D<float> GlobalPosition2D;
109typedef math_utils::Point2D<float> LocalPosition2D;
110typedef math_utils::Point3D<float> GlobalPosition3D;
111typedef math_utils::Point3D<float> LocalPosition3D;
112
114typedef unsigned short GlobalPadNumber;
115
117typedef unsigned int TimeBin;
118
119// GlobalPosition3D LocalToGlobal(const LocalPosition3D pos, const float alpha)
120// {
121// const double cs=cos(alpha), sn=sin(alpha);
122// return GlobalPosition3D(pos.X()*cs-pos.Y()*sn,pos.X()*sn+pos.Y()*cs,pos.Z());
123// }
124
125// LocalPosition3D GlobalToLocal(const GlobalPosition3D& pos, const float alpha)
126// {
127// const double cs=cos(-alpha), sn=sin(-alpha);
128// return LocalPosition3D(pos.X()*cs-pos.Y()*sn,pos.X()*sn+pos.Y()*cs,pos.Z());
129// }
130
137template <typename T>
138class Enum
139{
140 public:
142 {
143 public:
144 Iterator(int value) : m_value(value) {}
145
146 T operator*() const { return (T)m_value; }
147
148 void operator++() { ++m_value; }
149
150 bool operator!=(Iterator rhs) { return m_value != rhs.m_value; }
151
152 private:
153 int m_value;
154 };
155};
156
157template <typename T>
159{
160 return typename Enum<T>::Iterator((int)T::First);
161}
162
163template <typename T>
165{
166 return typename Enum<T>::Iterator(((int)T::Last) + 1);
167}
168} // namespace o2::tpc
169
170#endif
Definition A.h:16
bool operator!=(Iterator rhs)
Definition Defs.h:150
Iterator(int value)
Definition Defs.h:144
T operator*() const
Definition Defs.h:146
GLuint GLuint end
Definition glcorearb.h:469
GLuint index
Definition glcorearb.h:781
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)
Global TPC definitions and constants.
Definition SimTraits.h:172
GEMstack
TPC GEM stack types.
Definition Defs.h:55
@ IROCgem
Definition Defs.h:55
@ OROC1gem
Definition Defs.h:56
@ OROC3gem
Definition Defs.h:58
@ OROC2gem
Definition Defs.h:57
GPUglobalconstexpr() unsigned char SECTORSPERSIDE
ChargeType
Definition Defs.h:72
@ Tot
Definition Defs.h:74
@ Max
Definition Defs.h:73
RocType
TPC ROC types.
Definition Defs.h:50
@ OROC
Definition Defs.h:51
@ IROC
Definition Defs.h:50
math_utils::Point2D< float > LocalPosition2D
Definition Defs.h:109
math_utils::Point3D< float > LocalPosition3D
Definition Defs.h:111
StatisticsType
Statistics type.
Definition Defs.h:96
@ GausFitFast
Use fast gaus fit (less accurate error treatment)
@ MeanStdDev
Use mean and standard deviation.
@ GausFit
Use slow gaus fit (better fit stability)
math_utils::Point2D< float > PadCentre
Pad centres as 2D float.
Definition Defs.h:107
Enum< T >::Iterator begin(Enum< T >)
Definition Defs.h:158
math_utils::Point3D< float > GlobalPosition3D
Definition Defs.h:110
PadSubset
Definition of the different pad subsets.
Definition Defs.h:65
@ Partition
Partitions (up to 36*5)
@ Region
Regions (up to 36*10)
Side
TPC readout sidE.
Definition Defs.h:37
@ C
Definition Defs.h:38
@ UNDEFINED
Definition Defs.h:39
unsigned short GlobalPadNumber
global pad number
Definition Defs.h:114
unsigned int TimeBin
global time bin
Definition Defs.h:117
math_utils::Point2D< float > GlobalPosition2D
Definition Defs.h:108
GEM stack identification.
Definition Defs.h:79
GPUdi() int getIndex() const
Single number identification for the stacks.
Definition Defs.h:84
GPUdi() void setIndex(int index)
Definition Defs.h:88