File indexing completed on 2025-01-18 10:13:59
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef VECGEOM_VOLUMES_KERNEL_SHAPETYPES_CONETYPES_H_
0012 #define VECGEOM_VOLUMES_KERNEL_SHAPETYPES_CONETYPES_H_
0013
0014
0015
0016
0017 namespace vecgeom {
0018
0019 VECGEOM_DEVICE_DECLARE_NS_CONV(ConeTypes, struct, UniversalCone, UniversalCone);
0020
0021 #ifndef VECGEOM_NO_SPECIALIZATION
0022
0023 VECGEOM_DEVICE_DECLARE_NS_CONV(ConeTypes, struct, NonHollowCone, UniversalCone);
0024 VECGEOM_DEVICE_DECLARE_NS_CONV(ConeTypes, struct, NonHollowConeWithSmallerThanPiSector, UniversalCone);
0025 VECGEOM_DEVICE_DECLARE_NS_CONV(ConeTypes, struct, NonHollowConeWithBiggerThanPiSector, UniversalCone);
0026 VECGEOM_DEVICE_DECLARE_NS_CONV(ConeTypes, struct, NonHollowConeWithPiSector, UniversalCone);
0027
0028 VECGEOM_DEVICE_DECLARE_NS_CONV(ConeTypes, struct, HollowCone, UniversalCone);
0029 VECGEOM_DEVICE_DECLARE_NS_CONV(ConeTypes, struct, HollowConeWithSmallerThanPiSector, UniversalCone);
0030 VECGEOM_DEVICE_DECLARE_NS_CONV(ConeTypes, struct, HollowConeWithBiggerThanPiSector, UniversalCone);
0031 VECGEOM_DEVICE_DECLARE_NS_CONV(ConeTypes, struct, HollowConeWithPiSector, UniversalCone);
0032
0033 #endif
0034
0035 inline namespace VECGEOM_IMPL_NAMESPACE {
0036 namespace ConeTypes {
0037
0038 #define DEFINE_CONE_TYPE(name) \
0039 struct name { \
0040 VECCORE_ATT_HOST_DEVICE \
0041 static char const *toString() { return #name; } \
0042 }
0043
0044
0045 DEFINE_CONE_TYPE(UniversalCone);
0046
0047
0048
0049
0050 DEFINE_CONE_TYPE(NonHollowCone);
0051
0052 DEFINE_CONE_TYPE(NonHollowConeWithSmallerThanPiSector);
0053
0054 DEFINE_CONE_TYPE(NonHollowConeWithBiggerThanPiSector);
0055
0056 DEFINE_CONE_TYPE(NonHollowConeWithPiSector);
0057
0058
0059 DEFINE_CONE_TYPE(HollowCone);
0060
0061 DEFINE_CONE_TYPE(HollowConeWithSmallerThanPiSector);
0062
0063 DEFINE_CONE_TYPE(HollowConeWithBiggerThanPiSector);
0064
0065 DEFINE_CONE_TYPE(HollowConeWithPiSector);
0066
0067
0068
0069 #undef DEFINE_CONE_TYPE
0070
0071
0072 enum ETreatmentType { kYes = 0, kNo, kUnknown };
0073
0074
0075 template <typename T>
0076 struct NeedsPhiTreatment {
0077 static const ETreatmentType value = kYes;
0078 };
0079
0080 #ifndef VECGEOM_NO_SPECIALIZATION
0081
0082 template <>
0083 struct NeedsPhiTreatment<NonHollowCone> {
0084 static const ETreatmentType value = kNo;
0085 };
0086 template <>
0087 struct NeedsPhiTreatment<HollowCone> {
0088 static const ETreatmentType value = kNo;
0089 };
0090
0091 #endif
0092
0093 template <>
0094 struct NeedsPhiTreatment<UniversalCone> {
0095 static const ETreatmentType value = kUnknown;
0096 };
0097
0098 template <typename T, typename UnplacedCone>
0099 VECGEOM_FORCE_INLINE
0100 VECCORE_ATT_HOST_DEVICE
0101 bool checkPhiTreatment(const UnplacedCone &cone)
0102 {
0103 if (NeedsPhiTreatment<T>::value != kUnknown)
0104 return NeedsPhiTreatment<T>::value == kYes;
0105 else
0106 return cone.fDPhi < vecgeom::kTwoPi;
0107 }
0108
0109
0110 template <typename T>
0111 struct NeedsRminTreatment {
0112 static const ETreatmentType value = kYes;
0113 };
0114
0115 #ifndef VECGEOM_NO_SPECIALIZATION
0116
0117 template <>
0118 struct NeedsRminTreatment<NonHollowCone> {
0119 static const ETreatmentType value = kNo;
0120 };
0121 template <>
0122 struct NeedsRminTreatment<NonHollowConeWithSmallerThanPiSector> {
0123 static const ETreatmentType value = kNo;
0124 };
0125 template <>
0126 struct NeedsRminTreatment<NonHollowConeWithBiggerThanPiSector> {
0127 static const ETreatmentType value = kNo;
0128 };
0129 template <>
0130 struct NeedsRminTreatment<NonHollowConeWithPiSector> {
0131 static const ETreatmentType value = kNo;
0132 };
0133
0134 #endif
0135
0136 template <>
0137 struct NeedsRminTreatment<UniversalCone> {
0138 static const ETreatmentType value = kUnknown;
0139 };
0140
0141 template <typename T, typename UnplacedCone>
0142 VECGEOM_FORCE_INLINE
0143 VECCORE_ATT_HOST_DEVICE
0144 bool checkRminTreatment(const UnplacedCone &cone)
0145 {
0146 if (NeedsRminTreatment<T>::value != kUnknown)
0147 return NeedsRminTreatment<T>::value == kYes;
0148 else
0149
0150 return cone.fRmin1 > 0 || cone.fRmin2 > 0;
0151 }
0152
0153
0154 enum EAngleType { kNoAngle = 0, kSmallerThanPi, kOnePi, kBiggerThanPi, kUnknownAngle };
0155
0156 template <typename T>
0157 struct SectorType {
0158 static const EAngleType value = kNoAngle;
0159 };
0160
0161 template <>
0162 struct SectorType<UniversalCone> {
0163 static const EAngleType value = kUnknownAngle;
0164 };
0165
0166 #ifndef VECGEOM_NO_SPECIALIZATION
0167
0168 template <>
0169 struct SectorType<NonHollowConeWithSmallerThanPiSector> {
0170 static const EAngleType value = kSmallerThanPi;
0171 };
0172
0173 template <>
0174 struct SectorType<NonHollowConeWithPiSector> {
0175 static const EAngleType value = kOnePi;
0176 };
0177
0178 template <>
0179 struct SectorType<NonHollowConeWithBiggerThanPiSector> {
0180 static const EAngleType value = kBiggerThanPi;
0181 };
0182 template <>
0183 struct SectorType<HollowConeWithSmallerThanPiSector> {
0184 static const EAngleType value = kSmallerThanPi;
0185 };
0186
0187 template <>
0188 struct SectorType<HollowConeWithPiSector> {
0189 static const EAngleType value = kOnePi;
0190 };
0191
0192 template <>
0193 struct SectorType<HollowConeWithBiggerThanPiSector> {
0194 static const EAngleType value = kBiggerThanPi;
0195 };
0196
0197 #endif
0198
0199 }
0200 }
0201 }
0202
0203 #endif