VGM Version 5.3
Loading...
Searching...
No Matches
Factory.h
Go to the documentation of this file.
1// $Id$
2
3// -----------------------------------------------------------------------
4// The RootGM package of the Virtual Geometry Model
5// Copyright (C) 2007, Ivana Hrivnacova
6// All rights reserved.
7//
8// For the licensing terms see vgm/LICENSE.
9// Contact: ivana@ipno.in2p3.fr
10// -----------------------------------------------------------------------
11
13//
19
20#ifndef ROOT_GM_FACTORY_H
21#define ROOT_GM_FACTORY_H
22
24
25#include <string>
26
27class TGeoShape;
28class TGeoVolume;
29class TGeoCompositeShape;
30class TGeoNode;
31
32namespace VGM {
33class ISolid;
34class IVolume;
35class IPlacement;
36class IExtrudedSolid;
37} // namespace VGM
38
40
41namespace RootGM {
42
44{
45 public:
46 Factory();
47 virtual ~Factory();
48
49 //
50 // methods
51 //
52
53 // solids
54 //
55 virtual VGM::ISolid* CreateArb8(
56 const std::string& name, double hz, std::vector<VGM::TwoVector> vertices);
57
58 virtual VGM::ISolid* CreateBox(
59 const std::string& name, double hx, double hy, double hz);
60
61 virtual VGM::ISolid* CreateCons(const std::string& name, double rin1,
62 double rout1, double rin2, double rout2, double hz, double sphi,
63 double dphi);
64
65 virtual VGM::ISolid* CreateCtubs(const std::string& name, double rin,
66 double rout, double hz, double sphi, double dphi, double nxlow,
67 double nylow, double nzlow, double nxhigh, double nyhigh, double nzhigh);
68
69 virtual VGM::ISolid* CreateEllipsoid(const std::string& name, double dx,
70 double dy, double dz, double zBottomCut, double zTopCut);
71
73 const std::string& name, double dx, double dy, double hz);
74
75 virtual VGM::ISolid* CreateExtrudedSolid(const std::string& name,
76 std::vector<VGM::TwoVector> polygon,
77 std::vector<std::vector<double> > zsections);
78
79 virtual VGM::ISolid* CreateHype(const std::string& name, double r1, double r2,
80 double stereo1, double stereo2, double hz);
81
82 virtual VGM::ISolid* CreatePara(const std::string& name, double dx, double dy,
83 double dz, double alpha, double theta, double phi);
84
86 const std::string& name, double r1, double r2, double hz);
87
88 virtual VGM::ISolid* CreatePolycone(const std::string& name, double sphi,
89 double dphi, int nofZplanes, double* z, double* rin, double* rout);
90
91 virtual VGM::ISolid* CreatePolyhedra(const std::string& name, double sphi,
92 double dphi, int nofSides, int nofZplanes, double* z, double* rin,
93 double* rout);
94
95 virtual VGM::ISolid* CreateSphere(const std::string& name, double rin,
96 double rout, double sphi, double dphi, double stheta, double dtheta);
97
98 virtual VGM::ISolid* CreateTessellatedSolid(const std::string& name,
99 std::vector<std::vector<VGM::ThreeVector> > facets);
100
101 virtual VGM::ISolid* CreateTorus(const std::string& name, double rin,
102 double rout, double rax, double sphi, double dphi);
103
104 virtual VGM::ISolid* CreateTrap(const std::string& name, double hz,
105 double theta, double phi, double dy1, double dx1, double dx2, double alpha1,
106 double dy2, double dx3, double dx4, double alpha2);
107
108 virtual VGM::ISolid* CreateTrd(const std::string& name, double hx1,
109 double hx2, double hy1, double hy2, double hz);
110
111 virtual VGM::ISolid* CreateTubs(const std::string& name, double rin,
112 double rout, double hz, double sphi, double dphi);
113
114 // Boolean solids
115 //
116 virtual VGM::ISolid* CreateIntersectionSolid(const std::string& name,
117 VGM::ISolid* solidA, VGM::ISolid* solidB, const VGM::Transform& transform);
118
119 virtual VGM::ISolid* CreateSubtractionSolid(const std::string& name,
120 VGM::ISolid* solidA, VGM::ISolid* solidB, const VGM::Transform& transform);
121
122 virtual VGM::ISolid* CreateUnionSolid(const std::string& name,
123 VGM::ISolid* solidA, VGM::ISolid* solidB, const VGM::Transform& transform);
124
125 virtual VGM::ISolid* CreateDisplacedSolid(const std::string& name,
126 VGM::ISolid* solid, const VGM::Transform& transform);
127
128 virtual VGM::ISolid* CreateScaledSolid(const std::string& name,
129 VGM::ISolid* solid, const VGM::Transform& transform);
130
131 virtual VGM::ISolid* CreateMultiUnion(const std::string& name,
132 std::vector<VGM::ISolid*> constituents,
133 std::vector<VGM::Transform> transforms);
134
135 // volumes
136 //
137 virtual VGM::IVolume* CreateVolume(
138 const std::string& name, VGM::ISolid* solid, const std::string& mediumName);
139
140 // placements
141 //
142 virtual VGM::IPlacement* CreatePlacement(const std::string& name, int copyNo,
143 VGM::IVolume* volume, VGM::IVolume* motherVolume,
144 const VGM::Transform& transform);
145
146 virtual VGM::IPlacement* CreateMultiplePlacement(const std::string& name,
147 VGM::IVolume* volume, VGM::IVolume* motherVolume, VGM::Axis axis,
148 int nofItems, double width, double offset, double halfGap);
149
150 virtual VGM::IPlacement* CreateParameterisedPlacement(const std::string& name,
151 VGM::IVolume* motherVolume,
152 const std::vector<VGM::Transform>& transforms,
153 const std::vector<VGM::IVolume*>& volumes);
154
155 // top volume
156 //
157 virtual VGM::IPlacement* Top() const;
158 virtual VGM::ISolid* SingleSolid() const;
159 TGeoNode* World() const;
160 TGeoShape* Solid() const;
161
162 // import/export
163 //
164 bool Import(TGeoNode* topNode);
165 bool Import(TGeoShape* shape);
166
167 protected:
168 Factory(const Factory& rhs);
169
170 virtual void SetSolid(VGM::ISolid* solid);
171
172 private:
173 void ImportConstituentSolid(int index, TGeoCompositeShape* solid);
174 VGM::ISolid* ImportSolid(TGeoShape* shape);
175 VGM::IVolume* ImportVolume(TGeoVolume* rootVolume);
176 void ImportDaughters(TGeoVolume* rootVolume);
177 void ImportAssembly(const TGeoVolume* rootVolume, VGM::IVolume* volume,
178 const TGeoNode* rootAssemblyNode,
179 std::vector<const TGeoNode*>& assemblyNodes);
180 void ImportPlacements(const TGeoVolume* rootVolume, VGM::IVolume* volume);
181 void ImportDivision(const TGeoVolume* rootVolume, VGM::IVolume* volume);
182 void ImportPositions();
183 bool IsDivided(const TGeoVolume* volume) const;
184
185 VGM::ISolid* Register(VGM::ISolid* solid);
186
187 void EmulateReplicatedSlice(const std::string& name, VGM::IVolume* volume,
188 VGM::IVolume* motherVolume, VGM::Axis axis, int nofItems, double width,
189 double offset, double halfGap);
190
191 // import/export
192 //
193 virtual bool Import(void* topNode);
194 virtual bool ImportSolid(void* solid);
195
196 VGM::IPlacement* fTop;
197 VGM::ISolid* fSolid;
198};
199
200} // namespace RootGM
201
202#endif // ROOT_GM_FACTORY_H
The abstract base class to geometry factory.
Definition VFactory.h:43
VGM factory for Root.
Definition Factory.h:44
virtual VGM::ISolid * CreateTubs(const std::string &name, double rin, double rout, double hz, double sphi, double dphi)
Create the trd solid = phi segment of a tube.
Definition Factory.cxx:853
TGeoNode * World() const
Definition Factory.cxx:1064
virtual VGM::ISolid * CreatePara(const std::string &name, double dx, double dy, double dz, double alpha, double theta, double phi)
Create the para solid = parallelepiped.
Definition Factory.cxx:774
virtual VGM::ISolid * CreateCons(const std::string &name, double rin1, double rout1, double rin2, double rout2, double hz, double sphi, double dphi)
Create the cons solid = phi segment of a conical tube.
Definition Factory.cxx:731
virtual VGM::ISolid * CreateMultiUnion(const std::string &name, std::vector< VGM::ISolid * > constituents, std::vector< VGM::Transform > transforms)
Create the multi union of solids.
Definition Factory.cxx:914
virtual VGM::ISolid * CreateHype(const std::string &name, double r1, double r2, double stereo1, double stereo2, double hz)
Create the hyperboloid solid.
Definition Factory.cxx:766
virtual VGM::ISolid * CreateSubtractionSolid(const std::string &name, VGM::ISolid *solidA, VGM::ISolid *solidB, const VGM::Transform &transform)
Create the subtraction of two solids.
Definition Factory.cxx:879
virtual VGM::IPlacement * Top() const
Return the top volume placement.
Definition Factory.cxx:1048
virtual VGM::IPlacement * CreateMultiplePlacement(const std::string &name, VGM::IVolume *volume, VGM::IVolume *motherVolume, VGM::Axis axis, int nofItems, double width, double offset, double halfGap)
Create the multiple volume placement.
Definition Factory.cxx:963
virtual VGM::IPlacement * CreatePlacement(const std::string &name, int copyNo, VGM::IVolume *volume, VGM::IVolume *motherVolume, const VGM::Transform &transform)
Create the simple volume placement.
Definition Factory.cxx:939
virtual VGM::ISolid * CreateEllipsoid(const std::string &name, double dx, double dy, double dz, double zBottomCut, double zTopCut)
Create the ellipsoid solid.
Definition Factory.cxx:750
virtual VGM::ISolid * CreateTrd(const std::string &name, double hx1, double hx2, double hy1, double hy2, double hz)
Create the trd solid = a trapezoid with the x and y dimensions varying along z.
Definition Factory.cxx:845
virtual VGM::ISolid * CreatePolycone(const std::string &name, double sphi, double dphi, int nofZplanes, double *z, double *rin, double *rout)
Create the polycone solid = phi segment of a polycone.
Definition Factory.cxx:790
virtual VGM::ISolid * CreateScaledSolid(const std::string &name, VGM::ISolid *solid, const VGM::Transform &transform)
Create scaled solid.
Definition Factory.cxx:906
virtual VGM::ISolid * CreateEllipticalTube(const std::string &name, double dx, double dy, double hz)
Create the elliptical tube solid.
Definition Factory.cxx:758
virtual VGM::ISolid * CreateBox(const std::string &name, double hx, double hy, double hz)
Create the box solid.
Definition Factory.cxx:723
virtual VGM::IVolume * CreateVolume(const std::string &name, VGM::ISolid *solid, const std::string &mediumName)
Create the volume.
Definition Factory.cxx:928
TGeoShape * Solid() const
Definition Factory.cxx:1072
virtual VGM::ISolid * CreateTrap(const std::string &name, double hz, double theta, double phi, double dy1, double dx1, double dx2, double alpha1, double dy2, double dx3, double dx4, double alpha2)
Create the trap solid = general trapezoid ( Note that of the 11 parameters described below,...
Definition Factory.cxx:835
virtual VGM::IPlacement * CreateParameterisedPlacement(const std::string &name, VGM::IVolume *motherVolume, const std::vector< VGM::Transform > &transforms, const std::vector< VGM::IVolume * > &volumes)
Create the parameterised volume placement.
Definition Factory.cxx:1015
virtual VGM::ISolid * CreateArb8(const std::string &name, double hz, std::vector< VGM::TwoVector > vertices)
Create the arbitrary trapezoid with 8 vertices standing on two paralel planes perpendicular to Z axis...
Definition Factory.cxx:715
virtual VGM::ISolid * CreateTessellatedSolid(const std::string &name, std::vector< std::vector< VGM::ThreeVector > > facets)
Create tessellated solid = solid composed from triangular and rectangular facets.
Definition Factory.cxx:819
virtual VGM::ISolid * CreateTorus(const std::string &name, double rin, double rout, double rax, double sphi, double dphi)
Create the torus solid = phi segment of a torus.
Definition Factory.cxx:827
virtual ~Factory()
Definition Factory.cxx:107
virtual VGM::ISolid * CreateCtubs(const std::string &name, double rin, double rout, double hz, double sphi, double dphi, double nxlow, double nylow, double nzlow, double nxhigh, double nyhigh, double nzhigh)
Create the cut tubs solid = phi segment of a tube cut with two planes.
Definition Factory.cxx:740
virtual VGM::ISolid * CreateParaboloid(const std::string &name, double r1, double r2, double hz)
Create the paraboloid solid.
Definition Factory.cxx:782
virtual VGM::ISolid * CreatePolyhedra(const std::string &name, double sphi, double dphi, int nofSides, int nofZplanes, double *z, double *rin, double *rout)
Create the polyhedra solid = phi segment of a polyhedra (polygone)
Definition Factory.cxx:800
virtual VGM::ISolid * SingleSolid() const
Return solid (if in one solid conversion mode)
Definition Factory.cxx:1056
virtual void SetSolid(VGM::ISolid *solid)
Set solid (in single mode)
Definition Factory.cxx:703
virtual VGM::ISolid * CreateIntersectionSolid(const std::string &name, VGM::ISolid *solidA, VGM::ISolid *solidB, const VGM::Transform &transform)
Create the intersection of two solids.
Definition Factory.cxx:870
virtual VGM::ISolid * CreateExtrudedSolid(const std::string &name, std::vector< VGM::TwoVector > polygon, std::vector< std::vector< double > > zsections)
Create the extruded solid.
Definition Factory.cxx:861
virtual VGM::ISolid * CreateUnionSolid(const std::string &name, VGM::ISolid *solidA, VGM::ISolid *solidB, const VGM::Transform &transform)
Create the union of two solids.
Definition Factory.cxx:888
virtual VGM::ISolid * CreateSphere(const std::string &name, double rin, double rout, double sphi, double dphi, double stheta, double dtheta)
Create the sphere solid = phi segment of a spherical shell.
Definition Factory.cxx:810
virtual VGM::ISolid * CreateDisplacedSolid(const std::string &name, VGM::ISolid *solid, const VGM::Transform &transform)
Create displaced solid.
Definition Factory.cxx:897
bool Import(TGeoNode *topNode)
Definition Factory.cxx:1080
VGM Axis enumeration.
The VGM interface to positions of volumes.
Definition IPlacement.h:44
The VGM interface to solids.
Definition ISolid.h:58
The VGM interface to volumes.
Definition IVolume.h:32
VGM implementation for Root.
Definition axis.h:28
VGM interfaces.
Definition VMedium.h:28
std::vector< double > Transform
Definition Transform.h:40