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 // >> 27 // $Id:$ >> 28 // 26 // Implementation for G4UHype wrapper class 29 // Implementation for G4UHype wrapper class 27 // 30 // 28 // 16-10-2017 G.Cosmo, CERN 31 // 16-10-2017 G.Cosmo, CERN >> 32 // 29 // ------------------------------------------- 33 // -------------------------------------------------------------------- 30 34 31 #include "G4Hype.hh" 35 #include "G4Hype.hh" 32 << 36 #if 0 33 #include "G4UHype.hh" 37 #include "G4UHype.hh" 34 38 35 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G 39 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) ) 36 40 37 #include "G4AffineTransform.hh" 41 #include "G4AffineTransform.hh" 38 #include "G4VPVParameterisation.hh" 42 #include "G4VPVParameterisation.hh" 39 #include "G4BoundingEnvelope.hh" 43 #include "G4BoundingEnvelope.hh" 40 #include "G4Polyhedron.hh" 44 #include "G4Polyhedron.hh" 41 45 42 ////////////////////////////////////////////// 46 //////////////////////////////////////////////////////////////////////// 43 // 47 // 44 // Constructor 48 // Constructor 45 49 46 G4UHype::G4UHype(const G4String& pName, 50 G4UHype::G4UHype(const G4String& pName, 47 G4double newInnerRadiu 51 G4double newInnerRadius, 48 G4double newOuterRadiu 52 G4double newOuterRadius, 49 G4double newInnerStere 53 G4double newInnerStereo, 50 G4double newOuterStere 54 G4double newOuterStereo, 51 G4double newHalfLenZ) 55 G4double newHalfLenZ) 52 : Base_t(pName, newInnerRadius, newOuterRadi 56 : Base_t(pName, newInnerRadius, newOuterRadius, 53 newInnerStereo, newOuterSter 57 newInnerStereo, newOuterStereo, newHalfLenZ) 54 { } 58 { } 55 59 56 ////////////////////////////////////////////// 60 ////////////////////////////////////////////////////////////////////////// 57 // 61 // 58 // Fake default constructor - sets only member 62 // Fake default constructor - sets only member data and allocates memory 59 // for usage restri 63 // for usage restricted to object persistency. 60 64 61 G4UHype::G4UHype( __void__& a ) 65 G4UHype::G4UHype( __void__& a ) 62 : Base_t(a) 66 : Base_t(a) 63 { } 67 { } 64 68 65 ////////////////////////////////////////////// 69 ////////////////////////////////////////////////////////////////////////// 66 // 70 // 67 // Destructor 71 // Destructor 68 72 69 G4UHype::~G4UHype() = default; << 73 G4UHype::~G4UHype() { } 70 74 71 ////////////////////////////////////////////// 75 ////////////////////////////////////////////////////////////////////////// 72 // 76 // 73 // Copy constructor 77 // Copy constructor 74 78 75 G4UHype::G4UHype(const G4UHype& rhs) 79 G4UHype::G4UHype(const G4UHype& rhs) 76 : Base_t(rhs) 80 : Base_t(rhs) 77 { } 81 { } 78 82 79 ////////////////////////////////////////////// 83 ////////////////////////////////////////////////////////////////////////// 80 // 84 // 81 // Assignment operator 85 // Assignment operator 82 86 83 G4UHype& G4UHype::operator = (const G4UHype& r 87 G4UHype& G4UHype::operator = (const G4UHype& rhs) 84 { 88 { 85 // Check assignment to self 89 // Check assignment to self 86 // 90 // 87 if (this == &rhs) { return *this; } 91 if (this == &rhs) { return *this; } 88 92 89 // Copy base class data 93 // Copy base class data 90 // 94 // 91 Base_t::operator=(rhs); 95 Base_t::operator=(rhs); 92 96 93 return *this; 97 return *this; 94 } 98 } 95 99 96 ////////////////////////////////////////////// 100 ////////////////////////////////////////////////////////////////////////// 97 // 101 // 98 // Accessors 102 // Accessors 99 103 100 G4double G4UHype::GetInnerRadius () const 104 G4double G4UHype::GetInnerRadius () const 101 { 105 { 102 return GetRmin(); 106 return GetRmin(); 103 } 107 } 104 108 105 G4double G4UHype::GetOuterRadius () const 109 G4double G4UHype::GetOuterRadius () const 106 { 110 { 107 return GetRmax(); 111 return GetRmax(); 108 } 112 } 109 113 110 G4double G4UHype::GetZHalfLength () const 114 G4double G4UHype::GetZHalfLength () const 111 { 115 { 112 return GetDz(); 116 return GetDz(); 113 } 117 } 114 118 115 G4double G4UHype::GetInnerStereo () const 119 G4double G4UHype::GetInnerStereo () const 116 { 120 { 117 return GetStIn(); 121 return GetStIn(); 118 } 122 } 119 123 120 G4double G4UHype::GetOuterStereo () const 124 G4double G4UHype::GetOuterStereo () const 121 { 125 { 122 return GetStOut(); 126 return GetStOut(); 123 } 127 } 124 128 125 ////////////////////////////////////////////// 129 ////////////////////////////////////////////////////////////////////////// 126 // 130 // 127 // Modifiers 131 // Modifiers 128 132 129 void G4UHype::SetInnerRadius (G4double newIRad 133 void G4UHype::SetInnerRadius (G4double newIRad) 130 { 134 { 131 SetParameters(newIRad, GetRmax(), GetStIn(), 135 SetParameters(newIRad, GetRmax(), GetStIn(), GetStOut(), GetDz()); 132 fRebuildPolyhedron = true; 136 fRebuildPolyhedron = true; 133 } 137 } 134 138 135 void G4UHype::SetOuterRadius (G4double newORad 139 void G4UHype::SetOuterRadius (G4double newORad) 136 { 140 { 137 SetParameters(GetRmin(), newORad, GetStIn(), 141 SetParameters(GetRmin(), newORad, GetStIn(), GetStOut(), GetDz()); 138 fRebuildPolyhedron = true; 142 fRebuildPolyhedron = true; 139 } 143 } 140 144 141 void G4UHype::SetZHalfLength (G4double newHLZ) 145 void G4UHype::SetZHalfLength (G4double newHLZ) 142 { 146 { 143 SetParameters(GetRmin(), GetRmax(), GetStIn( 147 SetParameters(GetRmin(), GetRmax(), GetStIn(), GetStOut(), newHLZ); 144 fRebuildPolyhedron = true; 148 fRebuildPolyhedron = true; 145 } 149 } 146 150 147 void G4UHype::SetInnerStereo (G4double newISte 151 void G4UHype::SetInnerStereo (G4double newISte) 148 { 152 { 149 SetParameters(GetRmin(), GetRmax(), newISte, 153 SetParameters(GetRmin(), GetRmax(), newISte, GetStOut(), GetDz()); 150 fRebuildPolyhedron = true; 154 fRebuildPolyhedron = true; 151 } 155 } 152 156 153 void G4UHype::SetOuterStereo (G4double newOSte 157 void G4UHype::SetOuterStereo (G4double newOSte) 154 { 158 { 155 SetParameters(GetRmin(), GetRmax(), GetStIn( 159 SetParameters(GetRmin(), GetRmax(), GetStIn(), newOSte, GetDz()); 156 fRebuildPolyhedron = true; 160 fRebuildPolyhedron = true; 157 } 161 } 158 162 159 163 160 ////////////////////////////////////////////// 164 //////////////////////////////////////////////////////////////////////// 161 // 165 // 162 // Dispatch to parameterisation for replicatio 166 // Dispatch to parameterisation for replication mechanism dimension 163 // computation & modification. 167 // computation & modification. 164 168 165 void G4UHype::ComputeDimensions(G4VPVParameter 169 void G4UHype::ComputeDimensions(G4VPVParameterisation* p, 166 const G4int n, 170 const G4int n, 167 const G4VPhysi 171 const G4VPhysicalVolume* pRep) 168 { 172 { 169 p->ComputeDimensions(*(G4Hype*)this,n,pRep); 173 p->ComputeDimensions(*(G4Hype*)this,n,pRep); 170 } 174 } 171 175 172 176 173 ////////////////////////////////////////////// 177 ////////////////////////////////////////////////////////////////////////// 174 // 178 // 175 // Make a clone of the object 179 // Make a clone of the object 176 180 177 G4VSolid* G4UHype::Clone() const 181 G4VSolid* G4UHype::Clone() const 178 { 182 { 179 return new G4UHype(*this); 183 return new G4UHype(*this); 180 } 184 } 181 185 182 ////////////////////////////////////////////// 186 ////////////////////////////////////////////////////////////////////////// 183 // 187 // 184 // Get bounding box 188 // Get bounding box 185 189 186 void G4UHype::BoundingLimits(G4ThreeVector& pM 190 void G4UHype::BoundingLimits(G4ThreeVector& pMin, 187 G4ThreeVector& pM 191 G4ThreeVector& pMax) const 188 { 192 { 189 G4double endORadius = GetEndInnerRadius(); 193 G4double endORadius = GetEndInnerRadius(); 190 pMin.set(-endORadius,-endORadius,-GetDz()); 194 pMin.set(-endORadius,-endORadius,-GetDz()); 191 pMax.set( endORadius, endORadius, GetDz()); 195 pMax.set( endORadius, endORadius, GetDz()); 192 196 193 // Check correctness of the bounding box 197 // Check correctness of the bounding box 194 // 198 // 195 if (pMin.x() >= pMax.x() || pMin.y() >= pMax 199 if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z()) 196 { 200 { 197 std::ostringstream message; 201 std::ostringstream message; 198 message << "Bad bounding box (min >= max) 202 message << "Bad bounding box (min >= max) for solid: " 199 << GetName() << " !" 203 << GetName() << " !" 200 << "\npMin = " << pMin 204 << "\npMin = " << pMin 201 << "\npMax = " << pMax; 205 << "\npMax = " << pMax; 202 G4Exception("G4UHype::BoundingLimits()", " 206 G4Exception("G4UHype::BoundingLimits()", "GeomMgt0001", 203 JustWarning, message); 207 JustWarning, message); 204 StreamInfo(G4cout); 208 StreamInfo(G4cout); 205 } 209 } 206 } 210 } 207 211 208 ////////////////////////////////////////////// 212 ////////////////////////////////////////////////////////////////////////// 209 // 213 // 210 // Calculate extent under transform and specif 214 // Calculate extent under transform and specified limit 211 215 212 G4bool 216 G4bool 213 G4UHype::CalculateExtent(const EAxis pAxis, 217 G4UHype::CalculateExtent(const EAxis pAxis, 214 const G4VoxelLimits& 218 const G4VoxelLimits& pVoxelLimit, 215 const G4AffineTransfo 219 const G4AffineTransform& pTransform, 216 G4double& pMin, 220 G4double& pMin, G4double& pMax) const 217 { 221 { 218 G4ThreeVector bmin, bmax; 222 G4ThreeVector bmin, bmax; 219 223 220 // Get bounding box 224 // Get bounding box 221 BoundingLimits(bmin,bmax); 225 BoundingLimits(bmin,bmax); 222 226 223 // Find extent 227 // Find extent 224 G4BoundingEnvelope bbox(bmin,bmax); 228 G4BoundingEnvelope bbox(bmin,bmax); 225 return bbox.CalculateExtent(pAxis,pVoxelLimi 229 return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax); 226 } 230 } 227 231 228 ////////////////////////////////////////////// 232 //////////////////////////////////////////////////////////////////////// 229 // 233 // 230 // CreatePolyhedron 234 // CreatePolyhedron 231 // 235 // 232 G4Polyhedron* G4UHype::CreatePolyhedron() cons 236 G4Polyhedron* G4UHype::CreatePolyhedron() const 233 { 237 { 234 return new G4PolyhedronHype(GetRmin(), GetRm 238 return new G4PolyhedronHype(GetRmin(), GetRmax(), 235 GetTIn2(), GetTO 239 GetTIn2(), GetTOut2(), GetDz()); 236 } 240 } 237 241 238 #endif // G4GEOM_USE_USOLIDS 242 #endif // G4GEOM_USE_USOLIDS >> 243 >> 244 #endif 239 245