Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*
0002  * PlacedCone.h
0003  *
0004  *  Created on: May 14, 2014
0005  *      Author: swenzel
0006  * 20180320 Guilherme Lima  Adapted to new factory of unplaced volumes
0007  */
0008 #ifndef VECGEOM_VOLUMES_PLACEDCONE_H_
0009 #define VECGEOM_VOLUMES_PLACEDCONE_H_
0010 
0011 #include "VecGeom/base/Global.h"
0012 #include "VecGeom/volumes/PlacedVolume.h"
0013 #include "VecGeom/volumes/UnplacedVolume.h"
0014 #include "VecGeom/volumes/kernel/ConeImplementation.h"
0015 #include "VecGeom/volumes/PlacedVolImplHelper.h"
0016 #include "VecGeom/volumes/UnplacedCone.h"
0017 
0018 namespace vecgeom {
0019 
0020 VECGEOM_DEVICE_FORWARD_DECLARE(class PlacedCone;);
0021 VECGEOM_DEVICE_DECLARE_CONV(class, PlacedCone);
0022 
0023 inline namespace VECGEOM_IMPL_NAMESPACE {
0024 
0025 class PlacedCone : public VPlacedVolume {
0026 
0027 public:
0028 #ifndef VECCORE_CUDA
0029   // constructor inheritance;
0030   PlacedCone(char const *const label, LogicalVolume const *const logicalVolume,
0031              Transformation3D const *const transformation)
0032       : VPlacedVolume(label, logicalVolume, transformation)
0033   {
0034   }
0035 
0036   PlacedCone(LogicalVolume const *const logicalVolume, Transformation3D const *const transformation)
0037       : PlacedCone("", logicalVolume, transformation)
0038   {
0039   }
0040 #else
0041   VECCORE_ATT_DEVICE PlacedCone(LogicalVolume const *const logicalVolume, Transformation3D const *const transformation,
0042                                 const int id, const int copy_no, const int child_id)
0043       : VPlacedVolume(logicalVolume, transformation, id, copy_no, child_id)
0044   {
0045   }
0046 #endif
0047 
0048   VECCORE_ATT_HOST_DEVICE
0049   virtual ~PlacedCone() {}
0050 
0051   VECCORE_ATT_HOST_DEVICE
0052   virtual void PrintType() const override;
0053   virtual void PrintType(std::ostream &s) const override;
0054 
0055   VECCORE_ATT_HOST_DEVICE
0056   UnplacedCone const *GetUnplacedVolume() const
0057   {
0058     return static_cast<UnplacedCone const *>(GetLogicalVolume()->GetUnplacedVolume());
0059   }
0060 
0061 #ifndef VECCORE_CUDA
0062   virtual VPlacedVolume const *ConvertToUnspecialized() const override;
0063 #ifdef VECGEOM_ROOT
0064   virtual TGeoShape const *ConvertToRoot() const override { return GetUnplacedVolume()->ConvertToRoot(GetName()); }
0065 #endif
0066 #ifdef VECGEOM_GEANT4
0067   virtual G4VSolid const *ConvertToGeant4() const override { return GetUnplacedVolume()->ConvertToGeant4(GetName()); }
0068 #endif
0069 #endif // VECGEOM_CUDA
0070 
0071   Precision GetRmin1() const { return GetUnplacedVolume()->GetRmin1(); }
0072   Precision GetRmax1() const { return GetUnplacedVolume()->GetRmax1(); }
0073   Precision GetRmin2() const { return GetUnplacedVolume()->GetRmin2(); }
0074   Precision GetRmax2() const { return GetUnplacedVolume()->GetRmax2(); }
0075   Precision GetDz() const { return GetUnplacedVolume()->GetDz(); }
0076   Precision GetSPhi() const { return GetUnplacedVolume()->GetSPhi(); }
0077   Precision GetDPhi() const { return GetUnplacedVolume()->GetDPhi(); }
0078   Precision GetInnerSlope() const { return GetUnplacedVolume()->GetInnerSlope(); }
0079   Precision GetOuterSlope() const { return GetUnplacedVolume()->GetOuterSlope(); }
0080   Precision GetInnerOffset() const { return GetUnplacedVolume()->GetInnerOffset(); }
0081   Precision GetOuterOffset() const { return GetUnplacedVolume()->GetOuterOffset(); }
0082   Precision GetOuterConeApex() const { return GetUnplacedVolume()->GetOuterConeApex(); }
0083 
0084   // interface required by Geant4
0085   Precision GetInnerRadiusMinusZ() const { return GetUnplacedVolume()->GetRmin1(); }
0086   Precision GetOuterRadiusMinusZ() const { return GetUnplacedVolume()->GetRmax1(); }
0087   Precision GetInnerRadiusPlusZ() const { return GetUnplacedVolume()->GetRmin2(); }
0088   Precision GetOuterRadiusPlusZ() const { return GetUnplacedVolume()->GetRmax2(); }
0089   Precision GetZHalfLength() const { return GetUnplacedVolume()->GetDz(); }
0090   Precision GetStartPhiAngle() const { return GetUnplacedVolume()->GetSPhi(); }
0091   Precision GetDeltaPhiAngle() const { return GetUnplacedVolume()->GetDPhi(); }
0092 
0093   void SetInnerRadiusMinusZ(Precision xin) { const_cast<UnplacedCone *>(GetUnplacedVolume())->SetRmin1(xin); }
0094   void SetOuterRadiusMinusZ(Precision xin) { const_cast<UnplacedCone *>(GetUnplacedVolume())->SetRmax1(xin); }
0095   void SetInnerRadiusPlusZ(Precision xin) { const_cast<UnplacedCone *>(GetUnplacedVolume())->SetRmin2(xin); }
0096   void SetOuterRadiusPlusZ(Precision xin) { const_cast<UnplacedCone *>(GetUnplacedVolume())->SetRmax2(xin); }
0097   void SetZHalfLength(Precision xin) { const_cast<UnplacedCone *>(GetUnplacedVolume())->SetDz(xin); }
0098   void SetStartPhiAngle(Precision xin, bool) { const_cast<UnplacedCone *>(GetUnplacedVolume())->SetSPhi(xin); }
0099   void SetDeltaPhiAngle(Precision xin) { const_cast<UnplacedCone *>(GetUnplacedVolume())->SetDPhi(xin); }
0100 }; // end class
0101 
0102 // a placed cone knowing abouts its volume/structural specialization
0103 template <typename UnplacedCone_t>
0104 class SPlacedCone : public PlacedVolumeImplHelper<UnplacedCone_t, PlacedCone> {
0105   using Base = PlacedVolumeImplHelper<UnplacedCone_t, PlacedCone>;
0106 
0107 public:
0108   typedef UnplacedCone UnplacedShape_t;
0109   using Base::Base;
0110 };
0111 } // namespace VECGEOM_IMPL_NAMESPACE
0112 } // namespace vecgeom
0113 
0114 #endif // VECGEOM_VOLUMES_PLACEDCONE_H_