Project
Loading...
Searching...
No Matches
GeometryBase.cxx
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
13
14using namespace o2::trd;
15using namespace o2::trd::constants;
16
17//_____________________________________________________________________________
18GPUd() int GeometryBase::getStack(float z, int layer) const
19{
20 //
21 // Reconstruct the chamber number from the z position and layer number
22 //
23 // The return function has to be protected for positiveness !!
24 //
25
26 if ((layer < 0) || (layer >= NLAYER)) {
27 return -1;
28 }
29
30 int istck = NSTACK;
31 float zmin = 0.0;
32 float zmax = 0.0;
33
34 do {
35 istck--;
36 if (istck < 0) {
37 break;
38 }
39 const PadPlane* pp = getPadPlane(layer, istck);
40 zmax = pp->getRow0();
41 int nrows = pp->getNrows();
42 zmin = zmax - 2 * pp->getLengthOPad() - (nrows - 2) * pp->getLengthIPad() - (nrows - 1) * pp->getRowSpacing();
43 } while ((z < zmin) || (z > zmax));
44
45 return istck;
46}
47
48//_____________________________________________________________________________
49GPUd() bool GeometryBase::isOnBoundary(int det, float y, float z, float eps) const
50{
51 //
52 // Checks whether position is at the boundary of the sensitive volume
53 //
54
55 int ly = getLayer(det);
56 if ((ly < 0) || (ly >= NLAYER)) {
57 return true;
58 }
59
60 int stk = getStack(det);
61 if ((stk < 0) || (stk >= NSTACK)) {
62 return true;
63 }
64
65 const PadPlane* pp = &mPadPlanes[getDetectorSec(ly, stk)];
66 if (!pp) {
67 return true;
68 }
69
70 float max = pp->getRow0();
71 int n = pp->getNrows();
72 float min = max - 2 * pp->getLengthOPad() - (n - 2) * pp->getLengthIPad() - (n - 1) * pp->getRowSpacing();
73 if (z < min + eps || z > max - eps) {
74 // printf("z : min[%7.2f (%7.2f)] %7.2f max[(%7.2f) %7.2f]\n", min, min+eps, z, max-eps, max);
75 return true;
76 }
77 min = pp->getCol0();
78 n = pp->getNcols();
79 max = min + 2 * pp->getWidthOPad() + (n - 2) * pp->getWidthIPad() + (n - 1) * pp->getColSpacing();
80 if (y < min + eps || y > max - eps) {
81 // printf("y : min[%7.2f (%7.2f)] %7.2f max[(%7.2f) %7.2f]\n", min, min+eps, y, max-eps, max);
82 return true;
83 }
84
85 return false;
86}
#define GPUd()
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char pp
GLdouble n
Definition glcorearb.h:1982
GLint y
Definition glcorearb.h:270
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
constexpr size_t min
constexpr size_t max