Logo ROOT   6.12/07
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 
22 namespace vecgeom {
23  inline namespace cxx {
24  class Transformation3D;
25  class VPlacedVolume;
26  class VUnplacedVolume;
27  }
28 }
29 
30 class TGeoVGShape : public TGeoBBox
31 {
32 private:
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 
39 public:
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->IsComposite() ); }
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
vecgeom::cxx::VPlacedVolume * GetVGShape() const
Definition: TGeoVGShape.h:100
virtual void Sizeof3D() const =0
Bridge class for using a VecGeom solid as TGeoShape.
Definition: TGeoVGShape.h:30
virtual Int_t GetNmeshVertices() const
Definition: TGeoVGShape.h:82
virtual void SetDimensions(Double_t *param)=0
Box class.
Definition: TGeoBBox.h:17
virtual Bool_t IsReflected() const
Definition: TGeoShape.h:137
float Float_t
Definition: RtypesCore.h:53
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)=0
Computes distance from point (px,py) to the object.
const char Option_t
Definition: RtypesCore.h:62
Geometrical transformation package.
Definition: TGeoMatrix.h:40
virtual Int_t GetByteCount() const =0
TGeoShape * fShape
Definition: TGeoVGShape.h:34
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:48
virtual void GetBoundingCylinder(Double_t *param) const
Fill vector param[4] with the bounding cylinder parameters.
Definition: TGeoVGShape.h:66
virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const =0
virtual Bool_t IsReflected() const
Definition: TGeoVGShape.h:87
virtual TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const =0
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
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 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 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 void GetBoundingCylinder(Double_t *param) const =0
virtual Bool_t IsAssembly() const
Definition: TGeoShape.h:129
virtual const char * GetName() const
Get the shape name.
Definition: TGeoVGShape.h:80
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
#define ClassDef(name, id)
Definition: Rtypes.h:320
virtual void Draw(Option_t *option="")
Draw this shape.
Definition: TGeoVGShape.h:61
virtual Bool_t IsCylType() const
Definition: TGeoVGShape.h:86
virtual void SetSegsAndPols(TBuffer3D &buff) const =0
virtual Bool_t IsValidBox() const =0
virtual void SetPoints(Double_t *points) const =0
virtual TBuffer3D * MakeBuffer3D() const
Definition: TGeoShape.h:143
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
point * points
Definition: X3DBuffer.c:20
virtual const char * GetName() const
Get the shape name.
Definition: TGeoShape.cxx:248
virtual Bool_t CouldBeCrossed(const Double_t *point, const Double_t *dir) const =0
Base abstract class for all shapes.
Definition: TGeoShape.h:25
virtual void SetSegsAndPols(TBuffer3D &buff) const
Fills TBuffer3D structure for segments and polygons.
Definition: TGeoVGShape.h:96
virtual Bool_t IsComposite() const
Definition: TGeoShape.h:130
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Stub implementation to avoid forcing implementation at this stage.
Definition: TGeoShape.cxx:689
virtual Int_t GetNmeshVertices() const
Definition: TGeoShape.h:127
vecgeom::cxx::VPlacedVolume * fVGShape
Definition: TGeoVGShape.h:33
Generic 3D primitive description class.
Definition: TBuffer3D.h:17
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 void SetPoints(Double_t *points) const
Fill box points.
Definition: TGeoVGShape.h:94
virtual Bool_t IsValidBox() const
Definition: TGeoVGShape.h:88
virtual const char * GetAxisName(Int_t iaxis) const =0
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute closest distance from point px,py to each corner.
Definition: TGeoVGShape.h:53
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
Definition: TGeoVGShape.h:91
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 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
double Double_t
Definition: RtypesCore.h:55
virtual void GetMeshNumbers(Int_t &, Int_t &, Int_t &) const
Definition: TGeoShape.h:125
static Double_t Big()
Definition: TGeoShape.h:88
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 Bool_t IsComposite() const
Definition: TGeoVGShape.h:85
virtual void Sizeof3D() const
Definition: TGeoVGShape.h:97
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const =0
virtual Int_t GetByteCount() const
Definition: TGeoVGShape.h:70
virtual void SetPoints(Float_t *points) const
Fill box points.
Definition: TGeoVGShape.h:95
virtual void Paint(Option_t *option="")
Paint this shape.
Definition: TGeoShape.cxx:734
virtual Int_t GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const =0
virtual void Draw(Option_t *option="")
Draw this shape.
Definition: TGeoShape.cxx:721
virtual void Paint(Option_t *option="")
Paint this shape.
Definition: TGeoVGShape.h:92
const Bool_t kTRUE
Definition: RtypesCore.h:87
virtual Bool_t IsVecGeom() const
Definition: TGeoVGShape.h:89
virtual Bool_t IsAssembly() const
Definition: TGeoVGShape.h:84
virtual const char * GetAxisName(Int_t iaxis) const
Returns name of axis IAXIS.
Definition: TGeoVGShape.h:62