Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:13:59

0001 // This file is part of VecGeom and is distributed under the
0002 // conditions in the file LICENSE.txt in the top directory.
0003 // For the full list of authors see CONTRIBUTORS.txt and `git log`.
0004 
0005 /// This file defines specialized types for the Trd shape
0006 /// @file volumes/kernel/shapetypes/TrdTypes.h
0007 /// @author Georgios Bitzes
0008 
0009 #ifndef VECGEOM_VOLUMES_KERNEL_SHAPETYPES_TRDTYPES_H_
0010 #define VECGEOM_VOLUMES_KERNEL_SHAPETYPES_TRDTYPES_H_
0011 
0012 namespace vecgeom {
0013 
0014 VECGEOM_DEVICE_DECLARE_NS_CONV(TrdTypes, struct, UniversalTrd, UniversalTrd);
0015 
0016 #ifndef VECGEOM_NO_SPECIALIZATION
0017 
0018 VECGEOM_DEVICE_DECLARE_NS_CONV(TrdTypes, struct, Trd1, UniversalTrd);
0019 VECGEOM_DEVICE_DECLARE_NS_CONV(TrdTypes, struct, Trd2, UniversalTrd);
0020 
0021 #endif // VECGEOM_NO_SPECIALIZATION
0022 
0023 inline namespace VECGEOM_IMPL_NAMESPACE {
0024 namespace TrdTypes {
0025 
0026 #define DEFINE_TRD_TYPE(name)                       \
0027   struct name {                                     \
0028     VECCORE_ATT_HOST_DEVICE                         \
0029     static char const *toString() { return #name; } \
0030   }
0031 
0032 // A Trd that includes all cases but does runtime checks
0033 DEFINE_TRD_TYPE(UniversalTrd);
0034 
0035 #ifndef VECGEOM_NO_SPECIALIZATION
0036 
0037 // A special case for which dy1 == dy2
0038 DEFINE_TRD_TYPE(Trd1);
0039 // A general case without runtime checks
0040 DEFINE_TRD_TYPE(Trd2);
0041 
0042 #endif // VECGEOM_NO_SPECIALIZATION
0043 
0044 #undef DEFINE_TRD_TYPE
0045 
0046 enum ETreatmentType { kYes = 0, kNo, kUnknown };
0047 
0048 template <typename T>
0049 struct HasVaryingY {
0050   static const ETreatmentType value = kUnknown;
0051 };
0052 
0053 #ifndef VECGEOM_NO_SPECIALIZATION
0054 
0055 template <>
0056 struct HasVaryingY<Trd1> {
0057   static const ETreatmentType value = kNo;
0058 };
0059 template <>
0060 struct HasVaryingY<Trd2> {
0061   static const ETreatmentType value = kYes;
0062 };
0063 
0064 #endif // VECGEOM_NO_SPECIALIZATION
0065 
0066 template <typename T>
0067 VECGEOM_FORCE_INLINE
0068 VECCORE_ATT_HOST_DEVICE
0069 bool checkVaryingY(const TrdStruct<Precision> &trd)
0070 {
0071   if (HasVaryingY<T>::value != kUnknown)
0072     return HasVaryingY<T>::value == kYes;
0073   else
0074     return trd.fDY1 != trd.fDY2;
0075 }
0076 
0077 } // namespace TrdTypes
0078 } // namespace VECGEOM_IMPL_NAMESPACE
0079 } // namespace vecgeom
0080 
0081 #endif // VECGEOM_VOLUMES_KERNEL_SHAPETYPES_TRDTYPES_H_