60 ,
G4int requestedDepth
64 :
G4VModel (modelTransformation, pMP)
67 , fRequestedDepth (requestedDepth)
68 , fUseFullExtent (useFullExtent)
72 , fpCurrentMaterial (0)
73 , fpCurrentTransform (0)
75 , fCurtailDescent (
false)
77 , fClippingMode (subtraction)
79 fType =
"G4PhysicalVolumeModel";
94 fGlobalDescription =
"G4PhysicalVolumeModel " + fGlobalTag;
98 fTopPVName = fpTopPV -> GetName ();
99 fTopPVCopyNo = fpTopPV -> GetCopyNo ();
100 std::ostringstream o;
101 o << fpTopPV -> GetCopyNo ();
102 fGlobalTag = fpTopPV -> GetName () +
"." + o.str();
103 fGlobalDescription =
"G4PhysicalVolumeModel " + fGlobalTag;
105 fpCurrentPV = fpTopPV;
106 if (fpCurrentPV) fpCurrentLV = fpCurrentPV->GetLogicalVolume();
107 if (fpCurrentLV) fpCurrentMaterial = fpCurrentLV->GetMaterial();
108 fpCurrentTransform =
const_cast<G4Transform3D*
>(&modelTransformation);
162 (
"G4PhysicalVolumeModel::DescribeYourselfTo",
166 (
"G4PhysicalVolumeModel::DescribeYourselfTo",
177 startingTransformation,
188 (
"G4PhysicalVolumeModel::DescribeYourselfTo",
191 "Path at start of modeling not equal to base path. Something badly" 192 "\nwrong. Please contact visualisation coordinator.");
202 std::ostringstream o;
207 return "WARNING: NO CURRENT VOLUME - global tag is " +
fGlobalTag;
218 G4int requestedDepth,
235 if (!(pVPV -> IsReplicated ())) {
237 pSol = pLV -> GetSolid ();
238 pMaterial = pLV -> GetMaterial ();
240 theAT, sceneHandler);
249 pVPV -> GetReplicationData (axis, nReplicas, width, offset, consuming);
253 for (
int n = 0;
n < nReplicas;
n++) {
254 pSol = pP -> ComputeSolid (
n, pVPV);
255 pP -> ComputeTransformation (
n, pVPV);
256 pSol -> ComputeDimensions (pP,
n, pVPV);
257 pVPV -> SetCopyNo (
n);
262 pMaterial = pP -> ComputeMaterial (
n, pVPV, &parentTouchable);
264 theAT, sceneHandler);
289 pSol = pLV -> GetSolid ();
290 pMaterial = pLV -> GetMaterial ();
291 G4ThreeVector originalTranslation = pVPV -> GetTranslation ();
293 G4double originalRMin = 0., originalRMax = 0.;
295 originalRMin = ((
G4Tubs*)pSol)->GetInnerRadius();
296 originalRMax = ((
G4Tubs*)pSol)->GetOuterRadius();
298 G4bool visualisable =
true;
299 for (
int n = 0;
n < nReplicas;
n++) {
306 translation =
G4ThreeVector (-width*(nReplicas-1)*0.5+
n*width,0,0);
309 translation =
G4ThreeVector (0,-width*(nReplicas-1)*0.5+
n*width,0);
312 translation =
G4ThreeVector (0,0,-width*(nReplicas-1)*0.5+
n*width);
316 ((
G4Tubs*)pSol)->SetInnerRadius(width*
n+offset);
317 ((
G4Tubs*)pSol)->SetOuterRadius(width*(
n+1)+offset);
321 "G4PhysicalVolumeModel::VisitGeometryAndGetVisReps: WARNING:" 322 "\n built-in replicated volumes replicated in radius for " 324 "-type\n solids (your solid \"" 326 "\") are not visualisable." 328 visualisable =
false;
332 rotation.
rotateZ (-(offset+(
n+0.5)*width));
335 pRotation = &rotation;
338 pVPV -> SetTranslation (translation);
339 pVPV -> SetRotation (pRotation);
340 pVPV -> SetCopyNo (
n);
343 theAT, sceneHandler);
347 pVPV -> SetTranslation (originalTranslation);
348 pVPV -> SetRotation (pOriginalRotation);
350 ((
G4Tubs*)pSol)->SetInnerRadius(originalRMin);
351 ((
G4Tubs*)pSol)->SetOuterRadius(originalRMax);
359 G4int requestedDepth,
372 const G4ThreeVector& translation = pVPV -> GetTranslation ();
389 G4bool visAttsCreated =
false;
392 visAttsCreated =
true;
397 G4bool thisToBeDrawn =
true;
406 G4bool copyForVAM =
false;
411 const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
413 std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator
415 for (iModifier = vams.begin();
416 iModifier != vams.end();
419 iModifier->GetPVNameCopyNoPath();
424 std::vector<G4PhysicalVolumeNodeID>::const_iterator iPVNodeId;
425 for (iVAMNameCopyNo = vamPath.begin(), iPVNodeId =
fFullPVPath.begin();
426 iVAMNameCopyNo != vamPath.end();
427 ++iVAMNameCopyNo, ++iPVNodeId) {
435 iVAMNameCopyNo->GetName() ==
436 iPVNodeId->GetPhysicalVolume()->GetName() &&
437 iVAMNameCopyNo->GetCopyNo() ==
438 iPVNodeId->GetPhysicalVolume()->GetCopyNo()
443 if (iVAMNameCopyNo == vamPath.end()) {
447 pVisAttribs = pModifiedVisAtts;
451 switch (iModifier->GetVisAttributesSignifier()) {
507 if (cullingInvisible) {
509 if (!markedVisible) thisToBeDrawn =
false;
512 if (cullingLowDensity) {
514 if (density < densityCut) thisToBeDrawn =
false;
518 if (
fAbort) thisToBeDrawn =
false;
541 explodeFactor * oldTranslation.
dy(),
542 explodeFactor * oldTranslation.
dz());
543 theNewAT = centering * newTranslation * oldRotation * oldScale;
555 G4bool daughtersToBeDrawn =
true;
557 if (!nDaughters) daughtersToBeDrawn =
false;
559 else if (requestedDepth == 0) daughtersToBeDrawn =
false;
561 else if (
fAbort) daughtersToBeDrawn =
false;
586 if (cullingInvisible) {
588 if (daughtersInvisible) daughtersToBeDrawn =
false;
591 if (cullingCovered) {
593 if (surfaceDrawing) {
597 if (opaque) daughtersToBeDrawn =
false;
606 delete pModifiedVisAtts;
607 pVisAttribs = pUnmodifiedVisAtts;
612 if (visAttsCreated)
delete pVisAttribs;
614 if (daughtersToBeDrawn) {
615 for (
G4int iDaughter = 0; iDaughter < nDaughters; iDaughter++) {
621 (pDaughterVPV, requestedDepth - 1, theNewAT, sceneHandler);
668 "WARNING: G4PhysicalVolumeModel::DescribeSolid: solid\n \"" 670 "\" has no polyhedron. Cannot by clipped." 696 (
"sectioned_solid", pSol, pSectionSolid, theAT.
inverse());
701 (
"cutaway_solid", pSol, pCutawaySolid, theAT.
inverse());
705 if (tmpResultant) resultant = *tmpResultant;
709 "WARNING: G4PhysicalVolumeModel::DescribeSolid: resultant polyhedron for" 710 "\n solid \"" << pSol->
GetName() <<
711 "\" not defined due to error during Boolean processing." 712 "\n Original will be drawn in red." 717 delete resultantSolid;
734 size_t nWorlds = transportationManager->
GetNoWorlds();
738 std::vector<G4VPhysicalVolume*>::iterator iterWorld =
740 for (
size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
754 if (foundVolume !=
fpTopPV && warn) {
756 "G4PhysicalVolumeModel::Validate(): A volume of the same name and" 759 <<
") still exists and is being used." 760 "\n But it is not the same volume you originally specified" 761 "\n in /vis/scene/add/." 769 if (found)
return true;
773 "G4PhysicalVolumeModel::Validate(): No volume of name and" 786 std::map<G4String,G4AttDef>* store
790 G4AttDef(
"PVPath",
"Physical Volume Path",
"Physics",
"",
"G4String");
792 G4AttDef(
"LVol",
"Logical Volume",
"Physics",
"",
"G4String");
794 G4AttDef(
"Solid",
"Solid Name",
"Physics",
"",
"G4String");
796 G4AttDef(
"EType",
"Entity Type",
"Physics",
"",
"G4String");
798 G4AttDef(
"DmpSol",
"Dump of Solid properties",
"Physics",
"",
"G4String");
799 (*store)[
"LocalTrans"] =
800 G4AttDef(
"LocalTrans",
"Local transformation of volume",
"Physics",
"",
"G4String");
801 (*store)[
"GlobalTrans"] =
802 G4AttDef(
"GlobalTrans",
"Global transformation of volume",
"Physics",
"",
"G4String");
803 (*store)[
"Material"] =
804 G4AttDef(
"Material",
"Material Name",
"Physics",
"",
"G4String");
805 (*store)[
"Density"] =
806 G4AttDef(
"Density",
"Material Density",
"Physics",
"G4BestUnit",
"G4double");
808 G4AttDef(
"State",
"Material State (enum undefined,solid,liquid,gas)",
"Physics",
"",
"G4String");
810 G4AttDef(
"Radlen",
"Material Radiation Length",
"Physics",
"G4BestUnit",
"G4double");
812 G4AttDef(
"Region",
"Cuts Region",
"Physics",
"",
"G4String");
813 (*store)[
"RootRegion"] =
814 G4AttDef(
"RootRegion",
"Root Region (0/1 = false/true)",
"Physics",
"",
"G4bool");
833 o << setw(w) << t.
xx() << setw(w) << t.
xy() << setw(w) << t.
xz() << setw(w) << t.
dx() << endl;
834 o << setw(w) << t.
yx() << setw(w) << t.
yy() << setw(w) << t.
yz() << setw(w) << t.
dy() << endl;
835 o << setw(w) << t.
zx() << setw(w) << t.
zy() << setw(w) << t.
zz() << setw(w) << t.
dz() << endl;
838 o <<
"= translation:" << endl;
839 o << setw(w) << tl.
dx() << setw(w) << tl.
dy() << setw(w) << tl.
dz() << endl;
842 o <<
"* rotation:" << endl;
843 o << setw(w) << r.
xx() << setw(w) << r.
xy() << setw(w) << r.
xz() << endl;
844 o << setw(w) << r.
yx() << setw(w) << r.
yy() << setw(w) << r.
yz() << endl;
845 o << setw(w) << r.
zx() << setw(w) << r.
zy() << setw(w) << r.
zz() << endl;
848 o <<
"* scale:" << endl;
849 o << setw(w) << sc.
xx() << setw(w) << sc.
yy() << setw(w) << sc.
zz() << endl;
852 o <<
"Transformed axes:" << endl;
853 o <<
"x': " << r *
G4Vector3D(1., 0., 0.) << endl;
854 o <<
"y': " << r *
G4Vector3D(0., 1., 0.) << endl;
855 o <<
"z': " << r *
G4Vector3D(0., 0., 1.) << endl;
862 std::vector<G4AttValue>* values =
new std::vector<G4AttValue>;
863 std::ostringstream oss;
865 oss <<
fFullPVPath[i].GetPhysicalVolume()->GetName()
872 (
"G4PhysicalVolumeModel::CreateCurrentAttValues",
875 "Current logical volume not defined.");
879 values->push_back(
G4AttValue(
"PVPath", oss.str(),
""));
884 oss.str(
""); oss <<
'\n' << *pSol;
885 values->push_back(
G4AttValue(
"DmpSol", oss.str(),
""));
888 oss.str(
""); oss <<
'\n' <<
G4Transform3D(localRotation,localTranslation);
889 values->push_back(
G4AttValue(
"LocalTrans", oss.str(),
""));
891 values->push_back(
G4AttValue(
"GlobalTrans", oss.str(),
""));
893 values->push_back(
G4AttValue(
"Material", matName,
""));
897 oss.str(
""); oss << matState;
898 values->push_back(
G4AttValue(
"State", oss.str(),
""));
903 values->push_back(
G4AttValue(
"Region", regionName,
""));
905 values->push_back(
G4AttValue(
"RootRegion", oss.str(),
""));
909 G4bool G4PhysicalVolumeModel::G4PhysicalVolumeNodeID::operator<
912 if (fpPV <
right.fpPV)
return true;
913 if (fpPV ==
right.fpPV) {
914 if (fCopyNo <
right.fCopyNo)
return true;
915 if (fCopyNo ==
right.fCopyNo)
916 return fNonCulledDepth <
right.fNonCulledDepth;
921 std::ostream&
operator<<
927 <<
':' << node.GetCopyNo()
928 <<
'[' << node.GetNonCulledDepth() <<
']' 929 <<
':' << node.GetTransform();
930 if (!node.GetDrawn()) os <<
" Not ";
939 (
const std::vector<G4PhysicalVolumeNodeID>& fullPVPath):
946 G4Exception(
"G4PhysicalVolumeModelTouchable::GetTranslation",
949 "Index out of range. Asking for non-existent depth");
952 tempTranslation =
fFullPVPath[i].GetTransform().getTranslation();
953 return tempTranslation;
960 G4Exception(
"G4PhysicalVolumeModelTouchable::GetRotation",
963 "Index out of range. Asking for non-existent depth");
966 tempRotation =
fFullPVPath[i].GetTransform().getRotation();
967 return &tempRotation;
974 G4Exception(
"G4PhysicalVolumeModelTouchable::GetVolume",
977 "Index out of range. Asking for non-existent depth");
986 G4Exception(
"G4PhysicalVolumeModelTouchable::GetSolid",
989 "Index out of range. Asking for non-existent depth");
991 return fFullPVPath[i].GetPhysicalVolume()->GetLogicalVolume()->GetSolid();
998 G4Exception(
"G4PhysicalVolumeModelTouchable::GetReplicaNumber",
1001 "Index out of range. Asking for non-existent depth");
virtual void PostAddSolid()=0
const G4VisExtent & GetExtent() const
ForcedDrawingStyle GetForcedDrawingStyle() const
void SetColour(const G4Colour &)
G4bool IsForceAuxEdgeVisible() const
void SetForceWireframe(G4bool)
G4String GetCurrentDescription() const
G4bool IsDensityCulling() const
CLHEP::Hep3Vector G4ThreeVector
G4int GetNoDaughters() const
G4VSolid * GetSolid(G4int depth) const
std::vector< G4VPhysicalVolume * >::iterator GetWorldsIterator()
G4int GetReplicaNumber(G4int depth) const
G4bool IsForceDrawingStyle() const
void SetLineStyle(LineStyle)
void SetLineWidth(G4double)
void SetVisibility(G4bool)
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4double GetAlpha() const
std::vector< G4AttValue > * CreateCurrentAttValues() const
virtual void BeginPrimitives(const G4Transform3D &objectTransformation=G4Transform3D())=0
G4double GetDensity() const
DrawingStyle GetDrawingStyle() const
HepGeom::Vector3D< G4double > G4Vector3D
G4bool Validate(G4bool warn)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
ClippingMode fClippingMode
size_t GetNoWorlds() const
G4Transform3D * fpCurrentTransform
void SetForceSolid(G4bool)
virtual G4GeometryType GetEntityType() const =0
void SetModelingParameters(const G4ModelingParameters *)
G4VPhysicalVolume * fpCurrentPV
virtual G4Polyhedron * GetPolyhedron() const
G4int GetNoOfSides() const
virtual ~G4PhysicalVolumeModel()
virtual void AddPrimitive(const G4Polyline &)=0
const G4VisAttributes * GetDefaultVisAttributes() const
std::vector< G4PhysicalVolumeNodeID > fFullPVPath
G4VPhysicalVolume * GetVolume(G4int depth) const
G4VSolid * GetCutawaySolid() const
G4bool IsDaughtersInvisible() const
G4VPhysicalVolume * GetFoundVolume() const
G4bool IsCullingInvisible() const
const G4Point3D & GetCentre() const
G4GLOB_DLL std::ostream G4cout
std::vector< G4PhysicalVolumeNodeID > fBaseFullPVPath
const G4String & GetName() const
const G4VisAttributes * GetVisAttributes() const
G4bool IsRootRegion() const
friend std::ostream & operator<<(std::ostream &os, const G4VModel &)
G4Material * fpCurrentMaterial
G4LogicalVolume * fpCurrentLV
const G4ModelingParameters * fpMP
G4double GetExplodeFactor() const
virtual void DescribeSolid(const G4Transform3D &theAT, G4VSolid *pSol, const G4VisAttributes *pVisAttribs, G4VGraphicsScene &sceneHandler)
void SetForceAuxEdgeVisible(G4bool)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void SetVisAttributes(const G4VisAttributes *)
const G4String & GetName() const
static G4TransportationManager * GetTransportationManager()
const std::vector< VisAttributesModifier > & GetVisAttributesModifiers() const
G4VPhysicalVolume * fpTopPV
G4VSolid * fpClippingSolid
const G4String & GetName() const
G4PhysicalVolumeModelTouchable(const std::vector< G4PhysicalVolumeNodeID > &fullPVPath)
std::vector< PVNameCopyNo > PVNameCopyNoPath
G4double GetRadius() const
G4bool IsCullingCovered() const
virtual void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &visAttribs)=0
virtual G4int GetCopyNo() const =0
G4bool IsForceLineSegmentsPerCircle() const
G4Region * GetRegion() const
const G4Point3D & GetExplodeCentre() const
HepRotation & rotateZ(double delta)
G4VSolid * GetSectionSolid() const
G4PhysicalVolumeModel(G4VPhysicalVolume *=0, G4int requestedDepth=UNLIMITED, const G4Transform3D &modelTransformation=G4Transform3D(), const G4ModelingParameters *=0, G4bool useFullExtent=false)
G4RotationMatrix GetObjectRotationValue() const
virtual void EndPrimitives()=0
static void SetNumberOfRotationSteps(G4int n)
std::map< G4String, G4AttDef > * GetInstance(const G4String &storeKey, G4bool &isNew)
std::vector< G4PhysicalVolumeNodeID > fDrawnPVPath
void VisitGeometryAndGetVisReps(G4VPhysicalVolume *, G4int requestedDepth, const G4Transform3D &, G4VGraphicsScene &)
void SetDefaultVisAttributes(const G4VisAttributes *pDefaultVisAttributes)
const G4ThreeVector & GetTranslation() const
const G4String & GetName() const
const G4ThreeVector & GetTranslation(G4int depth) const
G4double GetRadlen() const
G4double GetLineWidth() const
LineStyle GetLineStyle() const
void SetDaughtersInvisible(G4bool)
G4String GetCurrentTag() const
const G4RotationMatrix * GetRotation(G4int depth) const
G4VSolid * GetSolid() const
void DescribeAndDescend(G4VPhysicalVolume *, G4int requestedDepth, G4LogicalVolume *, G4VSolid *, G4Material *, const G4Transform3D &, G4VGraphicsScene &)
PVNameCopyNoPath::const_iterator PVNameCopyNoPathConstIterator
G4int GetForcedLineSegmentsPerCircle() const
void SetForceLineSegmentsPerCircle(G4int nSegments)
static void ResetNumberOfRotationSteps()
void DescribeYourselfTo(G4VGraphicsScene &)
const G4Colour & GetColour() const