VGM Version 5.3
Loading...
Searching...
No Matches
Factory.h
Go to the documentation of this file.
1// $Id$
2
3// -----------------------------------------------------------------------
4// The Geant4GM 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 GEANT4_GM_FACTORY_H
21#define GEANT4_GM_FACTORY_H
22
24
25#include "G4ReflectionFactory.hh"
26
27#include <string>
28
29class G4VSolid;
30class G4LogicalVolume;
31class G4VPhysicalVolume;
32class G4BooleanSolid;
33class G4MultiUnion;
34
35namespace VGM {
36class ISolid;
37class IVolume;
38class IPlacement;
39class IExtrudedSolid;
40} // namespace VGM
41
43
44namespace Geant4GM {
45
47{
48 public:
49 Factory();
50 virtual ~Factory();
51
52 // static methods
53 static void SetSurfCheck(bool surfCheck);
54 static bool GetSurfCheck();
55
56 //
57 // methods
58 //
59
60 // solids
61 //
62 virtual VGM::ISolid* CreateArb8(
63 const std::string& name, double hz, std::vector<VGM::TwoVector> vertices);
64
65 virtual VGM::ISolid* CreateBox(
66 const std::string& name, double hx, double hy, double hz);
67
68 virtual VGM::ISolid* CreateCons(const std::string& name, double rin1,
69 double rout1, double rin2, double rout2, double hz, double sphi,
70 double dphi);
71
72 virtual VGM::ISolid* CreateCtubs(const std::string& name, double rin,
73 double rout, double hz, double sphi, double dphi, double nxlow,
74 double nylow, double nzlow, double nxhigh, double nyhigh, double nzhigh);
75
76 virtual VGM::ISolid* CreateEllipsoid(const std::string& name, double dx,
77 double dy, double dz, double zBottomCut, double zTopCut);
78
80 const std::string& name, double dx, double dy, double hz);
81
82 virtual VGM::ISolid* CreateExtrudedSolid(const std::string& name,
83 std::vector<VGM::TwoVector> polygon,
84 std::vector<std::vector<double> > zsections);
85
86 virtual VGM::ISolid* CreateHype(const std::string& name, double r1, double r2,
87 double stereo1, double stereo2, double hz);
88
89 virtual VGM::ISolid* CreatePara(const std::string& name, double dx, double dy,
90 double dz, double alpha, double theta, double phi);
91
93 const std::string& name, double r1, double r2, double hz);
94
95 virtual VGM::ISolid* CreatePolycone(const std::string& name, double sphi,
96 double dphi, int nofZplanes, double* z, double* rin, double* rout);
97
98 virtual VGM::ISolid* CreatePolyhedra(const std::string& name, double sphi,
99 double dphi, int nofSides, int nofZplanes, double* z, double* rin,
100 double* rout);
101
102 virtual VGM::ISolid* CreateSphere(const std::string& name, double rin,
103 double rout, double sphi, double dphi, double stheta, double dtheta);
104
105 virtual VGM::ISolid* CreateTessellatedSolid(const std::string& name,
106 std::vector<std::vector<VGM::ThreeVector> > facets);
107
108 virtual VGM::ISolid* CreateTorus(const std::string& name, double rin,
109 double rout, double rax, double sphi, double dphi);
110
111 virtual VGM::ISolid* CreateTrap(const std::string& name, double hz,
112 double theta, double phi, double dy1, double dx1, double dx2, double alpha1,
113 double dy2, double dx3, double dx4, double alpha2);
114
115 virtual VGM::ISolid* CreateTrd(const std::string& name, double hx1,
116 double hx2, double hy1, double hy2, double hz);
117
118 virtual VGM::ISolid* CreateTubs(const std::string& name, double rin,
119 double rout, double hz, double sphi, double dphi);
120
121 // Boolean solids
122 //
123 virtual VGM::ISolid* CreateIntersectionSolid(const std::string& name,
124 VGM::ISolid* solidA, VGM::ISolid* solidB, const VGM::Transform& transform);
125
126 virtual VGM::ISolid* CreateSubtractionSolid(const std::string& name,
127 VGM::ISolid* solidA, VGM::ISolid* solidB, const VGM::Transform& transform);
128
129 virtual VGM::ISolid* CreateUnionSolid(const std::string& name,
130 VGM::ISolid* solidA, VGM::ISolid* solidB, const VGM::Transform& transform);
131
132 virtual VGM::ISolid* CreateDisplacedSolid(const std::string& name,
133 VGM::ISolid* solid, const VGM::Transform& transform);
134
135 virtual VGM::ISolid* CreateScaledSolid(const std::string& name,
136 VGM::ISolid* solid, const VGM::Transform& transform);
137
138 virtual VGM::ISolid* CreateMultiUnion(const std::string& name,
139 std::vector<VGM::ISolid*> constituents,
140 std::vector<VGM::Transform> transforms);
141
142 // volumes
143 //
144 virtual VGM::IVolume* CreateVolume(
145 const std::string& name, VGM::ISolid* solid, const std::string& mediumName);
146
147 // placements
148 //
149 virtual VGM::IPlacement* CreatePlacement(const std::string& name, int copyNo,
150 VGM::IVolume* volume, VGM::IVolume* motherVolume,
151 const VGM::Transform& transform);
152
153 virtual VGM::IPlacement* CreateMultiplePlacement(const std::string& name,
154 VGM::IVolume* volume, VGM::IVolume* motherVolume, VGM::Axis axis,
155 int nofItems, double width, double offset, double halfGap);
156
157 virtual VGM::IPlacement* CreateParameterisedPlacement(const std::string& name,
158 VGM::IVolume* motherVolume,
159 const std::vector<VGM::Transform>& transforms,
160 const std::vector<VGM::IVolume*>& volumes);
161
162 // top volume
163 //
164 virtual VGM::IPlacement* Top() const;
165 virtual VGM::ISolid* SingleSolid() const;
166
167 G4VPhysicalVolume* World() const;
168 G4VSolid* Solid() const;
169
170 // import/export
171 //
172 bool Import(G4VPhysicalVolume* topVolume);
173 bool Import(G4VSolid* solid);
174
175 protected:
176 Factory(const Factory& rhs);
177
178 virtual void SetSolid(VGM::ISolid* solid);
179
180 private:
181 // methods
182
183 void ImportConstituentSolid(int index, G4BooleanSolid* solid);
184 void ImportConstituentSolid(int index, G4MultiUnion* solid);
185 VGM::ISolid* ImportSolid(G4VSolid* solid);
186 VGM::IVolume* ImportLV(G4LogicalVolume* lv);
187 VGM::IVolume* ImportLV(G4LogicalVolume* lv, const std::string& mediumName);
188 void ImportDaughters(G4LogicalVolume* lv);
189 void ImportPositions();
190 void ImportPositions(G4LogicalVolume* lv);
191 VGM::IPlacement* ImportPVPair(VGM::IVolume* volume,
192 VGM::IVolume* motherVolume, G4PhysicalVolumesPair pvPair);
193 bool SwitchSolid(
194 VGM::IVolume* volume, G4LogicalVolume* g4LV, G4LogicalVolume* g4Mother);
195 VGM::ISolid* Register(VGM::ISolid* solid);
196
197 // import/export
198 //
199 virtual bool Import(void* topVolume);
200 virtual bool ImportSolid(void* solid);
201
202 // static data members
203 static bool fgSurfCheck;
204
205 // data members
206 VGM::IPlacement* fTop;
207 VGM::ISolid* fSolid;
208};
209
210} // namespace Geant4GM
211
212#endif // GEANT4_GM_FACTORY_H
The abstract base class to geometry factory.
Definition VFactory.h:43
VGM factory for Geant4.
Definition Factory.h:47
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:914
G4VSolid * Solid() const
Definition Factory.cxx:1271
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:827
virtual VGM::ISolid * CreateScaledSolid(const std::string &name, VGM::ISolid *solid, const VGM::Transform &transform)
Create scaled solid.
Definition Factory.cxx:1022
virtual VGM::ISolid * CreateBox(const std::string &name, double hx, double hy, double hz)
Create the box solid.
Definition Factory.cxx:800
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:1039
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:1212
bool Import(G4VPhysicalVolume *topVolume)
Definition Factory.cxx:1279
virtual VGM::ISolid * SingleSolid() const
Return solid (if in one solid conversion mode)
Definition Factory.cxx:1255
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:888
virtual VGM::ISolid * CreateEllipticalTube(const std::string &name, double dx, double dy, double hz)
Create the elliptical tube solid.
Definition Factory.cxx:836
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:906
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:940
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:779
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:898
virtual VGM::ISolid * CreateDisplacedSolid(const std::string &name, VGM::ISolid *solid, const VGM::Transform &transform)
Create displaced solid.
Definition Factory.cxx:1004
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:844
virtual VGM::IPlacement * Top() const
Return the top volume placement.
Definition Factory.cxx:1247
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:878
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:852
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:949
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:1089
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:808
static bool GetSurfCheck()
Definition Factory.cxx:104
virtual ~Factory()
Definition Factory.cxx:133
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:924
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:967
virtual void SetSolid(VGM::ISolid *solid)
Set solid (in single mode)
Definition Factory.cxx:767
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:932
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:1134
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:986
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:817
virtual VGM::IVolume * CreateVolume(const std::string &name, VGM::ISolid *solid, const std::string &mediumName)
Create the volume.
Definition Factory.cxx:1061
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:868
static void SetSurfCheck(bool surfCheck)
Definition Factory.cxx:95
G4VPhysicalVolume * World() const
Definition Factory.cxx:1263
virtual VGM::ISolid * CreateParaboloid(const std::string &name, double r1, double r2, double hz)
Create the paraboloid solid.
Definition Factory.cxx:860
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 Geant4.
Definition Element.h:29
VGM interfaces.
Definition VMedium.h:28
std::vector< double > Transform
Definition Transform.h:40