#include <G4PVPlacement.hh>
Inheritance diagram for G4PVPlacement:
Public Member Functions | |
G4PVPlacement (G4RotationMatrix *pRot, const G4ThreeVector &tlate, G4LogicalVolume *pCurrentLogical, const G4String &pName, G4LogicalVolume *pMotherLogical, G4bool pMany, G4int pCopyNo, G4bool pSurfChk=false) | |
G4PVPlacement (const G4Transform3D &Transform3D, G4LogicalVolume *pCurrentLogical, const G4String &pName, G4LogicalVolume *pMotherLogical, G4bool pMany, G4int pCopyNo, G4bool pSurfChk=false) | |
G4PVPlacement (G4RotationMatrix *pRot, const G4ThreeVector &tlate, const G4String &pName, G4LogicalVolume *pLogical, G4VPhysicalVolume *pMother, G4bool pMany, G4int pCopyNo, G4bool pSurfChk=false) | |
G4PVPlacement (const G4Transform3D &Transform3D, const G4String &pName, G4LogicalVolume *pLogical, G4VPhysicalVolume *pMother, G4bool pMany, G4int pCopyNo, G4bool pSurfChk=false) | |
virtual | ~G4PVPlacement () |
G4int | GetCopyNo () const |
void | SetCopyNo (G4int CopyNo) |
G4bool | CheckOverlaps (G4int res=1000, G4double tol=0., G4bool verbose=true) |
G4PVPlacement (__void__ &) | |
G4bool | IsMany () const |
G4bool | IsReplicated () const |
G4bool | IsParameterised () const |
G4VPVParameterisation * | GetParameterisation () const |
void | GetReplicationData (EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const |
G4bool | IsRegularStructure () const |
G4int | GetRegularStructureId () const |
Definition at line 51 of file G4PVPlacement.hh.
G4PVPlacement::G4PVPlacement | ( | G4RotationMatrix * | pRot, | |
const G4ThreeVector & | tlate, | |||
G4LogicalVolume * | pCurrentLogical, | |||
const G4String & | pName, | |||
G4LogicalVolume * | pMotherLogical, | |||
G4bool | pMany, | |||
G4int | pCopyNo, | |||
G4bool | pSurfChk = false | |||
) |
Definition at line 100 of file G4PVPlacement.cc.
References G4LogicalVolume::AddDaughter(), CheckOverlaps(), FatalException, G4Exception(), and G4VPhysicalVolume::SetMotherLogical().
00108 : G4VPhysicalVolume(pRot,tlate,pName,pCurrentLogical,0), 00109 fmany(pMany), fallocatedRotM(false), fcopyNo(pCopyNo) 00110 { 00111 if (pCurrentLogical == pMotherLogical) 00112 { 00113 G4Exception("G4PVPlacement::G4PVPlacement()", "GeomVol0002", 00114 FatalException, "Cannot place a volume inside itself!"); 00115 } 00116 SetMotherLogical(pMotherLogical); 00117 if (pMotherLogical) { pMotherLogical->AddDaughter(this); } 00118 if ((pSurfChk) && (pMotherLogical)) { CheckOverlaps(); } 00119 }
G4PVPlacement::G4PVPlacement | ( | const G4Transform3D & | Transform3D, | |
G4LogicalVolume * | pCurrentLogical, | |||
const G4String & | pName, | |||
G4LogicalVolume * | pMotherLogical, | |||
G4bool | pMany, | |||
G4int | pCopyNo, | |||
G4bool | pSurfChk = false | |||
) |
Definition at line 125 of file G4PVPlacement.cc.
References G4LogicalVolume::AddDaughter(), CheckOverlaps(), FatalException, G4Exception(), G4VPhysicalVolume::GetRotation(), G4VPhysicalVolume::SetMotherLogical(), and G4VPhysicalVolume::SetRotation().
00132 : G4VPhysicalVolume(0,Transform3D.getTranslation(),pName,pCurrentLogical,0), 00133 fmany(pMany), fcopyNo(pCopyNo) 00134 { 00135 if (pCurrentLogical == pMotherLogical) 00136 { 00137 G4Exception("G4PVPlacement::G4PVPlacement()", "GeomVol0002", 00138 FatalException, "Cannot place a volume inside itself!"); 00139 } 00140 SetRotation( NewPtrRotMatrix(Transform3D.getRotation().inverse()) ); 00141 fallocatedRotM = (GetRotation() != 0); 00142 SetMotherLogical(pMotherLogical); 00143 if (pMotherLogical) { pMotherLogical->AddDaughter(this); } 00144 if ((pSurfChk) && (pMotherLogical)) { CheckOverlaps(); } 00145 }
G4PVPlacement::G4PVPlacement | ( | G4RotationMatrix * | pRot, | |
const G4ThreeVector & | tlate, | |||
const G4String & | pName, | |||
G4LogicalVolume * | pLogical, | |||
G4VPhysicalVolume * | pMother, | |||
G4bool | pMany, | |||
G4int | pCopyNo, | |||
G4bool | pSurfChk = false | |||
) |
Definition at line 43 of file G4PVPlacement.cc.
References G4LogicalVolume::AddDaughter(), CheckOverlaps(), FatalException, G4Exception(), G4VPhysicalVolume::GetLogicalVolume(), and G4VPhysicalVolume::SetMotherLogical().
00051 : G4VPhysicalVolume(pRot,tlate,pName,pLogical,pMother), 00052 fmany(pMany), fallocatedRotM(false), fcopyNo(pCopyNo) 00053 { 00054 if (pMother) 00055 { 00056 G4LogicalVolume* motherLogical = pMother->GetLogicalVolume(); 00057 if (pLogical == motherLogical) 00058 { 00059 G4Exception("G4PVPlacement::G4PVPlacement()", "GeomVol0002", 00060 FatalException, "Cannot place a volume inside itself!"); 00061 } 00062 SetMotherLogical(motherLogical); 00063 motherLogical->AddDaughter(this); 00064 if (pSurfChk) { CheckOverlaps(); } 00065 } 00066 }
G4PVPlacement::G4PVPlacement | ( | const G4Transform3D & | Transform3D, | |
const G4String & | pName, | |||
G4LogicalVolume * | pLogical, | |||
G4VPhysicalVolume * | pMother, | |||
G4bool | pMany, | |||
G4int | pCopyNo, | |||
G4bool | pSurfChk = false | |||
) |
Definition at line 71 of file G4PVPlacement.cc.
References G4LogicalVolume::AddDaughter(), CheckOverlaps(), FatalException, G4Exception(), G4VPhysicalVolume::GetLogicalVolume(), G4VPhysicalVolume::GetRotation(), and G4VPhysicalVolume::SetMotherLogical().
00078 : G4VPhysicalVolume(NewPtrRotMatrix(Transform3D.getRotation().inverse()), 00079 Transform3D.getTranslation(),pName,pLogical,pMother), 00080 fmany(pMany), fcopyNo(pCopyNo) 00081 { 00082 fallocatedRotM = (GetRotation() != 0); 00083 if (pMother) 00084 { 00085 G4LogicalVolume* motherLogical = pMother->GetLogicalVolume(); 00086 if (pLogical == motherLogical) 00087 G4Exception("G4PVPlacement::G4PVPlacement()", "GeomVol0002", 00088 FatalException, "Cannot place a volume inside itself!"); 00089 SetMotherLogical(motherLogical); 00090 motherLogical->AddDaughter(this); 00091 if (pSurfChk) { CheckOverlaps(); } 00092 } 00093 }
G4PVPlacement::~G4PVPlacement | ( | ) | [virtual] |
Definition at line 159 of file G4PVPlacement.cc.
References G4VPhysicalVolume::frot.
00160 { 00161 if( fallocatedRotM ){ delete frot; } 00162 }
G4PVPlacement::G4PVPlacement | ( | __void__ & | ) |
Definition at line 151 of file G4PVPlacement.cc.
00152 : G4VPhysicalVolume(a), fmany(false), fallocatedRotM(0), fcopyNo(0) 00153 { 00154 }
G4bool G4PVPlacement::CheckOverlaps | ( | G4int | res = 1000 , |
|
G4double | tol = 0. , |
|||
G4bool | verbose = true | |||
) | [virtual] |
Reimplemented from G4VPhysicalVolume.
Definition at line 244 of file G4PVPlacement.cc.
References G4VSolid::DistanceToIn(), G4VSolid::DistanceToOut(), G4BestUnit, G4cout, G4endl, G4Exception(), G4LogicalVolume::GetDaughter(), G4VPhysicalVolume::GetLogicalVolume(), G4VPhysicalVolume::GetMotherLogical(), G4LogicalVolume::GetName(), G4VPhysicalVolume::GetName(), G4LogicalVolume::GetNoDaughters(), G4VSolid::GetPointOnSurface(), G4VPhysicalVolume::GetRotation(), G4LogicalVolume::GetSolid(), G4VPhysicalVolume::GetTranslation(), G4VSolid::Inside(), G4AffineTransform::Inverse(), JustWarning, kInside, kOutside, CLHEP::detail::n, and G4AffineTransform::TransformPoint().
Referenced by G4PVPlacement().
00245 { 00246 if (res<=0) { return false; } 00247 00248 G4VSolid* solid = GetLogicalVolume()->GetSolid(); 00249 G4LogicalVolume* motherLog = GetMotherLogical(); 00250 if (!motherLog) { return false; } 00251 00252 G4VSolid* motherSolid = motherLog->GetSolid(); 00253 00254 if (verbose) 00255 { 00256 G4cout << "Checking overlaps for volume " << GetName() << " ... "; 00257 } 00258 00259 // Create the transformation from daughter to mother 00260 // 00261 G4AffineTransform Tm( GetRotation(), GetTranslation() ); 00262 00263 for (G4int n=0; n<res; n++) 00264 { 00265 // Generate a random point on the solid's surface 00266 // 00267 G4ThreeVector point = solid->GetPointOnSurface(); 00268 00269 // Transform the generated point to the mother's coordinate system 00270 // 00271 G4ThreeVector mp = Tm.TransformPoint(point); 00272 00273 // Checking overlaps with the mother volume 00274 // 00275 if (motherSolid->Inside(mp)==kOutside) 00276 { 00277 G4double distin = motherSolid->DistanceToIn(mp); 00278 if (distin > tol) 00279 { 00280 std::ostringstream message; 00281 message << "Overlap with mother volume !" << G4endl 00282 << " Overlap is detected for volume " 00283 << GetName() << G4endl 00284 << " with its mother volume " 00285 << motherLog->GetName() << G4endl 00286 << " at mother local point " << mp << ", " 00287 << "overlapping by at least: " 00288 << G4BestUnit(distin, "Length"); 00289 G4Exception("G4PVPlacement::CheckOverlaps()", 00290 "GeomVol1002", JustWarning, message); 00291 return true; 00292 } 00293 } 00294 00295 // Checking overlaps with each 'sister' volume 00296 // 00297 for (G4int i=0; i<motherLog->GetNoDaughters(); i++) 00298 { 00299 G4VPhysicalVolume* daughter = motherLog->GetDaughter(i); 00300 00301 if (daughter == this) { continue; } 00302 00303 // Create the transformation for daughter volume and transform point 00304 // 00305 G4AffineTransform Td( daughter->GetRotation(), 00306 daughter->GetTranslation() ); 00307 G4ThreeVector md = Td.Inverse().TransformPoint(mp); 00308 00309 G4VSolid* daughterSolid = daughter->GetLogicalVolume()->GetSolid(); 00310 if (daughterSolid->Inside(md)==kInside) 00311 { 00312 G4double distout = daughterSolid->DistanceToOut(md); 00313 if (distout > tol) 00314 { 00315 std::ostringstream message; 00316 message << "Overlap with volume already placed !" << G4endl 00317 << " Overlap is detected for volume " 00318 << GetName() << G4endl 00319 << " with " << daughter->GetName() << " volume's" 00320 << G4endl 00321 << " local point " << md << ", " 00322 << "overlapping by at least: " 00323 << G4BestUnit(distout,"Length"); 00324 G4Exception("G4PVPlacement::CheckOverlaps()", 00325 "GeomVol1002", JustWarning, message); 00326 return true; 00327 } 00328 } 00329 00330 // Now checking that 'sister' volume is not totally included and 00331 // overlapping. Do it only once, for the first point generated 00332 // 00333 if (n==0) 00334 { 00335 // Generate a single point on the surface of the 'sister' volume 00336 // and verify that the point is NOT inside the current volume 00337 00338 G4ThreeVector dPoint = daughterSolid->GetPointOnSurface(); 00339 00340 // Transform the generated point to the mother's coordinate system 00341 // and finally to current volume's coordinate system 00342 // 00343 G4ThreeVector mp2 = Td.TransformPoint(dPoint); 00344 G4ThreeVector msi = Tm.Inverse().TransformPoint(mp2); 00345 00346 if (solid->Inside(msi)==kInside) 00347 { 00348 std::ostringstream message; 00349 message << "Overlap with volume already placed !" << G4endl 00350 << " Overlap is detected for volume " 00351 << GetName() << G4endl 00352 << " apparently fully encapsulating volume " 00353 << daughter->GetName() << G4endl 00354 << " at the same level !"; 00355 G4Exception("G4PVPlacement::CheckOverlaps()", 00356 "GeomVol1002", JustWarning, message); 00357 return true; 00358 } 00359 } 00360 } 00361 } 00362 00363 if (verbose) 00364 { 00365 G4cout << "OK! " << G4endl; 00366 } 00367 00368 return false; 00369 }
G4int G4PVPlacement::GetCopyNo | ( | ) | const [virtual] |
G4VPVParameterisation * G4PVPlacement::GetParameterisation | ( | ) | const [virtual] |
G4int G4PVPlacement::GetRegularStructureId | ( | ) | const [virtual] |
void G4PVPlacement::GetReplicationData | ( | EAxis & | axis, | |
G4int & | nReplicas, | |||
G4double & | width, | |||
G4double & | offset, | |||
G4bool & | consuming | |||
) | const [virtual] |
G4bool G4PVPlacement::IsMany | ( | ) | const [virtual] |
G4bool G4PVPlacement::IsParameterised | ( | ) | const [virtual] |
G4bool G4PVPlacement::IsRegularStructure | ( | ) | const [virtual] |
G4bool G4PVPlacement::IsReplicated | ( | ) | const [virtual] |
void G4PVPlacement::SetCopyNo | ( | G4int | CopyNo | ) | [virtual] |