Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:08

0001 /// \file PlacedSphere.h
0002 /// \author Raman Sehgal (raman.sehgal@cern.ch)
0003 
0004 #ifndef VECGEOM_VOLUMES_PLACEDSPHERE_H_
0005 #define VECGEOM_VOLUMES_PLACEDSPHERE_H_
0006 
0007 #include "VecGeom/base/Global.h"
0008 #ifndef VECCORE_CUDA
0009 #include "VecGeom/base/RNG.h"
0010 #include <cmath>
0011 #endif
0012 #include "VecGeom/volumes/PlacedVolume.h"
0013 #include "VecGeom/volumes/UnplacedVolume.h"
0014 #include "VecGeom/volumes/kernel/SphereImplementation.h"
0015 #include "VecGeom/volumes/PlacedVolImplHelper.h"
0016 #include "VecGeom/volumes/UnplacedSphere.h"
0017 
0018 namespace vecgeom {
0019 
0020 VECGEOM_DEVICE_FORWARD_DECLARE(class PlacedSphere;);
0021 VECGEOM_DEVICE_DECLARE_CONV(class, PlacedSphere);
0022 
0023 inline namespace VECGEOM_IMPL_NAMESPACE {
0024 
0025 class PlacedSphere : public PlacedVolumeImplHelper<UnplacedSphere, VPlacedVolume> {
0026 
0027   using Base = PlacedVolumeImplHelper<UnplacedSphere, VPlacedVolume>;
0028 
0029 public:
0030   using Base::Base;
0031 
0032 #ifndef VECCORE_CUDA
0033 
0034   PlacedSphere(char const *const label, LogicalVolume const *const logical_volume,
0035                Transformation3D const *const transformation)
0036       : Base(label, logical_volume, transformation)
0037   {
0038   }
0039 
0040   PlacedSphere(LogicalVolume const *const logical_volume, Transformation3D const *const transformation)
0041       : PlacedSphere("", logical_volume, transformation)
0042   {
0043   }
0044 
0045 #else
0046 
0047   VECCORE_ATT_DEVICE PlacedSphere(LogicalVolume const *const logical_volume,
0048                                   Transformation3D const *const transformation, const int id, const int copy_no,
0049                                   const int child_id)
0050       : Base(logical_volume, transformation, id, copy_no, child_id)
0051   {
0052   }
0053 
0054 #endif
0055   VECCORE_ATT_HOST_DEVICE
0056   virtual ~PlacedSphere() {}
0057 
0058   VECCORE_ATT_HOST_DEVICE
0059   VECGEOM_FORCE_INLINE
0060   UnplacedSphere const *GetUnplacedVolume() const
0061   {
0062     return static_cast<UnplacedSphere const *>(GetLogicalVolume()->GetUnplacedVolume());
0063   }
0064 
0065   VECCORE_ATT_HOST_DEVICE
0066   virtual void PrintType() const override;
0067   virtual void PrintType(std::ostream &s) const override;
0068 
0069   VECCORE_ATT_HOST_DEVICE
0070   VECGEOM_FORCE_INLINE
0071   evolution::Wedge const &GetWedge() const { return GetUnplacedVolume()->GetWedge(); }
0072 
0073   VECCORE_ATT_HOST_DEVICE
0074   VECGEOM_FORCE_INLINE
0075   ThetaCone const &GetThetaCone() const { return GetUnplacedVolume()->GetThetaCone(); }
0076 
0077   VECCORE_ATT_HOST_DEVICE
0078   VECGEOM_FORCE_INLINE
0079   Precision GetInsideRadius() const { return GetUnplacedVolume()->GetInsideRadius(); }
0080 
0081   VECCORE_ATT_HOST_DEVICE
0082   VECGEOM_FORCE_INLINE
0083   Precision GetInnerRadius() const { return GetUnplacedVolume()->GetInnerRadius(); }
0084 
0085   void SetInnerRadius(Precision arg) { const_cast<UnplacedSphere *>(GetUnplacedVolume())->SetInnerRadius(arg); }
0086   void SetOuterRadius(Precision arg) { const_cast<UnplacedSphere *>(GetUnplacedVolume())->SetOuterRadius(arg); }
0087   void SetStartPhiAngle(Precision arg, bool compute = true)
0088   {
0089     const_cast<UnplacedSphere *>(GetUnplacedVolume())->SetStartPhiAngle(arg, compute);
0090   }
0091   void SetDeltaPhiAngle(Precision arg) { const_cast<UnplacedSphere *>(GetUnplacedVolume())->SetDeltaPhiAngle(arg); }
0092   void SetStartThetaAngle(Precision arg) { const_cast<UnplacedSphere *>(GetUnplacedVolume())->SetStartThetaAngle(arg); }
0093   void SetDeltaThetaAngle(Precision arg) { const_cast<UnplacedSphere *>(GetUnplacedVolume())->SetDeltaThetaAngle(arg); }
0094 
0095   VECCORE_ATT_HOST_DEVICE
0096   VECGEOM_FORCE_INLINE
0097   Precision GetOuterRadius() const { return GetUnplacedVolume()->GetOuterRadius(); }
0098 
0099   VECCORE_ATT_HOST_DEVICE
0100   VECGEOM_FORCE_INLINE
0101   Precision GetStartPhiAngle() const { return GetUnplacedVolume()->GetStartPhiAngle(); }
0102 
0103   VECCORE_ATT_HOST_DEVICE
0104   VECGEOM_FORCE_INLINE
0105   Precision GetDeltaPhiAngle() const { return GetUnplacedVolume()->GetDeltaPhiAngle(); }
0106 
0107   VECCORE_ATT_HOST_DEVICE
0108   VECGEOM_FORCE_INLINE
0109   Precision GetStartThetaAngle() const { return GetUnplacedVolume()->GetStartThetaAngle(); }
0110 
0111   VECCORE_ATT_HOST_DEVICE
0112   VECGEOM_FORCE_INLINE
0113   Precision GetDeltaThetaAngle() const { return GetUnplacedVolume()->GetDeltaThetaAngle(); }
0114 
0115   // Functions to get Tolerance
0116   VECCORE_ATT_HOST_DEVICE
0117   VECGEOM_FORCE_INLINE
0118   Precision GetFRminTolerance() const { return GetUnplacedVolume()->GetFRminTolerance(); }
0119 
0120   VECCORE_ATT_HOST_DEVICE
0121   VECGEOM_FORCE_INLINE
0122   Precision GetMKTolerance() const { return GetUnplacedVolume()->GetMKTolerance(); }
0123 
0124   VECCORE_ATT_HOST_DEVICE
0125   VECGEOM_FORCE_INLINE
0126   Precision GetAngTolerance() const { return GetUnplacedVolume()->GetAngTolerance(); }
0127 
0128   VECCORE_ATT_HOST_DEVICE
0129   VECGEOM_FORCE_INLINE
0130   bool IsFullSphere() const { return GetUnplacedVolume()->IsFullSphere(); }
0131 
0132   VECCORE_ATT_HOST_DEVICE
0133   VECGEOM_FORCE_INLINE
0134   bool IsFullPhiSphere() const { return GetUnplacedVolume()->IsFullPhiSphere(); }
0135 
0136   VECCORE_ATT_HOST_DEVICE
0137   VECGEOM_FORCE_INLINE
0138   bool IsFullThetaSphere() const { return GetUnplacedVolume()->IsFullThetaSphere(); }
0139 
0140   // Function to return all Trignometric values
0141   VECCORE_ATT_HOST_DEVICE
0142   VECGEOM_FORCE_INLINE
0143   Precision GetHDPhi() const { return GetUnplacedVolume()->GetHDPhi(); }
0144 
0145   VECCORE_ATT_HOST_DEVICE
0146   VECGEOM_FORCE_INLINE
0147   Precision GetCPhi() const { return GetUnplacedVolume()->GetCPhi(); }
0148 
0149   VECCORE_ATT_HOST_DEVICE
0150   VECGEOM_FORCE_INLINE
0151   Precision GetEPhi() const { return GetUnplacedVolume()->GetEPhi(); }
0152 
0153   VECCORE_ATT_HOST_DEVICE
0154   VECGEOM_FORCE_INLINE
0155   Precision GetSinCPhi() const { return GetUnplacedVolume()->GetSinCPhi(); }
0156 
0157   VECCORE_ATT_HOST_DEVICE
0158   VECGEOM_FORCE_INLINE
0159   Precision GetCosCPhi() const { return GetUnplacedVolume()->GetCosCPhi(); }
0160 
0161   VECCORE_ATT_HOST_DEVICE
0162   VECGEOM_FORCE_INLINE
0163   Precision GetSinSPhi() const { return GetUnplacedVolume()->GetSinSPhi(); }
0164 
0165   VECCORE_ATT_HOST_DEVICE
0166   VECGEOM_FORCE_INLINE
0167   Precision GetCosSPhi() const { return GetUnplacedVolume()->GetCosSPhi(); }
0168 
0169   VECCORE_ATT_HOST_DEVICE
0170   VECGEOM_FORCE_INLINE
0171   Precision GetSinEPhi() const { return GetUnplacedVolume()->GetSinEPhi(); }
0172 
0173   VECCORE_ATT_HOST_DEVICE
0174   VECGEOM_FORCE_INLINE
0175   Precision GetCosEPhi() const { return GetUnplacedVolume()->GetCosEPhi(); }
0176 
0177   VECCORE_ATT_HOST_DEVICE
0178   VECGEOM_FORCE_INLINE
0179   Precision GetETheta() const { return GetUnplacedVolume()->GetETheta(); }
0180 
0181   VECCORE_ATT_HOST_DEVICE
0182   VECGEOM_FORCE_INLINE
0183   Precision GetSinSTheta() const { return GetUnplacedVolume()->GetSinSTheta(); }
0184 
0185   VECCORE_ATT_HOST_DEVICE
0186   VECGEOM_FORCE_INLINE
0187   Precision GetCosSTheta() const { return GetUnplacedVolume()->GetCosSTheta(); }
0188 
0189   VECCORE_ATT_HOST_DEVICE
0190   VECGEOM_FORCE_INLINE
0191   Precision GetSinETheta() const { return GetUnplacedVolume()->GetSinETheta(); }
0192 
0193   VECCORE_ATT_HOST_DEVICE
0194   VECGEOM_FORCE_INLINE
0195   Precision GetCosETheta() const { return GetUnplacedVolume()->GetCosETheta(); }
0196 
0197   //****************************************************************
0198   VECCORE_ATT_HOST_DEVICE
0199   VECGEOM_FORCE_INLINE
0200   Precision GetTanSTheta() const { return GetUnplacedVolume()->GetTanSTheta(); }
0201 
0202   VECCORE_ATT_HOST_DEVICE
0203   VECGEOM_FORCE_INLINE
0204   Precision GetTanETheta() const { return GetUnplacedVolume()->GetTanETheta(); }
0205 
0206   VECCORE_ATT_HOST_DEVICE
0207   VECGEOM_FORCE_INLINE
0208   Precision GetFabsTanSTheta() const { return GetUnplacedVolume()->GetFabsTanSTheta(); }
0209 
0210   VECCORE_ATT_HOST_DEVICE
0211   VECGEOM_FORCE_INLINE
0212   Precision GetFabsTanETheta() const { return GetUnplacedVolume()->GetFabsTanETheta(); }
0213 
0214   VECCORE_ATT_HOST_DEVICE
0215   VECGEOM_FORCE_INLINE
0216   Precision GetTanSTheta2() const { return GetUnplacedVolume()->GetTanSTheta2(); }
0217 
0218   VECCORE_ATT_HOST_DEVICE
0219   VECGEOM_FORCE_INLINE
0220   Precision GetTanETheta2() const { return GetUnplacedVolume()->GetTanETheta2(); }
0221 
0222   VECCORE_ATT_HOST_DEVICE
0223   VECGEOM_FORCE_INLINE
0224   Precision GetCosHDPhiOT() const { return GetUnplacedVolume()->GetCosHDPhiOT(); }
0225 
0226   VECCORE_ATT_HOST_DEVICE
0227   VECGEOM_FORCE_INLINE
0228   Precision GetCosHDPhiIT() const { return GetUnplacedVolume()->GetCosHDPhiIT(); }
0229   //****************************************************************
0230 
0231   // Old access functions
0232   VECCORE_ATT_HOST_DEVICE
0233   VECGEOM_FORCE_INLINE
0234   Precision GetRmin() const { return GetUnplacedVolume()->GetRmin(); }
0235 
0236   VECCORE_ATT_HOST_DEVICE
0237   VECGEOM_FORCE_INLINE
0238   Precision GetRmax() const { return GetUnplacedVolume()->GetRmax(); }
0239 
0240   VECCORE_ATT_HOST_DEVICE
0241   VECGEOM_FORCE_INLINE
0242   Precision GetSPhi() const { return GetUnplacedVolume()->GetSPhi(); }
0243 
0244   VECCORE_ATT_HOST_DEVICE
0245   VECGEOM_FORCE_INLINE
0246   Precision GetDPhi() const { return GetUnplacedVolume()->GetDPhi(); }
0247 
0248   VECCORE_ATT_HOST_DEVICE
0249   VECGEOM_FORCE_INLINE
0250   Precision GetSTheta() const { return GetUnplacedVolume()->GetSTheta(); }
0251 
0252   VECCORE_ATT_HOST_DEVICE
0253   VECGEOM_FORCE_INLINE
0254   Precision GetDTheta() const { return GetUnplacedVolume()->GetDTheta(); }
0255 
0256 #ifndef VECCORE_CUDA
0257   virtual VPlacedVolume const *ConvertToUnspecialized() const override;
0258 
0259 #ifdef VECGEOM_ROOT
0260   virtual TGeoShape const *ConvertToRoot() const override { return GetUnplacedVolume()->ConvertToRoot(GetName()); }
0261 #endif
0262 #ifdef VECGEOM_GEANT4
0263   virtual G4VSolid const *ConvertToGeant4() const override { return GetUnplacedVolume()->ConvertToGeant4(GetName()); }
0264 #endif
0265 #endif // VECCORE_CUDA
0266 };
0267 } // namespace VECGEOM_IMPL_NAMESPACE
0268 } // namespace vecgeom
0269 
0270 #endif // VECGEOM_VOLUMES_PLACEDSPHERE_H_