File indexing completed on 2025-01-30 10:26:24
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef VECGEOM_VOLUMES_TRDSTRUCT_H_
0010 #define VECGEOM_VOLUMES_TRDSTRUCT_H_
0011 #include "VecGeom/base/Global.h"
0012
0013 namespace vecgeom {
0014
0015 inline namespace VECGEOM_IMPL_NAMESPACE {
0016
0017
0018 template <typename T = double>
0019 struct TrdStruct {
0020 T fDX1;
0021 T fDX2;
0022 T fDY1;
0023 T fDY2;
0024 T fDZ;
0025
0026
0027 T fX2minusX1;
0028 T fY2minusY1;
0029 T fHalfX1plusX2;
0030 T fHalfY1plusY2;
0031 T fCalfX;
0032 T fCalfY;
0033 T fSecxz;
0034 T fSecyz;
0035 T fToleranceX;
0036 T fToleranceY;
0037
0038 T fFx;
0039 T fFy;
0040
0041
0042 VECCORE_ATT_HOST_DEVICE
0043 TrdStruct() {}
0044
0045
0046
0047
0048
0049
0050 VECCORE_ATT_HOST_DEVICE
0051 TrdStruct(const T x1, const T x2, const T y, const T z)
0052 : fDX1(x1), fDX2(x2), fDY1(y), fDY2(y), fDZ(z), fX2minusX1(0), fY2minusY1(0), fHalfX1plusX2(0), fHalfY1plusY2(0),
0053 fCalfX(0), fCalfY(0), fFx(0), fFy(0)
0054 {
0055 CalculateCached();
0056 }
0057
0058
0059
0060
0061
0062
0063
0064 VECCORE_ATT_HOST_DEVICE
0065 TrdStruct(const T x1, const T x2, const T y1, const T y2, const T z)
0066 : fDX1(x1), fDX2(x2), fDY1(y1), fDY2(y2), fDZ(z), fX2minusX1(0), fY2minusY1(0), fHalfX1plusX2(0),
0067 fHalfY1plusY2(0), fCalfX(0), fCalfY(0), fFx(0), fFy(0)
0068 {
0069 CalculateCached();
0070 }
0071
0072
0073
0074
0075
0076 VECCORE_ATT_HOST_DEVICE
0077 TrdStruct(const T x, const T y, const T z)
0078 : fDX1(x), fDX2(x), fDY1(y), fDY2(y), fDZ(z), fX2minusX1(0), fY2minusY1(0), fHalfX1plusX2(0), fHalfY1plusY2(0),
0079 fCalfX(0), fCalfY(0), fFx(0), fFy(0)
0080 {
0081 CalculateCached();
0082 }
0083
0084
0085
0086
0087
0088
0089
0090 VECCORE_ATT_HOST_DEVICE
0091 void SetAllParameters(T x1, T x2, T y1, T y2, T z)
0092 {
0093 fDX1 = x1;
0094 fDX2 = x2;
0095 fDY1 = y1;
0096 fDY2 = y2;
0097 fDZ = z;
0098 CalculateCached();
0099 }
0100
0101
0102 VECCORE_ATT_HOST_DEVICE
0103 void CalculateCached()
0104 {
0105 fX2minusX1 = fDX2 - fDX1;
0106 fY2minusY1 = fDY2 - fDY1;
0107 fHalfX1plusX2 = 0.5 * (fDX1 + fDX2);
0108 fHalfY1plusY2 = 0.5 * (fDY1 + fDY2);
0109
0110 fFx = 0.5 * (fDX1 - fDX2) / fDZ;
0111 fFy = 0.5 * (fDY1 - fDY2) / fDZ;
0112 fSecxz = sqrt(1 + fFx * fFx);
0113 fSecyz = sqrt(1 + fFy * fFy);
0114
0115 fCalfX = 1. / Sqrt(1.0 + fFx * fFx);
0116 fCalfY = 1. / Sqrt(1.0 + fFy * fFy);
0117 fToleranceX = kTolerance * Sqrt(fX2minusX1 * fX2minusX1 + 4 * fDZ * fDZ);
0118 fToleranceY = kTolerance * Sqrt(fX2minusX1 * fX2minusX1 + 4 * fDZ * fDZ);
0119 }
0120 };
0121 }
0122 }
0123
0124 #endif