66 const G4String G4ReflectionFactory::fDefaultNameExtension =
"_refl";
85 fNameExtension(fDefaultNameExtension)
129 G4cout <<
"Place " << name <<
" lv " << LV <<
" "
152 if (! IsReflection(scale))
159 motherLV, isMany, copyNo, surfCheck);
168 ReflectLV(LV, surfCheck),
name, reflMotherLV,
169 isMany, copyNo, surfCheck);
183 =
new G4PVPlacement(pureTransform3D, ReflectLV(LV, surfCheck), name,
184 motherLV, isMany, copyNo, surfCheck);
194 LV, name, reflMotherLV, isMany, copyNo, surfCheck);
220 G4cout <<
"Replicate " << name <<
" lv " << LV <<
" "
225 =
new G4PVReplica(name, LV, motherLV, axis, nofReplicas, width, offset);
233 pv2 =
new G4PVReplica(name, ReflectLV(LV), reflMotherLV,
234 axis, nofReplicas, width, offset);
259 G4cout <<
"Divide " << name <<
" lv " << LV <<
" "
275 axis, nofDivisions, width, offset);
300 G4cout <<
"Divide " << name <<
" lv " << LV <<
" "
316 axis, nofDivisions, offset);
341 G4cout <<
"Divide " << name <<
" lv " << LV <<
" "
348 -> CreatePVDivision(name, LV, motherLV, axis, width, offset);
357 axis, width, offset);
384 refLV = CreateReflectedLV(LV);
388 ReflectDaughters(LV, refLV, surfCheck);
411 if (fReflectedLVMap.find(LV) != fReflectedLVMap.end())
413 std::ostringstream message;
414 message <<
"Invalid reflection for volume: "
416 <<
"Cannot be applied to a volume already reflected !";
417 G4Exception(
"G4ReflectionFactory::CreateReflectedLV()",
428 LV->
GetName() + fNameExtension,
439 fConstituentLVMap[LV] = refLV;
440 fReflectedLVMap[refLV] = LV;
456 G4cout <<
"G4ReflectionFactory::ReflectDaughters(): "
466 ReflectPVPlacement(dPV, refLV, surfCheck);
470 ReflectPVReplica(dPV, refLV);
475 ReflectPVDivision(dPV, refLV);
479 ReflectPVParameterised(dPV, refLV, surfCheck);
499 dt = fScale * (dt * fScale.
inverse());
519 refDLV = CreateReflectedLV(dLV);
523 ReflectDaughters(dLV, refDLV, surfCheck);
584 refDLV = CreateReflectedLV(dLV);
588 ReflectDaughters(dLV, refDLV);
594 axis, nofReplicas, width, offset);
604 axis, nofReplicas, width, offset);
643 refDLV = CreateReflectedLV(dLV);
647 ReflectDaughters(dLV, refDLV);
675 std::ostringstream message;
676 message <<
"Not yet implemented. Volume: " << dPV->
GetName() << G4endl
677 <<
"Reflection of parameterised volumes is not yet implemented.";
678 G4Exception(
"G4ReflectionFactory::ReflectPVParameterised()",
691 LogicalVolumesMapIterator it = fReflectedLVMap.find(reflLV);
693 if (it == fReflectedLVMap.end())
return 0;
707 LogicalVolumesMapIterator it = fConstituentLVMap.find(lv);
709 if (it == fConstituentLVMap.end())
return 0;
722 return (fConstituentLVMap.find(lv) != fConstituentLVMap.end());
733 return (fReflectedLVMap.find(lv) != fReflectedLVMap.end());
754 return fReflectedLVMap;
762 fConstituentLVMap.~map();
763 fReflectedLVMap.~map();
768 void G4ReflectionFactory::PrintConstituentLVMap()
773 LogicalVolumesMapIterator it;
774 for (it = fConstituentLVMap.begin(); it != fConstituentLVMap.end(); it++)
776 G4cout <<
"lv: " << (*it).first <<
" lv_refl: " << (*it).second <<
G4endl;
783 void G4ReflectionFactory::CheckScale(
const G4Scale3D& scale)
const
789 if (!IsReflection(scale))
return;
792 for (
G4int i=0; i<4; i++)
793 for (
G4int j=0; j<4; j++)
794 diff += std::abs(
scale(i,j) - fScale(i,j));
796 if (diff > fScalePrecision)
798 std::ostringstream message;
799 message <<
"Unexpected scale in input !" << G4endl
800 <<
" Difference: " << diff;
815 if (!divisionFactory)
817 std::ostringstream message;
818 message <<
"A concrete G4PVDivisionFactory instantiated is required !"
820 <<
" It has been requested to reflect divided volumes."
822 <<
" In this case, it is required to instantiate a concrete"
824 <<
" factory G4PVDivisionFactory in your program -before-"
826 <<
" executing the reflection !";
827 G4Exception(
"G4ReflectionFactory::GetPVDivisionFactory()",
831 return divisionFactory;
838 fScalePrecision = scaleValue;
845 return fScalePrecision;
852 fVerboseLevel = verboseLevel;
859 return fVerboseLevel;
866 fNameExtension = nameExtension;
873 return fNameExtension;