66const 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());
743 if (scale(0,0)*scale(1,1)*scale(2,2) < 0.)
754 return fReflectedLVMap;
762 fConstituentLVMap.~map();
763 fReflectedLVMap.~map();
768void G4ReflectionFactory::PrintConstituentLVMap()
773 LogicalVolumesMapIterator it;
774 for (it = fConstituentLVMap.begin(); it != fConstituentLVMap.end(); it++)
776 G4cout <<
"lv: " << (*it).first <<
" lv_refl: " << (*it).second <<
G4endl;
783void 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;
std::map< G4LogicalVolume *, G4LogicalVolume *, std::less< G4LogicalVolume * > > G4ReflectedVolumesMap
std::pair< G4VPhysicalVolume *, G4VPhysicalVolume * > G4PhysicalVolumesPair
G4DLLIMPORT std::ostream G4cout
G4double GetSurfaceTolerance() const
static G4GeometryTolerance * GetInstance()
G4VSolid * GetSolid() const
const G4VisAttributes * GetVisAttributes() const
G4int GetNoDaughters() const
G4VSensitiveDetector * GetSensitiveDetector() const
void SetRegion(G4Region *reg)
G4bool IsRootRegion() const
G4Region * GetRegion() const
G4double GetBiasWeight() const
G4Material * GetMaterial() const
G4VPhysicalVolume * GetDaughter(const G4int i) const
G4UserLimits * GetUserLimits() const
G4FieldManager * GetFieldManager() const
void SetVisAttributes(const G4VisAttributes *pVA)
void SetBiasWeight(G4double w)
G4int GetVerboseLevel() const
const G4String & GetVolumesNameExtension() const
G4bool IsReflected(G4LogicalVolume *lv) const
G4PhysicalVolumesPair Divide(const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, EAxis axis, G4int nofDivisions, G4double width, G4double offset)
G4LogicalVolume * GetReflectedLV(G4LogicalVolume *lv) const
static G4ReflectionFactory * Instance()
void SetVerboseLevel(G4int verboseLevel)
virtual ~G4ReflectionFactory()
G4double GetScalePrecision() const
G4PhysicalVolumesPair Place(const G4Transform3D &transform3D, const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, G4bool isMany, G4int copyNo, G4bool surfCheck=false)
G4bool IsConstituent(G4LogicalVolume *lv) const
void SetScalePrecision(G4double scaleValue)
G4PhysicalVolumesPair Replicate(const G4String &name, G4LogicalVolume *LV, G4LogicalVolume *motherLV, EAxis axis, G4int nofReplicas, G4double width, G4double offset=0)
const G4ReflectedVolumesMap & GetReflectedVolumesMap() const
G4LogicalVolume * GetConstituentLV(G4LogicalVolume *reflLV) const
void SetVolumesNameExtension(const G4String &nameExtension)
void AddRootLogicalVolume(G4LogicalVolume *lv)
static G4VPVDivisionFactory * Instance()
virtual G4VPhysicalVolume * CreatePVDivision(const G4String &pName, G4LogicalVolume *pLogical, G4LogicalVolume *pMother, const EAxis pAxis, const G4int nReplicas, const G4double width, const G4double offset)=0
virtual G4bool IsReplicated() const =0
G4LogicalVolume * GetLogicalVolume() const
G4RotationMatrix GetObjectRotationValue() const
virtual void GetReplicationData(EAxis &axis, G4int &nReplicas, G4double &width, G4double &offset, G4bool &consuming) const =0
virtual G4int GetCopyNo() const =0
const G4String & GetName() const
virtual G4VPVParameterisation * GetParameterisation() const =0
virtual G4bool IsMany() const =0
G4ThreeVector GetObjectTranslation() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)