Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 {
23inline namespace cxx {
24class Transformation3D;
25class VPlacedVolume;
26class VUnplacedVolume;
27} // namespace cxx
28} // namespace vecgeom
29
30class TGeoVGShape : public TGeoBBox {
31private:
32 vecgeom::cxx::VPlacedVolume *fVGShape; //! VecGeom placed solid
33 TGeoShape *fShape; // ROOT shape
34
35 static vecgeom::cxx::VPlacedVolume *CreateVecGeomSolid(TGeoShape *shape);
36 TGeoVGShape(TGeoShape *shape, vecgeom::cxx::VPlacedVolume *vgshape);
37
38public:
39 TGeoVGShape() : TGeoBBox(), fVGShape(nullptr), fShape(nullptr) {}
40 ~TGeoVGShape() override;
41 static vecgeom::cxx::Transformation3D *Convert(TGeoMatrix const *const geomatrix);
42 static vecgeom::cxx::VUnplacedVolume *Convert(TGeoShape const *const shape);
43 static TGeoVGShape *Create(TGeoShape *shape);
44 Double_t Capacity() const override;
45 void ComputeBBox() override;
46 void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override;
47 Bool_t Contains(const Double_t *point) const override;
48 Bool_t CouldBeCrossed(const Double_t *point, const Double_t *dir) const override
49 {
50 return fShape->CouldBeCrossed(point, dir);
51 }
52 Int_t DistancetoPrimitive(Int_t px, Int_t py) override { return fShape->DistancetoPrimitive(px, py); }
53 Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact = 1, Double_t step = TGeoShape::Big(),
54 Double_t *safe = nullptr) const override;
55 Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact = 1,
56 Double_t step = TGeoShape::Big(), Double_t *safe = nullptr) const override;
57 TGeoVolume *Divide(TGeoVolume *, const char *, Int_t, Int_t, Double_t, Double_t) override { return nullptr; }
58 void Draw(Option_t *option = "") override { fShape->Draw(option); } // *MENU*
59 const char *GetAxisName(Int_t iaxis) const override { return (fShape->GetAxisName(iaxis)); }
60 Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
61 {
62 return (fShape->GetAxisRange(iaxis, xlo, xhi));
63 }
64 void GetBoundingCylinder(Double_t *param) const override { return (fShape->GetBoundingCylinder(param)); }
65 const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
66 {
67 return (fShape->GetBuffer3D(reqSections, localFrame));
68 }
69 Int_t GetByteCount() const override { return (fShape->GetByteCount()); }
70 Double_t Safety(const Double_t *point, Bool_t in = kTRUE) const override;
71 Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override
72 {
73 return (fShape->GetPointsOnSegments(npoints, array));
74 }
75 Int_t
76 GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const override
77 {
78 return (fShape->GetFittingBox(parambox, mat, dx, dy, dz));
79 }
80 TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
81 {
82 return (fShape->GetMakeRuntimeShape(mother, mat));
83 }
84 void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
85 {
86 fShape->GetMeshNumbers(nvert, nsegs, npols);
87 }
88 const char *GetName() const override { return (fShape->GetName()); }
89 Int_t GetNmeshVertices() const override { return (fShape->GetNmeshVertices()); }
90 Bool_t IsAssembly() const override { return (fShape->IsAssembly()); }
91 Bool_t IsComposite() const override { return (fShape->IsComposite()); }
92 Bool_t IsCylType() const override { return (fShape->IsCylType()); }
93 Bool_t IsReflected() const override { return (fShape->IsReflected()); }
94 Bool_t IsValidBox() const override { return (fShape->IsValidBox()); }
95 Bool_t IsVecGeom() const override { return kTRUE; }
96 void InspectShape() const override;
97 TBuffer3D *MakeBuffer3D() const override { return (fShape->MakeBuffer3D()); }
98 void Paint(Option_t *option = "") override { fShape->Paint(option); }
99 void SetDimensions(Double_t *param) override { fShape->SetDimensions(param); }
100 void SetPoints(Double_t *points) const override { fShape->SetPoints(points); }
101 void SetPoints(Float_t *points) const override { fShape->SetPoints(points); }
102 void SetSegsAndPols(TBuffer3D &buff) const override { fShape->SetSegsAndPols(buff); }
103 void Sizeof3D() const override { fShape->Sizeof3D(); }
104
105 TGeoShape *GetShape() const { return fShape; }
106 vecgeom::cxx::VPlacedVolume *GetVGShape() const { return fVGShape; }
107
108 ClassDefOverride(TGeoVGShape, 1) // Adapter for a VecGeom shape
109};
110#endif
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
Generic 3D primitive description class.
Definition TBuffer3D.h:18
Box class.
Definition TGeoBBox.h:17
Geometrical transformation package.
Definition TGeoMatrix.h:38
Base abstract class for all shapes.
Definition TGeoShape.h:25
Int_t DistancetoPrimitive(Int_t px, Int_t py) override=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.
static Double_t Big()
Definition TGeoShape.h:87
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
void Draw(Option_t *option="") override
Draw this shape.
virtual Bool_t IsCylType() const =0
void Paint(Option_t *option="") override
Paint this shape.
virtual void GetBoundingCylinder(Double_t *param) const =0
virtual Bool_t IsValidBox() const =0
virtual Bool_t IsReflected() const
Definition TGeoShape.h:140
virtual Int_t GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const =0
virtual Int_t GetByteCount() const =0
const char * GetName() const override
Get the shape name.
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:146
Bridge class for using a VecGeom solid as TGeoShape.
Definition TGeoVGShape.h:30
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
Get range of shape for a given axis.
Definition TGeoVGShape.h:60
~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.
Int_t GetByteCount() const override
Definition TGeoVGShape.h:69
TGeoVolume * Divide(TGeoVolume *, const char *, Int_t, Int_t, Double_t, Double_t) override
Divide this box shape belonging to volume "voldiv" into ndiv equal volumes called divname,...
Definition TGeoVGShape.h:57
void SetPoints(Double_t *points) const override
Fill box points.
Bool_t IsReflected() const override
Definition TGeoVGShape.h:93
TGeoShape * fShape
VecGeom placed solid.
Definition TGeoVGShape.h:33
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
In case shape has some negative parameters, these has to be computed in order to fit the mother.
Definition TGeoVGShape.h:80
Bool_t CouldBeCrossed(const Double_t *point, const Double_t *dir) const override
Decides fast if the bounding box could be crossed by a vector.
Definition TGeoVGShape.h:48
Bool_t IsValidBox() const override
Definition TGeoVGShape.h:94
void Paint(Option_t *option="") override
Paint this shape.
Definition TGeoVGShape.h:98
Bool_t Contains(const Double_t *point) const override
Test if point is inside this shape.
Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override
Fills array with n random points located on the line segments of the shape mesh.
Definition TGeoVGShape.h:71
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.
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute closest distance from point px,py to each corner.
Definition TGeoVGShape.h:52
const char * GetAxisName(Int_t iaxis) const override
Returns name of axis IAXIS.
Definition TGeoVGShape.h:59
Bool_t IsCylType() const override
Definition TGeoVGShape.h:92
void SetDimensions(Double_t *param) override
Set dimensions based on the array of parameters param[0] - half-length in x param[1] - half-length in...
Definition TGeoVGShape.h:99
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
Returns numbers of vertices, segments and polygons composing the shape mesh.
Definition TGeoVGShape.h:84
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
Computes the closest distance from given point to this shape.
Int_t GetNmeshVertices() const override
Definition TGeoVGShape.h:89
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override
Normal computation.
TBuffer3D * MakeBuffer3D() const override
Creates a TBuffer3D describing this shape.
Definition TGeoVGShape.h:97
Double_t Capacity() const override
Returns analytic capacity of the solid.
vecgeom::cxx::VPlacedVolume * GetVGShape() const
Int_t GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const override
Fills real parameters of a positioned box inside this one. Returns 0 if successful.
Definition TGeoVGShape.h:76
vecgeom::cxx::VPlacedVolume * fVGShape
Definition TGeoVGShape.h:32
void GetBoundingCylinder(Double_t *param) const override
Fill vector param[4] with the bounding cylinder parameters.
Definition TGeoVGShape.h:64
void SetPoints(Float_t *points) const override
Fill box points.
void SetSegsAndPols(TBuffer3D &buff) const override
Fills TBuffer3D structure for segments and polygons.
void ComputeBBox() override
Compute bounding box.
TGeoShape * GetShape() const
void Draw(Option_t *option="") override
Draw this shape.
Definition TGeoVGShape.h:58
const char * GetName() const override
Get the shape name.
Definition TGeoVGShape.h:88
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 Sizeof3D() const override
void InspectShape() const override
Print info about the VecGeom solid.
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Fills a static 3D buffer and returns a reference.
Definition TGeoVGShape.h:65
Bool_t IsAssembly() const override
Definition TGeoVGShape.h:90
Bool_t IsComposite() const override
Definition TGeoVGShape.h:91
Bool_t IsVecGeom() const override
Definition TGeoVGShape.h:95
static vecgeom::cxx::Transformation3D * Convert(TGeoMatrix const *const geomatrix)
Convert a TGeoMatrix to a TRansformation3D.
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43