Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /// \file HypeTypes.h
0002 // \author Marilena Bandieramonte (marilena.bandieramonte@cern.ch)
0003 //
0004 // Contains all possible hype types
0005 ///
0006 
0007 #ifndef VECGEOM_VOLUMES_KERNEL_SHAPETYPES_HYPETYPES_H_
0008 #define VECGEOM_VOLUMES_KERNEL_SHAPETYPES_HYPETYPES_H_
0009 
0010 #include <string>
0011 
0012 namespace vecgeom {
0013 
0014 VECGEOM_DEVICE_DECLARE_NS_CONV(HypeTypes, struct, UniversalHype, UniversalHype);
0015 
0016 #ifndef VECGEOM_NO_SPECIALIZATION
0017 VECGEOM_DEVICE_DECLARE_NS_CONV(HypeTypes, struct, NonHollowHype, UniversalHype);
0018 VECGEOM_DEVICE_DECLARE_NS_CONV(HypeTypes, struct, HollowHype, UniversalHype);
0019 #endif
0020 
0021 inline namespace VECGEOM_IMPL_NAMESPACE {
0022 namespace HypeTypes {
0023 
0024 #define DEFINE_HYPE_TYPE(name)                      \
0025   struct name {                                     \
0026     VECCORE_ATT_HOST_DEVICE                         \
0027     static char const *toString() { return #name; } \
0028   }
0029 
0030 // A Hype that encompasses all cases - not specialized and
0031 // will do extra checks at runtime
0032 DEFINE_HYPE_TYPE(UniversalHype);
0033 
0034 // A Hype with rmin=0
0035 DEFINE_HYPE_TYPE(NonHollowHype);
0036 
0037 // A Hype with rmin!=0
0038 DEFINE_HYPE_TYPE(HollowHype);
0039 
0040 #undef DEFINE_HYPE_TYPE
0041 
0042 // Mapping of Hype types to certain characteristics
0043 enum ETreatmentType { kYes = 0, kNo, kUnknown };
0044 
0045 // asking for rmin treatment
0046 template <typename T>
0047 struct NeedsRminTreatment {
0048   static const ETreatmentType value = kYes;
0049 };
0050 template <>
0051 struct NeedsRminTreatment<NonHollowHype> {
0052   static const ETreatmentType value = kNo;
0053 };
0054 
0055 template <>
0056 struct NeedsRminTreatment<UniversalHype> {
0057   static const ETreatmentType value = kUnknown;
0058 };
0059 
0060 template <typename T, typename UnplacedHype>
0061 VECGEOM_FORCE_INLINE
0062 VECCORE_ATT_HOST_DEVICE
0063 bool checkInnerSurfaceTreatment(const UnplacedHype &hype)
0064 {
0065 
0066   if (NeedsRminTreatment<T>::value != kUnknown)
0067     return NeedsRminTreatment<T>::value == kYes;
0068   else
0069     return hype.InnerSurfaceExists();
0070 }
0071 
0072 } // namespace HypeTypes
0073 } // namespace VECGEOM_IMPL_NAMESPACE
0074 } // namespace vecgeom
0075 
0076 #endif // VECGEOM_VOLUMES_KERNEL_SHAPETYPES_HYPETYPES_H_