Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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); }
53  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
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