Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /// \file PlacedPolyhedron.h
0002 /// \author Johannes de Fine Licht (johannes.definelicht@cern.ch)
0003 
0004 #ifndef VECGEOM_VOLUMES_PLACEDPOLYHEDRON_H_
0005 #define VECGEOM_VOLUMES_PLACEDPOLYHEDRON_H_
0006 
0007 #include "VecGeom/base/Global.h"
0008 
0009 #include "VecGeom/volumes/PlacedVolume.h"
0010 #include "VecGeom/volumes/kernel/PolyhedronImplementation.h"
0011 #include "VecGeom/volumes/PlacedVolImplHelper.h"
0012 #include "VecGeom/volumes/UnplacedPolyhedron.h"
0013 
0014 class UPolyhedraHistorical;
0015 struct PolyhedraSideRZ {   // Avoid clash in class name UPolyhedraSideRZ
0016   vecgeom::Precision r, z; // start of vector
0017 };
0018 
0019 namespace vecgeom {
0020 
0021 VECGEOM_DEVICE_FORWARD_DECLARE(class PlacedPolyhedron;);
0022 VECGEOM_DEVICE_DECLARE_CONV(class, PlacedPolyhedron);
0023 
0024 inline namespace VECGEOM_IMPL_NAMESPACE {
0025 
0026 class PlacedPolyhedron : public PlacedVolumeImplHelper<UnplacedPolyhedron, VPlacedVolume> {
0027   using Base = PlacedVolumeImplHelper<UnplacedPolyhedron, VPlacedVolume>;
0028 
0029 public:
0030   typedef UnplacedPolyhedron UnplacedShape_t;
0031 
0032 #ifndef VECCORE_CUDA
0033   // constructor inheritance;
0034   using Base::Base;
0035   PlacedPolyhedron(char const *const label, LogicalVolume const *const logicalVolume,
0036                    Transformation3D const *const transformation)
0037       : Base(label, logicalVolume, transformation)
0038   {
0039   }
0040 
0041   PlacedPolyhedron(LogicalVolume const *const logicalVolume, Transformation3D const *const transformation)
0042       : PlacedPolyhedron("", logicalVolume, transformation)
0043   {
0044   }
0045 #else
0046   VECCORE_ATT_DEVICE PlacedPolyhedron(LogicalVolume const *const logicalVolume,
0047                                       Transformation3D const *const transformation, const int id, const int copy_no,
0048                                       const int child_id)
0049       : Base(logicalVolume, transformation, id, copy_no, child_id)
0050   {
0051   }
0052 #endif
0053 
0054   VECCORE_ATT_HOST_DEVICE
0055   virtual ~PlacedPolyhedron() {}
0056 
0057   // Accessors
0058 
0059   VECCORE_ATT_HOST_DEVICE
0060   UnplacedPolyhedron const *GetUnplacedVolume() const
0061   {
0062     return static_cast<UnplacedPolyhedron 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   int GetSideCount() const { return GetUnplacedVolume()->GetSideCount(); }
0072 
0073   VECCORE_ATT_HOST_DEVICE
0074   VECGEOM_FORCE_INLINE
0075   int GetZSegmentCount() const { return GetUnplacedVolume()->GetZSegmentCount(); }
0076 
0077   VECCORE_ATT_HOST_DEVICE
0078   VECGEOM_FORCE_INLINE
0079   bool HasInnerRadii() const { return GetUnplacedVolume()->HasInnerRadii(); }
0080 
0081   VECCORE_ATT_HOST_DEVICE
0082   VECGEOM_FORCE_INLINE
0083   bool HasPhiCutout() const { return GetUnplacedVolume()->HasPhiCutout(); }
0084 
0085   VECCORE_ATT_HOST_DEVICE
0086   VECGEOM_FORCE_INLINE
0087   ZSegment const &GetZSegment(int index) const { return GetUnplacedVolume()->GetZSegment(index); }
0088 
0089   VECCORE_ATT_HOST_DEVICE
0090   VECGEOM_FORCE_INLINE
0091   Array<ZSegment> const &GetZSegments() const { return GetUnplacedVolume()->GetZSegments(); }
0092 
0093   VECCORE_ATT_HOST_DEVICE
0094   VECGEOM_FORCE_INLINE
0095   Array<Precision> const &GetZPlanes() const { return GetUnplacedVolume()->GetZPlanes(); }
0096 
0097   VECCORE_ATT_HOST_DEVICE
0098   VECGEOM_FORCE_INLINE
0099   Array<Precision> const &GetRMin() const { return GetUnplacedVolume()->GetRMin(); }
0100 
0101   VECCORE_ATT_HOST_DEVICE
0102   VECGEOM_FORCE_INLINE
0103   Array<Precision> const &GetRMax() const { return GetUnplacedVolume()->GetRMax(); }
0104 
0105   VECCORE_ATT_HOST_DEVICE
0106   VECGEOM_FORCE_INLINE
0107   Vector3D<Precision> GetPhiSection(int i) const { return GetUnplacedVolume()->GetPhiSection(i); }
0108 
0109   VECCORE_ATT_HOST_DEVICE
0110   VECGEOM_FORCE_INLINE
0111   SOA3D<Precision> const &GetPhiSections() const { return GetUnplacedVolume()->GetPhiSections(); }
0112 
0113   VECCORE_ATT_HOST_DEVICE
0114   VECGEOM_FORCE_INLINE
0115   Precision GetPhiStart() const { return GetUnplacedVolume()->GetPhiStart(); }
0116 
0117   VECCORE_ATT_HOST_DEVICE
0118   VECGEOM_FORCE_INLINE
0119   Precision GetPhiEnd() const { return GetUnplacedVolume()->GetPhiEnd(); }
0120 
0121   VECCORE_ATT_HOST_DEVICE
0122   VECGEOM_FORCE_INLINE
0123   Precision GetPhiDelta() const { return GetUnplacedVolume()->GetPhiDelta(); }
0124 
0125   VECCORE_ATT_HOST_DEVICE
0126   int PhiSegmentIndex(Vector3D<Precision> const &point) const;
0127 
0128   bool IsOpen() const { return (GetUnplacedVolume()->GetPhiDelta() < kTwoPi); }
0129   bool IsGeneric() const { return false; }
0130   Precision GetStartPhi() const { return GetUnplacedVolume()->GetPhiStart(); }
0131   Precision GetEndPhi() const { return GetUnplacedVolume()->GetPhiEnd(); }
0132   int GetNumSide() const { return GetUnplacedVolume()->GetSideCount(); }
0133   int GetNumRZCorner() const { return GetZPlanes().size(); }
0134 
0135   // CUDA specific
0136 
0137   virtual int MemorySize() const override { return sizeof(*this); }
0138 
0139 // Comparison specific
0140 #ifndef VECCORE_CUDA
0141   virtual VPlacedVolume const *ConvertToUnspecialized() const override;
0142 #ifdef VECGEOM_ROOT
0143   virtual TGeoShape const *ConvertToRoot() const override;
0144 #endif
0145 #ifdef VECGEOM_GEANT4
0146   virtual G4VSolid const *ConvertToGeant4() const override;
0147 #endif
0148 #endif // VECCORE_CUDA
0149 };
0150 
0151 } // namespace VECGEOM_IMPL_NAMESPACE
0152 
0153 } // namespace vecgeom
0154 
0155 #endif // VECGEOM_VOLUMES_PLACEDPOLYHEDRON_H_