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