Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PVPlacement Class Reference

G4PVPlacement represents a single volume positioned within and relative to a mother volume. More...

#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)
 G4PVPlacement (__void__ &)
 ~G4PVPlacement () override
 G4PVPlacement (const G4PVPlacement &)=delete
G4PVPlacementoperator= (const G4PVPlacement &)=delete
G4int GetCopyNo () const override
void SetCopyNo (G4int CopyNo) override
G4bool CheckOverlaps (G4int res=1000, G4double tol=0., G4bool verbose=true, G4int maxErr=1) override
G4bool IsMany () const override
G4bool IsReplicated () const override
G4bool IsParameterised () const override
G4VPVParameterisationGetParameterisation () const override
void GetReplicationData (EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const override
G4bool IsRegularStructure () const override
G4int GetRegularStructureId () const override
EVolume VolumeType () const override
Public Member Functions inherited from G4VPhysicalVolume
 G4VPhysicalVolume (G4RotationMatrix *pRot, const G4ThreeVector &tlate, const G4String &pName, G4LogicalVolume *pLogical, G4VPhysicalVolume *pMother)
virtual ~G4VPhysicalVolume ()
 G4VPhysicalVolume (const G4VPhysicalVolume &)=delete
G4VPhysicalVolumeoperator= (const G4VPhysicalVolume &)=delete
G4bool operator== (const G4VPhysicalVolume &p) const
G4RotationMatrixGetObjectRotation () const
G4RotationMatrix GetObjectRotationValue () const
G4ThreeVector GetObjectTranslation () const
const G4RotationMatrixGetFrameRotation () const
G4ThreeVector GetFrameTranslation () const
const G4ThreeVector GetTranslation () const
const G4RotationMatrixGetRotation () const
G4RotationMatrixGetRotation ()
void SetTranslation (const G4ThreeVector &v)
void SetRotation (G4RotationMatrix *)
G4LogicalVolumeGetLogicalVolume () const
void SetLogicalVolume (G4LogicalVolume *pLogical)
G4LogicalVolumeGetMotherLogical () const
void SetMotherLogical (G4LogicalVolume *pMother)
const G4StringGetName () const
void SetName (const G4String &pName)
virtual G4int GetMultiplicity () const
 G4VPhysicalVolume (__void__ &)
G4int GetInstanceID () const
EVolume DeduceVolumeType () const

Additional Inherited Members

Static Public Member Functions inherited from G4VPhysicalVolume
static const G4PVManagerGetSubInstanceManager ()
static void Clean ()
Protected Member Functions inherited from G4VPhysicalVolume
void InitialiseWorker (G4VPhysicalVolume *pMasterObject, G4RotationMatrix *pRot, const G4ThreeVector &tlate)
void TerminateWorker (G4VPhysicalVolume *pMasterObject)
Protected Attributes inherited from G4VPhysicalVolume
G4int instanceID
Static Protected Attributes inherited from G4VPhysicalVolume
static G4GEOM_DLL G4PVManager subInstanceManager

Detailed Description

G4PVPlacement represents a single volume positioned within and relative to a mother volume.

Definition at line 46 of file G4PVPlacement.hh.

Constructor & Destructor Documentation

◆ G4PVPlacement() [1/6]

G4PVPlacement::G4PVPlacement ( G4RotationMatrix * pRot,
const G4ThreeVector & tlate,
G4LogicalVolume * pCurrentLogical,
const G4String & pName,
G4LogicalVolume * pMotherLogical,
G4bool pMany,
G4int pCopyNo,
G4bool pSurfChk = false )

Initialises a single volume, positioned in a frame which is rotated by '*pRot' and traslated by 'tlate', relative to the coordinate system of the mother volume 'pMotherLogical'. If 'pRot=nullptr' the volume is unrotated with respect to its mother. The physical volume is added to the mother's logical volume. This is a very natural way of defining a physical volume, and is especially useful when creating subdetectors: the mother volumes are not placed until a later stage of the assembly program.

Parameters
[in]pRotThe pointer to the rotation in the mother volume.
[in]tlateTraslation vector in the mother volume.
[in]pCurrentLogicalPointer to its logical volume.
[in]pNameThe volume name.
[in]pMotherLogicalPointer to the logical volume of the mother.
[in]pManyFlag to identify if the volume is meant to be considered an overlapping structure, or not. - not used.
[in]pCopyNoThe optional custom copy number. Should be set to 0 for the first volume of a given type.
[in]pSurfChkBoolean flag, if true activates check for overlaps with existing volumes (false by default).

Definition at line 99 of file G4PVPlacement.cc.

107 : G4VPhysicalVolume(pRot, tlate, pName, pCurrentLogical, nullptr),
108 fmany(pMany), fcopyNo(pCopyNo)
109{
110 if (pCurrentLogical == pMotherLogical)
111 {
112 G4Exception("G4PVPlacement::G4PVPlacement()", "GeomVol0002",
113 FatalException, "Cannot place a volume inside itself!");
114 }
115 SetMotherLogical(pMotherLogical);
116 if (pMotherLogical != nullptr) { pMotherLogical->AddDaughter(this); }
117 if ((pSurfChk) && ((pMotherLogical) != nullptr)) { CheckOverlaps(); }
118}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void AddDaughter(G4VPhysicalVolume *p)
G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true, G4int maxErr=1) override
G4VPhysicalVolume(G4RotationMatrix *pRot, const G4ThreeVector &tlate, const G4String &pName, G4LogicalVolume *pLogical, G4VPhysicalVolume *pMother)
void SetMotherLogical(G4LogicalVolume *pMother)

Referenced by G4PVPlacement(), and operator=().

◆ G4PVPlacement() [2/6]

G4PVPlacement::G4PVPlacement ( const G4Transform3D & Transform3D,
G4LogicalVolume * pCurrentLogical,
const G4String & pName,
G4LogicalVolume * pMotherLogical,
G4bool pMany,
G4int pCopyNo,
G4bool pSurfChk = false )

Additional constructor, which expects a G4Transform3D object that represents the direct rotation and translation of the solid (NOT of the frame). The G4Transform3D argument should be constructed by: i) First rotating it to align the solid to the system of reference of its mother volume *pMotherLogical, and ii) Then placing the solid at the location Transform3D.getTranslation(), with respect to the origin of the system of coordinates of the mother volume.
This construct is useful for the people who prefer to think in terms of moving objects in a given reference frame. All other arguments are the same as for the previous constructor.

Parameters
[in]Transform3DThe transformation in the 3D space.
[in]pCurrentLogicalPointer to its logical volume.
[in]pNameThe volume name.
[in]pMotherLogicalPointer to the logical volume of the mother.
[in]pManyFlag to identify if the volume is meant to be considered an overlapping structure, or not. - not used.
[in]pCopyNoThe optional custom copy number. Should be set to 0 for the first volume of a given type.
[in]pSurfChkBoolean flag, if true activates check for overlaps with existing volumes (false by default).

Definition at line 123 of file G4PVPlacement.cc.

130 : G4VPhysicalVolume(nullptr, Transform3D.getTranslation(),
131 pName, pCurrentLogical, nullptr),
132 fmany(pMany), fcopyNo(pCopyNo)
133{
134 if (pCurrentLogical == pMotherLogical)
135 {
136 G4Exception("G4PVPlacement::G4PVPlacement()", "GeomVol0002",
137 FatalException, "Cannot place a volume inside itself!");
138 }
139 SetRotation( NewPtrRotMatrix(Transform3D.getRotation().inverse()) );
140 fallocatedRotM = (GetRotation() != nullptr);
141 SetMotherLogical(pMotherLogical);
142 if (pMotherLogical != nullptr) { pMotherLogical->AddDaughter(this); }
143 if ((pSurfChk) && ((pMotherLogical) != nullptr)) { CheckOverlaps(); }
144}
HepRotation inverse() const
const G4RotationMatrix * GetRotation() const
void SetRotation(G4RotationMatrix *)
CLHEP::HepRotation getRotation() const
CLHEP::Hep3Vector getTranslation() const

◆ G4PVPlacement() [3/6]

G4PVPlacement::G4PVPlacement ( G4RotationMatrix * pRot,
const G4ThreeVector & tlate,
const G4String & pName,
G4LogicalVolume * pLogical,
G4VPhysicalVolume * pMother,
G4bool pMany,
G4int pCopyNo,
G4bool pSurfChk = false )

A simple variation of the first constructor, only specifying the mother volume as a pointer to its physical volume instead of its logical volume. The effect is exactly the same.

Definition at line 40 of file G4PVPlacement.cc.

48 : G4VPhysicalVolume(pRot, tlate, pName, pLogical, pMother),
49 fmany(pMany), fcopyNo(pCopyNo)
50{
51 if (pMother != nullptr)
52 {
53 G4LogicalVolume* motherLogical = pMother->GetLogicalVolume();
54 if (pLogical == motherLogical)
55 {
56 G4Exception("G4PVPlacement::G4PVPlacement()", "GeomVol0002",
57 FatalException, "Cannot place a volume inside itself!");
58 }
59 SetMotherLogical(motherLogical);
60 motherLogical->AddDaughter(this);
61 if (pSurfChk) { CheckOverlaps(); }
62 }
63}
G4LogicalVolume * GetLogicalVolume() const

◆ G4PVPlacement() [4/6]

G4PVPlacement::G4PVPlacement ( const G4Transform3D & Transform3D,
const G4String & pName,
G4LogicalVolume * pLogical,
G4VPhysicalVolume * pMother,
G4bool pMany,
G4int pCopyNo,
G4bool pSurfChk = false )

Utilises both variations above (from first and third constructors). The effect is the same as for the second constructor.

Definition at line 68 of file G4PVPlacement.cc.

75 : G4VPhysicalVolume(NewPtrRotMatrix(Transform3D.getRotation().inverse()),
76 Transform3D.getTranslation(), pName, pLogical, pMother),
77 fmany(pMany), fcopyNo(pCopyNo)
78{
79 fallocatedRotM = (GetRotation() != nullptr);
80 if (pMother != nullptr)
81 {
82 G4LogicalVolume* motherLogical = pMother->GetLogicalVolume();
83 if (pLogical == motherLogical)
84 {
85 G4Exception("G4PVPlacement::G4PVPlacement()", "GeomVol0002",
86 FatalException, "Cannot place a volume inside itself!");
87 }
88 SetMotherLogical(motherLogical);
89 motherLogical->AddDaughter(this);
90 if (pSurfChk) { CheckOverlaps(); }
91 }
92}

◆ G4PVPlacement() [5/6]

G4PVPlacement::G4PVPlacement ( __void__ & a)

Fake default constructor for usage restricted to direct object persistency for clients requiring preallocation of memory for persistifiable objects.

Definition at line 150 of file G4PVPlacement.cc.

152{
153}

◆ ~G4PVPlacement()

G4PVPlacement::~G4PVPlacement ( )
override

Default Destructor.

Definition at line 158 of file G4PVPlacement.cc.

159{
160 if( fallocatedRotM ){ delete this->GetRotation() ; }
161}

◆ G4PVPlacement() [6/6]

G4PVPlacement::G4PVPlacement ( const G4PVPlacement & )
delete

Copy constructor and assignment operator not allowed.

Member Function Documentation

◆ CheckOverlaps()

G4bool G4PVPlacement::CheckOverlaps ( G4int res = 1000,
G4double tol = 0.,
G4bool verbose = true,
G4int maxErr = 1 )
overridevirtual

Verifies if the placed volume is overlapping with existing daughters or with the mother volume. Provides default resolution for the number of points to be generated and verified. A tolerance for the precision of the overlap check can be specified, by default it is set to maximum precision. Reports a maximum of overlaps errors according to parameter in input.

Parameters
[in]resThe number of points to generate on volume's surface.
[in]tolThe precision tolerance for the overlap check, below which to ignore overlaps (default is maximim precision).
[in]verboseVerbosity mode (default is true).
[in]maxErrMaximum of overlaps errors to report (default is 1).
Returns
True if an overlap occurs.

Reimplemented from G4VPhysicalVolume.

Definition at line 245 of file G4PVPlacement.cc.

247{
248 if (res <= 0) { return false; }
249
250 G4VSolid* solid = GetLogicalVolume()->GetSolid();
251 G4LogicalVolume* motherLog = GetMotherLogical();
252 if (motherLog == nullptr) { return false; }
253
254 G4int trials = 0;
255 G4bool retval = false;
256
257 if (verbose)
258 {
259 G4cout << "Checking overlaps for volume "
260 << GetName() << ':' << GetCopyNo()
261 << " (" << solid->GetEntityType() << ") ... ";
262 }
263
264 // Check that random points are gererated correctly
265 //
266 G4ThreeVector ptmp = solid->GetPointOnSurface();
267 if (solid->Inside(ptmp) != kSurface)
268 {
269 G4String position[3] = { "outside", "surface", "inside" };
270 std::ostringstream message;
271 message << "Sample point is not on the surface !" << G4endl
272 << " The issue is detected for volume "
273 << GetName() << ':' << GetCopyNo()
274 << " (" << solid->GetEntityType() << ")" << G4endl
275 << " generated point " << ptmp
276 << " is " << position[solid->Inside(ptmp)];
277 G4Exception("G4PVPlacement::CheckOverlaps()",
278 "GeomVol1002", JustWarning, message);
279 return false;
280 }
281
282 // Generate random points on the surface of the solid,
283 // transform them into the mother volume coordinate system
284 // and find the bonding box
285 //
286 std::vector<G4ThreeVector> points(res);
287 G4double xmin = kInfinity;
288 G4double ymin = kInfinity;
289 G4double zmin = kInfinity;
290 G4double xmax = -kInfinity;
291 G4double ymax = -kInfinity;
292 G4double zmax = -kInfinity;
293 G4AffineTransform Tm(GetRotation(), GetTranslation());
294 for (G4int i = 0; i < res; ++i)
295 {
296 points[i] = Tm.TransformPoint(solid->GetPointOnSurface());
297 xmin = std::min(xmin, points[i].x());
298 ymin = std::min(ymin, points[i].y());
299 zmin = std::min(zmin, points[i].z());
300 xmax = std::max(xmax, points[i].x());
301 ymax = std::max(ymax, points[i].y());
302 zmax = std::max(zmax, points[i].z());
303 }
304 G4ThreeVector scenter(0.5*(xmax+xmin), 0.5*(ymax+ymin), 0.5*(zmax+zmin));
305 G4double sradius = 0.5*G4ThreeVector(xmax-xmin, ymax-ymin, zmax-zmin).mag();
306
307 // Check overlap with the mother volume
308 //
309 G4int overlapCount = 0;
310 G4double overlapSize = -kInfinity;
311 G4ThreeVector overlapPoint;
312 G4VSolid* motherSolid = motherLog->GetSolid();
313 for (G4int i = 0; i < res; ++i)
314 {
315 G4ThreeVector mp = points[i];
316 if (motherSolid->Inside(mp) != kOutside) { continue; }
317 G4double distin = motherSolid->DistanceToIn(mp);
318 if (distin < tol) { continue; } // too small overlap
319 ++overlapCount;
320 if (distin <= overlapSize) { continue; }
321 overlapSize = distin;
322 overlapPoint = mp;
323 }
324
325 // Print information on overlap
326 //
327 if (overlapCount > 0)
328 {
329 ++trials;
330 retval = true;
331 std::ostringstream message;
332 message << "Overlap with mother volume !" << G4endl
333 << " Overlap is detected for volume "
334 << GetName() << ':' << GetCopyNo()
335 << " (" << solid->GetEntityType() << ")"
336 << " with its mother volume " << motherLog->GetName()
337 << " (" << motherSolid->GetEntityType() << ")" << G4endl
338 << " protrusion at mother local point " << overlapPoint
339 << " by " << G4BestUnit(overlapSize, "Length")
340 << " (max of " << overlapCount << " cases)";
341 if (trials >= maxErr)
342 {
343 message << G4endl
344 << "NOTE: Reached maximum fixed number -" << maxErr
345 << "- of overlaps reports for this volume !";
346 }
347 G4Exception("G4PVPlacement::CheckOverlaps()",
348 "GeomVol1002", JustWarning, message);
349 if (trials >= maxErr) { return true; }
350 }
351
352 // Checking overlaps with each 'sister' volumes
353 //
354 G4VSolid* previous = nullptr;
355 G4ThreeVector pmin_local(0.,0.,0.);
356 G4ThreeVector pmax_local(0.,0.,0.);
357
358 for (std::size_t k = 0; k < motherLog->GetNoDaughters(); ++k)
359 {
360 G4VPhysicalVolume* daughter = motherLog->GetDaughter((G4int)k);
361 if (daughter == this) { continue; }
362 G4bool check_encapsulation = true;
363
364 G4AffineTransform Td(daughter->GetRotation(), daughter->GetTranslation());
365 G4VSolid* daughterSolid = daughter->GetLogicalVolume()->GetSolid();
366 if (previous != daughterSolid)
367 {
368 daughterSolid->BoundingLimits(pmin_local, pmax_local);
369 previous = daughterSolid;
370 }
371 overlapCount = 0;
372 overlapSize = -kInfinity;
373 if (!Td.IsRotated()) { // no rotation, only translation
374 G4ThreeVector offset = Td.NetTranslation();
375 G4ThreeVector pmin(pmin_local + offset);
376 G4ThreeVector pmax(pmax_local + offset);
377 if (pmin.x() >= xmax) { continue; }
378 if (pmin.y() >= ymax) { continue; }
379 if (pmin.z() >= zmax) { continue; }
380 if (pmax.x() <= xmin) { continue; }
381 if (pmax.y() <= ymin) { continue; }
382 if (pmax.z() <= zmin) { continue; }
383 for (G4int i = 0; i < res; ++i)
384 {
385 G4ThreeVector p = points[i];
386 if (p.x() <= pmin.x()) { continue; }
387 if (p.x() >= pmax.x()) { continue; }
388 if (p.y() <= pmin.y()) { continue; }
389 if (p.y() >= pmax.y()) { continue; }
390 if (p.z() <= pmin.z()) { continue; }
391 if (p.z() >= pmax.z()) { continue; }
392 G4ThreeVector md = p - offset;
393 if (daughterSolid->Inside(md) == kInside)
394 {
395 check_encapsulation = false;
396 G4double distout = daughterSolid->DistanceToOut(md);
397 if (distout < tol) { continue; } // too small overlap
398 ++overlapCount;
399 if (distout <= overlapSize) { continue; }
400 overlapSize = distout;
401 overlapPoint = md;
402 }
403 }
404 }
405 else // transformation with rotation
406 {
407 G4ThreeVector pmin(pmin_local);
408 G4ThreeVector pmax(pmax_local);
409 G4ThreeVector dcenter = Td.TransformPoint(0.5*(pmin + pmax));
410 G4double dradius = 0.5*((pmax - pmin).mag());
411 if ((scenter - dcenter).mag2() >= (sradius + dradius)*(sradius + dradius)) { continue; }
412 if (dcenter.x() - dradius >= xmax) { continue; }
413 if (dcenter.y() - dradius >= ymax) { continue; }
414 if (dcenter.z() - dradius >= zmax) { continue; }
415 if (dcenter.x() + dradius <= xmin) { continue; }
416 if (dcenter.y() + dradius <= ymin) { continue; }
417 if (dcenter.z() + dradius <= zmin) { continue; }
418
419 G4ThreeVector pbox[8] =
420 {
421 G4ThreeVector(pmin.x(), pmin.y(), pmin.z()),
422 G4ThreeVector(pmax.x(), pmin.y(), pmin.z()),
423 G4ThreeVector(pmin.x(), pmax.y(), pmin.z()),
424 G4ThreeVector(pmax.x(), pmax.y(), pmin.z()),
425 G4ThreeVector(pmin.x(), pmin.y(), pmax.z()),
426 G4ThreeVector(pmax.x(), pmin.y(), pmax.z()),
427 G4ThreeVector(pmin.x(), pmax.y(), pmax.z()),
428 G4ThreeVector(pmax.x(), pmax.y(), pmax.z())
429 };
430 G4double dxmin = kInfinity;
431 G4double dymin = kInfinity;
432 G4double dzmin = kInfinity;
433 G4double dxmax = -kInfinity;
434 G4double dymax = -kInfinity;
435 G4double dzmax = -kInfinity;
436 for (const auto & i : pbox)
437 {
438 G4ThreeVector p = Td.TransformPoint(i);
439 dxmin = std::min(dxmin, p.x());
440 dymin = std::min(dymin, p.y());
441 dzmin = std::min(dzmin, p.z());
442 dxmax = std::max(dxmax, p.x());
443 dymax = std::max(dymax, p.y());
444 dzmax = std::max(dzmax, p.z());
445 }
446 if (dxmin >= xmax) { continue; }
447 if (dymin >= ymax) { continue; }
448 if (dzmin >= zmax) { continue; }
449 if (dxmax <= xmin) { continue; }
450 if (dymax <= ymin) { continue; }
451 if (dzmax <= zmin) { continue; }
452 for (G4int i = 0; i < res; ++i)
453 {
454 G4ThreeVector p = points[i];
455 if (p.x() >= dxmax) { continue; }
456 if (p.x() <= dxmin) { continue; }
457 if (p.y() >= dymax) { continue; }
458 if (p.y() <= dymin) { continue; }
459 if (p.z() >= dzmax) { continue; }
460 if (p.z() <= dzmin) { continue; }
461 G4ThreeVector md = Td.InverseTransformPoint(p);
462 if (daughterSolid->Inside(md) == kInside)
463 {
464 check_encapsulation = false;
465 G4double distout = daughterSolid->DistanceToOut(md);
466 if (distout < tol) { continue; } // too small overlap
467 ++overlapCount;
468 if (distout <= overlapSize) { continue; }
469 overlapSize = distout;
470 overlapPoint = md;
471 }
472 }
473 }
474
475 // Print information on overlap
476 //
477 if (overlapCount > 0)
478 {
479 ++trials;
480 retval = true;
481 std::ostringstream message;
482 message << "Overlap with volume already placed !" << G4endl
483 << " Overlap is detected for volume "
484 << GetName() << ':' << GetCopyNo()
485 << " (" << solid->GetEntityType() << ") with "
486 << daughter->GetName() << ':' << daughter->GetCopyNo()
487 << " (" << daughterSolid->GetEntityType() << ")" << G4endl
488 << " overlap at local point " << overlapPoint
489 << " by " << G4BestUnit(overlapSize, "Length")
490 << " (max of " << overlapCount << " cases)";
491 if (trials >= maxErr)
492 {
493 message << G4endl
494 << "NOTE: Reached maximum fixed number -" << maxErr
495 << "- of overlaps reports for this volume !";
496 }
497 G4Exception("G4PVPlacement::CheckOverlaps()",
498 "GeomVol1002", JustWarning, message);
499 if (trials >= maxErr) { return true; }
500 }
501 else if (check_encapsulation)
502 {
503 // Now checking that 'sister' volume is not totally included
504 // and overlapping. Generate a single point inside of
505 // the 'sister' volume and verify that the point in NOT inside
506 // the current volume
507 //
508 G4ThreeVector pSurface = daughterSolid->GetPointOnSurface();
509 G4ThreeVector normal = daughterSolid->SurfaceNormal(pSurface);
510 G4ThreeVector pInside = pSurface - normal*1.e-4; // move point to inside
511 G4ThreeVector dPoint = (daughterSolid->Inside(pInside) == kInside) ?
512 pInside : pSurface;
513
514 // Transform the generated point to the mother's coordinate system
515 // and then to current volume's coordinate system
516 //
517 G4ThreeVector mp2 = Td.TransformPoint(dPoint);
518 G4ThreeVector msi = Tm.InverseTransformPoint(mp2);
519
520 if (solid->Inside(msi) == kInside)
521 {
522 ++trials;
523 retval = true;
524 std::ostringstream message;
525 message << "Overlap with volume already placed !" << G4endl
526 << " Overlap is detected for volume "
527 << GetName() << ':' << GetCopyNo()
528 << " (" << solid->GetEntityType() << ")" << G4endl
529 << " apparently fully encapsulating volume "
530 << daughter->GetName() << ':' << daughter->GetCopyNo()
531 << " (" << daughterSolid->GetEntityType() << ")"
532 << " at the same level!";
533 if (trials >= maxErr)
534 {
535 message << G4endl
536 << "NOTE: Reached maximum fixed number -" << maxErr
537 << "- of overlaps reports for this volume !";
538 }
539 G4Exception("G4PVPlacement::CheckOverlaps()",
540 "GeomVol1002", JustWarning, message);
541 if (trials >= maxErr) { return true; }
542 }
543 }
544 }
545
546 if (verbose && trials == 0) { G4cout << "OK! " << G4endl; }
547 return retval;
548}
@ JustWarning
G4ThreadLocal T * G4GeomSplitter< T >::offset
#define G4BestUnit(a, b)
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition G4Types.hh:83
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
double z() const
double x() const
double y() const
double mag() const
G4VSolid * GetSolid() const
std::size_t GetNoDaughters() const
G4VPhysicalVolume * GetDaughter(const std::size_t i) const
const G4String & GetName() const
G4int GetCopyNo() const override
G4LogicalVolume * GetMotherLogical() const
const G4ThreeVector GetTranslation() const
virtual G4int GetCopyNo() const =0
const G4String & GetName() const
virtual EInside Inside(const G4ThreeVector &p) const =0
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const =0
virtual G4ThreeVector GetPointOnSurface() const
Definition G4VSolid.cc:151
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
virtual void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition G4VSolid.cc:691
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
virtual G4GeometryType GetEntityType() const =0
@ kInside
Definition geomdefs.hh:70
@ kOutside
Definition geomdefs.hh:68
@ kSurface
Definition geomdefs.hh:69

Referenced by G4PVPlacement(), G4PVPlacement(), G4PVPlacement(), and G4PVPlacement().

◆ GetCopyNo()

G4int G4PVPlacement::GetCopyNo ( ) const
inlineoverridevirtual

Returns/sets the copy number associated to the volume.

Implements G4VPhysicalVolume.

Definition at line 158 of file G4PVPlacement.hh.

158{ return fcopyNo; }

Referenced by CheckOverlaps().

◆ GetParameterisation()

G4VPVParameterisation * G4PVPlacement::GetParameterisation ( ) const
overridevirtual

Returns a pointer to the replicas parameterisation object/algorithm (able to compute dimensions and transformations of replicas), or a null pointer if not applicable.

Implements G4VPhysicalVolume.

Definition at line 198 of file G4PVPlacement.cc.

199{
200 return nullptr;
201}

◆ GetRegularStructureId()

G4int G4PVPlacement::GetRegularStructureId ( ) const
overridevirtual

Returns non-zero code in case the underlying volume structure is regular, voxel-like. The value is an identifier for the structure type. If non-zero the volume is a candidate for specialised navigation such as 'nearest neighbour' directly on volumes.

Implements G4VPhysicalVolume.

Definition at line 227 of file G4PVPlacement.cc.

228{
229 return 0;
230}

◆ GetReplicationData()

void G4PVPlacement::GetReplicationData ( EAxis & axis,
G4int & nReplicas,
G4double & width,
G4double & offset,
G4bool & consuming ) const
overridevirtual

Returns the replication information. No-op for non replicated volumes.

Parameters
[in,out]axisThe axis of replication/parameterisation.
[in,out]nReplicasThe number of replicated/parameterised objects.
[in,out]widthThe width of replicated object.
[in,out]offsetThe optional offset distance from mother's border.
[in,out]consumingFlag of replica characterisation (always true for pure replicas).

Implements G4VPhysicalVolume.

Definition at line 206 of file G4PVPlacement.cc.

208{
209 // No-operations
210}

◆ IsMany()

G4bool G4PVPlacement::IsMany ( ) const
overridevirtual

Stub methods, unused for placed volumes.

Implements G4VPhysicalVolume.

Definition at line 166 of file G4PVPlacement.cc.

167{
168 return fmany;
169}

◆ IsParameterised()

G4bool G4PVPlacement::IsParameterised ( ) const
overridevirtual

Returns true if the volume is parameterised (single object instance represents many real parameterised volumes), else false.

Implements G4VPhysicalVolume.

Definition at line 190 of file G4PVPlacement.cc.

191{
192 return false;
193}

◆ IsRegularStructure()

G4bool G4PVPlacement::IsRegularStructure ( ) const
overridevirtual

Used only for specialised repeated volumes. Always false with Id 0.

Implements G4VPhysicalVolume.

Definition at line 217 of file G4PVPlacement.cc.

218{
219 return false;
220}

◆ IsReplicated()

G4bool G4PVPlacement::IsReplicated ( ) const
overridevirtual

Returns true if the volume is replicated (single object instance represents many real volumes), else false.

Implements G4VPhysicalVolume.

Definition at line 182 of file G4PVPlacement.cc.

183{
184 return false;
185}

◆ operator=()

G4PVPlacement & G4PVPlacement::operator= ( const G4PVPlacement & )
delete

◆ SetCopyNo()

void G4PVPlacement::SetCopyNo ( G4int CopyNo)
overridevirtual

Implements G4VPhysicalVolume.

Definition at line 174 of file G4PVPlacement.cc.

175{
176 fcopyNo = newCopyNo;
177}

◆ VolumeType()

EVolume G4PVPlacement::VolumeType ( ) const
overridevirtual

Returns the volume type characterisation.

Implements G4VPhysicalVolume.

Definition at line 237 of file G4PVPlacement.cc.

238{
239 return kNormal;
240}
@ kNormal
Definition geomdefs.hh:84

The documentation for this class was generated from the following files: