00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include "G4BREPSolidOpenPCone.hh"
00037 #include "G4BREPSolidPCone.hh"
00038 #include "G4Tubs.hh"
00039 #include "G4VGraphicsScene.hh"
00040
00041 G4BREPSolidOpenPCone::
00042 G4BREPSolidOpenPCone ( const G4String& name,
00043 G4double sangle,
00044 G4double oangle,
00045 G4int nplanes,
00046 G4double zstart,
00047 G4double zvalues[],
00048 G4double radmin[],
00049 G4double radmax[] )
00050 : G4IntersectionSolid ( name,
00051 new G4BREPSolidPCone( name,
00052 sangle, oangle,
00053 nplanes, zstart, zvalues,
00054 radmin, radmax ),
00055 new G4Tubs( "IntersectionTubs",
00056 0., 1., 1., sangle, oangle ) )
00057 {
00058
00059
00060 constructorParams.start_angle = sangle;
00061 constructorParams.opening_angle = oangle;
00062 constructorParams.num_z_planes = nplanes;
00063 constructorParams.z_start = zstart;
00064 constructorParams.z_values = 0;
00065 constructorParams.RMIN = 0;
00066 constructorParams.RMAX = 0;
00067 if ( nplanes>0 )
00068 {
00069 constructorParams.z_values = new G4double[nplanes];
00070 constructorParams.RMIN = new G4double[nplanes];
00071 constructorParams.RMAX = new G4double[nplanes];
00072 for ( G4int i = 0; i < nplanes; ++i )
00073 {
00074 constructorParams.z_values[i] = zvalues[i];
00075 constructorParams.RMIN[i] = radmin[i];
00076 constructorParams.RMAX[i] = radmax[i];
00077 }
00078 }
00079
00080
00081
00082 InitializeOPCone();
00083 }
00084
00085 G4BREPSolidOpenPCone::G4BREPSolidOpenPCone( __void__& a )
00086 : G4IntersectionSolid(a)
00087 {
00088 constructorParams.start_angle = 0.;
00089 constructorParams.opening_angle = 0.;
00090 constructorParams.num_z_planes = 0;
00091 constructorParams.z_start = 0.;
00092 constructorParams.z_values = 0;
00093 constructorParams.RMIN = 0;
00094 constructorParams.RMAX = 0;
00095 }
00096
00097 G4BREPSolidOpenPCone::~G4BREPSolidOpenPCone()
00098 {
00099 if( constructorParams.num_z_planes > 0 )
00100 {
00101 delete [] constructorParams.z_values;
00102 delete [] constructorParams.RMIN;
00103 delete [] constructorParams.RMAX;
00104 }
00105 }
00106
00107 G4BREPSolidOpenPCone::G4BREPSolidOpenPCone(const G4BREPSolidOpenPCone& rhs)
00108 : G4IntersectionSolid ( rhs.GetName(),
00109 new G4BREPSolidPCone( rhs.GetName(), rhs.constructorParams.start_angle,
00110 rhs.constructorParams.opening_angle,
00111 rhs.constructorParams.num_z_planes,
00112 rhs.constructorParams.z_start,
00113 rhs.constructorParams.z_values,
00114 rhs.constructorParams.RMIN,
00115 rhs.constructorParams.RMAX ),
00116 new G4Tubs( "IntersectionTubs", 0., 1., 1.,
00117 rhs.constructorParams.start_angle,
00118 rhs.constructorParams.opening_angle ) )
00119
00120 {
00121 SetName(rhs.GetName());
00122 constructorParams.start_angle = rhs.constructorParams.start_angle;
00123 constructorParams.opening_angle = rhs.constructorParams.opening_angle;
00124 constructorParams.num_z_planes = rhs.constructorParams.num_z_planes;
00125 constructorParams.z_start = rhs.constructorParams.z_start;
00126 constructorParams.z_values = 0;
00127 constructorParams.RMIN = 0;
00128 constructorParams.RMAX = 0;
00129 G4int nplanes = constructorParams.num_z_planes;
00130 if( nplanes > 0 )
00131 {
00132 constructorParams.z_values = new G4double[nplanes];
00133 constructorParams.RMIN = new G4double[nplanes];
00134 constructorParams.RMAX = new G4double[nplanes];
00135 for ( G4int i = 0; i < nplanes; ++i )
00136 {
00137 constructorParams.z_values[i] = rhs.constructorParams.z_values[i];
00138 constructorParams.RMIN[i] = rhs.constructorParams.RMIN[i];
00139 constructorParams.RMAX[i] = rhs.constructorParams.RMAX[i];
00140 }
00141 }
00142 InitializeOPCone();
00143 }
00144
00145 G4BREPSolidOpenPCone&
00146 G4BREPSolidOpenPCone::operator = (const G4BREPSolidOpenPCone& rhs)
00147 {
00148
00149
00150 if (this == &rhs) { return *this; }
00151
00152
00153
00154 G4IntersectionSolid::operator=(rhs);
00155
00156
00157
00158 SetName(rhs.GetName());
00159 constructorParams.start_angle = rhs.constructorParams.start_angle;
00160 constructorParams.opening_angle = rhs.constructorParams.opening_angle;
00161 constructorParams.num_z_planes = rhs.constructorParams.num_z_planes;
00162 constructorParams.z_start = rhs.constructorParams.z_start;
00163 G4int nplanes = constructorParams.num_z_planes;
00164 if( nplanes > 0 )
00165 {
00166 delete [] constructorParams.z_values;
00167 delete [] constructorParams.RMIN;
00168 delete [] constructorParams.RMAX;
00169 constructorParams.z_values = new G4double[nplanes];
00170 constructorParams.RMIN = new G4double[nplanes];
00171 constructorParams.RMAX = new G4double[nplanes];
00172 for( G4int idx = 0; idx < nplanes; ++idx )
00173 {
00174 constructorParams.z_values[idx] = rhs.constructorParams.z_values[idx];
00175 constructorParams.RMIN[idx] = rhs.constructorParams.RMIN[idx];
00176 constructorParams.RMAX[idx] = rhs.constructorParams.RMAX[idx];
00177 }
00178 }
00179 InitializeOPCone();
00180
00181 return *this;
00182 }
00183
00184 void G4BREPSolidOpenPCone::InitializeOPCone()
00185 {
00186 G4double MaxRMAX = 0;
00187 for ( G4int i = 0; i < constructorParams.num_z_planes; ++i )
00188 if ( constructorParams.RMAX[i] > MaxRMAX )
00189 MaxRMAX = constructorParams.RMAX[i];
00190
00191 G4double length =
00192 constructorParams.z_values[constructorParams.num_z_planes-1]
00193 - constructorParams.z_values[0];
00194
00195 ((G4Tubs*)fPtrSolidB)->SetOuterRadius ( MaxRMAX );
00196 ((G4Tubs*)fPtrSolidB)->SetZHalfLength ( length );
00197 }
00198
00199 void G4BREPSolidOpenPCone::DescribeYourselfTo (G4VGraphicsScene& scene) const
00200 {
00201 scene.AddSolid ( *this );
00202 }
00203
00204 G4VSolid* G4BREPSolidOpenPCone::Clone() const
00205 {
00206 return new G4BREPSolidOpenPCone(*this);
00207 }
00208
00209 std::ostream& G4BREPSolidOpenPCone::StreamInfo(std::ostream& os) const
00210 {
00211
00212
00213 G4IntersectionSolid::StreamInfo( os );
00214
00215 return os;
00216 }
00217