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 // G4ReplicatedSlice implementation 26 // G4ReplicatedSlice implementation 27 // 27 // 28 // Author: M.Asai (SLAC), 20/04/2010 - Extende 28 // Author: M.Asai (SLAC), 20/04/2010 - Extended from G4PVDivision 29 // ------------------------------------------- 29 // -------------------------------------------------------------------- 30 30 31 #include "G4ReplicatedSlice.hh" 31 #include "G4ReplicatedSlice.hh" 32 #include "G4LogicalVolume.hh" 32 #include "G4LogicalVolume.hh" 33 #include "G4VSolid.hh" 33 #include "G4VSolid.hh" 34 #include "G4ReflectedSolid.hh" 34 #include "G4ReflectedSolid.hh" 35 #include "G4ParameterisationBox.hh" 35 #include "G4ParameterisationBox.hh" 36 #include "G4ParameterisationTubs.hh" 36 #include "G4ParameterisationTubs.hh" 37 #include "G4ParameterisationCons.hh" 37 #include "G4ParameterisationCons.hh" 38 #include "G4ParameterisationTrd.hh" 38 #include "G4ParameterisationTrd.hh" 39 #include "G4ParameterisationPara.hh" 39 #include "G4ParameterisationPara.hh" 40 #include "G4ParameterisationPolycone.hh" 40 #include "G4ParameterisationPolycone.hh" 41 #include "G4ParameterisationPolyhedra.hh" 41 #include "G4ParameterisationPolyhedra.hh" 42 42 43 //-------------------------------------------- 43 //-------------------------------------------------------------------------- 44 G4ReplicatedSlice::G4ReplicatedSlice(const G4S 44 G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName, 45 G4L 45 G4LogicalVolume* pLogical, 46 G4L 46 G4LogicalVolume* pMotherLogical, 47 const EAx 47 const EAxis pAxis, 48 const G4i 48 const G4int nDivs, 49 const G4d 49 const G4double width, 50 const G4d 50 const G4double half_gap, 51 const G4d 51 const G4double offset ) 52 : G4PVReplica(pName, nDivs, pAxis, pLogical, << 52 : G4VPhysicalVolume(nullptr,G4ThreeVector(),pName,pLogical,nullptr) 53 { 53 { 54 CheckAndSetParameters(pAxis, nDivs, width, h 54 CheckAndSetParameters(pAxis, nDivs, width, half_gap, offset, 55 DivNDIVandWIDTH, pMoth 55 DivNDIVandWIDTH, pMotherLogical, pLogical); 56 } 56 } 57 57 58 //-------------------------------------------- 58 //-------------------------------------------------------------------------- 59 G4ReplicatedSlice::G4ReplicatedSlice(const G4S 59 G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName, 60 G4L 60 G4LogicalVolume* pLogical, 61 G4L 61 G4LogicalVolume* pMotherLogical, 62 const EAx 62 const EAxis pAxis, 63 const G4i 63 const G4int nDivs, 64 const G4d 64 const G4double half_gap, 65 const G4d 65 const G4double offset ) 66 : G4PVReplica(pName, nDivs, pAxis, pLogical, << 66 : G4VPhysicalVolume(nullptr,G4ThreeVector(),pName,pLogical,nullptr) 67 { 67 { 68 CheckAndSetParameters(pAxis, nDivs, 0., half 68 CheckAndSetParameters(pAxis, nDivs, 0., half_gap, offset, 69 DivNDIV, pMotherLogica 69 DivNDIV, pMotherLogical, pLogical); 70 } 70 } 71 71 72 //-------------------------------------------- 72 //-------------------------------------------------------------------------- 73 G4ReplicatedSlice::G4ReplicatedSlice(const G4S 73 G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName, 74 G4L 74 G4LogicalVolume* pLogical, 75 G4L 75 G4LogicalVolume* pMotherLogical, 76 const EAx 76 const EAxis pAxis, 77 const G4d 77 const G4double width, 78 const G4d 78 const G4double half_gap, 79 const G4d 79 const G4double offset ) 80 : G4PVReplica(pName, 0, pAxis, pLogical, pMo << 80 : G4VPhysicalVolume(nullptr,G4ThreeVector(),pName,pLogical,nullptr) 81 { 81 { 82 CheckAndSetParameters(pAxis, 0, width, half_ 82 CheckAndSetParameters(pAxis, 0, width, half_gap, offset, 83 DivWIDTH, pMotherLogic 83 DivWIDTH, pMotherLogical, pLogical); 84 } 84 } 85 85 86 //-------------------------------------------- 86 //-------------------------------------------------------------------------- 87 G4ReplicatedSlice::G4ReplicatedSlice(const G4S 87 G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName, 88 G4L 88 G4LogicalVolume* pLogical, 89 G4V 89 G4VPhysicalVolume* pMotherPhysical, 90 const EAx 90 const EAxis pAxis, 91 const G4i 91 const G4int nDivs, 92 const G4d 92 const G4double width, 93 const G4d 93 const G4double half_gap, 94 const G4d 94 const G4double offset ) 95 : G4PVReplica(pName, nDivs, pAxis, pLogical, << 95 : G4VPhysicalVolume(nullptr,G4ThreeVector(),pName,pLogical,nullptr) 96 pMotherPhysical != nullptr ? p << 97 { 96 { 98 if (pMotherPhysical == nullptr) << 99 { << 100 std::ostringstream message; << 101 message << "Invalid setup." << G4endl << 102 << "NULL pointer specified as moth << 103 G4Exception("G4ReplicatedSlice::G4Replicat << 104 FatalException, message); << 105 return; << 106 } << 107 CheckAndSetParameters(pAxis, nDivs, width, h 97 CheckAndSetParameters(pAxis, nDivs, width, half_gap, offset, 108 DivNDIVandWIDTH, pMotherPhysical->GetLog 98 DivNDIVandWIDTH, pMotherPhysical->GetLogicalVolume(), pLogical); 109 } 99 } 110 100 111 //-------------------------------------------- 101 //-------------------------------------------------------------------------- 112 G4ReplicatedSlice::G4ReplicatedSlice(const G4S 102 G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName, 113 G4L 103 G4LogicalVolume* pLogical, 114 G4V 104 G4VPhysicalVolume* pMotherPhysical, 115 const EAx 105 const EAxis pAxis, 116 const G4i 106 const G4int nDivs, 117 const G4d 107 const G4double half_gap, 118 const G4d 108 const G4double offset ) 119 : G4PVReplica(pName, nDivs, pAxis, pLogical, << 109 : G4VPhysicalVolume(nullptr,G4ThreeVector(),pName,pLogical,nullptr) 120 pMotherPhysical != nullptr ? p << 121 { 110 { 122 if (pMotherPhysical == nullptr) << 123 { << 124 std::ostringstream message; << 125 message << "Invalid setup." << G4endl << 126 << "NULL pointer specified as moth << 127 G4Exception("G4ReplicatedSlice::G4Replicat << 128 FatalException, message); << 129 return; << 130 } << 131 CheckAndSetParameters(pAxis, nDivs, 0., half 111 CheckAndSetParameters(pAxis, nDivs, 0., half_gap, offset, 132 DivNDIV, pMotherPhysical->GetLogicalVolu 112 DivNDIV, pMotherPhysical->GetLogicalVolume(), pLogical); 133 } 113 } 134 114 135 //-------------------------------------------- 115 //-------------------------------------------------------------------------- 136 G4ReplicatedSlice::G4ReplicatedSlice(const G4S 116 G4ReplicatedSlice::G4ReplicatedSlice(const G4String& pName, 137 G4L 117 G4LogicalVolume* pLogical, 138 G4V 118 G4VPhysicalVolume* pMotherPhysical, 139 const EAx 119 const EAxis pAxis, 140 const G4d 120 const G4double width, 141 const G4d 121 const G4double half_gap, 142 const G4d 122 const G4double offset ) 143 : G4PVReplica(pName, 0, pAxis, pLogical, << 123 : G4VPhysicalVolume(nullptr,G4ThreeVector(),pName,pLogical,nullptr) 144 pMotherPhysical != nullptr ? p << 145 { 124 { 146 if (pMotherPhysical == nullptr) << 147 { << 148 std::ostringstream message; << 149 message << "Invalid setup." << G4endl << 150 << "NULL pointer specified as moth << 151 G4Exception("G4ReplicatedSlice::G4Replicat << 152 FatalException, message); << 153 return; << 154 } << 155 CheckAndSetParameters(pAxis, 0, width, half_ 125 CheckAndSetParameters(pAxis, 0, width, half_gap, offset, 156 DivWIDTH, pMotherPhysical->GetLogicalVol 126 DivWIDTH, pMotherPhysical->GetLogicalVolume(), pLogical); 157 } 127 } 158 128 159 //-------------------------------------------- 129 //-------------------------------------------------------------------------- 160 void 130 void 161 G4ReplicatedSlice::CheckAndSetParameters( cons 131 G4ReplicatedSlice::CheckAndSetParameters( const EAxis pAxis, 162 cons 132 const G4int nDivs, 163 cons 133 const G4double width, 164 cons 134 const G4double half_gap, 165 cons 135 const G4double offset, 166 136 DivisionType divType, 167 137 G4LogicalVolume* pMotherLogical, 168 cons 138 const G4LogicalVolume* pLogical ) 169 { 139 { 170 if(pMotherLogical == nullptr) 140 if(pMotherLogical == nullptr) 171 { 141 { 172 std::ostringstream message; 142 std::ostringstream message; 173 message << "Invalid setup." << G4endl 143 message << "Invalid setup." << G4endl 174 << "NULL pointer specified as moth 144 << "NULL pointer specified as mother! Volume: " << GetName(); 175 G4Exception("G4ReplicatedSlice::CheckAndSe 145 G4Exception("G4ReplicatedSlice::CheckAndSetParameters()", "GeomDiv0002", 176 FatalException, message); 146 FatalException, message); 177 } 147 } 178 if(pLogical == pMotherLogical) 148 if(pLogical == pMotherLogical) 179 { 149 { 180 std::ostringstream message; 150 std::ostringstream message; 181 message << "Invalid setup." << G4endl 151 message << "Invalid setup." << G4endl 182 << "Cannot place a volume inside i 152 << "Cannot place a volume inside itself! Volume: " << GetName(); 183 G4Exception("G4ReplicatedSlice::CheckAndSe 153 G4Exception("G4ReplicatedSlice::CheckAndSetParameters()", "GeomDiv0002", 184 FatalException, message); 154 FatalException, message); 185 } 155 } 186 156 187 //----- Check that mother solid is of the sa 157 //----- Check that mother solid is of the same type as 188 // daughter solid (otherwise, the corre 158 // daughter solid (otherwise, the corresponding 189 // Parameterisation::ComputeDimension() 159 // Parameterisation::ComputeDimension() will not be called) 190 // 160 // 191 G4String msolType = pMotherLogical->GetSolid 161 G4String msolType = pMotherLogical->GetSolid()->GetEntityType(); 192 G4String dsolType = pLogical->GetSolid()->Ge 162 G4String dsolType = pLogical->GetSolid()->GetEntityType(); 193 if( msolType != dsolType && ( msolType != "G 163 if( msolType != dsolType && ( msolType != "G4Trd" || dsolType != "G4Trap" ) ) 194 { 164 { 195 std::ostringstream message; 165 std::ostringstream message; 196 message << "Invalid setup." << G4endl 166 message << "Invalid setup." << G4endl 197 << "Incorrect solid type for divis 167 << "Incorrect solid type for division of volume: " 198 << GetName() << G4endl 168 << GetName() << G4endl 199 << " It is: " << msolType 169 << " It is: " << msolType 200 << ", while it should be: " << dso 170 << ", while it should be: " << dsolType; 201 G4Exception("G4ReplicatedSlice::CheckAndSe 171 G4Exception("G4ReplicatedSlice::CheckAndSetParameters()", 202 "GeomDiv0002", FatalException, 172 "GeomDiv0002", FatalException, message); 203 } 173 } 204 174 205 pMotherLogical->AddDaughter(this); 175 pMotherLogical->AddDaughter(this); 206 SetMotherLogical(pMotherLogical); 176 SetMotherLogical(pMotherLogical); 207 SetParameterisation(pMotherLogical, pAxis, n 177 SetParameterisation(pMotherLogical, pAxis, nDivs, 208 width, half_gap, offset, 178 width, half_gap, offset, divType); 209 179 210 if( divType == DivWIDTH ) 180 if( divType == DivWIDTH ) 211 { 181 { 212 fnReplicas = fparam->GetNoDiv(); 182 fnReplicas = fparam->GetNoDiv(); 213 } 183 } 214 else 184 else 215 { 185 { 216 fnReplicas = nDivs; 186 fnReplicas = nDivs; 217 } 187 } 218 if (fnReplicas < 1 ) 188 if (fnReplicas < 1 ) 219 { 189 { 220 G4Exception("G4ReplicatedSlice::CheckAndSe 190 G4Exception("G4ReplicatedSlice::CheckAndSetParameters()", "GeomDiv0002", 221 FatalException, "Illegal numbe 191 FatalException, "Illegal number of replicas!"); 222 } 192 } 223 if( divType != DivNDIV) 193 if( divType != DivNDIV) 224 { 194 { 225 fwidth = fparam->GetWidth(); 195 fwidth = fparam->GetWidth(); 226 } 196 } 227 else 197 else 228 { 198 { 229 fwidth = width; 199 fwidth = width; 230 } 200 } 231 if( fwidth < 0 ) 201 if( fwidth < 0 ) 232 { 202 { 233 G4Exception("G4ReplicatedSlice::CheckAndSe 203 G4Exception("G4ReplicatedSlice::CheckAndSetParameters()", "GeomDiv0002", 234 FatalException, "Width must be 204 FatalException, "Width must be positive!"); 235 } 205 } 236 if( fwidth < 2.*half_gap ) 206 if( fwidth < 2.*half_gap ) 237 { 207 { 238 G4Exception("G4ReplicatedSlice::CheckAndSe 208 G4Exception("G4ReplicatedSlice::CheckAndSetParameters()", "GeomDiv0002", 239 FatalException, "Half_gap is t 209 FatalException, "Half_gap is too large!"); 240 } 210 } 241 211 242 foffset = offset; 212 foffset = offset; 243 fdivAxis = pAxis; 213 fdivAxis = pAxis; 244 214 245 //!!!!! axis has to be x/y/z in G4VoxelLimit 215 //!!!!! axis has to be x/y/z in G4VoxelLimits::GetMinExtent 246 // 216 // 247 if( pAxis == kRho || pAxis == kRadial3D || p 217 if( pAxis == kRho || pAxis == kRadial3D || pAxis == kPhi ) 248 { 218 { 249 faxis = kZAxis; 219 faxis = kZAxis; 250 } 220 } 251 else 221 else 252 { 222 { 253 faxis = pAxis; 223 faxis = pAxis; 254 } 224 } 255 225 256 switch (faxis) 226 switch (faxis) 257 { 227 { 258 case kPhi: 228 case kPhi: 259 case kRho: 229 case kRho: 260 case kXAxis: 230 case kXAxis: 261 case kYAxis: 231 case kYAxis: 262 case kZAxis: 232 case kZAxis: 263 break; 233 break; 264 default: 234 default: 265 G4Exception("G4ReplicatedSlice::CheckAnd 235 G4Exception("G4ReplicatedSlice::CheckAndSetParameters()", "GeomDiv0002", 266 FatalException, "Unknown axi 236 FatalException, "Unknown axis of replication."); 267 break; 237 break; 268 } 238 } 269 239 270 // Create rotation matrix: for phi axis it w 240 // Create rotation matrix: for phi axis it will be changed 271 // in G4VPVParameterisation::ComputeTransfor 241 // in G4VPVParameterisation::ComputeTransformation, for others 272 // it will stay the unity 242 // it will stay the unity 273 // 243 // 274 auto pRMat = new G4RotationMatrix(); << 244 G4RotationMatrix* pRMat = new G4RotationMatrix(); 275 SetRotation(pRMat); 245 SetRotation(pRMat); 276 } 246 } 277 247 278 //-------------------------------------------- 248 //-------------------------------------------------------------------------- 279 G4ReplicatedSlice::~G4ReplicatedSlice() 249 G4ReplicatedSlice::~G4ReplicatedSlice() 280 { 250 { 281 delete GetRotation(); 251 delete GetRotation(); 282 } 252 } 283 253 284 //-------------------------------------------- 254 //-------------------------------------------------------------------------- 285 EAxis G4ReplicatedSlice::GetDivisionAxis() con 255 EAxis G4ReplicatedSlice::GetDivisionAxis() const 286 { 256 { 287 return fdivAxis; 257 return fdivAxis; 288 } 258 } 289 259 290 //-------------------------------------------- 260 //-------------------------------------------------------------------------- 291 G4bool G4ReplicatedSlice::IsParameterised() co 261 G4bool G4ReplicatedSlice::IsParameterised() const 292 { 262 { 293 return true; 263 return true; 294 } 264 } 295 265 296 //-------------------------------------------- 266 //-------------------------------------------------------------------------- 297 G4bool G4ReplicatedSlice::IsMany() const 267 G4bool G4ReplicatedSlice::IsMany() const 298 { 268 { 299 return false; 269 return false; >> 270 } >> 271 >> 272 //-------------------------------------------------------------------------- >> 273 G4int G4ReplicatedSlice::GetCopyNo() const >> 274 { >> 275 return fcopyNo; >> 276 } >> 277 >> 278 //-------------------------------------------------------------------------- >> 279 void G4ReplicatedSlice::SetCopyNo(G4int newCopyNo) >> 280 { >> 281 fcopyNo= newCopyNo; 300 } 282 } 301 283 302 //-------------------------------------------- 284 //-------------------------------------------------------------------------- 303 G4bool G4ReplicatedSlice::IsReplicated() const 285 G4bool G4ReplicatedSlice::IsReplicated() const 304 { 286 { 305 return true; 287 return true; 306 } 288 } 307 289 308 //-------------------------------------------- 290 //-------------------------------------------------------------------------- 309 G4int G4ReplicatedSlice::GetMultiplicity() con 291 G4int G4ReplicatedSlice::GetMultiplicity() const 310 { 292 { 311 return fnReplicas; 293 return fnReplicas; 312 } 294 } 313 295 314 //-------------------------------------------- 296 //-------------------------------------------------------------------------- 315 G4VPVParameterisation* G4ReplicatedSlice::GetP 297 G4VPVParameterisation* G4ReplicatedSlice::GetParameterisation() const 316 { 298 { 317 return fparam; 299 return fparam; 318 } 300 } 319 301 320 //-------------------------------------------- 302 //-------------------------------------------------------------------------- 321 EVolume G4ReplicatedSlice::VolumeType() const 303 EVolume G4ReplicatedSlice::VolumeType() const 322 { 304 { 323 return kParameterised; 305 return kParameterised; 324 } 306 } 325 307 326 //-------------------------------------------- 308 //-------------------------------------------------------------------------- 327 void G4ReplicatedSlice::GetReplicationData(EAx 309 void G4ReplicatedSlice::GetReplicationData(EAxis& axis, 328 G4i 310 G4int& nDivs, 329 G4d 311 G4double& width, 330 G4d 312 G4double& offset, 331 G4b 313 G4bool& consuming ) const 332 { 314 { 333 axis = faxis; 315 axis = faxis; 334 nDivs = fnReplicas; 316 nDivs = fnReplicas; 335 width = fwidth; 317 width = fwidth; 336 offset = foffset; 318 offset = foffset; 337 consuming = false; 319 consuming = false; 338 } 320 } 339 321 340 322 341 //-------------------------------------------- 323 //-------------------------------------------------------------------------- 342 void G4ReplicatedSlice::SetParameterisation( G 324 void G4ReplicatedSlice::SetParameterisation( G4LogicalVolume* motherLogical, 343 const E 325 const EAxis axis, 344 const G 326 const G4int nDivs, 345 const G 327 const G4double width, 346 const G 328 const G4double half_gap, 347 const G 329 const G4double offset, 348 D 330 DivisionType divType ) 349 { 331 { 350 G4VSolid* mSolid = motherLogical->GetSolid() 332 G4VSolid* mSolid = motherLogical->GetSolid(); 351 G4String mSolidType = mSolid->GetEntityType( 333 G4String mSolidType = mSolid->GetEntityType(); 352 fparam = nullptr; 334 fparam = nullptr; 353 335 354 // If the solid is a reflected one, update t 336 // If the solid is a reflected one, update type to its 355 // real constituent solid. 337 // real constituent solid. 356 // 338 // 357 if (mSolidType == "G4ReflectedSolid") 339 if (mSolidType == "G4ReflectedSolid") 358 { 340 { 359 mSolidType = ((G4ReflectedSolid*)mSolid) 341 mSolidType = ((G4ReflectedSolid*)mSolid)->GetConstituentMovedSolid() 360 ->GetEntityType(); 342 ->GetEntityType(); 361 } 343 } 362 344 363 // Parameterisation type depend of mother so 345 // Parameterisation type depend of mother solid type and axis of division 364 // 346 // 365 if( mSolidType == "G4Box" ) 347 if( mSolidType == "G4Box" ) 366 { 348 { 367 switch( axis ) 349 switch( axis ) 368 { 350 { 369 case kXAxis: 351 case kXAxis: 370 fparam = new G4ParameterisationBoxX( a 352 fparam = new G4ParameterisationBoxX( axis, nDivs, width, 371 o 353 offset, mSolid, divType ); 372 break; 354 break; 373 case kYAxis: 355 case kYAxis: 374 fparam = new G4ParameterisationBoxY( a 356 fparam = new G4ParameterisationBoxY( axis, nDivs, width, 375 o 357 offset, mSolid, divType ); 376 break; 358 break; 377 case kZAxis: 359 case kZAxis: 378 fparam = new G4ParameterisationBoxZ( a 360 fparam = new G4ParameterisationBoxZ( axis, nDivs, width, 379 o 361 offset, mSolid, divType ); 380 break; 362 break; 381 default: 363 default: 382 ErrorInAxis( axis, mSolid ); 364 ErrorInAxis( axis, mSolid ); 383 break; 365 break; 384 } 366 } 385 } 367 } 386 else if( mSolidType == "G4Tubs" ) 368 else if( mSolidType == "G4Tubs" ) 387 { 369 { 388 switch( axis ) 370 switch( axis ) 389 { 371 { 390 case kRho: 372 case kRho: 391 fparam = new G4ParameterisationTubsRho 373 fparam = new G4ParameterisationTubsRho( axis, nDivs, width, 392 374 offset, mSolid, divType ); 393 break; 375 break; 394 case kPhi: 376 case kPhi: 395 fparam = new G4ParameterisationTubsPhi 377 fparam = new G4ParameterisationTubsPhi( axis, nDivs, width, 396 378 offset, mSolid, divType ); 397 break; 379 break; 398 case kZAxis: 380 case kZAxis: 399 fparam = new G4ParameterisationTubsZ( 381 fparam = new G4ParameterisationTubsZ( axis, nDivs, width, 400 382 offset, mSolid, divType ); 401 break; 383 break; 402 default: 384 default: 403 ErrorInAxis( axis, mSolid ); 385 ErrorInAxis( axis, mSolid ); 404 break; 386 break; 405 } 387 } 406 } 388 } 407 else if( mSolidType == "G4Cons" ) 389 else if( mSolidType == "G4Cons" ) 408 { 390 { 409 switch( axis ) 391 switch( axis ) 410 { 392 { 411 case kRho: 393 case kRho: 412 fparam = new G4ParameterisationConsRho 394 fparam = new G4ParameterisationConsRho( axis, nDivs, width, 413 395 offset, mSolid, divType ); 414 break; 396 break; 415 case kPhi: 397 case kPhi: 416 fparam = new G4ParameterisationConsPhi 398 fparam = new G4ParameterisationConsPhi( axis, nDivs, width, 417 399 offset, mSolid, divType ); 418 break; 400 break; 419 case kZAxis: 401 case kZAxis: 420 fparam = new G4ParameterisationConsZ( 402 fparam = new G4ParameterisationConsZ( axis, nDivs, width, 421 403 offset, mSolid, divType ); 422 break; 404 break; 423 default: 405 default: 424 ErrorInAxis( axis, mSolid ); 406 ErrorInAxis( axis, mSolid ); 425 break; 407 break; 426 } 408 } 427 } 409 } 428 else if( mSolidType == "G4Trd" ) 410 else if( mSolidType == "G4Trd" ) 429 { 411 { 430 switch( axis ) 412 switch( axis ) 431 { 413 { 432 case kXAxis: 414 case kXAxis: 433 fparam = new G4ParameterisationTrdX( a 415 fparam = new G4ParameterisationTrdX( axis, nDivs, width, 434 o 416 offset, mSolid, divType ); 435 break; 417 break; 436 case kYAxis: 418 case kYAxis: 437 fparam = new G4ParameterisationTrdY( a 419 fparam = new G4ParameterisationTrdY( axis, nDivs, width, 438 o 420 offset, mSolid, divType ); 439 break; 421 break; 440 case kZAxis: 422 case kZAxis: 441 fparam = new G4ParameterisationTrdZ( a 423 fparam = new G4ParameterisationTrdZ( axis, nDivs, width, 442 o 424 offset, mSolid, divType ); 443 break; 425 break; 444 default: 426 default: 445 ErrorInAxis( axis, mSolid ); 427 ErrorInAxis( axis, mSolid ); 446 break; 428 break; 447 } 429 } 448 } 430 } 449 else if( mSolidType == "G4Para" ) 431 else if( mSolidType == "G4Para" ) 450 { 432 { 451 switch( axis ) 433 switch( axis ) 452 { 434 { 453 case kXAxis: 435 case kXAxis: 454 fparam = new G4ParameterisationParaX( 436 fparam = new G4ParameterisationParaX( axis, nDivs, width, 455 o 437 offset, mSolid, divType ); 456 break; 438 break; 457 case kYAxis: 439 case kYAxis: 458 fparam = new G4ParameterisationParaY( 440 fparam = new G4ParameterisationParaY( axis, nDivs, width, 459 o 441 offset, mSolid, divType ); 460 break; 442 break; 461 case kZAxis: 443 case kZAxis: 462 fparam = new G4ParameterisationParaZ( 444 fparam = new G4ParameterisationParaZ( axis, nDivs, width, 463 o 445 offset, mSolid, divType ); 464 break; 446 break; 465 default: 447 default: 466 ErrorInAxis( axis, mSolid ); 448 ErrorInAxis( axis, mSolid ); 467 break; 449 break; 468 } 450 } 469 } 451 } 470 // else if( mSolidType == "G4Trap" ) 452 // else if( mSolidType == "G4Trap" ) 471 // { 453 // { 472 // } 454 // } 473 // else if( mSolidType == "G4Polycone" ) 455 // else if( mSolidType == "G4Polycone" ) 474 // { 456 // { 475 // switch( axis ) 457 // switch( axis ) 476 // { 458 // { 477 // case kRho: 459 // case kRho: 478 // fparam = new G4ParameterisationPolyc 460 // fparam = new G4ParameterisationPolyconeRho( axis, nDivs, width, 479 // 461 // offset, mSolid, divType ); 480 // break; 462 // break; 481 // case kPhi: 463 // case kPhi: 482 // fparam = new G4ParameterisationPolyc 464 // fparam = new G4ParameterisationPolyconePhi( axis, nDivs, width, 483 // 465 // offset, mSolid, divType ); 484 // break; 466 // break; 485 // case kZAxis: 467 // case kZAxis: 486 // fparam = new G4ParameterisationPolyc 468 // fparam = new G4ParameterisationPolyconeZ( axis, nDivs, width, 487 // 469 // offset, mSolid, divType ); 488 // break; 470 // break; 489 // default: 471 // default: 490 // ErrorInAxis( axis, mSolid ); 472 // ErrorInAxis( axis, mSolid ); 491 // break; 473 // break; 492 // } 474 // } 493 // } 475 // } 494 // else if( mSolidType == "G4Polyhedra" ) 476 // else if( mSolidType == "G4Polyhedra" ) 495 // { 477 // { 496 // switch( axis ) 478 // switch( axis ) 497 // { 479 // { 498 // case kRho: 480 // case kRho: 499 // fparam = new G4ParameterisationPolyh 481 // fparam = new G4ParameterisationPolyhedraRho( axis, nDivs, width, 500 // 482 // offset, mSolid, divType ); 501 // break; 483 // break; 502 // case kPhi: 484 // case kPhi: 503 // fparam = new G4ParameterisationPolyh 485 // fparam = new G4ParameterisationPolyhedraPhi( axis, nDivs, width, 504 // 486 // offset, mSolid, divType ); 505 // break; 487 // break; 506 // case kZAxis: 488 // case kZAxis: 507 // fparam = new G4ParameterisationPolyh 489 // fparam = new G4ParameterisationPolyhedraZ( axis, nDivs, width, 508 // 490 // offset, mSolid, divType ); 509 // break; 491 // break; 510 // default: 492 // default: 511 // ErrorInAxis( axis, mSolid ); 493 // ErrorInAxis( axis, mSolid ); 512 // break; 494 // break; 513 // } 495 // } 514 // } 496 // } 515 else 497 else 516 { 498 { 517 std::ostringstream message; 499 std::ostringstream message; 518 message << "Solid type not supported: " << 500 message << "Solid type not supported: " << mSolidType << "." << G4endl 519 << "Divisions for " << mSolidType 501 << "Divisions for " << mSolidType << " not implemented."; 520 G4Exception("G4ReplicatedSlice::SetParamet 502 G4Exception("G4ReplicatedSlice::SetParameterisation()", "GeomDiv0001", 521 FatalException, message); 503 FatalException, message); 522 } 504 } 523 505 524 fparam->SetHalfGap(half_gap); 506 fparam->SetHalfGap(half_gap); 525 } 507 } 526 508 527 //-------------------------------------------- 509 //-------------------------------------------------------------------------- 528 void G4ReplicatedSlice::ErrorInAxis( EAxis axi 510 void G4ReplicatedSlice::ErrorInAxis( EAxis axis, G4VSolid* solid ) 529 { 511 { 530 G4String error = "Trying to divide solid " + 512 G4String error = "Trying to divide solid " + solid->GetName() 531 + " of type " + solid->GetEnt 513 + " of type " + solid->GetEntityType() + " along axis "; 532 switch( axis ) 514 switch( axis ) 533 { 515 { 534 case kXAxis: 516 case kXAxis: 535 error += "X."; 517 error += "X."; 536 break; 518 break; 537 case kYAxis: 519 case kYAxis: 538 error += "Y."; 520 error += "Y."; 539 break; 521 break; 540 case kZAxis: 522 case kZAxis: 541 error += "Z."; 523 error += "Z."; 542 break; 524 break; 543 case kRho: 525 case kRho: 544 error += "Rho."; 526 error += "Rho."; 545 break; 527 break; 546 case kRadial3D: 528 case kRadial3D: 547 error += "Radial3D."; 529 error += "Radial3D."; 548 break; 530 break; 549 case kPhi: 531 case kPhi: 550 error += "Phi."; 532 error += "Phi."; 551 break; 533 break; 552 default: 534 default: 553 break; 535 break; 554 } 536 } 555 G4Exception("G4ReplicatedSlice::ErrorInAxis( 537 G4Exception("G4ReplicatedSlice::ErrorInAxis()", "GeomDiv0002", 556 FatalException, error); 538 FatalException, error); 557 } 539 } 558 540 559 // The next methods are for specialised repeat 541 // The next methods are for specialised repeated volumes 560 // (replicas, parameterised vol.) which are co 542 // (replicas, parameterised vol.) which are completely regular. 561 // Currently this is not applicable to divisio 543 // Currently this is not applicable to divisions ( J.A. Nov 2005 ) 562 544 563 // ------------------------------------------- 545 // ---------------------------------------------------------------------- 564 // IsRegularStructure() 546 // IsRegularStructure() 565 // 547 // 566 G4bool G4ReplicatedSlice::IsRegularStructure() 548 G4bool G4ReplicatedSlice::IsRegularStructure() const 567 { 549 { 568 return false; 550 return false; 569 } 551 } 570 552 571 // ------------------------------------------- 553 // ---------------------------------------------------------------------- 572 // GetRegularStructureId() 554 // GetRegularStructureId() 573 // 555 // 574 G4int G4ReplicatedSlice::GetRegularStructureId 556 G4int G4ReplicatedSlice::GetRegularStructureId() const 575 { 557 { 576 return 0; 558 return 0; 577 } 559 } 578 560