Logo ROOT  
Reference Guide
TGeoVGShape.h
Go to the documentation of this file.
1// Author: Mihaela Gheata 30/03/16
2
3/*************************************************************************
4 * Copyright (C) 1995-2016, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOT_TGeoVGShape
12#define ROOT_TGeoVGShape
13
14#include "TGeoBBox.h"
15
16////////////////////////////////////////////////////////////////////////////
17// //
18// TGeoVGShape - bridge class for using a VecGeom solid as TGeoShape. //
19// //
20////////////////////////////////////////////////////////////////////////////
21
22namespace vecgeom {
23 inline namespace cxx {
24 class Transformation3D;
25 class VPlacedVolume;
26 class VUnplacedVolume;
27 }
28}
29
30class TGeoVGShape : public TGeoBBox
31{
32private:
33 vecgeom::cxx::VPlacedVolume *fVGShape; // VecGeom placed solid
34 TGeoShape *fShape; // ROOT shape
35
36 static vecgeom::cxx::VPlacedVolume *CreateVecGeomSolid(TGeoShape *shape);
37 TGeoVGShape(TGeoShape *shape, vecgeom::cxx::VPlacedVolume *vgshape);
38
39public:
40 TGeoVGShape() : TGeoBBox(), fVGShape(nullptr), fShape(nullptr) {}
41 virtual ~TGeoVGShape();
42 static vecgeom::cxx::Transformation3D *
43 Convert(TGeoMatrix const *const geomatrix);
44 static vecgeom::cxx::VUnplacedVolume *
45 Convert(TGeoShape const *const shape);
46 static TGeoVGShape *Create(TGeoShape *shape);
47 virtual Double_t Capacity() const;
48 virtual void ComputeBBox();
49 virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm);
50 virtual Bool_t Contains(const Double_t *point) const;
51 virtual Bool_t CouldBeCrossed(const Double_t *point, const Double_t *dir) const
52 { return fShape->CouldBeCrossed(point,dir); }
54 { return fShape->DistancetoPrimitive(px, py); }
55 virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1,
56 Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
57 virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1,
58 Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
59 virtual TGeoVolume *Divide(TGeoVolume *, const char *, Int_t, Int_t, Double_t, Double_t)
60 { return nullptr; }
61 virtual void Draw(Option_t *option="") { fShape->Draw(option); } // *MENU*
62 virtual const char *GetAxisName(Int_t iaxis) const
63 { return ( fShape->GetAxisName(iaxis) ); }
64 virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
65 { return ( fShape->GetAxisRange(iaxis, xlo, xhi) ); }
66 virtual void GetBoundingCylinder(Double_t *param) const
67 { return ( fShape->GetBoundingCylinder(param) ); }
68 virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
69 { return ( fShape->GetBuffer3D(reqSections, localFrame) ); }
70 virtual Int_t GetByteCount() const { return ( fShape->GetByteCount() ); }
71 virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const;
72 virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const
73 { return ( fShape->GetPointsOnSegments(npoints, array) ); }
74 virtual Int_t GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const
75 { return ( fShape->GetFittingBox(parambox, mat, dx, dy, dz) ); }
76 virtual TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const
77 { return ( fShape->GetMakeRuntimeShape(mother, mat) ); }
78 virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
79 { fShape->GetMeshNumbers(nvert, nsegs, npols); }
80 virtual const char *GetName() const
81 { return ( fShape->GetName() ); }
82 virtual Int_t GetNmeshVertices() const
83 {return ( fShape->GetNmeshVertices() );}
84 virtual Bool_t IsAssembly() const { return ( fShape->IsAssembly() ); }
85 virtual Bool_t IsComposite() const { return ( fShape->IsComposite() ); }
86 virtual Bool_t IsCylType() const { return ( fShape->IsCylType() ); }
87 virtual Bool_t IsReflected() const { return ( fShape->IsReflected() ); }
88 virtual Bool_t IsValidBox() const { return ( fShape->IsValidBox() ); }
89 virtual Bool_t IsVecGeom() const {return kTRUE;}
90 virtual void InspectShape() const;
91 virtual TBuffer3D *MakeBuffer3D() const { return ( fShape->MakeBuffer3D() );}
92 virtual void Paint(Option_t *option="") { fShape->Paint(option); }
93 virtual void SetDimensions(Double_t *param) { fShape->SetDimensions(param); }
94 virtual void SetPoints(Double_t *points) const { fShape->SetPoints(points); }
95 virtual void SetPoints(Float_t *points) const { fShape->SetPoints(points); }
96 virtual void SetSegsAndPols(TBuffer3D &buff) const { fShape->SetSegsAndPols(buff); }
97 virtual void Sizeof3D() const { fShape->Sizeof3D(); }
98
99 TGeoShape *GetShape() const { return fShape; }
100 vecgeom::cxx::VPlacedVolume *GetVGShape() const { return fVGShape; }
101
102 ClassDef(TGeoVGShape, 0) // Adapter for a VecGeom shape
103};
104#endif
int Int_t
Definition: RtypesCore.h:43
bool Bool_t
Definition: RtypesCore.h:61
double Double_t
Definition: RtypesCore.h:57
float Float_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:89
const char Option_t
Definition: RtypesCore.h:64
#define ClassDef(name, id)
Definition: Rtypes.h:322
point * points
Definition: X3DBuffer.c:22
Generic 3D primitive description class.
Definition: TBuffer3D.h:18
Box class.
Definition: TGeoBBox.h:18
Geometrical transformation package.
Definition: TGeoMatrix.h:41
Base abstract class for all shapes.
Definition: TGeoShape.h:26
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)=0
Computes distance from point (px,py) to the object.
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Stub implementation to avoid forcing implementation at this stage.
Definition: TGeoShape.cxx:689
static Double_t Big()
Definition: TGeoShape.h:88
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const =0
virtual Int_t GetNmeshVertices() const
Definition: TGeoShape.h:127
virtual void GetMeshNumbers(Int_t &, Int_t &, Int_t &) const
Definition: TGeoShape.h:125
virtual void SetSegsAndPols(TBuffer3D &buff) const =0
virtual void SetDimensions(Double_t *param)=0
virtual void Sizeof3D() const =0
virtual const char * GetAxisName(Int_t iaxis) const =0
virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const =0
virtual Bool_t IsComposite() const
Definition: TGeoShape.h:130
virtual Bool_t IsCylType() const =0
virtual void GetBoundingCylinder(Double_t *param) const =0
virtual Bool_t IsValidBox() const =0
virtual Bool_t IsReflected() const
Definition: TGeoShape.h:137
virtual Int_t GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const =0
virtual const char * GetName() const
Get the shape name.
Definition: TGeoShape.cxx:248
virtual Int_t GetByteCount() const =0
virtual void Paint(Option_t *option="")
Paint this shape.
Definition: TGeoShape.cxx:734
virtual Bool_t CouldBeCrossed(const Double_t *point, const Double_t *dir) const =0
virtual TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const =0
virtual void SetPoints(Double_t *points) const =0
virtual Bool_t IsAssembly() const
Definition: TGeoShape.h:129
virtual TBuffer3D * MakeBuffer3D() const
Definition: TGeoShape.h:143
virtual void Draw(Option_t *option="")
Draw this shape.
Definition: TGeoShape.cxx:721
Bridge class for using a VecGeom solid as TGeoShape.
Definition: TGeoVGShape.h:31
virtual void GetBoundingCylinder(Double_t *param) const
Fill vector param[4] with the bounding cylinder parameters.
Definition: TGeoVGShape.h:66
virtual const char * GetAxisName(Int_t iaxis) const
Returns name of axis IAXIS.
Definition: TGeoVGShape.h:62
static vecgeom::cxx::VPlacedVolume * CreateVecGeomSolid(TGeoShape *shape)
Conversion method to create VecGeom solid corresponding to TGeoShape.
Definition: TGeoVGShape.cxx:94
static TGeoVGShape * Create(TGeoShape *shape)
Factory creating TGeoVGShape from a Root shape.
Definition: TGeoVGShape.cxx:83
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
Definition: TGeoVGShape.h:91
virtual void ComputeBBox()
Compute bounding box.
virtual Int_t GetNmeshVertices() const
Definition: TGeoVGShape.h:82
virtual void Paint(Option_t *option="")
Paint this shape.
Definition: TGeoVGShape.h:92
virtual void Draw(Option_t *option="")
Draw this shape.
Definition: TGeoVGShape.h:61
TGeoShape * fShape
Definition: TGeoVGShape.h:34
virtual void SetPoints(Float_t *points) const
Fill box points.
Definition: TGeoVGShape.h:95
virtual Bool_t Contains(const Double_t *point) const
Test if point is inside this shape.
virtual TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const
In case shape has some negative parameters, these has to be computed in order to fit the mother.
Definition: TGeoVGShape.h:76
virtual Bool_t IsVecGeom() const
Definition: TGeoVGShape.h:89
virtual Bool_t IsAssembly() const
Definition: TGeoVGShape.h:84
virtual TGeoVolume * Divide(TGeoVolume *, const char *, Int_t, Int_t, Double_t, Double_t)
Divide this box shape belonging to volume "voldiv" into ndiv equal volumes called divname,...
Definition: TGeoVGShape.h:59
virtual const char * GetName() const
Get the shape name.
Definition: TGeoVGShape.h:80
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Normal computation.
virtual ~TGeoVGShape()
Destructor.
Definition: TGeoVGShape.cxx:73
virtual Bool_t IsComposite() const
Definition: TGeoVGShape.h:85
virtual Double_t Capacity() const
Returns analytic capacity of the solid.
vecgeom::cxx::VPlacedVolume * GetVGShape() const
Definition: TGeoVGShape.h:100
vecgeom::cxx::VPlacedVolume * fVGShape
Definition: TGeoVGShape.h:33
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 Sizeof3D() const
Definition: TGeoVGShape.h:97
virtual Bool_t IsReflected() const
Definition: TGeoVGShape.h:87
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
Definition: TGeoVGShape.h:68
virtual Bool_t CouldBeCrossed(const Double_t *point, const Double_t *dir) const
Decides fast if the bounding box could be crossed by a vector.
Definition: TGeoVGShape.h:51
virtual void InspectShape() const
Print info about the VecGeom solid.
virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const
Fills array with n random points located on the line segments of the shape mesh.
Definition: TGeoVGShape.h:72
TGeoShape * GetShape() const
Definition: TGeoVGShape.h:99
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 GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
Get range of shape for a given axis.
Definition: TGeoVGShape.h:64
virtual Bool_t IsCylType() const
Definition: TGeoVGShape.h:86
virtual void SetDimensions(Double_t *param)
Set dimensions based on the array of parameters param[0] - half-length in x param[1] - half-length in...
Definition: TGeoVGShape.h:93
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.
virtual Int_t GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const
Fills real parameters of a positioned box inside this one. Returns 0 if successful.
Definition: TGeoVGShape.h:74
virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
Returns numbers of vertices, segments and polygons composing the shape mesh.
Definition: TGeoVGShape.h:78
virtual Int_t GetByteCount() const
Definition: TGeoVGShape.h:70
virtual Bool_t IsValidBox() const
Definition: TGeoVGShape.h:88
virtual void SetSegsAndPols(TBuffer3D &buff) const
Fills TBuffer3D structure for segments and polygons.
Definition: TGeoVGShape.h:96
static vecgeom::cxx::Transformation3D * Convert(TGeoMatrix const *const geomatrix)
Convert a TGeoMatrix to a TRansformation3D.
virtual void SetPoints(Double_t *points) const
Fill box points.
Definition: TGeoVGShape.h:94
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute closest distance from point px,py to each corner.
Definition: TGeoVGShape.h:53
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:47