Project
Loading...
Searching...
No Matches
PadPlane.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
12#ifndef O2_TRD_PADPLANE_H
13#define O2_TRD_PADPLANE_H
14
15// Forwards to standard header with protection for GPU compilation
16#include "GPUCommonRtypes.h" // for ClassDef
17#include "GPUCommonDef.h"
18
20// //
21// TRD pad plane class //
22// //
23// Contains the information on ideal pad positions, pad dimensions, //
24// tilting angle, etc. //
25// It also provides methods to identify the current pad number from //
26// local tracking coordinates. //
27// //
29namespace o2
30{
31namespace trd
32{
34{
35 public:
36 PadPlane() = default;
37 PadPlane(int layer, int stack) : mLayer(layer), mStack(stack){};
38 PadPlane(const PadPlane& p) = delete;
39 PadPlane& operator=(const PadPlane& p) = delete;
40 ~PadPlane() = default;
41
42 void setLayer(int l) { mLayer = l; };
43 void setStack(int s) { mStack = s; };
44 void setRowSpacing(double s) { mRowSpacing = s; };
45 void setColSpacing(double s) { mColSpacing = s; };
46 void setLengthRim(double l) { mLengthRim = l; };
47 void setWidthRim(double w) { mWidthRim = w; };
48 void setNcols(int n);
49 void setNrows(int n);
50 void setPadCol(int ic, double c)
51 {
52 if (ic < mNcols) {
53 mPadCol[ic] = c;
54 }
55 };
56 void setPadRow(int ir, double r)
57 {
58 if (ir < mNrows) {
59 mPadRow[ir] = r;
60 }
61 };
62 void setLength(double l) { mLength = l; };
63 void setWidth(double w) { mWidth = w; };
64 void setLengthOPad(double l)
65 {
66 mLengthOPad = l;
67 mInverseLengthOPad = 1.0 / l;
68 };
69 void setWidthOPad(double w)
70 {
71 mWidthOPad = w;
72 mInverseWidthOPad = 1.0 / w;
73 };
74 void setLengthIPad(double l)
75 {
76 mLengthIPad = l;
77 mInverseLengthIPad = 1.0 / l;
78 };
79 void setWidthIPad(double w)
80 {
81 mWidthIPad = w;
82 mInverseWidthIPad = 1.0 / w;
83 };
84 void setPadRowSMOffset(double o) { mPadRowSMOffset = o; };
85 void setAnodeWireOffset(float o) { mAnodeWireOffset = o; };
86 void setTiltingAngle(double t);
87
88 GPUd() int getPadRowNumber(double z) const
89 {
90 //
91 // Finds the pad row number for a given z-position in local supermodule system
92 //
93 int row = 0;
94 int nabove = 0;
95 int nbelow = 0;
96 int middle = 0;
97
98 if ((z > getRow0()) || (z < getRowEnd())) {
99 row = -1;
100
101 } else {
102 nabove = mNrows + 1;
103 nbelow = 0;
104 while (nabove - nbelow > 1) {
105 middle = (nabove + nbelow) / 2;
106 if (z == (mPadRow[middle - 1] + mPadRowSMOffset)) {
107 row = middle;
108 }
109 if (z > (mPadRow[middle - 1] + mPadRowSMOffset)) {
110 nabove = middle;
111 } else {
112 nbelow = middle;
113 }
114 }
115 row = nbelow - 1;
116 }
117
118 return row;
119 };
120
121 GPUd() int getPadRowNumberROC(double z) const;
122 GPUd() double getPadRow(double z) const;
123 GPUd() int getPadColNumber(double rphi) const;
124 GPUd() double getPad(double y, double z) const;
125
126 GPUd() double getTiltOffset(int row, double rowOffset) const
127 {
128 if (row == 0 || row == mNrows - 1) {
129 return mTiltingTan * (rowOffset - 0.5 * mLengthOPad);
130 } else {
131 return mTiltingTan * (rowOffset - 0.5 * mLengthIPad);
132 }
133 };
134 GPUd() double getPadRowOffset(int row, double z) const
135 {
136 if ((row < 0) || (row >= mNrows)) {
137 return -1.0;
138 } else {
139 return mPadRow[row] + mPadRowSMOffset - z;
140 }
141 };
142 GPUd() double getPadRowOffsetROC(int row, double z) const
143 {
144 if ((row < 0) || (row >= mNrows)) {
145 return -1.0;
146 } else {
147 return mPadRow[row] - z;
148 }
149 };
150
151 GPUd() double getPadColOffset(int col, double rphi) const
152 {
153 if ((col < 0) || (col >= mNcols)) {
154 return -1.0;
155 } else {
156 return rphi - mPadCol[col];
157 }
158 };
159
160 GPUd() double getTiltingAngle() const { return mTiltingAngle; };
161 GPUd() int getNrows() const { return mNrows; };
162 GPUd() int getNcols() const { return mNcols; };
163 GPUd() double getRow0() const { return mPadRow[0] + mPadRowSMOffset; };
164 GPUd() double getRow0ROC() const { return mPadRow[0]; };
165 GPUd() double getCol0() const { return mPadCol[0]; };
166 GPUd() double getRowEnd() const { return mPadRow[mNrows - 1] - mLengthOPad + mPadRowSMOffset; };
167 GPUd() double getRowEndROC() const { return mPadRow[mNrows - 1] - mLengthOPad; };
168 GPUd() double getColEnd() const { return mPadCol[mNcols - 1] + mWidthOPad; };
169 GPUd() double getRowPos(int row) const { return mPadRow[row] + mPadRowSMOffset; };
170 GPUd() double getRowPosROC(int row) const { return mPadRow[row]; };
171 GPUd() double getColPos(int col) const { return mPadCol[col]; };
172 GPUd() double getRowSize(int row) const
173 {
174 if ((row == 0) || (row == mNrows - 1)) {
175 return mLengthOPad;
176 } else {
177 return mLengthIPad;
178 }
179 };
180 GPUd() double getColSize(int col) const
181 {
182 if ((col == 0) || (col == mNcols - 1)) {
183 return mWidthOPad;
184 } else {
185 return mWidthIPad;
186 }
187 };
188
189 GPUd() double getLengthRim() const { return mLengthRim; };
190 GPUd() double getWidthRim() const { return mWidthRim; };
191 GPUd() double getRowSpacing() const { return mRowSpacing; };
192 GPUd() double getColSpacing() const { return mColSpacing; };
193 GPUd() double getLengthOPad() const { return mLengthOPad; };
194 GPUd() double getLengthIPad() const { return mLengthIPad; };
195 GPUd() double getWidthOPad() const { return mWidthOPad; };
196 GPUd() double getWidthIPad() const { return mWidthIPad; };
197 GPUd() double getAnodeWireOffset() const { return mAnodeWireOffset; };
198
199 private:
200 static constexpr int MAXCOLS = 144;
201 static constexpr int MAXROWS = 16;
202
203 int mLayer; // Layer number
204 int mStack; // Stack number
205
206 double mLength; // Length of pad plane in z-direction (row)
207 double mWidth; // Width of pad plane in rphi-direction (col)
208
209 double mLengthRim; // Length of the rim in z-direction (row)
210 double mWidthRim; // Width of the rim in rphi-direction (col)
211
212 double mLengthOPad; // Length of an outer pad in z-direction (row)
213 double mWidthOPad; // Width of an outer pad in rphi-direction (col)
214
215 double mLengthIPad; // Length of an inner pad in z-direction (row)
216 double mWidthIPad; // Width of an inner pad in rphi-direction (col)
217
218 double mRowSpacing; // Spacing between the pad rows
219 double mColSpacing; // Spacing between the pad columns
220
221 int mNrows; // Number of rows
222 int mNcols; // Number of columns
223
224 double mTiltingAngle; // Pad tilting angle
225 double mTiltingTan; // Tangens of pad tilting angle
226
227 double mPadRow[MAXROWS]; // Pad border positions in row direction
228 double mPadCol[MAXCOLS]; // Pad border positions in column direction
229
230 double mPadRowSMOffset; // To be added to translate local ROC system to local SM system
231
232 double mAnodeWireOffset; // Distance of first anode wire from pad edge
233
234 double mInverseLengthIPad; // 1 / mLengthIPad
235 double mInverseLengthOPad; // 1 / mLengthOPad
236
237 double mInverseWidthIPad; // 1 / mWidthIPad
238 double mInverseWidthOPad; // 1 / mWidthOPad
239
240 ClassDefNV(PadPlane, 2); // TRD ROC pad plane
241};
242} // namespace trd
243} // namespace o2
244#endif
bool o
uint32_t col
Definition RawData.h:4
uint32_t c
Definition RawData.h:2
uint32_t stack
Definition RawData.h:1
void setPadRow(int ir, double r)
Definition PadPlane.h:56
GPUd() double getRowEndROC() const
Definition PadPlane.h:167
GPUd() double getColSpacing() const
Definition PadPlane.h:192
GPUd() double getRow0ROC() const
Definition PadPlane.h:164
void setWidthOPad(double w)
Definition PadPlane.h:69
GPUd() double getPadRowOffset(int row
void setNrows(int n)
Definition PadPlane.cxx:122
GPUd() double getCol0() const
Definition PadPlane.h:165
void setNcols(int n)
Definition PadPlane.cxx:114
GPUd() int getNrows() const
Definition PadPlane.h:161
void setPadRowSMOffset(double o)
Definition PadPlane.h:84
GPUd() double getColSize(int col) const
Definition PadPlane.h:180
GPUd() double getWidthIPad() const
Definition PadPlane.h:196
GPUd() double getColEnd() const
Definition PadPlane.h:168
GPUd() double getWidthRim() const
Definition PadPlane.h:190
PadPlane & operator=(const PadPlane &p)=delete
GPUd() double getWidthOPad() const
Definition PadPlane.h:195
GPUd() double getLengthIPad() const
Definition PadPlane.h:194
GPUd() double getAnodeWireOffset() const
Definition PadPlane.h:197
GPUd() double getTiltingAngle() const
Definition PadPlane.h:160
void setTiltingAngle(double t)
Definition PadPlane.cxx:34
GPUd() int getNcols() const
Definition PadPlane.h:162
GPUd() int getPadRowNumberROC(double z) const
PadPlane()=default
void setRowSpacing(double s)
Definition PadPlane.h:44
PadPlane(const PadPlane &p)=delete
void setWidthRim(double w)
Definition PadPlane.h:47
void setLayer(int l)
Definition PadPlane.h:42
void setWidthIPad(double w)
Definition PadPlane.h:79
GPUd() double getRowSpacing() const
Definition PadPlane.h:191
GPUd() int getPadRowNumber(double z) const
Definition PadPlane.h:88
GPUd() double getRowPos(int row) const
Definition PadPlane.h:169
void setPadCol(int ic, double c)
Definition PadPlane.h:50
~PadPlane()=default
void setColSpacing(double s)
Definition PadPlane.h:45
GPUd() double getColPos(int col) const
Definition PadPlane.h:171
GPUd() double getRowSize(int row) const
Definition PadPlane.h:172
void setLengthIPad(double l)
Definition PadPlane.h:74
GPUd() double getRowPosROC(int row) const
Definition PadPlane.h:170
void setAnodeWireOffset(float o)
Definition PadPlane.h:85
void setLengthRim(double l)
Definition PadPlane.h:46
GPUd() double getRowEnd() const
Definition PadPlane.h:166
PadPlane(int layer, int stack)
Definition PadPlane.h:37
void setLength(double l)
Definition PadPlane.h:62
void setWidth(double w)
Definition PadPlane.h:63
GPUd() double getPadRowOffsetROC(int row
GPUd() double getLengthRim() const
Definition PadPlane.h:189
void setLengthOPad(double l)
Definition PadPlane.h:64
GPUd() double getRow0() const
Definition PadPlane.h:163
GPUd() double getLengthOPad() const
Definition PadPlane.h:193
void setStack(int s)
Definition PadPlane.h:43
GLdouble n
Definition glcorearb.h:1982
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLboolean r
Definition glcorearb.h:1233
GLubyte GLubyte GLubyte GLubyte w
Definition glcorearb.h:852
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
o2::InteractionRecord ir(0, 0)
std::vector< int > row