Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // Implementation for G4UTubs wrapper class << 27 // 26 // 28 // 30.10.13 G.Cosmo, CERN/PH << 27 // >> 28 // >> 29 // Implementation for G4UTubs wrapper class 29 // ------------------------------------------- 30 // -------------------------------------------------------------------- 30 31 31 #include "G4Tubs.hh" 32 #include "G4Tubs.hh" 32 #include "G4UTubs.hh" 33 #include "G4UTubs.hh" 33 34 34 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G 35 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) ) 35 36 36 #include "G4GeomTools.hh" 37 #include "G4GeomTools.hh" 37 #include "G4AffineTransform.hh" 38 #include "G4AffineTransform.hh" 38 #include "G4VPVParameterisation.hh" 39 #include "G4VPVParameterisation.hh" 39 #include "G4BoundingEnvelope.hh" 40 #include "G4BoundingEnvelope.hh" 40 41 41 using namespace CLHEP; 42 using namespace CLHEP; 42 43 43 ////////////////////////////////////////////// 44 ///////////////////////////////////////////////////////////////////////// 44 // 45 // 45 // Constructor - check parameters, convert ang 46 // Constructor - check parameters, convert angles so 0<sphi+dpshi<=2_PI 46 // - note if pdphi>2PI then reset 47 // - note if pdphi>2PI then reset to 2PI 47 48 48 G4UTubs::G4UTubs( const G4String& pName, 49 G4UTubs::G4UTubs( const G4String& pName, 49 G4double pRMin, G4doub 50 G4double pRMin, G4double pRMax, 50 G4double pDz, 51 G4double pDz, 51 G4double pSPhi, G4doub 52 G4double pSPhi, G4double pDPhi ) 52 : Base_t(pName, pRMin, pRMax, pDz, pSPhi, pD 53 : Base_t(pName, pRMin, pRMax, pDz, pSPhi, pDPhi) 53 { 54 { 54 } 55 } 55 56 56 ////////////////////////////////////////////// 57 /////////////////////////////////////////////////////////////////////// 57 // 58 // 58 // Fake default constructor - sets only member 59 // Fake default constructor - sets only member data and allocates memory 59 // for usage restri 60 // for usage restricted to object persistency. 60 // 61 // 61 G4UTubs::G4UTubs( __void__& a ) 62 G4UTubs::G4UTubs( __void__& a ) 62 : Base_t(a) 63 : Base_t(a) 63 { 64 { 64 } 65 } 65 66 66 ////////////////////////////////////////////// 67 ////////////////////////////////////////////////////////////////////////// 67 // 68 // 68 // Destructor 69 // Destructor 69 70 70 G4UTubs::~G4UTubs() = default; << 71 G4UTubs::~G4UTubs() >> 72 { >> 73 } 71 74 72 ////////////////////////////////////////////// 75 ////////////////////////////////////////////////////////////////////////// 73 // 76 // 74 // Copy constructor 77 // Copy constructor 75 78 76 G4UTubs::G4UTubs(const G4UTubs& rhs) 79 G4UTubs::G4UTubs(const G4UTubs& rhs) 77 : Base_t(rhs) 80 : Base_t(rhs) 78 { 81 { 79 } 82 } 80 83 81 ////////////////////////////////////////////// 84 ////////////////////////////////////////////////////////////////////////// 82 // 85 // 83 // Assignment operator 86 // Assignment operator 84 87 85 G4UTubs& G4UTubs::operator = (const G4UTubs& r 88 G4UTubs& G4UTubs::operator = (const G4UTubs& rhs) 86 { 89 { 87 // Check assignment to self 90 // Check assignment to self 88 // 91 // 89 if (this == &rhs) { return *this; } 92 if (this == &rhs) { return *this; } 90 93 91 // Copy base class data 94 // Copy base class data 92 // 95 // 93 Base_t::operator=(rhs); 96 Base_t::operator=(rhs); 94 97 95 return *this; 98 return *this; 96 } 99 } 97 100 98 ////////////////////////////////////////////// 101 ///////////////////////////////////////////////////////////////////////// 99 // 102 // 100 // Accessors and modifiers 103 // Accessors and modifiers 101 104 102 G4double G4UTubs::GetInnerRadius() const 105 G4double G4UTubs::GetInnerRadius() const 103 { 106 { 104 return rmin(); 107 return rmin(); 105 } 108 } 106 G4double G4UTubs::GetOuterRadius() const 109 G4double G4UTubs::GetOuterRadius() const 107 { 110 { 108 return rmax(); 111 return rmax(); 109 } 112 } 110 G4double G4UTubs::GetZHalfLength() const 113 G4double G4UTubs::GetZHalfLength() const 111 { 114 { 112 return z(); 115 return z(); 113 } 116 } 114 G4double G4UTubs::GetStartPhiAngle() const 117 G4double G4UTubs::GetStartPhiAngle() const 115 { 118 { 116 return sphi(); 119 return sphi(); 117 } 120 } 118 G4double G4UTubs::GetDeltaPhiAngle() const 121 G4double G4UTubs::GetDeltaPhiAngle() const 119 { 122 { 120 return dphi(); 123 return dphi(); 121 } 124 } 122 G4double G4UTubs::GetSinStartPhi() const 125 G4double G4UTubs::GetSinStartPhi() const 123 { 126 { 124 return std::sin(GetStartPhiAngle()); 127 return std::sin(GetStartPhiAngle()); 125 } 128 } 126 G4double G4UTubs::GetCosStartPhi() const 129 G4double G4UTubs::GetCosStartPhi() const 127 { 130 { 128 return std::cos(GetStartPhiAngle()); 131 return std::cos(GetStartPhiAngle()); 129 } 132 } 130 G4double G4UTubs::GetSinEndPhi() const 133 G4double G4UTubs::GetSinEndPhi() const 131 { 134 { 132 return std::sin(GetStartPhiAngle()+GetDeltaP 135 return std::sin(GetStartPhiAngle()+GetDeltaPhiAngle()); 133 } 136 } 134 G4double G4UTubs::GetCosEndPhi() const 137 G4double G4UTubs::GetCosEndPhi() const 135 { 138 { 136 return std::cos(GetStartPhiAngle()+GetDeltaP 139 return std::cos(GetStartPhiAngle()+GetDeltaPhiAngle()); 137 } 140 } 138 141 139 void G4UTubs::SetInnerRadius(G4double newRMin) 142 void G4UTubs::SetInnerRadius(G4double newRMin) 140 { 143 { 141 SetRMin(newRMin); 144 SetRMin(newRMin); 142 fRebuildPolyhedron = true; 145 fRebuildPolyhedron = true; 143 } 146 } 144 void G4UTubs::SetOuterRadius(G4double newRMax) 147 void G4UTubs::SetOuterRadius(G4double newRMax) 145 { 148 { 146 SetRMax(newRMax); 149 SetRMax(newRMax); 147 fRebuildPolyhedron = true; 150 fRebuildPolyhedron = true; 148 } 151 } 149 void G4UTubs::SetZHalfLength(G4double newDz) 152 void G4UTubs::SetZHalfLength(G4double newDz) 150 { 153 { 151 SetDz(newDz); 154 SetDz(newDz); 152 fRebuildPolyhedron = true; 155 fRebuildPolyhedron = true; 153 } 156 } 154 void G4UTubs::SetStartPhiAngle(G4double newSPh 157 void G4UTubs::SetStartPhiAngle(G4double newSPhi, G4bool) 155 { 158 { 156 SetSPhi(newSPhi); 159 SetSPhi(newSPhi); 157 fRebuildPolyhedron = true; 160 fRebuildPolyhedron = true; 158 } 161 } 159 void G4UTubs::SetDeltaPhiAngle(G4double newDPh 162 void G4UTubs::SetDeltaPhiAngle(G4double newDPhi) 160 { 163 { 161 SetDPhi(newDPhi); 164 SetDPhi(newDPhi); 162 fRebuildPolyhedron = true; 165 fRebuildPolyhedron = true; 163 } 166 } 164 167 165 ////////////////////////////////////////////// 168 ///////////////////////////////////////////////////////////////////////// 166 // 169 // 167 // Dispatch to parameterisation for replicatio 170 // Dispatch to parameterisation for replication mechanism dimension 168 // computation & modification. 171 // computation & modification. 169 172 170 void G4UTubs::ComputeDimensions( G4VPVPar 173 void G4UTubs::ComputeDimensions( G4VPVParameterisation* p, 171 const G4int n, 174 const G4int n, 172 const G4VPhysi 175 const G4VPhysicalVolume* pRep ) 173 { 176 { 174 p->ComputeDimensions(*(G4Tubs*)this,n,pRep) 177 p->ComputeDimensions(*(G4Tubs*)this,n,pRep) ; 175 } 178 } 176 179 177 ////////////////////////////////////////////// 180 ///////////////////////////////////////////////////////////////////////// 178 // 181 // 179 // Make a clone of the object 182 // Make a clone of the object 180 183 181 G4VSolid* G4UTubs::Clone() const 184 G4VSolid* G4UTubs::Clone() const 182 { 185 { 183 return new G4UTubs(*this); 186 return new G4UTubs(*this); 184 } 187 } 185 188 186 ////////////////////////////////////////////// 189 ////////////////////////////////////////////////////////////////////////// 187 // 190 // 188 // Get bounding box 191 // Get bounding box 189 192 190 void G4UTubs::BoundingLimits(G4ThreeVector& pM 193 void G4UTubs::BoundingLimits(G4ThreeVector& pMin, G4ThreeVector& pMax) const 191 { 194 { 192 static G4bool checkBBox = true; 195 static G4bool checkBBox = true; 193 196 194 G4double rmin = GetInnerRadius(); 197 G4double rmin = GetInnerRadius(); 195 G4double rmax = GetOuterRadius(); 198 G4double rmax = GetOuterRadius(); 196 G4double dz = GetZHalfLength(); 199 G4double dz = GetZHalfLength(); 197 200 198 // Find bounding box 201 // Find bounding box 199 // 202 // 200 if (GetDeltaPhiAngle() < twopi) 203 if (GetDeltaPhiAngle() < twopi) 201 { 204 { 202 G4TwoVector vmin,vmax; 205 G4TwoVector vmin,vmax; 203 G4GeomTools::DiskExtent(rmin,rmax, 206 G4GeomTools::DiskExtent(rmin,rmax, 204 GetSinStartPhi(),G 207 GetSinStartPhi(),GetCosStartPhi(), 205 GetSinEndPhi(),Get 208 GetSinEndPhi(),GetCosEndPhi(), 206 vmin,vmax); 209 vmin,vmax); 207 pMin.set(vmin.x(),vmin.y(),-dz); 210 pMin.set(vmin.x(),vmin.y(),-dz); 208 pMax.set(vmax.x(),vmax.y(), dz); 211 pMax.set(vmax.x(),vmax.y(), dz); 209 } 212 } 210 else 213 else 211 { 214 { 212 pMin.set(-rmax,-rmax,-dz); 215 pMin.set(-rmax,-rmax,-dz); 213 pMax.set( rmax, rmax, dz); 216 pMax.set( rmax, rmax, dz); 214 } 217 } 215 218 216 // Check correctness of the bounding box 219 // Check correctness of the bounding box 217 // 220 // 218 if (pMin.x() >= pMax.x() || pMin.y() >= pMax 221 if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z()) 219 { 222 { 220 std::ostringstream message; 223 std::ostringstream message; 221 message << "Bad bounding box (min >= max) 224 message << "Bad bounding box (min >= max) for solid: " 222 << GetName() << " !" 225 << GetName() << " !" 223 << "\npMin = " << pMin 226 << "\npMin = " << pMin 224 << "\npMax = " << pMax; 227 << "\npMax = " << pMax; 225 G4Exception("G4UTubs::BoundingLimits()", " 228 G4Exception("G4UTubs::BoundingLimits()", "GeomMgt0001", 226 JustWarning, message); 229 JustWarning, message); 227 StreamInfo(G4cout); 230 StreamInfo(G4cout); 228 } 231 } 229 232 230 // Check consistency of bounding boxes 233 // Check consistency of bounding boxes 231 // 234 // 232 if (checkBBox) 235 if (checkBBox) 233 { 236 { 234 U3Vector vmin, vmax; 237 U3Vector vmin, vmax; 235 Extent(vmin,vmax); 238 Extent(vmin,vmax); 236 if (std::abs(pMin.x()-vmin.x()) > kCarTole 239 if (std::abs(pMin.x()-vmin.x()) > kCarTolerance || 237 std::abs(pMin.y()-vmin.y()) > kCarTole 240 std::abs(pMin.y()-vmin.y()) > kCarTolerance || 238 std::abs(pMin.z()-vmin.z()) > kCarTole 241 std::abs(pMin.z()-vmin.z()) > kCarTolerance || 239 std::abs(pMax.x()-vmax.x()) > kCarTole 242 std::abs(pMax.x()-vmax.x()) > kCarTolerance || 240 std::abs(pMax.y()-vmax.y()) > kCarTole 243 std::abs(pMax.y()-vmax.y()) > kCarTolerance || 241 std::abs(pMax.z()-vmax.z()) > kCarTole 244 std::abs(pMax.z()-vmax.z()) > kCarTolerance) 242 { 245 { 243 std::ostringstream message; 246 std::ostringstream message; 244 message << "Inconsistency in bounding bo 247 message << "Inconsistency in bounding boxes for solid: " 245 << GetName() << " !" 248 << GetName() << " !" 246 << "\nBBox min: wrapper = " << p 249 << "\nBBox min: wrapper = " << pMin << " solid = " << vmin 247 << "\nBBox max: wrapper = " << p 250 << "\nBBox max: wrapper = " << pMax << " solid = " << vmax; 248 G4Exception("G4UTubs::BoundingLimits()", 251 G4Exception("G4UTubs::BoundingLimits()", "GeomMgt0001", 249 JustWarning, message); 252 JustWarning, message); 250 checkBBox = false; 253 checkBBox = false; 251 } 254 } 252 } 255 } 253 } 256 } 254 257 255 ////////////////////////////////////////////// 258 ////////////////////////////////////////////////////////////////////////// 256 // 259 // 257 // Calculate extent under transform and specif 260 // Calculate extent under transform and specified limit 258 261 259 G4bool 262 G4bool 260 G4UTubs::CalculateExtent(const EAxis pAxis, 263 G4UTubs::CalculateExtent(const EAxis pAxis, 261 const G4VoxelLimits& 264 const G4VoxelLimits& pVoxelLimit, 262 const G4AffineTransfo 265 const G4AffineTransform& pTransform, 263 G4double& pMin, 266 G4double& pMin, G4double& pMax) const 264 { 267 { 265 G4ThreeVector bmin, bmax; 268 G4ThreeVector bmin, bmax; 266 G4bool exist; 269 G4bool exist; 267 270 268 // Get bounding box 271 // Get bounding box 269 BoundingLimits(bmin,bmax); 272 BoundingLimits(bmin,bmax); 270 273 271 // Check bounding box 274 // Check bounding box 272 G4BoundingEnvelope bbox(bmin,bmax); 275 G4BoundingEnvelope bbox(bmin,bmax); 273 #ifdef G4BBOX_EXTENT 276 #ifdef G4BBOX_EXTENT 274 if (true) return bbox.CalculateExtent(pAxis, 277 if (true) return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax); 275 #endif 278 #endif 276 if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVox 279 if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax)) 277 { 280 { 278 return exist = pMin < pMax; << 281 return exist = (pMin < pMax) ? true : false; 279 } 282 } 280 283 281 // Get parameters of the solid 284 // Get parameters of the solid 282 G4double rmin = GetInnerRadius(); 285 G4double rmin = GetInnerRadius(); 283 G4double rmax = GetOuterRadius(); 286 G4double rmax = GetOuterRadius(); 284 G4double dz = GetZHalfLength(); 287 G4double dz = GetZHalfLength(); 285 G4double dphi = GetDeltaPhiAngle(); 288 G4double dphi = GetDeltaPhiAngle(); 286 289 287 // Find bounding envelope and calculate exte 290 // Find bounding envelope and calculate extent 288 // 291 // 289 const G4int NSTEPS = 24; // numbe 292 const G4int NSTEPS = 24; // number of steps for whole circle 290 G4double astep = twopi/NSTEPS; // max a 293 G4double astep = twopi/NSTEPS; // max angle for one step 291 G4int ksteps = (dphi <= astep) ? 1 : (G4i 294 G4int ksteps = (dphi <= astep) ? 1 : (G4int)((dphi-deg)/astep) + 1; 292 G4double ang = dphi/ksteps; 295 G4double ang = dphi/ksteps; 293 296 294 G4double sinHalf = std::sin(0.5*ang); 297 G4double sinHalf = std::sin(0.5*ang); 295 G4double cosHalf = std::cos(0.5*ang); 298 G4double cosHalf = std::cos(0.5*ang); 296 G4double sinStep = 2.*sinHalf*cosHalf; 299 G4double sinStep = 2.*sinHalf*cosHalf; 297 G4double cosStep = 1. - 2.*sinHalf*sinHalf; 300 G4double cosStep = 1. - 2.*sinHalf*sinHalf; 298 G4double rext = rmax/cosHalf; 301 G4double rext = rmax/cosHalf; 299 302 300 // bounding envelope for full cylinder consi 303 // bounding envelope for full cylinder consists of two polygons, 301 // in other cases it is a sequence of quadri 304 // in other cases it is a sequence of quadrilaterals 302 if (rmin == 0 && dphi == twopi) 305 if (rmin == 0 && dphi == twopi) 303 { 306 { 304 G4double sinCur = sinHalf; 307 G4double sinCur = sinHalf; 305 G4double cosCur = cosHalf; 308 G4double cosCur = cosHalf; 306 309 307 G4ThreeVectorList baseA(NSTEPS),baseB(NSTE 310 G4ThreeVectorList baseA(NSTEPS),baseB(NSTEPS); 308 for (G4int k=0; k<NSTEPS; ++k) 311 for (G4int k=0; k<NSTEPS; ++k) 309 { 312 { 310 baseA[k].set(rext*cosCur,rext*sinCur,-dz 313 baseA[k].set(rext*cosCur,rext*sinCur,-dz); 311 baseB[k].set(rext*cosCur,rext*sinCur, dz 314 baseB[k].set(rext*cosCur,rext*sinCur, dz); 312 315 313 G4double sinTmp = sinCur; 316 G4double sinTmp = sinCur; 314 sinCur = sinCur*cosStep + cosCur*sinStep 317 sinCur = sinCur*cosStep + cosCur*sinStep; 315 cosCur = cosCur*cosStep - sinTmp*sinStep 318 cosCur = cosCur*cosStep - sinTmp*sinStep; 316 } 319 } 317 std::vector<const G4ThreeVectorList *> pol 320 std::vector<const G4ThreeVectorList *> polygons(2); 318 polygons[0] = &baseA; 321 polygons[0] = &baseA; 319 polygons[1] = &baseB; 322 polygons[1] = &baseB; 320 G4BoundingEnvelope benv(bmin,bmax,polygons 323 G4BoundingEnvelope benv(bmin,bmax,polygons); 321 exist = benv.CalculateExtent(pAxis,pVoxelL 324 exist = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax); 322 } 325 } 323 else 326 else 324 { 327 { 325 G4double sinStart = GetSinStartPhi(); 328 G4double sinStart = GetSinStartPhi(); 326 G4double cosStart = GetCosStartPhi(); 329 G4double cosStart = GetCosStartPhi(); 327 G4double sinEnd = GetSinEndPhi(); 330 G4double sinEnd = GetSinEndPhi(); 328 G4double cosEnd = GetCosEndPhi(); 331 G4double cosEnd = GetCosEndPhi(); 329 G4double sinCur = sinStart*cosHalf + cos 332 G4double sinCur = sinStart*cosHalf + cosStart*sinHalf; 330 G4double cosCur = cosStart*cosHalf - sin 333 G4double cosCur = cosStart*cosHalf - sinStart*sinHalf; 331 334 332 // set quadrilaterals 335 // set quadrilaterals 333 G4ThreeVectorList pols[NSTEPS+2]; 336 G4ThreeVectorList pols[NSTEPS+2]; 334 for (G4int k=0; k<ksteps+2; ++k) pols[k].r 337 for (G4int k=0; k<ksteps+2; ++k) pols[k].resize(4); 335 pols[0][0].set(rmin*cosStart,rmin*sinStart 338 pols[0][0].set(rmin*cosStart,rmin*sinStart, dz); 336 pols[0][1].set(rmin*cosStart,rmin*sinStart 339 pols[0][1].set(rmin*cosStart,rmin*sinStart,-dz); 337 pols[0][2].set(rmax*cosStart,rmax*sinStart 340 pols[0][2].set(rmax*cosStart,rmax*sinStart,-dz); 338 pols[0][3].set(rmax*cosStart,rmax*sinStart 341 pols[0][3].set(rmax*cosStart,rmax*sinStart, dz); 339 for (G4int k=1; k<ksteps+1; ++k) 342 for (G4int k=1; k<ksteps+1; ++k) 340 { 343 { 341 pols[k][0].set(rmin*cosCur,rmin*sinCur, 344 pols[k][0].set(rmin*cosCur,rmin*sinCur, dz); 342 pols[k][1].set(rmin*cosCur,rmin*sinCur,- 345 pols[k][1].set(rmin*cosCur,rmin*sinCur,-dz); 343 pols[k][2].set(rext*cosCur,rext*sinCur,- 346 pols[k][2].set(rext*cosCur,rext*sinCur,-dz); 344 pols[k][3].set(rext*cosCur,rext*sinCur, 347 pols[k][3].set(rext*cosCur,rext*sinCur, dz); 345 348 346 G4double sinTmp = sinCur; 349 G4double sinTmp = sinCur; 347 sinCur = sinCur*cosStep + cosCur*sinStep 350 sinCur = sinCur*cosStep + cosCur*sinStep; 348 cosCur = cosCur*cosStep - sinTmp*sinStep 351 cosCur = cosCur*cosStep - sinTmp*sinStep; 349 } 352 } 350 pols[ksteps+1][0].set(rmin*cosEnd,rmin*sin 353 pols[ksteps+1][0].set(rmin*cosEnd,rmin*sinEnd, dz); 351 pols[ksteps+1][1].set(rmin*cosEnd,rmin*sin 354 pols[ksteps+1][1].set(rmin*cosEnd,rmin*sinEnd,-dz); 352 pols[ksteps+1][2].set(rmax*cosEnd,rmax*sin 355 pols[ksteps+1][2].set(rmax*cosEnd,rmax*sinEnd,-dz); 353 pols[ksteps+1][3].set(rmax*cosEnd,rmax*sin 356 pols[ksteps+1][3].set(rmax*cosEnd,rmax*sinEnd, dz); 354 357 355 // set envelope and calculate extent 358 // set envelope and calculate extent 356 std::vector<const G4ThreeVectorList *> pol 359 std::vector<const G4ThreeVectorList *> polygons; 357 polygons.resize(ksteps+2); 360 polygons.resize(ksteps+2); 358 for (G4int k=0; k<ksteps+2; ++k) polygons[ 361 for (G4int k=0; k<ksteps+2; ++k) polygons[k] = &pols[k]; 359 G4BoundingEnvelope benv(bmin,bmax,polygons 362 G4BoundingEnvelope benv(bmin,bmax,polygons); 360 exist = benv.CalculateExtent(pAxis,pVoxelL 363 exist = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax); 361 } 364 } 362 return exist; 365 return exist; 363 } 366 } 364 367 365 ////////////////////////////////////////////// 368 ////////////////////////////////////////////////////////////////////////// 366 // 369 // 367 // Create polyhedron for visualization 370 // Create polyhedron for visualization 368 // 371 // 369 G4Polyhedron* G4UTubs::CreatePolyhedron() cons 372 G4Polyhedron* G4UTubs::CreatePolyhedron() const 370 { 373 { 371 return new G4PolyhedronTubs(GetInnerRadius() 374 return new G4PolyhedronTubs(GetInnerRadius(), 372 GetOuterRadius() 375 GetOuterRadius(), 373 GetZHalfLength() 376 GetZHalfLength(), 374 GetStartPhiAngle 377 GetStartPhiAngle(), 375 GetDeltaPhiAngle 378 GetDeltaPhiAngle()); 376 } 379 } 377 380 378 #endif // G4GEOM_USE_USOLIDS 381 #endif // G4GEOM_USE_USOLIDS 379 382