Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // This file is part of VecGeom and is distributed under the
0002 // conditions in the file LICENSE.txt in the top directory.
0003 // For the full list of authors see CONTRIBUTORS.txt and `git log`.
0004 
0005 /// Declaration of the placed Trd volume
0006 /// @file volumes/PlacedTrd.h
0007 /// @author Georgios Bitzes
0008 
0009 #ifndef VECGEOM_VOLUMES_PLACEDTRD_H_
0010 #define VECGEOM_VOLUMES_PLACEDTRD_H_
0011 
0012 #include "VecGeom/base/Global.h"
0013 #ifndef VECCORE_CUDA
0014 #include "VecGeom/base/RNG.h"
0015 #include <cmath>
0016 #endif
0017 #include "VecGeom/volumes/PlacedVolume.h"
0018 #include "VecGeom/volumes/UnplacedVolume.h"
0019 #include "VecGeom/volumes/kernel/TrdImplementation.h"
0020 #include "VecGeom/volumes/PlacedVolImplHelper.h"
0021 #include "VecGeom/volumes/UnplacedTrd.h"
0022 
0023 namespace vecgeom {
0024 
0025 VECGEOM_DEVICE_FORWARD_DECLARE(class PlacedTrd;);
0026 VECGEOM_DEVICE_DECLARE_CONV(class, PlacedTrd);
0027 
0028 inline namespace VECGEOM_IMPL_NAMESPACE {
0029 
0030 /// Class for the positioned Trd volume
0031 class PlacedTrd : public VPlacedVolume {
0032 
0033 public:
0034   using VPlacedVolume::VPlacedVolume;
0035 #ifndef VECCORE_CUDA
0036   /// Constructor
0037   /// @param label Name of logical volume.
0038   /// @param logicalVolume The logical volume to be positioned.
0039   /// @param transformation The positioning transformation.
0040   PlacedTrd(char const *const label, LogicalVolume const *const logicalVolume,
0041             Transformation3D const *const transformation)
0042       : VPlacedVolume(label, logicalVolume, transformation)
0043   {
0044   }
0045 
0046   /// Constructor
0047   /// @param logicalVolume The logical volume to be positioned.
0048   /// @param transformation The positioning transformation.
0049   PlacedTrd(LogicalVolume const *const logicalVolume, Transformation3D const *const transformation)
0050       : PlacedTrd("", logicalVolume, transformation)
0051   {
0052   }
0053 #else
0054   /// CUDA version of constructor
0055   VECCORE_ATT_DEVICE PlacedTrd(LogicalVolume const *const logicalVolume, Transformation3D const *const transformation,
0056                                const int id, const int copy_no, const int child_id)
0057       : VPlacedVolume(logicalVolume, transformation, id, copy_no, child_id)
0058   {
0059   }
0060 #endif
0061 
0062   /// Destructor
0063   VECCORE_ATT_HOST_DEVICE
0064   virtual ~PlacedTrd() {}
0065 
0066   /// Getter for unplaced volume
0067   VECCORE_ATT_HOST_DEVICE
0068   UnplacedTrd const *GetUnplacedVolume() const
0069   {
0070     return static_cast<UnplacedTrd const *>(GetLogicalVolume()->GetUnplacedVolume());
0071   }
0072 
0073   VECCORE_ATT_HOST_DEVICE
0074   virtual void PrintType() const override;
0075   virtual void PrintType(std::ostream &s) const override;
0076 
0077   /// Getter for half-length along x at -dz
0078   VECCORE_ATT_HOST_DEVICE
0079   VECGEOM_FORCE_INLINE
0080   Precision dx1() const { return GetUnplacedVolume()->dx1(); }
0081 
0082   /// Getter for half-length along x at +dz
0083   VECCORE_ATT_HOST_DEVICE
0084   VECGEOM_FORCE_INLINE
0085   Precision dx2() const { return GetUnplacedVolume()->dx2(); }
0086 
0087   /// Getter for half-length along y at -dz
0088   VECCORE_ATT_HOST_DEVICE
0089   VECGEOM_FORCE_INLINE
0090   Precision dy1() const { return GetUnplacedVolume()->dy1(); }
0091 
0092   /// Getter for half-length along y at +dz
0093   VECCORE_ATT_HOST_DEVICE
0094   VECGEOM_FORCE_INLINE
0095   Precision dy2() const { return GetUnplacedVolume()->dy2(); }
0096 
0097   /// Getter for half-length along z
0098   VECCORE_ATT_HOST_DEVICE
0099   VECGEOM_FORCE_INLINE
0100   Precision dz() const { return GetUnplacedVolume()->dz(); }
0101 
0102   /// Getter for half-length along x at -dz
0103   Precision GetXHalfLength1() const { return GetUnplacedVolume()->dx1(); }
0104 
0105   /// Getter for half-length along x at +dz
0106   Precision GetXHalfLength2() const { return GetUnplacedVolume()->dx2(); }
0107 
0108   /// Getter for half-length along y at -dz
0109   Precision GetYHalfLength1() const { return GetUnplacedVolume()->dy1(); }
0110 
0111   /// Getter for half-length along y at +dz
0112   Precision GetYHalfLength2() const { return GetUnplacedVolume()->dy2(); }
0113 
0114   /// Getter for half-length along z
0115   Precision GetZHalfLength() const { return GetUnplacedVolume()->dz(); }
0116 
0117   /// Setter for half-length along x at -dz
0118   void SetXHalfLength1(Precision arg) { const_cast<UnplacedTrd *>(GetUnplacedVolume())->SetXHalfLength1(arg); }
0119 
0120   /// Setter for half-length along x at +dz
0121   void SetXHalfLength2(Precision arg) { const_cast<UnplacedTrd *>(GetUnplacedVolume())->SetXHalfLength2(arg); }
0122 
0123   /// Setter for half-length along y at -dz
0124   void SetYHalfLength1(Precision arg) { const_cast<UnplacedTrd *>(GetUnplacedVolume())->SetYHalfLength1(arg); }
0125 
0126   /// Setter for half-length along y at +dz
0127   void SetYHalfLength2(Precision arg) { const_cast<UnplacedTrd *>(GetUnplacedVolume())->SetYHalfLength2(arg); }
0128 
0129   /// Setter for half-length along z
0130   void SetZHalfLength(Precision arg) { const_cast<UnplacedTrd *>(GetUnplacedVolume())->SetZHalfLength(arg); }
0131 
0132   /// Setter for all parameters
0133   /// @param x1 Half-length along x at the surface positioned at -dz
0134   /// @param x2 Half-length along x at the surface positioned at +dz
0135   /// @param y1 Half-length along y at the surface positioned at -dz
0136   /// @param y2 Half-length along y at the surface positioned at +dz
0137   /// @param z Half-length along z axis
0138   void SetAllParameters(Precision x1, Precision x2, Precision y1, Precision y2, Precision z)
0139   {
0140     const_cast<UnplacedTrd *>(GetUnplacedVolume())->SetAllParameters(x1, x2, y1, y2, z);
0141   }
0142 
0143 #ifndef VECCORE_CUDA
0144   /// Returns memory size in bytes
0145   VECGEOM_FORCE_INLINE
0146   virtual int MemorySize() const override { return sizeof(*this); }
0147 
0148   virtual VPlacedVolume const *ConvertToUnspecialized() const override;
0149 
0150 #ifdef VECGEOM_ROOT
0151   virtual TGeoShape const *ConvertToRoot() const override { return GetUnplacedVolume()->ConvertToRoot(GetName()); }
0152 #endif
0153 #ifdef VECGEOM_GEANT4
0154   G4VSolid const *ConvertToGeant4() const override { return GetUnplacedVolume()->ConvertToGeant4(GetName()); }
0155 #endif
0156 #endif // VECCORE_CUDA
0157 };
0158 
0159 template <typename UnplacedTrd_t>
0160 class SPlacedTrd : public PlacedVolumeImplHelper<UnplacedTrd_t, PlacedTrd> {
0161   using Base = PlacedVolumeImplHelper<UnplacedTrd_t, PlacedTrd>;
0162 
0163 public:
0164   typedef UnplacedTrd UnplacedShape_t;
0165   using Base::Base;
0166 };
0167 
0168 } // namespace VECGEOM_IMPL_NAMESPACE
0169 } // namespace vecgeom
0170 
0171 #endif // VECGEOM_VOLUMES_PLACEDTUBE_H_