Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4BREPSolidOpenPCone.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//
27// $Id$
28//
29// ----------------------------------------------------------------------
30// GEANT 4 class source file
31//
32// G4BREPSolidOpenPCone.cc
33//
34// ----------------------------------------------------------------------
35
37#include "G4BREPSolidPCone.hh"
38#include "G4Tubs.hh"
39#include "G4VGraphicsScene.hh"
40
42G4BREPSolidOpenPCone ( const G4String& name,
43 G4double sangle,
44 G4double oangle,
45 G4int nplanes, // sections,
46 G4double zstart,
47 G4double zvalues[],
48 G4double radmin[],
49 G4double radmax[] )
50 : G4IntersectionSolid ( name,
51 new G4BREPSolidPCone( name,
52 sangle, oangle,
53 nplanes, zstart, zvalues,
54 radmin, radmax ),
55 new G4Tubs( "IntersectionTubs",
56 0., 1., 1., sangle, oangle ) )
57{
58 // Save local data
59 //
60 constructorParams.start_angle = sangle;
61 constructorParams.opening_angle = oangle;
62 constructorParams.num_z_planes = nplanes;
63 constructorParams.z_start = zstart;
64 constructorParams.z_values = 0;
65 constructorParams.RMIN = 0;
66 constructorParams.RMAX = 0;
67 if ( nplanes>0 )
68 {
69 constructorParams.z_values = new G4double[nplanes];
70 constructorParams.RMIN = new G4double[nplanes];
71 constructorParams.RMAX = new G4double[nplanes];
72 for ( G4int i = 0; i < nplanes; ++i )
73 {
74 constructorParams.z_values[i] = zvalues[i];
75 constructorParams.RMIN[i] = radmin[i];
76 constructorParams.RMAX[i] = radmax[i];
77 }
78 }
79
80 // compute max radius
81 //
82 InitializeOPCone();
83}
84
87{
88 constructorParams.start_angle = 0.;
89 constructorParams.opening_angle = 0.;
90 constructorParams.num_z_planes = 0;
91 constructorParams.z_start = 0.;
92 constructorParams.z_values = 0;
93 constructorParams.RMIN = 0;
94 constructorParams.RMAX = 0;
95}
96
98{
99 if( constructorParams.num_z_planes > 0 )
100 {
101 delete [] constructorParams.z_values;
102 delete [] constructorParams.RMIN;
103 delete [] constructorParams.RMAX;
104 }
105}
106
108 : G4IntersectionSolid ( rhs.GetName(),
109 new G4BREPSolidPCone( rhs.GetName(), rhs.constructorParams.start_angle,
110 rhs.constructorParams.opening_angle,
111 rhs.constructorParams.num_z_planes,
112 rhs.constructorParams.z_start,
113 rhs.constructorParams.z_values,
114 rhs.constructorParams.RMIN,
115 rhs.constructorParams.RMAX ),
116 new G4Tubs( "IntersectionTubs", 0., 1., 1.,
117 rhs.constructorParams.start_angle,
118 rhs.constructorParams.opening_angle ) )
119
120{
121 SetName(rhs.GetName());
122 constructorParams.start_angle = rhs.constructorParams.start_angle;
123 constructorParams.opening_angle = rhs.constructorParams.opening_angle;
124 constructorParams.num_z_planes = rhs.constructorParams.num_z_planes;
125 constructorParams.z_start = rhs.constructorParams.z_start;
126 constructorParams.z_values = 0;
127 constructorParams.RMIN = 0;
128 constructorParams.RMAX = 0;
129 G4int nplanes = constructorParams.num_z_planes;
130 if( nplanes > 0 )
131 {
132 constructorParams.z_values = new G4double[nplanes];
133 constructorParams.RMIN = new G4double[nplanes];
134 constructorParams.RMAX = new G4double[nplanes];
135 for ( G4int i = 0; i < nplanes; ++i )
136 {
137 constructorParams.z_values[i] = rhs.constructorParams.z_values[i];
138 constructorParams.RMIN[i] = rhs.constructorParams.RMIN[i];
139 constructorParams.RMAX[i] = rhs.constructorParams.RMAX[i];
140 }
141 }
142 InitializeOPCone();
143}
144
147{
148 // Check assignment to self
149 //
150 if (this == &rhs) { return *this; }
151
152 // Copy base class data
153 //
155
156 // Copy data
157 //
158 SetName(rhs.GetName());
159 constructorParams.start_angle = rhs.constructorParams.start_angle;
160 constructorParams.opening_angle = rhs.constructorParams.opening_angle;
161 constructorParams.num_z_planes = rhs.constructorParams.num_z_planes;
162 constructorParams.z_start = rhs.constructorParams.z_start;
163 G4int nplanes = constructorParams.num_z_planes;
164 if( nplanes > 0 )
165 {
166 delete [] constructorParams.z_values;
167 delete [] constructorParams.RMIN;
168 delete [] constructorParams.RMAX;
169 constructorParams.z_values = new G4double[nplanes];
170 constructorParams.RMIN = new G4double[nplanes];
171 constructorParams.RMAX = new G4double[nplanes];
172 for( G4int idx = 0; idx < nplanes; ++idx )
173 {
174 constructorParams.z_values[idx] = rhs.constructorParams.z_values[idx];
175 constructorParams.RMIN[idx] = rhs.constructorParams.RMIN[idx];
176 constructorParams.RMAX[idx] = rhs.constructorParams.RMAX[idx];
177 }
178 }
179 InitializeOPCone();
180
181 return *this;
182}
183
184void G4BREPSolidOpenPCone::InitializeOPCone()
185{
186 G4double MaxRMAX = 0;
187 for ( G4int i = 0; i < constructorParams.num_z_planes; ++i )
188 if ( constructorParams.RMAX[i] > MaxRMAX )
189 MaxRMAX = constructorParams.RMAX[i];
190
191 G4double length =
192 constructorParams.z_values[constructorParams.num_z_planes-1]
193 - constructorParams.z_values[0];
194
195 ((G4Tubs*)fPtrSolidB)->SetOuterRadius ( MaxRMAX );
196 ((G4Tubs*)fPtrSolidB)->SetZHalfLength ( length );
197}
198
200{
201 scene.AddSolid ( *this );
202}
203
205{
206 return new G4BREPSolidOpenPCone(*this);
207}
208
209std::ostream& G4BREPSolidOpenPCone::StreamInfo(std::ostream& os) const
210{
211 // Streams solid contents to output stream.
212
214
215 return os;
216}
217
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
std::ostream & StreamInfo(std::ostream &os) const
G4BREPSolidOpenPCone & operator=(const G4BREPSolidOpenPCone &rhs)
G4VSolid * Clone() const
G4BREPSolidOpenPCone(const G4String &name, G4double start_angle, G4double opening_angle, G4int num_z_planes, G4double z_start, G4double z_values[], G4double RMIN[], G4double RMAX[])
void DescribeYourselfTo(G4VGraphicsScene &scene) const
G4VSolid * fPtrSolidB
G4IntersectionSolid & operator=(const G4IntersectionSolid &rhs)
Definition: G4Tubs.hh:77
virtual void AddSolid(const G4Box &)=0
G4String GetName() const
virtual std::ostream & StreamInfo(std::ostream &os) const =0
void SetName(const G4String &name)