Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4BREPSolidCylinder.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// $Id$
27//
28// ----------------------------------------------------------------------
29// GEANT 4 class source file
30//
31// G4BREPSolidCylinder.cc
32//
33// ----------------------------------------------------------------------
34
36#include "G4CircularCurve.hh"
37#include "G4FPlane.hh"
39
41 const G4ThreeVector& origin,
42 const G4ThreeVector& axis,
43 const G4ThreeVector& direction,
44 G4double radius,
45 G4double length)
46 : G4BREPSolid(name)
47{
49 active=1;
50
51 // Save constructor parameters
52 constructorParams.origin = origin;
53 constructorParams.axis = axis;
54 constructorParams.direction = direction;
55 constructorParams.length = length;
56 constructorParams.radius = radius;
57
58 InitializeCylinder();
59}
60
62 : G4BREPSolid(a)
63{
64}
65
67{
68}
69
71 : G4BREPSolid(rhs)
72{
73 constructorParams.origin = rhs.constructorParams.origin;
74 constructorParams.axis = rhs.constructorParams.axis;
75 constructorParams.direction = rhs.constructorParams.direction;
76 constructorParams.length = rhs.constructorParams.length;
77 constructorParams.radius = rhs.constructorParams.radius;
78
79 InitializeCylinder();
80}
81
84{
85 // Check assignment to self
86 //
87 if (this == &rhs) { return *this; }
88
89 // Copy base class data
90 //
92
93 // Copy data
94 //
95 constructorParams.origin = rhs.constructorParams.origin;
96 constructorParams.axis = rhs.constructorParams.axis;
97 constructorParams.direction = rhs.constructorParams.direction;
98 constructorParams.length = rhs.constructorParams.length;
99 constructorParams.radius = rhs.constructorParams.radius;
100
101 InitializeCylinder();
102
103 return *this;
104}
105
106void G4BREPSolidCylinder::InitializeCylinder()
107{
108 SurfaceVec = new G4Surface*[3];
109 G4CurveVector cv;
110 G4CircularCurve* tmp;
111
112 // Creation of the cylindrical surface
113 SurfaceVec[0] = new G4FCylindricalSurface(constructorParams.origin,
114 constructorParams.axis,
115 constructorParams.radius,
116 constructorParams.length);
117 //SurfaceVec[0]->SetBoundaries(&cv);
118 //cv.clear();
119
120 // Creation of the first circular surface, which origin is origin
121 G4Point3D ArcStart1 = G4Point3D( constructorParams.origin
122 + ( constructorParams.radius
123 * constructorParams.direction ) );
124 G4Vector3D axis1 = G4Vector3D( constructorParams.axis.cross( constructorParams.direction ) );
125
126 tmp = new G4CircularCurve;
127 tmp->Init( G4Axis2Placement3D(constructorParams.direction, axis1,
128 constructorParams.origin),
129 constructorParams.radius );
130 tmp->SetBounds(ArcStart1, ArcStart1);
131 cv.push_back(tmp);
132
133 SurfaceVec[1] = new G4FPlane(constructorParams.direction, axis1,
134 constructorParams.origin);
135 SurfaceVec[1]->SetBoundaries(&cv);
136 cv.clear();
137
138
139 // Creation of the second circular surface
140 G4Point3D origin2 = G4Point3D( constructorParams.origin
141 + ( constructorParams.length
142 * constructorParams.axis ) );
143 G4Point3D ArcStart2 = origin2
144 + G4Point3D( constructorParams.radius
145 * constructorParams.direction );
146 G4Vector3D axis2 = axis1;
147
148 tmp = new G4CircularCurve;
149 tmp->Init( G4Axis2Placement3D(constructorParams.direction,
150 axis2, origin2),
151 constructorParams.radius);
152 tmp->SetBounds(ArcStart2, ArcStart2);
153 cv.push_back(tmp);
154
155 SurfaceVec[2] = new G4FPlane(constructorParams.direction, axis2, origin2);
156 SurfaceVec[2]->SetBoundaries(&cv);
157 cv.clear();
158
159 Initialize();
160}
161
163{
164 return new G4BREPSolidCylinder(*this);
165}
166
167std::ostream& G4BREPSolidCylinder::StreamInfo(std::ostream& os) const
168{
169 // Streams solid contents to output stream.
170
172 << "\n origin: " << constructorParams.origin
173 << "\n axis: " << constructorParams.axis
174 << "\n direction: " << constructorParams.direction
175 << "\n length: " << constructorParams.length
176 << "\n radius: " << constructorParams.radius
177 << "\n-----------------------------------------------------------\n";
178
179 return os;
180}
181
std::vector< G4Curve * > G4CurveVector
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:35
double G4double
Definition: G4Types.hh:64
HepGeom::Vector3D< G4double > G4Vector3D
Definition: G4Vector3D.hh:35
G4BREPSolidCylinder(const G4String &name, const G4ThreeVector &origin, const G4ThreeVector &axis, const G4ThreeVector &direction, G4double radius, G4double length)
G4VSolid * Clone() const
G4BREPSolidCylinder & operator=(const G4BREPSolidCylinder &rhs)
std::ostream & StreamInfo(std::ostream &os) const
G4Surface ** SurfaceVec
Definition: G4BREPSolid.hh:231
G4BREPSolid & operator=(const G4BREPSolid &rhs)
Definition: G4BREPSolid.cc:138
G4int nb_of_surfaces
Definition: G4BREPSolid.hh:229
virtual std::ostream & StreamInfo(std::ostream &os) const
virtual void Initialize()
Definition: G4BREPSolid.cc:171
void Init(const G4Axis2Placement3D &position0, G4double radius0)
void SetBounds(G4double p1, G4double p2)
void SetBoundaries(G4CurveVector *)
Definition: G4Surface.cc:140