Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:26:18

0001 /*
0002  * PlacedPolycone.h
0003  *
0004  *  Created on: May 14, 2014
0005  *      Author: swenzel
0006  */
0007 #ifndef VECGEOM_VOLUMES_PLACEDPOLYCONE_H_
0008 #define VECGEOM_VOLUMES_PLACEDPOLYCONE_H_
0009 
0010 #include "VecGeom/base/Global.h"
0011 #ifndef VECCORE_CUDA
0012 #include "VecGeom/base/RNG.h"
0013 #include <cmath>
0014 #endif
0015 #include "VecGeom/volumes/PlacedVolume.h"
0016 #include "VecGeom/volumes/UnplacedVolume.h"
0017 #include "VecGeom/volumes/kernel/PolyconeImplementation.h"
0018 #include "VecGeom/volumes/PlacedVolImplHelper.h"
0019 #include "VecGeom/volumes/UnplacedPolycone.h"
0020 
0021 namespace vecgeom {
0022 
0023 VECGEOM_DEVICE_FORWARD_DECLARE(class PlacedPolycone;);
0024 VECGEOM_DEVICE_DECLARE_CONV(class, PlacedPolycone);
0025 
0026 inline namespace VECGEOM_IMPL_NAMESPACE {
0027 
0028 class PlacedPolycone : public VPlacedVolume {
0029 
0030 public:
0031 #ifndef VECCORE_CUDA
0032   PlacedPolycone(char const *const label, LogicalVolume const *const logicalVolume,
0033                  Transformation3D const *const transformation)
0034       : VPlacedVolume(label, logicalVolume, transformation)
0035   {
0036   }
0037 
0038   PlacedPolycone(LogicalVolume const *const logicalVolume, Transformation3D const *const transformation)
0039       : PlacedPolycone("", logicalVolume, transformation)
0040   {
0041   }
0042 #else
0043   VECCORE_ATT_DEVICE PlacedPolycone(LogicalVolume const *const logicalVolume,
0044                                     Transformation3D const *const transformation, const int id, const int copy_no,
0045                                     const int child_id)
0046       : VPlacedVolume(logicalVolume, transformation, id, copy_no, child_id)
0047   {
0048   }
0049 #endif
0050 
0051   VECCORE_ATT_HOST_DEVICE
0052   virtual ~PlacedPolycone() {}
0053 
0054   VECCORE_ATT_HOST_DEVICE
0055   UnplacedPolycone const *GetUnplacedVolume() const
0056   {
0057     return static_cast<UnplacedPolycone const *>(GetLogicalVolume()->GetUnplacedVolume());
0058   }
0059 
0060   VECCORE_ATT_HOST_DEVICE
0061   virtual void PrintType() const override;
0062   virtual void PrintType(std::ostream &s) const override;
0063 
0064   bool IsOpen() const { return (GetUnplacedVolume()->GetDeltaPhi() < kTwoPi); }
0065   Precision GetStartPhi() const { return GetUnplacedVolume()->GetStartPhi(); }
0066   Precision GetEndPhi() const { return GetUnplacedVolume()->GetEndPhi(); }
0067   int GetNumRZCorner() const { return 2 * (int)(GetUnplacedVolume()->GetNz()); } // in USolids nCorners = 2*nPlanes
0068 
0069   PolyconeHistorical *GetOriginalParameters() const { return GetUnplacedVolume()->GetOriginalParameters(); }
0070 
0071   void Reset() { const_cast<UnplacedPolycone *>(GetUnplacedVolume())->Reset(); }
0072 
0073 #ifndef VECCORE_CUDA
0074   virtual VPlacedVolume const *ConvertToUnspecialized() const override;
0075 #ifdef VECGEOM_ROOT
0076   virtual TGeoShape const *ConvertToRoot() const override { return GetUnplacedVolume()->ConvertToRoot(GetName()); }
0077 #endif
0078 #ifdef VECGEOM_GEANT4
0079   virtual G4VSolid const *ConvertToGeant4() const override { return GetUnplacedVolume()->ConvertToGeant4(GetName()); }
0080 #endif
0081 #endif // VECGEOM_CUDA
0082 
0083 #if !defined(VECCORE_CUDA)
0084   virtual Precision SurfaceArea() const override { return GetUnplacedVolume()->SurfaceArea(); }
0085 #endif
0086 
0087 }; // end class
0088 
0089 template <typename UnplacedPolycone_t>
0090 class SPlacedPolycone : public PlacedVolumeImplHelper<UnplacedPolycone_t, PlacedPolycone> {
0091   using Base = PlacedVolumeImplHelper<UnplacedPolycone_t, PlacedPolycone>;
0092 
0093 public:
0094   typedef UnplacedPolycone UnplacedShape_t;
0095   using Base::Base;
0096 };
0097 
0098 } // namespace VECGEOM_IMPL_NAMESPACE
0099 } // namespace vecgeom
0100 
0101 #endif // VECGEOM_VOLUMES_PLACEDPOLYCONE_H_