Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-03-13 09:29:26

0001 /// \file PlacedGenTrap.h
0002 /// \author: swenzel
0003 /// Created on: Aug 3, 2014
0004 ///  Modified and completed: mihaela.gheata@cern.ch
0005 
0006 #ifndef VECGEOM_VOLUMES_PLACEDGENTRAP_H_
0007 #define VECGEOM_VOLUMES_PLACEDGENTRAP_H_
0008 
0009 #include "VecGeom/base/Global.h"
0010 #include "VecGeom/volumes/PlacedVolume.h"
0011 #include "VecGeom/volumes/UnplacedGenTrap.h"
0012 #include "VecGeom/volumes/kernel/GenTrapImplementation.h"
0013 #include "VecGeom/volumes/PlacedVolImplHelper.h"
0014 
0015 namespace vecgeom {
0016 
0017 VECGEOM_DEVICE_FORWARD_DECLARE(class PlacedGenTrap;);
0018 VECGEOM_DEVICE_DECLARE_CONV(class, PlacedGenTrap);
0019 
0020 inline namespace VECGEOM_IMPL_NAMESPACE {
0021 
0022 class Transformation3D;
0023 
0024 class PlacedGenTrap : public PlacedVolumeImplHelper<UnplacedGenTrap, VPlacedVolume> {
0025   using Base = PlacedVolumeImplHelper<UnplacedGenTrap, VPlacedVolume>;
0026 
0027 public:
0028 #ifndef VECCORE_CUDA
0029 
0030   /** @brief PlacedGenTrap constructor
0031    * @param label Name of the object
0032    * @param logicalVolume Logical volume
0033    * @param transformation Transformation matrix (local to mother)
0034    * @param halfzheight The half-height of the GenTrap
0035    */
0036   // constructor inheritance;
0037   using Base::Base;
0038   PlacedGenTrap(char const *const label, LogicalVolume const *const logicalVolume,
0039                 Transformation3D const *const transformation)
0040       : Base(label, logicalVolume, transformation)
0041   {
0042   }
0043 
0044   /** @brief PlacedGenTrap constructor
0045    * @param logicalVolume Logical volume
0046    * @param transformation Transformation matrix (local to mother)
0047    * @param halfzheight The half-height of the GenTrap
0048    */
0049   PlacedGenTrap(LogicalVolume const *const logicalVolume, Transformation3D const *const transformation)
0050       : PlacedGenTrap("", logicalVolume, transformation)
0051   {
0052   }
0053 
0054 #else
0055 
0056   /** @brief PlacedGenTrap device constructor
0057    * @param logicalVolume Logical volume
0058    * @param transformation Transformation matrix (local to mother)
0059    * @param halfzheight The half-height of the GenTrap
0060    */
0061   VECCORE_ATT_DEVICE PlacedGenTrap(LogicalVolume const *const logicalVolume,
0062                                    Transformation3D const *const transformation, const int id, const int copy_no,
0063                                    const int child_id)
0064       : Base(logicalVolume, transformation, id, copy_no, child_id)
0065   {
0066   }
0067 
0068 #endif
0069   /** @brief PlacedGenTrap destructor */
0070   VECCORE_ATT_HOST_DEVICE
0071   virtual ~PlacedGenTrap() {}
0072 
0073   /** @brief Getter for unplaced volume */
0074   VECCORE_ATT_HOST_DEVICE
0075   UnplacedGenTrap const *GetUnplacedVolume() const
0076   {
0077     return static_cast<UnplacedGenTrap const *>(GetLogicalVolume()->GetUnplacedVolume());
0078   }
0079 
0080   /** @brief Getter for one of the 8 vertices in Vector3D<Precision> form */
0081   VECCORE_ATT_HOST_DEVICE
0082   Vector3D<Precision> const &GetVertex(int i) const { return GetUnplacedVolume()->GetVertex(i); }
0083 
0084   /** @brief Getter for the half-height */
0085   VECCORE_ATT_HOST_DEVICE
0086   Precision GetDZ() const { return GetUnplacedVolume()->GetDZ(); }
0087 
0088   /** @brief Print type name */
0089   VECCORE_ATT_HOST_DEVICE
0090   void PrintType() const override;
0091 
0092   /** @brief Print type name */
0093   void PrintType(std::ostream &os) const override;
0094 
0095   // CUDA specific
0096 
0097   /** @brief Memory size in bytes */
0098   VECGEOM_FORCE_INLINE
0099   virtual int MemorySize() const override { return sizeof(*this); }
0100 
0101   // Comparison specific
0102 
0103 #ifndef VECCORE_CUDA
0104   /** @brief Convert to unspecialized placement */
0105   virtual VPlacedVolume const *ConvertToUnspecialized() const override;
0106 #ifdef VECGEOM_ROOT
0107   /** @brief Convert to ROOT shape */
0108   virtual TGeoShape const *ConvertToRoot() const override;
0109 #endif
0110 #ifdef VECGEOM_GEANT4
0111   /** @brief Convert to Geant4 solid */
0112   virtual G4VSolid const *ConvertToGeant4() const override;
0113 #endif
0114 
0115 #endif // VECCORE_CUDA
0116 };
0117 } // namespace VECGEOM_IMPL_NAMESPACE
0118 } // namespace vecgeom
0119 
0120 #endif /* VECGEOM_VOLUMES_PLACEDGENTRAP_H_ */