33#include "G4LogicalVolume.hh"
34#include "G4Material.hh"
35#include "G4PVDivision.hh"
36#include "G4PVParameterised.hh"
37#include "G4PVPlacement.hh"
38#include "G4PVReplica.hh"
39#include "G4ReflectionFactory.hh"
40#include "G4ReplicatedSlice.hh"
41#include "G4VDivisionParameterisation.hh"
42#include "G4VPhysicalVolume.hh"
49 BaseVGM::VPlacement(volume, motherVolume),
66 :
VGM::IPlacement(rhs),
BaseVGM::VPlacement(rhs)
151 if (
dynamic_cast<G4PVParameterised*
>(fPhysicalVolume) &&
152 (!
dynamic_cast<G4PVDivision*
>(fPhysicalVolume)))
156 if (fPhysicalVolume->IsParameterised() || fPhysicalVolume->IsReplicated())
166 return fPhysicalVolume->GetName();
173 return fPhysicalVolume->GetCopyNo();
181 fPhysicalVolume->GetObjectTranslation());
186 double& width,
double& offset,
double& halfGap)
const
192 EAxis g4Axis = kUndefined;
193 if (
dynamic_cast<G4PVDivision*
>(fPhysicalVolume) ||
194 dynamic_cast<G4ReplicatedSlice*
>(fPhysicalVolume)) {
197 G4VDivisionParameterisation* param =
198 dynamic_cast<G4VDivisionParameterisation*
>(
199 fPhysicalVolume->GetParameterisation());
202 std::cerr <<
" Geant4GM::Placement::MultiplePlacementData: "
204 std::cerr <<
" Incorrect parameterisation type for "
205 "G4PVDivision/G4ReplicatedSlice"
207 std::cerr <<
" (G4VDivisionParameterisation type was expected.)"
209 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
213 g4Axis = param->GetAxis();
214 nofItems = param->GetNoDiv();
215 width = param->GetWidth();
216 offset = param->GetOffset();
217 halfGap = param->GetHalfGap();
219 else if (
dynamic_cast<G4PVReplica*
>(fPhysicalVolume)) {
223 fPhysicalVolume->GetReplicationData(
224 g4Axis, nofItems, width, offset0, consuming);
233 if (g4Axis == kRho) {
235 xlo =
dynamic_cast<VGM::ITubs*
>(solid)->InnerRadius();
238 if (g4Axis == kPhi) {
244 xlo =
dynamic_cast<VGM::ICons*
>(solid)->StartPhi();
247 xlo =
dynamic_cast<VGM::ITubs*
>(solid)->StartPhi();
256 offset = offset0 - xlo;
258 axis = GetAxis(g4Axis);
270 std::vector<VGM::Transform>& transforms,
271 std::vector<VGM::IVolume*>& volumes)
const
276 G4PVParameterised* paraPhysicalVolume =
277 dynamic_cast<G4PVParameterised*
>(fPhysicalVolume);
278 if (!paraPhysicalVolume) {
279 std::cerr <<
" Geant4GM::Placement::ParameterisedPlacementData: "
281 std::cerr <<
" Physical volume is not parameterised..." << std::endl;
282 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
288 GetParamVolumes(paraPhysicalVolume->GetLogicalVolume());
290 G4VPVParameterisation* pPara = paraPhysicalVolume->GetParameterisation();
291 for (
int i = 0; i < paraPhysicalVolume->GetMultiplicity(); ++i) {
293 pPara->ComputeTransformation(i, paraPhysicalVolume);
294 transforms.emplace_back(
296 paraPhysicalVolume->GetObjectTranslation()));
300 volumes.emplace_back(paramVolume);
virtual VGM::ISolid * Solid() const
Return the associated solid.
static double AxisUnit(VGM::Axis axis)
Convert CLHEP default unit for given axis type in VGM units.
static PlacementMap * Instance()
void AddPlacement(VGM::IPlacement *, G4VPhysicalVolume *)
VGM implementation for Geant4 positions of volumes.
virtual VGM::Transform Transformation() const
Return the 3D transformation (if simple placement)
virtual VGM::PlacementType Type() const
Return the type of this placement.
static EAxis GetAxis(VGM::Axis axis)
virtual bool MultiplePlacementData(VGM::Axis &axis, int &nofItems, double &width, double &offset, double &halfGap) const
Fill the multiple placement data if relevant and return true; return false if not multiple placement.
virtual bool ParameterisedPlacementData(std::vector< VGM::Transform > &transforms, std::vector< VGM::IVolume * > &volumes) const
Fill the parameterised placement data if relevant and return true; return false if not parameterised ...
virtual int CopyNo() const
Return the copy number of this placement.
virtual std::string Name() const
Return the name of this placement.
static VolumeMap * Instance()
G4LogicalVolume * GetVolume(VGM::IVolume *iVolume) const
VGM implementation for Geant4 volume.
The VGM interface to cons solids.
The VGM interface to polycone solids.
The VGM interface to polyhedra solids.
The VGM interface to solids.
virtual SolidType Type() const =0
Return the type of this solid.
The VGM interface to tubs solids.
The VGM interface to volumes.
VGM::Transform Transform(const CLHEP::HepRotation &rotation, const CLHEP::Hep3Vector &translation)
std::vector< double > Transform