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
100// default point definitions for PointND, PointNDlocal, PointNDglobal are in
101// MathUtils/CartesianND.h
102
104// For some reason cling does not like the nested using statement, typedef works ...
110
112typedef unsigned short GlobalPadNumber;
113
115typedef unsigned int TimeBin;
116
117// GlobalPosition3D LocalToGlobal(const LocalPosition3D pos, const float alpha)
118// {
119// const double cs=cos(alpha), sn=sin(alpha);
120// return GlobalPosition3D(pos.X()*cs-pos.Y()*sn,pos.X()*sn+pos.Y()*cs,pos.Z());
121// }
122
123// LocalPosition3D GlobalToLocal(const GlobalPosition3D& pos, const float alpha)
124// {
125// const double cs=cos(-alpha), sn=sin(-alpha);
126// return LocalPosition3D(pos.X()*cs-pos.Y()*sn,pos.X()*sn+pos.Y()*cs,pos.Z());
127// }
128
135template <typename T>
136class Enum
137{
138 public:
140 {
141 public:
142 Iterator(int value) : m_value(value) {}
143
144 T operator*() const { return (T)m_value; }
145
146 void operator++() { ++m_value; }
147
148 bool operator!=(Iterator rhs) { return m_value != rhs.m_value; }
149
150 private:
151 int m_value;
152 };
153};
154
155template <typename T>
157{
158 return typename Enum<T>::Iterator((int)T::First);
159}
160
161template <typename T>
163{
164 return typename Enum<T>::Iterator(((int)T::Last) + 1);
165}
166} // namespace o2::tpc
167
168#endif
Definition A.h:16
bool operator!=(Iterator rhs)
Definition Defs.h:148
Iterator(int value)
Definition Defs.h:142
T operator*() const
Definition Defs.h:144
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:168
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:107
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:109
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)
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:105
constexpr unsigned short GEMSTACKS
Definition Defs.h:60
Enum< T >::Iterator begin(Enum< T >)
Definition Defs.h:156
math_utils::Point3D< float > GlobalPosition3D
Definition Defs.h:108
constexpr unsigned short GEMSPERSTACK
Definition Defs.h:58
constexpr unsigned char SIDES
Definition Defs.h:41
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:112
unsigned int TimeBin
global time bin
Definition Defs.h:115
constexpr unsigned short GEMSTACKSPERSECTOR
Definition Defs.h:57
math_utils::Point2D< float > GlobalPosition2D
Definition Defs.h:106
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