45 const G4int nReplicas,
49 pMotherPhysical ? pMotherPhysical->GetLogicalVolume() : nullptr ),
63 if ((pMotherPhysical !=
nullptr) && (pMotherPhysical->
IsParameterised()))
65 std::ostringstream
message, hint;
66 message <<
"A parameterised volume is being placed" <<
G4endl
67 <<
"inside another parameterised volume !";
68 hint <<
"To make sure that no overlaps are generated," << G4endl
69 <<
"you should verify the mother replicated shapes" << G4endl
70 <<
"are of the same type and dimensions." << G4endl
71 <<
" Mother physical volume: " << pMotherPhysical->
GetName() << G4endl
72 <<
" Parameterised volume: " << pName << G4endl
73 <<
" (To switch this warning off, compile with G4_NO_VERBOSE)";
74 G4Exception(
"G4PVParameterised::G4PVParameterised()",
"GeomVol1002",
88 const G4int nReplicas,
91 :
G4PVReplica(pName, nReplicas, pAxis, pLogical, pMotherLogical ),
177 if (res<=0) {
return false; }
181 G4VSolid *solidA =
nullptr, *solidB =
nullptr;
184 std::vector<G4ThreeVector> points;
188 G4cout <<
"Checking overlaps for parameterised volume "
207 for (
auto n=0;
n<res; ++
n)
218 ++trials; retval =
true;
220 message <<
"Overlap with mother volume !" <<
G4endl
221 <<
" Overlap is detected for volume "
223 <<
" with its mother volume "
225 <<
" at mother local point " << mp <<
", "
226 <<
"overlapping by at least: "
231 <<
"NOTE: Reached maximum fixed number -" << maxErr
232 <<
"- of overlaps reports for this volume !";
236 if (trials>=maxErr) {
return true; }
239 points.push_back(mp);
254 for (
auto pos=points.cbegin();
pos!=points.cend(); ++
pos)
260 if (solidB->Inside(md)==
kInside)
262 G4double distout = solidB->DistanceToOut(md);
265 ++trials; retval =
true;
267 message <<
"Overlap within parameterised volumes !" <<
G4endl
268 <<
" Overlap is detected for volume "
270 <<
" with parameterised volume instance: " << j
272 <<
" at local point " << md <<
", "
273 <<
"overlapping by at least: "
275 <<
", related to volume instance: " << j <<
".";
279 <<
"NOTE: Reached maximum fixed number -" << maxErr
280 <<
"- of overlaps reports for this volume !";
284 if (trials>=maxErr) {
return true; }