Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeoVGShape.cxx
Go to the documentation of this file.
1// Author: Mihaela Gheata 30/03/16
2/*************************************************************************
3 * Copyright (C) 1995-2016, Rene Brun and Fons Rademakers. *
4 * All rights reserved. *
5 * *
6 * For the licensing terms see $ROOTSYS/LICENSE. *
7 * For the list of contributors see $ROOTSYS/README/CREDITS. *
8 *************************************************************************/
9
10/** \class TGeoVGShape
11\ingroup Geometry_classes
12
13Bridge class for using a VecGeom solid as TGeoShape.
14*/
15
16#include "TGeoVGShape.h"
18
19#include "VecGeom/volumes/PlacedVolume.h"
20#include "VecGeom/volumes/UnplacedVolume.h"
21#include "VecGeom/volumes/UnplacedBox.h"
22#include "VecGeom/volumes/UnplacedTube.h"
23#include "VecGeom/volumes/UnplacedCone.h"
24#include "VecGeom/volumes/UnplacedParaboloid.h"
25#include "VecGeom/volumes/UnplacedParallelepiped.h"
26#include "VecGeom/volumes/UnplacedPolyhedron.h"
27#include "VecGeom/volumes/UnplacedTrd.h"
28#include "VecGeom/volumes/UnplacedOrb.h"
29#include "VecGeom/volumes/UnplacedSphere.h"
30#include "VecGeom/volumes/UnplacedBooleanVolume.h"
31#include "VecGeom/volumes/UnplacedTorus2.h"
32#include "VecGeom/volumes/UnplacedTrapezoid.h"
33#include "VecGeom/volumes/UnplacedPolycone.h"
34#include "VecGeom/volumes/UnplacedScaledShape.h"
35#include "VecGeom/volumes/UnplacedGenTrap.h"
36#include "VecGeom/volumes/UnplacedSExtruVolume.h"
37#include "VecGeom/volumes/UnplacedTessellated.h"
38#include "VecGeom/volumes/UnplacedEllipticalTube.h"
39#include "VecGeom/volumes/UnplacedHype.h"
40#include "VecGeom/volumes/UnplacedCutTube.h"
41
42#include "TError.h"
43#include "TBuffer.h"
44#include "TGeoManager.h"
45#include "TGeoMaterial.h"
46#include "TGeoMedium.h"
47#include "TGeoVolume.h"
48#include "TGeoArb8.h"
49#include "TGeoTube.h"
50#include "TGeoCone.h"
51#include "TGeoPara.h"
52#include "TGeoParaboloid.h"
53#include "TGeoTrd1.h"
54#include "TGeoTrd2.h"
55#include "TGeoPcon.h"
56#include "TGeoPgon.h"
57#include "TGeoSphere.h"
58#include "TGeoBoolNode.h"
59#include "TGeoCompositeShape.h"
60#include "TGeoScaledShape.h"
61#include "TGeoTorus.h"
62#include "TGeoEltu.h"
63#include "TGeoXtru.h"
64#include "TGeoTessellated.h"
65#include "TGeoHype.h"
66#include "TGeoShapeAssembly.h"
67
68////////////////////////////////////////////////////////////////////////////////
69/// Default constructor
70
71TGeoVGShape::TGeoVGShape(TGeoShape *shape, vecgeom::cxx::VPlacedVolume *vgshape)
72 : TGeoBBox(shape->GetName(), 0, 0, 0), fVGShape(vgshape), fShape(shape)
73{
74 // Copy box parameters from the original ROOT shape
75 const TGeoBBox *box = (const TGeoBBox *)shape;
76 TGeoBBox::SetBoxDimensions(box->GetDX(), box->GetDY(), box->GetDZ());
77 memcpy(fOrigin, box->GetOrigin(), 3 * sizeof(Double_t));
78}
79
80////////////////////////////////////////////////////////////////////////////////
81/// Destructor
82
84{
85 // Cleanup only the VecGeom solid, the ROOT shape is cleaned by TGeoManager
86 delete fVGShape;
87}
88
89////////////////////////////////////////////////////////////////////////////////
90/// Factory creating TGeoVGShape from a Root shape. Returns nullptr if the
91/// shape cannot be converted
92
94{
95 vecgeom::cxx::VPlacedVolume *vgshape = TGeoVGShape::CreateVecGeomSolid(shape);
96 if (!vgshape)
97 return nullptr;
98 return (new TGeoVGShape(shape, vgshape));
99}
100
101////////////////////////////////////////////////////////////////////////////////
102/// Conversion method to create VecGeom solid corresponding to TGeoShape
103
104vecgeom::cxx::VPlacedVolume *TGeoVGShape::CreateVecGeomSolid(TGeoShape *shape)
105{
106 // Call VecGeom TGeoShape->UnplacedSolid converter
107 // VUnplacedVolume *unplaced = RootGeoManager::Instance().Convert(shape);
108 vecgeom::cxx::VUnplacedVolume *unplaced = Convert(shape);
109 if (!unplaced)
110 return nullptr;
111 // We have to create a placed volume from the unplaced one to have access
112 // to the navigation interface
113 vecgeom::cxx::LogicalVolume *lvol = new vecgeom::cxx::LogicalVolume("", unplaced);
114 return (lvol->Place());
115}
116
117////////////////////////////////////////////////////////////////////////////////
118/// Convert a TGeoMatrix to a TRansformation3D
119
120vecgeom::cxx::Transformation3D *TGeoVGShape::Convert(TGeoMatrix const *const geomatrix)
121{
122 Double_t const *const t = geomatrix->GetTranslation();
123 Double_t const *const r = geomatrix->GetRotationMatrix();
124 vecgeom::cxx::Transformation3D *const transformation =
125 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]);
126 return transformation;
127}
128
129////////////////////////////////////////////////////////////////////////////////
130/// Convert a TGeo shape to VUnplacedVolume, then creates a VPlacedVolume
131
132vecgeom::cxx::VUnplacedVolume *TGeoVGShape::Convert(TGeoShape const *const shape)
133{
134 using namespace vecgeom;
135 using Vector3D = vecgeom::cxx::Vector3D<Precision>;
136 VUnplacedVolume *unplaced_volume = nullptr;
137
138 // THE BOX
139 if (shape->IsA() == TGeoBBox::Class()) {
140 TGeoBBox const *const box = static_cast<TGeoBBox const *>(shape);
141 unplaced_volume = GeoManager::MakeInstance<UnplacedBox>(box->GetDX(), box->GetDY(), box->GetDZ());
142 }
143
144 // THE TUBE
145 if (shape->IsA() == TGeoTube::Class()) {
146 TGeoTube const *const tube = static_cast<TGeoTube const *>(shape);
147 unplaced_volume =
148 GeoManager::MakeInstance<UnplacedTube>(tube->GetRmin(), tube->GetRmax(), tube->GetDz(), 0., kTwoPi);
149 }
150
151 // THE TUBESEG
152 if (shape->IsA() == TGeoTubeSeg::Class()) {
153 TGeoTubeSeg const *const tube = static_cast<TGeoTubeSeg const *>(shape);
154 unplaced_volume = GeoManager::MakeInstance<UnplacedTube>(tube->GetRmin(), tube->GetRmax(), tube->GetDz(),
155 kDegToRad * tube->GetPhi1(),
156 kDegToRad * (tube->GetPhi2() - tube->GetPhi1()));
157 }
158
159 // THE CONESEG
160 if (shape->IsA() == TGeoConeSeg::Class()) {
161 TGeoConeSeg const *const cone = static_cast<TGeoConeSeg const *>(shape);
162 unplaced_volume = GeoManager::MakeInstance<UnplacedCone>(
163 cone->GetRmin1(), cone->GetRmax1(), cone->GetRmin2(), cone->GetRmax2(), cone->GetDz(),
164 kDegToRad * cone->GetPhi1(), kDegToRad * (cone->GetPhi2() - cone->GetPhi1()));
165 }
166
167 // THE CONE
168 if (shape->IsA() == TGeoCone::Class()) {
169 TGeoCone const *const cone = static_cast<TGeoCone const *>(shape);
170 unplaced_volume = GeoManager::MakeInstance<UnplacedCone>(cone->GetRmin1(), cone->GetRmax1(), cone->GetRmin2(),
171 cone->GetRmax2(), cone->GetDz(), 0., kTwoPi);
172 }
173
174 // THE PARABOLOID
175 if (shape->IsA() == TGeoParaboloid::Class()) {
176 TGeoParaboloid const *const p = static_cast<TGeoParaboloid const *>(shape);
177 unplaced_volume = GeoManager::MakeInstance<UnplacedParaboloid>(p->GetRlo(), p->GetRhi(), p->GetDz());
178 }
179
180 // THE PARALLELEPIPED
181 if (shape->IsA() == TGeoPara::Class()) {
182 TGeoPara const *const p = static_cast<TGeoPara const *>(shape);
183 unplaced_volume = GeoManager::MakeInstance<UnplacedParallelepiped>(p->GetX(), p->GetY(), p->GetZ(), p->GetAlpha(),
184 p->GetTheta(), p->GetPhi());
185 }
186
187 // Polyhedron/TGeoPgon
188 if (shape->IsA() == TGeoPgon::Class()) {
189 TGeoPgon const *pgon = static_cast<TGeoPgon const *>(shape);
190 unplaced_volume = GeoManager::MakeInstance<UnplacedPolyhedron>(pgon->GetPhi1(), // phiStart
191 pgon->GetDphi(), // phiEnd
192 pgon->GetNedges(), // sideCount
193 pgon->GetNz(), // zPlaneCount
194 pgon->GetZ(), // zPlanes
195 pgon->GetRmin(), // rMin
196 pgon->GetRmax() // rMax
197 );
198 }
199
200 // TRD2
201 if (shape->IsA() == TGeoTrd2::Class()) {
202 TGeoTrd2 const *const p = static_cast<TGeoTrd2 const *>(shape);
203 unplaced_volume =
204 GeoManager::MakeInstance<UnplacedTrd>(p->GetDx1(), p->GetDx2(), p->GetDy1(), p->GetDy2(), p->GetDz());
205 }
206
207 // TRD1
208 if (shape->IsA() == TGeoTrd1::Class()) {
209 TGeoTrd1 const *const p = static_cast<TGeoTrd1 const *>(shape);
210 unplaced_volume = GeoManager::MakeInstance<UnplacedTrd>(p->GetDx1(), p->GetDx2(), p->GetDy(), p->GetDz());
211 }
212
213 // TRAPEZOID
214 if (shape->IsA() == TGeoTrap::Class()) {
215 TGeoTrap const *const p = static_cast<TGeoTrap const *>(shape);
216 unplaced_volume = GeoManager::MakeInstance<UnplacedTrapezoid>(
217 p->GetDz(), p->GetTheta() * kDegToRad, p->GetPhi() * kDegToRad, p->GetH1(), p->GetBl1(), p->GetTl1(),
218 std::tan(p->GetAlpha1() * kDegToRad), p->GetH2(), p->GetBl2(), p->GetTl2(),
219 std::tan(p->GetAlpha2() * kDegToRad));
220 }
221
222 // THE SPHERE | ORB
223 if (shape->IsA() == TGeoSphere::Class()) {
224 // make distinction
225 TGeoSphere const *const p = static_cast<TGeoSphere const *>(shape);
226 if (p->GetRmin() == 0. && p->GetTheta2() - p->GetTheta1() == 180. && p->GetPhi2() - p->GetPhi1() == 360.) {
227 unplaced_volume = GeoManager::MakeInstance<UnplacedOrb>(p->GetRmax());
228 } else {
229 unplaced_volume = GeoManager::MakeInstance<UnplacedSphere>(
230 p->GetRmin(), p->GetRmax(), p->GetPhi1() * kDegToRad, (p->GetPhi2() - p->GetPhi1()) * kDegToRad,
231 p->GetTheta1() * kDegToRad, (p->GetTheta2() - p->GetTheta1()) * kDegToRad);
232 }
233 }
234
235 if (shape->IsA() == TGeoCompositeShape::Class()) {
236 TGeoCompositeShape const *const compshape = static_cast<TGeoCompositeShape const *>(shape);
237 TGeoBoolNode const *const boolnode = compshape->GetBoolNode();
238
239 // need the matrix;
240 Transformation3D const *lefttrans = Convert(boolnode->GetLeftMatrix());
241 Transformation3D const *righttrans = Convert(boolnode->GetRightMatrix());
242 // unplaced shapes
243 VUnplacedVolume const *leftunplaced = Convert(boolnode->GetLeftShape());
244 VUnplacedVolume const *rightunplaced = Convert(boolnode->GetRightShape());
245 if (!leftunplaced || !rightunplaced) {
246 // If one of the components cannot be converted, cleanup & return nullptr
247 delete lefttrans;
248 delete righttrans;
249 delete leftunplaced;
250 delete rightunplaced;
251 return nullptr;
252 }
253
254 assert(leftunplaced != nullptr);
255 assert(rightunplaced != nullptr);
256
257 // the problem is that I can only place logical volumes
258 VPlacedVolume *const leftplaced = (new LogicalVolume("inner_virtual", leftunplaced))->Place(lefttrans);
259
260 VPlacedVolume *const rightplaced = (new LogicalVolume("inner_virtual", rightunplaced))->Place(righttrans);
261
262 // now it depends on concrete type
264 unplaced_volume =
265 GeoManager::MakeInstance<UnplacedBooleanVolume<kSubtraction>>(kSubtraction, leftplaced, rightplaced);
266 } else if (boolnode->GetBooleanOperator() == TGeoBoolNode::kGeoIntersection) {
267 unplaced_volume =
268 GeoManager::MakeInstance<UnplacedBooleanVolume<kIntersection>>(kIntersection, leftplaced, rightplaced);
269 } else if (boolnode->GetBooleanOperator() == TGeoBoolNode::kGeoUnion) {
270 unplaced_volume = GeoManager::MakeInstance<UnplacedBooleanVolume<kUnion>>(kUnion, leftplaced, rightplaced);
271 }
272 }
273
274 // THE TORUS
275 if (shape->IsA() == TGeoTorus::Class()) {
276 // make distinction
277 TGeoTorus const *const p = static_cast<TGeoTorus const *>(shape);
278 unplaced_volume = GeoManager::MakeInstance<UnplacedTorus2>(p->GetRmin(), p->GetRmax(), p->GetR(),
279 p->GetPhi1() * kDegToRad, p->GetDphi() * kDegToRad);
280 }
281
282 // THE POLYCONE
283 if (shape->IsA() == TGeoPcon::Class()) {
284 TGeoPcon const *const p = static_cast<TGeoPcon const *>(shape);
285 unplaced_volume = GeoManager::MakeInstance<UnplacedPolycone>(p->GetPhi1() * kDegToRad, p->GetDphi() * kDegToRad,
286 p->GetNz(), p->GetZ(), p->GetRmin(), p->GetRmax());
287 }
288
289 // THE SCALED SHAPE
290 if (shape->IsA() == TGeoScaledShape::Class()) {
291 TGeoScaledShape const *const p = static_cast<TGeoScaledShape const *>(shape);
292 // First convert the referenced shape
293 VUnplacedVolume *referenced_shape = Convert(p->GetShape());
294 if (!referenced_shape)
295 return nullptr;
296 const double *scale_root = p->GetScale()->GetScale();
297 unplaced_volume =
298 GeoManager::MakeInstance<UnplacedScaledShape>(referenced_shape, scale_root[0], scale_root[1], scale_root[2]);
299 }
300
301 // THE CUT TUBE
302 if (shape->IsA() == TGeoCtub::Class()) {
303 TGeoCtub const *const p = static_cast<TGeoCtub const *>(shape);
304 auto low = p->GetNlow();
305 auto high = p->GetNhigh();
306 auto const bottomNormal = Vector3D{low[0], low[1], low[2]};
307 auto const topNormal = Vector3D{high[0], high[1], high[2]};
308
309 unplaced_volume =
310 GeoManager::MakeInstance<UnplacedCutTube>(p->GetRmin(), p->GetRmax(), p->GetDz(), kDegToRad * p->GetPhi1(),
311 kDegToRad * (p->GetPhi2() - p->GetPhi1()), bottomNormal, topNormal);
312 }
313
314 // THE ELLIPTICAL TUBE
315 if (shape->IsA() == TGeoEltu::Class()) {
316 TGeoEltu const *const p = static_cast<TGeoEltu const *>(shape);
317 unplaced_volume = GeoManager::MakeInstance<UnplacedEllipticalTube>(p->GetA(), p->GetB(), p->GetDz());
318 }
319
320 // THE HYPERBOLOID
321 if (shape->IsA() == TGeoHype::Class()) {
322 TGeoHype const *const p = static_cast<TGeoHype const *>(shape);
323 unplaced_volume = GeoManager::MakeInstance<UnplacedHype>(p->GetRmin(), p->GetRmax(), kDegToRad * p->GetStIn(),
324 kDegToRad * p->GetStOut(), p->GetDz());
325 }
326
327 // THE ARB8
328 if (shape->IsA() == TGeoArb8::Class() || shape->IsA() == TGeoGtra::Class()) {
329 TGeoArb8 *p = (TGeoArb8 *)(shape);
330 // Create the corresponding GenTrap
331 const double *vertices = p->GetVertices();
332 Precision verticesx[8], verticesy[8];
333 for (auto ivert = 0; ivert < 8; ++ivert) {
334 verticesx[ivert] = vertices[2 * ivert];
335 verticesy[ivert] = vertices[2 * ivert + 1];
336 }
337 unplaced_volume = GeoManager::MakeInstance<UnplacedGenTrap>(verticesx, verticesy, p->GetDz());
338 }
339
340 // THE SIMPLE XTRU
341 if (shape->IsA() == TGeoXtru::Class()) {
342 TGeoXtru *p = (TGeoXtru *)(shape);
343 // analyse convertibility
344 if (p->GetNz() == 2) {
345 // add check on scaling and distortions
346 size_t Nvert = (size_t)p->GetNvert();
347 double *x = new double[Nvert];
348 double *y = new double[Nvert];
349 for (size_t i = 0; i < Nvert; ++i) {
350 x[i] = p->GetX(i);
351 y[i] = p->GetY(i);
352 }
353 // check in which orientation the polygon in given
354 if (PlanarPolygon::GetOrientation(x, y, Nvert) > 0.) {
355 // std::cerr << "Points not given in clockwise order ... reordering \n";
356 for (size_t i = 0; i < Nvert; ++i) {
357 x[Nvert - 1 - i] = p->GetX(i);
358 y[Nvert - 1 - i] = p->GetY(i);
359 }
360 }
361 unplaced_volume =
362 GeoManager::MakeInstance<UnplacedSExtruVolume>(p->GetNvert(), x, y, p->GetZ()[0], p->GetZ()[1]);
363 delete[] x;
364 delete[] y;
365 }
366 }
367
368 // THE TESSELLATED
369 if (shape->IsA() == TGeoTessellated::Class()) {
370 TGeoTessellated const *const tsl = static_cast<TGeoTessellated const *>(shape);
371 unplaced_volume = GeoManager::MakeInstance<UnplacedTessellated>();
372 auto vtsl = static_cast<UnplacedTessellated *>(unplaced_volume);
373
374 for (auto i = 0; i < tsl->GetNfacets(); ++i) {
375 auto const &facet = tsl->GetFacet(i);
376 int nvert = facet.GetNvert();
377 auto const &v0 = tsl->GetVertex(facet[0]);
378 auto const &v1 = tsl->GetVertex(facet[1]);
379 auto const &v2 = tsl->GetVertex(facet[2]);
380 if (nvert == 3) {
381 vtsl->AddTriangularFacet(Vector3D(v0[0], v0[1], v0[2]), Vector3D(v1[0], v1[1], v1[2]),
382 Vector3D(v2[0], v2[1], v2[2]));
383 } else if (nvert == 4) {
384 auto const &v3 = tsl->GetVertex(facet[3]);
385 vtsl->AddQuadrilateralFacet(Vector3D(v0[0], v0[1], v0[2]), Vector3D(v1[0], v1[1], v1[2]),
386 Vector3D(v2[0], v2[1], v2[2]), Vector3D(v3[0], v3[1], v3[2]));
387 } else {
388 return nullptr; // should never happen
389 }
390 }
391 vtsl->Close();
392 }
393
394 // ASSEMBLY
395 if (shape->IsA() == TGeoShapeAssembly::Class()) {
396 // Assemblies are handled by ROOT
397 return nullptr;
398 }
399
400 // New volumes should be implemented here...
401 if (!unplaced_volume) {
402 printf("Unsupported shape for ROOT shape \"%s\" of type %s. "
403 "Using ROOT implementation.\n",
404 shape->GetName(), shape->ClassName());
405 return nullptr;
406 }
407
408 return (unplaced_volume);
409}
410
411////////////////////////////////////////////////////////////////////////////////
412/// Compute bounding box.
413
415{
417}
418
419////////////////////////////////////////////////////////////////////////////////
420/// Returns analytic capacity of the solid
421
423{
424 return fVGShape->Capacity();
425}
426
427////////////////////////////////////////////////////////////////////////////////
428/// Normal computation.
429
430void TGeoVGShape::ComputeNormal(const Double_t *point, const Double_t * /*dir*/, Double_t *norm)
431{
432 vecgeom::cxx::Vector3D<Double_t> vnorm;
433 fVGShape->Normal(vecgeom::cxx::Vector3D<Double_t>(point[0], point[1], point[2]), vnorm);
434 norm[0] = vnorm.x();
435 norm[1] = vnorm.y(), norm[2] = vnorm.z();
436}
437
438////////////////////////////////////////////////////////////////////////////////
439/// Test if point is inside this shape.
440
442{
443 return (fVGShape->Contains(vecgeom::cxx::Vector3D<Double_t>(point[0], point[1], point[2])));
444}
445
446////////////////////////////////////////////////////////////////////////////////
447
448Double_t TGeoVGShape::DistFromInside(const Double_t *point, const Double_t *dir, Int_t /*iact*/, Double_t step,
449 Double_t * /*safe*/) const
450{
451 Double_t dist = fVGShape->DistanceToOut(vecgeom::cxx::Vector3D<Double_t>(point[0], point[1], point[2]),
452 vecgeom::cxx::Vector3D<Double_t>(dir[0], dir[1], dir[2]), step);
453 return ((dist < 0.) ? 0. : dist);
454}
455
456////////////////////////////////////////////////////////////////////////////////
457
458Double_t TGeoVGShape::DistFromOutside(const Double_t *point, const Double_t *dir, Int_t /*iact*/, Double_t step,
459 Double_t * /*safe*/) const
460{
461 Double_t dist = fVGShape->DistanceToIn(vecgeom::cxx::Vector3D<Double_t>(point[0], point[1], point[2]),
462 vecgeom::cxx::Vector3D<Double_t>(dir[0], dir[1], dir[2]), step);
463 return ((dist < 0.) ? 0. : dist);
464}
465
466////////////////////////////////////////////////////////////////////////////////
467
469{
470 Double_t safety = (in) ? fVGShape->SafetyToOut(vecgeom::cxx::Vector3D<Double_t>(point[0], point[1], point[2]))
471 : fVGShape->SafetyToIn(vecgeom::cxx::Vector3D<Double_t>(point[0], point[1], point[2]));
472 return ((safety < 0.) ? 0. : safety);
473}
474
475////////////////////////////////////////////////////////////////////////////////
476/// Print info about the VecGeom solid
477
479{
480 fVGShape->GetUnplacedVolume()->Print();
481 printf("\n");
482}
483
484////////////////////////////////////////////////////////////////////////////////
485/// Stream an object of class TGeoVGShape.
486
488{
489 if (R__b.IsReading()) {
492 Fatal("Streamer",
493 "This geometry contains solids converted to VecGeom and needs a VecGeom-enabled ROOT to read.");
494 }
496 } else {
498 }
499}
dims_t fShape
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Buffer base class used for serializing objects.
Definition TBuffer.h:43
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
Bool_t IsReading() const
Definition TBuffer.h:86
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
An arbitrary trapezoid with less than 8 vertices standing on two parallel planes perpendicular to Z a...
Definition TGeoArb8.h:17
static TClass * Class()
Box class.
Definition TGeoBBox.h:17
void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t *origin=nullptr)
Set parameters of the box.
Double_t fOrigin[3]
Definition TGeoBBox.h:23
static TClass * Class()
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
Composite shapes are Boolean combinations of two or more shape components.
static TClass * Class()
TGeoBoolNode * GetBoolNode() const
A cone segment is a cone having a range in phi.
Definition TGeoCone.h:99
Double_t GetPhi1() const
Definition TGeoCone.h:166
Double_t GetPhi2() const
Definition TGeoCone.h:167
static TClass * Class()
The cones are defined by 5 parameters:
Definition TGeoCone.h:17
virtual Double_t GetRmax2() const
Definition TGeoCone.h:79
virtual Double_t GetDz() const
Definition TGeoCone.h:71
virtual Double_t GetRmin2() const
Definition TGeoCone.h:78
virtual Double_t GetRmin1() const
Definition TGeoCone.h:76
static TClass * Class()
virtual Double_t GetRmax1() const
Definition TGeoCone.h:77
The cut tubes constructor has the form:
Definition TGeoTube.h:173
static TClass * Class()
An elliptical tube is defined by the two semi-axes A and B.
Definition TGeoEltu.h:17
static TClass * Class()
int GetNvert() const
static TClass * Class()
A hyperboloid is represented as a solid limited by two planes perpendicular to the Z axis (top and bo...
Definition TGeoHype.h:17
static TClass * Class()
Geometrical transformation package.
Definition TGeoMatrix.h:38
virtual const Double_t * GetTranslation() const =0
virtual const Double_t * GetRotationMatrix() const =0
Parallelepiped class.
Definition TGeoPara.h:17
static TClass * Class()
A paraboloid is defined by the revolution surface generated by a parabola and is bounded by two plane...
static TClass * Class()
A polycone is represented by a sequence of tubes/cones, glued together at defined Z planes.
Definition TGeoPcon.h:17
Double_t * GetRmax() const
Definition TGeoPcon.h:82
Double_t GetDphi() const
Definition TGeoPcon.h:77
Double_t * GetZ() const
Definition TGeoPcon.h:84
static TClass * Class()
Int_t GetNz() const
Definition TGeoPcon.h:78
Double_t * GetRmin() const
Definition TGeoPcon.h:80
Double_t GetPhi1() const
Definition TGeoPcon.h:76
Polygons are defined in the same way as polycones, the difference being just that the segments betwee...
Definition TGeoPgon.h:20
static TClass * Class()
Int_t GetNedges() const
Definition TGeoPgon.h:93
A shape scaled by a TGeoScale transformation.
static TClass * Class()
static TClass * Class()
Base abstract class for all shapes.
Definition TGeoShape.h:25
const char * GetName() const override
Get the shape name.
virtual void ComputeBBox()=0
TClass * IsA() const override
Definition TGeoShape.h:171
TGeoSphere are not just balls having internal and external radii, but sectors of a sphere having defi...
Definition TGeoSphere.h:17
static TClass * Class()
Tessellated solid class.
const TGeoFacet & GetFacet(int i) const
const Vertex_t & GetVertex(int i) const
static TClass * Class()
int GetNfacets() const
The torus is defined by its axial radius, its inner and outer radius.
Definition TGeoTorus.h:17
static TClass * Class()
A general trapezoid.
Definition TGeoArb8.h:96
static TClass * Class()
A trapezoid with only X varying with Z.
Definition TGeoTrd1.h:17
static TClass * Class()
A trapezoid with only X varying with Z.
Definition TGeoTrd2.h:17
static TClass * Class()
A tube segment is a tube having a range in phi.
Definition TGeoTube.h:94
static TClass * Class()
Double_t GetPhi2() const
Definition TGeoTube.h:155
Double_t GetPhi1() const
Definition TGeoTube.h:154
Cylindrical tube class.
Definition TGeoTube.h:17
virtual Double_t GetRmin() const
Definition TGeoTube.h:72
static TClass * Class()
virtual Double_t GetDz() const
Definition TGeoTube.h:74
virtual Double_t GetRmax() const
Definition TGeoTube.h:73
Bridge class for using a VecGeom solid as TGeoShape.
Definition TGeoVGShape.h:30
~TGeoVGShape() override
Destructor.
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.
TGeoShape * fShape
VecGeom placed solid.
Definition TGeoVGShape.h:33
Bool_t Contains(const Double_t *point) const override
Test if point is inside this shape.
Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Compute distance from outside point to surface of the box.
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
Computes the closest distance from given point to this shape.
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override
Normal computation.
Double_t Capacity() const override
Returns analytic capacity of the solid.
vecgeom::cxx::VPlacedVolume * fVGShape
Definition TGeoVGShape.h:32
void ComputeBBox() override
Compute bounding box.
Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=nullptr) const override
Compute distance from inside point to surface of the box.
void InspectShape() const override
Print info about the VecGeom solid.
static vecgeom::cxx::Transformation3D * Convert(TGeoMatrix const *const geomatrix)
Convert a TGeoMatrix to a TRansformation3D.
A TGeoXtru shape is represented by the extrusion of an arbitrary polygon with fixed outline between s...
Definition TGeoXtru.h:22
static TClass * Class()
void Streamer(TBuffer &) override
Stream an object of class TObject.
static TClass * Class()
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition TObject.cxx:207
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition TObject.cxx:1015
static TVirtualGeoConverter * Instance(TGeoManager *geom=nullptr)
Static function returning a pointer to the current geometry converter.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition fillpatterns.C:1
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17