1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
/// @file unplaced_root_volume.h
/// @author Johannes de Fine Licht (johannes.definelicht@cern.ch)
#ifndef VECGEOM_VOLUMES_UNPLACEDROOTVOLUME_H_
#define VECGEOM_VOLUMES_UNPLACEDROOTVOLUME_H_
#include "VecGeom/base/Cuda.h"
#include "VecGeom/base/Global.h"
#include "VecGeom/volumes/UnplacedVolume.h"
#include <TGeoShape.h>
namespace vecgeom {
class UnplacedRootVolume : public VUnplacedVolume {
private:
UnplacedRootVolume(const UnplacedRootVolume &); // Not implemented
UnplacedRootVolume &operator=(const UnplacedRootVolume &); // Not implemented
TGeoShape const *fRootShape;
public:
UnplacedRootVolume(TGeoShape const *const rootShape) : fRootShape(rootShape) {}
virtual ~UnplacedRootVolume() {}
VECGEOM_FORCE_INLINE
TGeoShape const *GetRootShape() const { return fRootShape; }
bool Contains(Vector3D<Precision> const &p) const override { return fRootShape->Contains(&Vector3D<double>(p)[0]); }
EnumInside Inside(Vector3D<Precision> const &point) const override
{
return Contains(point) ? static_cast<EnumInside>(EInside::kInside) : static_cast<EnumInside>(EInside::kOutside);
}
Precision DistanceToIn(Vector3D<Precision> const &position, Vector3D<Precision> const &direction,
const Precision stepMax) const override
{
return GetRootShape()->DistFromOutside(&Vector3D<double>(position)[0], &Vector3D<double>(direction)[0], 3);
}
Precision DistanceToOut(Vector3D<Precision> const &position, Vector3D<Precision> const &direction,
const Precision stepMax) const override
{
return GetRootShape()->DistFromInside(&Vector3D<double>(position)[0], &Vector3D<double>(direction)[0], 3);
}
Precision SafetyToOut(Vector3D<Precision> const &position) const override
{
return GetRootShape()->Safety(&Vector3D<double>(position)[0], true);
}
Precision SafetyToIn(Vector3D<Precision> const &position) const override
{
return GetRootShape()->Safety(&Vector3D<double>(position)[0], false);
}
Precision Capacity() const override { return GetRootShape()->Capacity(); }
Precision SurfaceArea() const override { return 0.; /*GetRootShape()->SurfaceArea();*/ }
VECGEOM_FORCE_INLINE
int MemorySize() const override { return sizeof(*this); }
void Print() const override;
void Print(std::ostream &os) const override;
#ifdef VECGEOM_CUDA_INTERFACE
virtual size_t DeviceSizeOf() const override { return 0; /* DevicePtr<cuda::UnplacedRootVolume>::SizeOf(); */ }
virtual DevicePtr<cuda::VUnplacedVolume> CopyToGpu() const override;
virtual DevicePtr<cuda::VUnplacedVolume> CopyToGpu(DevicePtr<cuda::VUnplacedVolume> const gpu_ptr) const override;
#endif
private:
virtual VPlacedVolume *SpecializedVolume(LogicalVolume const *const volume,
Transformation3D const *const transformation,
const TranslationCode trans_code, const RotationCode rot_code,
VPlacedVolume *const placement = NULL) const override;
};
} // End namespace vecgeom
#endif // VECGEOM_VOLUMES_UNPLACEDROOTVOLUME_H_
|