Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:26:16

0001 /*
0002  * CutTubeStruct.h
0003  *
0004  *  Created on: 03.11.2016
0005  *      Author: mgheata
0006  */
0007 #ifndef VECGEOM_CUTTUBESTRUCT_H_
0008 #define VECGEOM_CUTTUBESTRUCT_H_
0009 
0010 #include <VecCore/VecCore>
0011 #include "VecGeom/base/Vector3D.h"
0012 
0013 #include "TubeStruct.h"
0014 #include "CutPlanes.h"
0015 
0016 namespace vecgeom {
0017 
0018 inline namespace VECGEOM_IMPL_NAMESPACE {
0019 
0020 // a plain and lightweight struct to encapsulate data members of a cut tube
0021 template <typename T = double>
0022 struct CutTubeStruct {
0023   T fDz;                     //< Z half length
0024   TubeStruct<T> fTubeStruct; //< Tube parameters
0025   CutPlanes fCutPlanes;      //< Cut planes
0026 
0027   T fCosPhi1; //< Cosine of phi
0028   T fSinPhi1; //< Sine of phi
0029   T fCosPhi2; //< Cosine of phi+dphi
0030   T fSinPhi2; //< Sine of phi+dphi
0031   T fMaxVal;
0032 
0033   // constructors
0034 
0035   VECCORE_ATT_HOST_DEVICE
0036   CutTubeStruct() : fTubeStruct(0., 0., 0., 0., 0.), fCutPlanes() {}
0037 
0038   VECCORE_ATT_HOST_DEVICE
0039   CutTubeStruct(T const &rmin, T const &rmax, T const &z, T const &sphi, T const &dphi, Vector3D<T> const &bottomNormal,
0040                 Vector3D<T> const &topNormal)
0041       : fDz(z), fTubeStruct(rmin, rmax, kInfLength, sphi, dphi), fCutPlanes()
0042   {
0043     fCutPlanes.Set(0, bottomNormal.Unit(), Vector3D<T>(0., 0., -z));
0044     fCutPlanes.Set(1, topNormal.Unit(), Vector3D<T>(0., 0., z));
0045     fCosPhi1 = vecCore::math::Cos(sphi);
0046     fSinPhi1 = vecCore::math::Sin(sphi);
0047     fCosPhi2 = vecCore::math::Cos(sphi + dphi);
0048     fSinPhi2 = vecCore::math::Sin(sphi + dphi);
0049     fMaxVal  = vecCore::math::Max(rmax, z);
0050   }
0051 
0052   VECCORE_ATT_HOST_DEVICE
0053   VECGEOM_FORCE_INLINE
0054   TubeStruct<T> const &GetTubeStruct() const { return fTubeStruct; }
0055 
0056   VECCORE_ATT_HOST_DEVICE
0057   VECGEOM_FORCE_INLINE
0058   CutPlanes const &GetCutPlanes() const { return fCutPlanes; }
0059 };
0060 } // namespace VECGEOM_IMPL_NAMESPACE
0061 } // namespace vecgeom
0062 
0063 #endif