18#include "volumes/PlacedVolume.h"
19#include "volumes/UnplacedVolume.h"
20#include "volumes/UnplacedBox.h"
21#include "volumes/UnplacedTube.h"
22#include "volumes/UnplacedCone.h"
23#include "volumes/UnplacedParaboloid.h"
24#include "volumes/UnplacedParallelepiped.h"
25#include "volumes/UnplacedPolyhedron.h"
26#include "volumes/UnplacedTrd.h"
27#include "volumes/UnplacedOrb.h"
28#include "volumes/UnplacedSphere.h"
29#include "volumes/UnplacedBooleanVolume.h"
30#include "volumes/UnplacedTorus2.h"
31#include "volumes/UnplacedTrapezoid.h"
32#include "volumes/UnplacedPolycone.h"
33#include "volumes/UnplacedScaledShape.h"
34#include "volumes/UnplacedGenTrap.h"
35#include "volumes/UnplacedSExtruVolume.h"
86 if (!vgshape)
return nullptr;
97 vecgeom::cxx::VUnplacedVolume *unplaced =
Convert(shape);
98 if (!unplaced)
return nullptr;
101 vecgeom::cxx::LogicalVolume *lvol =
new vecgeom::cxx::LogicalVolume(
"", unplaced);
102 return ( lvol->Place() );
111 vecgeom::cxx::Transformation3D *
const transformation =
112 new vecgeom::cxx::Transformation3D(t[0], t[1], t[2],
r[0],
r[1],
r[2],
r[3],
r[4],
r[5],
r[6],
r[7],
r[8]);
113 return transformation;
122 VUnplacedVolume *unplaced_volume =
nullptr;
127 unplaced_volume =
new UnplacedBox(
box->GetDX(),
box->GetDY(),
box->GetDZ());
133 unplaced_volume =
new GenericUnplacedTube(tube->
GetRmin(), tube->
GetRmax(), tube->
GetDz(), 0., kTwoPi);
156 cone->
GetDz(), 0., kTwoPi);
175 unplaced_volume =
new UnplacedPolyhedron(pgon->
GetPhi1(),
210 unplaced_volume =
new UnplacedOrb(p->
GetRmax());
228 if (!leftunplaced || !rightunplaced) {
233 delete rightunplaced;
237 assert(leftunplaced !=
nullptr);
238 assert(rightunplaced !=
nullptr);
241 VPlacedVolume *
const leftplaced = (
new LogicalVolume(
"inner_virtual", leftunplaced))->Place(lefttrans);
243 VPlacedVolume *
const rightplaced = (
new LogicalVolume(
"inner_virtual", rightunplaced))->Place(righttrans);
247 unplaced_volume =
new UnplacedBooleanVolume(kSubtraction, leftplaced, rightplaced);
249 unplaced_volume =
new UnplacedBooleanVolume(kIntersection, leftplaced, rightplaced);
251 unplaced_volume =
new UnplacedBooleanVolume(kUnion, leftplaced, rightplaced);
266 unplaced_volume =
new UnplacedPolycone(p->
GetPhi1() * kDegToRad, p->
GetDphi() * kDegToRad, p->
GetNz(), p->
GetZ(),
275 if (!referenced_shape)
return nullptr;
277 unplaced_volume =
new UnplacedScaledShape(referenced_shape, scale_root[0], scale_root[1], scale_root[2]);
285 GenericUnplacedTube *tubeUnplaced =
new GenericUnplacedTube(0, p->
GetA(), p->
GetDZ(), 0, kTwoPi);
286 unplaced_volume =
new UnplacedScaledShape(tubeUnplaced, 1., p->
GetB() / p->
GetA(), 1.);
293 std::vector<Vector3D<Precision>> vertexlist;
296 for (
auto ivert = 0; ivert < 8; ++ivert) {
297 verticesx[ivert] = vertices[2 * ivert];
298 verticesy[ivert] = vertices[2 * ivert + 1];
300 unplaced_volume =
new UnplacedGenTrap(verticesx, verticesy, p->
GetDz());
307 if (p->
GetNz() == 2) {
309 size_t Nvert = (size_t)p->
GetNvert();
310 double *
x =
new double[Nvert];
311 double *
y =
new double[Nvert];
312 for (
size_t i = 0; i < Nvert; ++i) {
317 if (PlanarPolygon::GetOrientation(
x,
y, Nvert) > 0.) {
319 for (
size_t i = 0; i < Nvert; ++i) {
320 x[Nvert - 1 - i] = p->
GetX(i);
321 y[Nvert - 1 - i] = p->
GetY(i);
324 unplaced_volume =
new UnplacedSExtruVolume(p->
GetNvert(),
x,
y, p->
GetZ()[0], p->
GetZ()[1]);
329 if (!unplaced_volume) {
330 printf(
"Unsupported shape for ROOT shape \"%s\" of type %s. "
331 "Using ROOT implementation.\n",
336 return ( unplaced_volume );
360 vecgeom::cxx::Vector3D<Double_t> vnorm;
361 fVGShape->Normal(vecgeom::cxx::Vector3D<Double_t>(point[0], point[1], point[2]), vnorm);
362 norm[0] = vnorm.x(); norm[1] = vnorm.y(), norm[2] = vnorm.z();
370 return (
fVGShape->Contains(vecgeom::cxx::Vector3D<Double_t>(point[0], point[1], point[2])) );
378 Double_t dist =
fVGShape->DistanceToOut(vecgeom::cxx::Vector3D<Double_t>(point[0], point[1], point[2]),
379 vecgeom::cxx::Vector3D<Double_t>(dir[0], dir[1], dir[2]), step);
388 Double_t dist =
fVGShape->DistanceToIn(vecgeom::cxx::Vector3D<Double_t>(point[0], point[1], point[2]),
389 vecgeom::cxx::Vector3D<Double_t>(dir[0], dir[1], dir[2]), step);
397 Double_t safety = (in) ?
fVGShape->SafetyToOut(vecgeom::cxx::Vector3D<Double_t>(point[0], point[1], point[2]))
398 :
fVGShape->SafetyToIn(vecgeom::cxx::Vector3D<Double_t>(point[0], point[1], point[2]));
399 return ( (safety < 0.)? 0. : safety );
407 fVGShape->GetUnplacedVolume()->Print();
An arbitrary trapezoid with less than 8 vertices standing on two parallel planes perpendicular to Z a...
virtual Double_t GetDZ() const
void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0)
Set parameters of the box.
Base class for Boolean operations between two shapes.
virtual EGeoBoolType GetBooleanOperator() const =0
TGeoMatrix * GetRightMatrix() const
TGeoShape * GetLeftShape() const
TGeoMatrix * GetLeftMatrix() const
TGeoShape * GetRightShape() const
Class handling Boolean composition of shapes.
TGeoBoolNode * GetBoolNode() const
A phi segment of a conical tube.
virtual Double_t GetRmax2() const
virtual Double_t GetDz() const
virtual Double_t GetRmin2() const
virtual Double_t GetRmin1() const
virtual Double_t GetRmax1() const
virtual Double_t GetA() const
virtual Double_t GetB() const
Geometrical transformation package.
virtual const Double_t * GetTranslation() const =0
virtual const Double_t * GetRotationMatrix() const =0
Double_t GetAlpha() const
Double_t GetTheta() const
Double_t * GetRmax() const
Double_t * GetRmin() const
virtual const Double_t * GetScale() const
A shape scaled by a TGeoScale transformation.
TGeoShape * GetShape() const
TGeoScale * GetScale() const
Base abstract class for all shapes.
virtual const char * GetName() const
Get the shape name.
virtual void ComputeBBox()=0
virtual Double_t GetRmin() const
Double_t GetTheta2() const
virtual Double_t GetRmax() const
Double_t GetTheta1() const
TRAP is a general trapezoid, i.e.
Double_t GetAlpha2() const
Double_t GetTheta() const
Double_t GetAlpha1() const
A trapezoid with only x length varying with z.
A trapezoid with both x and y lengths varying with z.
virtual Double_t GetRmin() const
virtual Double_t GetDz() const
virtual Double_t GetRmax() const
Bridge class for using a VecGeom solid as TGeoShape.
static vecgeom::cxx::VPlacedVolume * CreateVecGeomSolid(TGeoShape *shape)
Conversion method to create VecGeom solid corresponding to TGeoShape.
static TGeoVGShape * Create(TGeoShape *shape)
Factory creating TGeoVGShape from a Root shape.
virtual void ComputeBBox()
Compute bounding box.
virtual Bool_t Contains(const Double_t *point) const
Test if point is inside this shape.
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Normal computation.
virtual ~TGeoVGShape()
Destructor.
virtual Double_t Capacity() const
Returns analytic capacity of the solid.
vecgeom::cxx::VPlacedVolume * fVGShape
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
Compute distance from outside point to surface of the box.
virtual void InspectShape() const
Print info about the VecGeom solid.
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const
Computes the closest distance from given point to this shape.
virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
Compute distance from inside point to surface of the box.
static vecgeom::cxx::Transformation3D * Convert(TGeoMatrix const *const geomatrix)
Convert a TGeoMatrix to a TRansformation3D.
An extrusion with fixed outline shape in x-y and a sequence of z extents (segments).
Double_t GetY(Int_t i) const
Double_t GetX(Int_t i) const
virtual const char * ClassName() const
Returns name of class to which the object belongs.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
std::string GetName(const std::string &scope_name)
double dist(Rotation3D const &r1, Rotation3D const &r2)
RooCmdArg Precision(Double_t prec)