117 fpScene = pVMan -> GetCurrentScene ();
119 std::ostringstream ost;
145 return defaultExtent;
172 (
"G4VSceneHandler::BeginPrimitives",
174 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
194 (
"G4VSceneHandler::BeginPrimitives2D",
196 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
326 if (trajectoriesModel)
330 (
"G4VSceneHandler::AddCompound(const G4VTrajectory&)",
337 const_cast<G4VHit&
>(hit).Draw();
342 const_cast<G4VDigi&
>(digi).Draw();
348 G4bool scoreMapHits =
false;
350 if (scoringManager) {
352 for (std::size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
357 for(
const auto& i : scoreMap) {
358 const G4String& scoreMapName = i.first;
359 if (scoreMapName == mapNam) {
362 mesh->
DrawMesh(scoreMapName, &colorMap);
369 static G4bool first =
true;
373 "Scoring map drawn with default parameters."
374 "\n To get gMocren file for gMocren browser:"
375 "\n /vis/open gMocrenFile"
376 "\n /vis/viewer/flush"
377 "\n Many other options available with /score/draw... commands."
378 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
390 G4bool scoreMapHits =
false;
392 if (scoringManager) {
394 for (std::size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
398 for(
const auto& i : scoreMap) {
399 const G4String& scoreMapName = i.first;
401 if (foundHits == &hits) {
404 mesh->
DrawMesh(scoreMapName, &colorMap);
411 static G4bool first =
true;
415 "Scoring map drawn with default parameters."
416 "\n To get gMocren file for gMocren browser:"
417 "\n /vis/open gMocrenFile"
418 "\n /vis/viewer/flush"
419 "\n Many other options available with /score/draw... commands."
420 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
432 "There has been an attempt to draw a mesh with option \""
433 <<
fpViewer->GetViewParameters().GetSpecialMeshRenderingOption()
435 <<
"but it is not of a recognised type or is not implemented"
436 "\nby the current graphics driver. Instead we draw its"
445 const auto& saveVisAtts = lv->GetVisAttributes();
447 tmpVisAtts = *saveVisAtts;
449 auto colour = saveVisAtts->GetColour();
455 solid->DescribeYourselfTo(*
this);
458 lv->SetVisAttributes(saveVisAtts);
473 for (
const auto& iPoint : polymarker) {
482 for (
const auto& iPoint : polymarker) {
491 for (
const auto& iPoint : polymarker) {
504 visManager->SetCurrentViewer(
nullptr);
510 G4warn <<
" Open a plotter-aware graphics system or remove plotter with" <<
G4endl;
519 (*i) -> SetNeedKernelVisit (
true);
534 auto pSolid = &solid;
538 pBooleanSolid->BoundingLimits(bmin, bmax);
541 auto ptrB = pBooleanSolid->GetConstituentSolid(1);
542 for (
G4int i=0; i<10; ++i) {
554 auto ptrB = pBooleanSolid->GetConstituentSolid(1);
555 for (
G4int i=0; i<10; ++i) {
569 for (
G4int i=0; i<10000; ++i) {
603 auto problematicVolume = pPVModel->GetCurrentPV();
608 "ERROR: G4VSceneHandler::RequestPrimitives"
609 "\n Polyhedron not available for " << solid.
GetName ();
610 G4warn <<
"\n Touchable path: " << pPVModel->GetFullPVPath();
611 static G4bool explanation =
false;
615 "\n This means it cannot be visualized in the usual way on most systems."
616 "\n 1) The solid may not have implemented the CreatePolyhedron method."
617 "\n 2) For Boolean solids, the BooleanProcessor, which attempts to create"
618 "\n the resultant polyhedron, may have failed."
619 "\n Try RayTracer. It uses Geant4's tracking algorithms instead.";
622 G4warn <<
"\n Drawing solid with cloud of points.";
642 for (
G4int i = 0; i < numberOfCloudPoints; ++i) {
684 "The scene has no extent.");
698 const std::vector<G4Scene::Model>& runDurationModelList =
699 fpScene->GetRunDurationModelList();
701 if(runDurationModelList.size()) {
704 static G4int first =
true;
708 "(This could happen more than once - in fact, up to three times"
709 "\nper rebuild, for opaque, transparent and non-hidden markers.)"
715 fpViewer->AccessSceneTree().ResetVisibility();
722 for(
const auto& i : runDurationModelList) {
725 fpModel->SetModelingParameters(pMP);
728 fpModel->DescribeYourselfTo(*
this);
740 fpModel->DescribeYourselfTo(sceneTreeScene);
741 const auto& maxDepth = pPVModel->GetMaxFullDepth();
747 fpModel->SetModelingParameters(0);
759 for (
const auto& model: runDurationModelList) {
764 G4cout <<
"Numbers of all touchables by depth \""
765 << pvModel->GetGlobalDescription() <<
"\":";
766 for (
const auto& dn : pvModel->GetMapOfAllTouchables()) {
767 G4cout <<
"\n Depth " << dn.first <<
": " << dn.second;
769 G4cout <<
"\n Total number of all touchables: "
770 << pvModel->GetTotalAllTouchables() <<
G4endl;
772 G4cout <<
"Numbers of touchables drawn by depth \""
773 << pvModel->GetGlobalDescription() <<
"\":";
774 for (
const auto& dn : pvModel->GetMapOfDrawnTouchables()) {
775 G4cout <<
"\n Depth " << dn.first <<
": " << dn.second;
777 G4cout <<
"\n Total number of drawn touchables: "
778 << pvModel->GetTotalDrawnTouchables() <<
G4endl;
785 G4cout <<
"Problematic volumes:";
787 G4cout <<
"\n " << prob.first->GetName() <<
" (" << prob.second <<
')';
831 const std::vector<const G4Event*>* events =
833 std::size_t nKeptEvents = 0;
835 nKeptEvents = events->size();
838 if(
fpScene->GetRefreshAtEndOfEvent())
845 if(events && events->size())
846 event = events->back();
857 for(
const auto& event : *events)
863 if(!
fpScene->GetRefreshAtEndOfRun())
867 G4warn <<
"WARNING: Cannot refresh events accumulated over more"
868 "\n than one runs. Refreshed just the last run."
891 if(!
fpViewer->ReadyToDraw())
return;
892 const std::vector<G4Scene::Model>& EOEModelList =
893 fpScene -> GetEndOfEventModelList ();
894 std::size_t nModels = EOEModelList.size();
898 for (std::size_t i = 0; i < nModels; ++i) {
899 if (EOEModelList[i].fActive) {
900 fpModel = EOEModelList[i].fpModel;
901 fpModel -> SetModelingParameters(pMP);
904 fpModel -> DescribeYourselfTo (*
this);
910 fpModel -> SetModelingParameters(0);
920 if(!
fpViewer->ReadyToDraw())
return;
921 const std::vector<G4Scene::Model>& EORModelList =
922 fpScene -> GetEndOfRunModelList ();
923 std::size_t nModels = EORModelList.size();
927 for (std::size_t i = 0; i < nModels; ++i) {
928 if (EORModelList[i].fActive) {
929 fpModel = EORModelList[i].fpModel;
930 fpModel -> SetModelingParameters(pMP);
933 fpModel -> DescribeYourselfTo (*
this);
939 fpModel -> SetModelingParameters(0);
977 G4bool reallyCullCovered =
1025 return pModelingParams;
1036 G4double safe = radius +
fpScene->GetExtent().GetExtentCentre().mag();
1038 new G4Box(
"_sectioner", safe, safe, 1.e-5 * radius);
1046 (
"_displaced_sectioning_box", sectionBox, requiredTransform);
1054 const auto& vp =
fpViewer->GetViewParameters();
1055 const auto& nPlanes = vp.GetCutawayPlanes().size();
1057 if (nPlanes == 0)
return nullptr;
1059 std::vector<G4DisplacedSolid*> cutaway_solids;
1062 G4double safe = radius +
fpScene->GetExtent().GetExtentCentre().mag();
1063 auto cutawayBox =
new G4Box(
"_cutaway_box", safe, safe, safe);
1077 for (
size_t plane_no = 0; plane_no < nPlanes; plane_no++)
1079 const G4Plane3D& sp = vp.GetCutawayPlanes()[plane_no];
1082 switch (vp.GetCutawayMode()) {
1084 normal = -sp.normal();
1089 normal = sp.normal();
1094 cutaway_solids.push_back
1095 (
new G4DisplacedSolid(
"_displaced_cutaway_box", cutawayBox, requiredTransform));
1102 switch (vp.GetCutawayMode()) {
1108 else if (nPlanes == 3) {
1119 else if (nPlanes == 3) {
1128 "Not programmed for more than 3 cutaway planes");
1137 const std::map<G4String,G4AttDef>* vaDefs =
1148 const std::map<G4String,G4AttDef>* pvDefs = pPVModel->
GetAttDefs();
1157 const std::map<G4String,G4AttDef>* trajModelDefs = trajModel->
GetAttDefs();
1158 if (trajModelDefs) {
1164 const std::map<G4String,G4AttDef>* trajDefs = traj->
GetAttDefs();
1169 for (
G4int i = 0; i < nPoints; ++i) {
1172 const std::map<G4String,G4AttDef>* pointDefs = trajPoint->
GetAttDefs();
1185 const std::map<G4String,G4AttDef>* hitsDefs = hit->
GetAttDefs();
1200 if (!pVA) pVA =
fpViewer->GetViewParameters().GetDefaultVisAttributes();
1201 return pVA->GetColour();
1206 if (!pVA) pVA =
fpViewer->GetViewParameters().GetDefaultTextVisAttributes();
1207 return pVA->GetColour();
1213 if (lineWidth < 1.) lineWidth = 1.;
1214 lineWidth *=
fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
1215 if (lineWidth < 1.) lineWidth = 1.;
1227 if (pVisAttribs -> IsForceDrawingStyle ()) {
1229 pVisAttribs -> GetForcedDrawingStyle ();
1232 switch (forcedStyle) {
1234 switch (viewerStyle) {
1262 return resultantStyle;
1270 G4int numberOfCloudPoints =
fpViewer->GetViewParameters().GetNumberOfCloudPoints();
1271 if (pVisAttribs -> IsForceDrawingStyle() &&
1273 pVisAttribs -> GetForcedNumberOfCloudPoints() > 0) {
1274 numberOfCloudPoints = pVisAttribs -> GetForcedNumberOfCloudPoints();
1276 return numberOfCloudPoints;
1280 G4bool isAuxEdgeVisible =
fpViewer->GetViewParameters().IsAuxEdgeVisible ();
1281 if (pVisAttribs -> IsForceAuxEdgeVisible()) {
1284 return isAuxEdgeVisible;
1292 const auto& vp =
fpViewer->GetViewParameters();
1294 const auto& polymarker =
dynamic_cast<const G4Polymarker&
>(marker);
1296 return vp.GetDotsSize();
1299 catch (
const std::bad_cast&) {}
1304 fpViewer -> GetViewParameters().GetDefaultMarker();
1309 markerSizeType =
world;
1312 size = userSpecified ?
1317 size *=
fpViewer -> GetViewParameters().GetGlobalMarkerScale();
1318 if (markerSizeType ==
screen && size < 1.) size = 1.;
1327 G4int lineSegmentsPerCircle =
fpViewer->GetViewParameters().GetNoOfSides();
1331 if (lineSegmentsPerCircle < pVisAttribs->GetMinLineSegmentsPerCircle()) {
1334 "G4VSceneHandler::GetNoOfSides: attempt to set the"
1335 "\nnumber of line segments per circle < " << lineSegmentsPerCircle
1339 return lineSegmentsPerCircle;
1344 os <<
"Scene handler " << sh.
fName <<
" has "
1354 os <<
"\n This scene handler currently has no scene.";
1360void G4VSceneHandler::PseudoSceneFor3DRectMeshPositions::AddSolid(
const G4Box&) {
1369 fPositionByMaterial.insert(std::make_pair(material,
position));
1370 if (fNameAndVisAttsByMaterial.find(material) == fNameAndVisAttsByMaterial.end())
1372 fNameAndVisAttsByMaterial[material] = NameAndVisAtts(name,*pVisAtts);
1376void G4VSceneHandler::PseudoSceneForTetVertices::AddSolid(
const G4VSolid& solid) {
1377 if (fpPVModel->GetCurrentDepth() == fpMesh->GetMeshDepth()) {
1380 const auto& tet =
dynamic_cast<const G4Tet&
>(solid);
1381 const auto& material = fpPVModel->GetCurrentLV()->GetMaterial();
1382 const auto&
name = material? material->GetName(): fpMesh->GetContainerVolume()->GetName();
1383 const auto& pVisAtts = fpPVModel->GetCurrentLV()->GetVisAttributes();
1385 if (fpCurrentObjectTransformation->xx() == 1. &&
1386 fpCurrentObjectTransformation->yy() == 1. &&
1387 fpCurrentObjectTransformation->zz() == 1.) {
1388 const auto& vertices = tet.GetVertices();
1389 fVerticesByMaterial.insert(std::make_pair(material,vertices));
1391 auto vertices = tet.GetVertices();
1392 for (
auto&& vertex: vertices) {
1393 vertex =
G4Point3D(vertex).transform(*fpCurrentObjectTransformation);
1395 fVerticesByMaterial.insert(std::make_pair(material,vertices));
1397 if (fNameAndVisAttsByMaterial.find(material) == fNameAndVisAttsByMaterial.end())
1399 fNameAndVisAttsByMaterial[material] =
NameAndVisAtts(name,*pVisAtts);
1401 catch (
const std::bad_cast&) {
1403 ed <<
"Called for a mesh that is not a tetrahedron mesh: " << solid.
GetName();
1414 G4bool implemented =
false;
1418 switch (
fpViewer->GetViewParameters().GetSpecialMeshRenderingOption()) {
1432 switch (
fpViewer->GetViewParameters().GetSpecialMeshRenderingOption()) {
1454 if (containerVisAtts ==
nullptr || containerVisAtts->IsVisible()) {
1455 auto solid = containerLogical->GetSolid();
1459 if (containerVisAtts !=
nullptr) tmpVisAtts = *containerVisAtts;
1461 polyhedron->SetVisAttributes(tmpVisAtts);
1481 ed <<
"Called with a mesh that is not rectangular:" << mesh;
1486 static G4bool firstPrint =
true;
1491 <<
"Special case drawing of 3D rectangular G4VNestedParameterisation as dots:"
1499 static std::map<G4String,std::map<const G4Material*,G4Polymarker>> dotsByMaterialAndMesh;
1503 if (dotsByMaterial.empty()) {
1511 const G4bool useFullExtent =
true;
1519 std::multimap<const G4Material*,const G4ThreeVector> positionByMaterial;
1520 std::map<const G4Material*,G4VSceneHandler::NameAndVisAtts> nameAndVisAttsByMaterial;
1523 (&tmpPVModel,&mesh,positionByMaterial,nameAndVisAttsByMaterial);
1530 const auto& halfX = prms.
fHalfX;
1531 const auto& halfY = prms.fHalfY;
1532 const auto& halfZ = prms.fHalfZ;
1535 G4int nDotsTotal = 0;
1536 for (
const auto& entry: nameAndVisAttsByMaterial) {
1538 const auto& material = entry.first;
1539 const auto& nameAndVisAtts = nameAndVisAttsByMaterial[material];
1540 const auto& name = nameAndVisAtts.fName;
1541 const auto& visAtts = nameAndVisAtts.fVisAtts;
1547 dotsByMaterial[material] = dots;
1549 auto& dotsInMap = dotsByMaterial[material];
1550 const auto& range = positionByMaterial.equal_range(material);
1551 for (
auto posByMat = range.first; posByMat != range.second; ++posByMat) {
1552 dotsInMap.push_back(
GetPointInBox(posByMat->second, halfX, halfY, halfZ));
1558 << std::setw(30) << std::left << name.substr(0,30) << std::right
1559 <<
": " << std::setw(7) << nDots <<
" dots"
1560 <<
": colour " << std::fixed << std::setprecision(2)
1561 << visAtts.GetColour() << std::defaultfloat
1565 nDotsTotal += nDots;
1569 G4cout <<
"Total number of dots: " << nDotsTotal <<
G4endl;
1578 parameterisationName = pPVModel->GetFullPVPath().back().GetPhysicalVolume()->GetName();
1583 auto keepVP =
fpViewer->GetViewParameters();
1584 auto vp =
fpViewer->GetViewParameters();
1585 vp.SetMarkerHidden();
1589 for (
const auto& entry: dotsByMaterial) {
1590 const auto& dots = entry.second;
1597 const auto& fullPVPath = pPVModel->GetFullPVPath();
1598 auto leafPV = fullPVPath.back().GetPhysicalVolume();
1599 leafPV->SetName(dots.GetInfo());
1606 fpViewer->SetViewParameters(keepVP);
1609 pPVModel->GetFullPVPath().back().GetPhysicalVolume()->SetName(parameterisationName);
1624 ed <<
"Called with a mesh that is not rectangular:" << mesh;
1629 static G4bool firstPrint =
true;
1634 <<
"Special case drawing of 3D rectangular G4VNestedParameterisation as surfaces:"
1642 static std::map<G4String,std::map<const G4Material*,G4Polyhedron>> boxesByMaterialAndMesh;
1646 if (boxesByMaterial.empty()) {
1654 const G4bool useFullExtent =
true;
1662 std::multimap<const G4Material*,const G4ThreeVector> positionByMaterial;
1663 std::map<const G4Material*,G4VSceneHandler::NameAndVisAtts> nameAndVisAttsByMaterial;
1666 (&tmpPVModel,&mesh,positionByMaterial,nameAndVisAttsByMaterial);
1673 const auto& sizeX = 2.*prms.
fHalfX;
1674 const auto& sizeY = 2.*prms.fHalfY;
1675 const auto& sizeZ = 2.*prms.fHalfZ;
1678 G4int nBoxesTotal = 0, nFacetsTotal = 0;
1679 for (
const auto& entry: nameAndVisAttsByMaterial) {
1681 const auto& material = entry.first;
1682 const auto& nameAndVisAtts = nameAndVisAttsByMaterial[material];
1683 const auto& name = nameAndVisAtts.fName;
1684 const auto& visAtts = nameAndVisAtts.fVisAtts;
1686 std::vector<G4ThreeVector> positionsForPolyhedron;
1687 const auto& range = positionByMaterial.equal_range(material);
1688 for (
auto posByMat = range.first; posByMat != range.second; ++posByMat) {
1689 const auto&
position = posByMat->second;
1690 positionsForPolyhedron.push_back(
position);
1695 auto& polyhedron = boxesByMaterial[material];
1698 polyhedron.SetVisAttributes(visAtts);
1699 polyhedron.SetInfo(name);
1703 << std::setw(30) << std::left << name.substr(0,30) << std::right
1704 <<
": " << std::setw(7) << nBoxes <<
" boxes"
1705 <<
" (" << std::setw(7) << 6*nBoxes <<
" faces)"
1706 <<
": reduced to " << std::setw(7) << polyhedron.GetNoFacets() <<
" facets ("
1707 << std::setw(2) << std::fixed << std::setprecision(2) << 100*polyhedron.GetNoFacets()/(6*nBoxes)
1708 <<
"%): colour " << std::fixed << std::setprecision(2)
1709 << visAtts.GetColour() << std::defaultfloat
1713 nBoxesTotal += nBoxes;
1714 nFacetsTotal += polyhedron.GetNoFacets();
1718 G4cout <<
"Total number of boxes: " << nBoxesTotal <<
" (" << 6*nBoxesTotal <<
" faces)"
1719 <<
": reduced to " << nFacetsTotal <<
" facets ("
1720 << std::setw(2) << std::fixed << std::setprecision(2) << 100*nFacetsTotal/(6*nBoxesTotal) <<
"%)"
1730 parameterisationName = pPVModel->GetFullPVPath().back().GetPhysicalVolume()->GetName();
1736 for (
const auto& entry: boxesByMaterial) {
1737 const auto& poly = entry.second;
1744 const auto& fullPVPath = pPVModel->GetFullPVPath();
1745 auto leafPV = fullPVPath.back().GetPhysicalVolume();
1746 leafPV->SetName(poly.GetInfo());
1753 pPVModel->GetFullPVPath().back().GetPhysicalVolume()->SetName(parameterisationName);
1767 ed <<
"Called with mesh that is not a tetrahedron mesh:" << mesh;
1772 static G4bool firstPrint =
true;
1778 <<
"Special case drawing of tetrahedron mesh as dots"
1786 static std::map<G4String,std::map<const G4Material*,G4Polymarker>> dotsByMaterialAndMesh;
1790 if (dotsByMaterial.empty()) {
1798 const G4bool useFullExtent =
true;
1806 std::multimap<const G4Material*,std::vector<G4ThreeVector>> verticesByMaterial;
1807 std::map<const G4Material*,G4VSceneHandler::NameAndVisAtts> nameAndVisAttsByMaterial;
1810 (&tmpPVModel,&mesh,verticesByMaterial,nameAndVisAttsByMaterial);
1817 G4int nDotsTotal = 0;
1818 for (
const auto& entry: nameAndVisAttsByMaterial) {
1820 const auto& material = entry.first;
1821 const auto& nameAndVisAtts = nameAndVisAttsByMaterial[material];
1822 const auto& name = nameAndVisAtts.fName;
1823 const auto& visAtts = nameAndVisAtts.fVisAtts;
1829 dotsByMaterial[material] = dots;
1831 auto& dotsInMap = dotsByMaterial[material];
1832 const auto& range = verticesByMaterial.equal_range(material);
1833 for (
auto vByMat = range.first; vByMat != range.second; ++vByMat) {
1840 << std::setw(30) << std::left << name.substr(0,30) << std::right
1841 <<
": " << std::setw(7) << nDots <<
" dots"
1842 <<
": colour " << std::fixed << std::setprecision(2)
1843 << visAtts.GetColour() << std::defaultfloat
1847 nDotsTotal += nDots;
1851 G4cout <<
"Total number of dots: " << nDotsTotal <<
G4endl;
1860 parameterisationName = pPVModel->GetFullPVPath().back().GetPhysicalVolume()->GetName();
1865 auto keepVP =
fpViewer->GetViewParameters();
1866 auto vp =
fpViewer->GetViewParameters();
1867 vp.SetMarkerHidden();
1872 for (
const auto& entry: dotsByMaterial) {
1873 const auto& dots = entry.second;
1880 const auto& fullPVPath = pPVModel->GetFullPVPath();
1881 auto leafPV = fullPVPath.back().GetPhysicalVolume();
1882 leafPV->SetName(dots.GetInfo());
1889 fpViewer->SetViewParameters(keepVP);
1892 pPVModel->GetFullPVPath().back().GetPhysicalVolume()->SetName(parameterisationName);
1906 ed <<
"Called with mesh that is not a tetrahedron mesh:" << mesh;
1911 static G4bool firstPrint =
true;
1917 <<
"Special case drawing of tetrahedron mesh as surfaces"
1923 static std::map<G4String,std::map<const G4Material*,G4Polyhedron>> surfacesByMaterialAndMesh;
1927 if (surfacesByMaterial.empty()) {
1935 const G4bool useFullExtent =
true;
1943 std::multimap<const G4Material*,std::vector<G4ThreeVector>> verticesByMaterial;
1944 std::map<const G4Material*,G4VSceneHandler::NameAndVisAtts> nameAndVisAttsByMaterial;
1947 (&tmpPVModel,&mesh,verticesByMaterial,nameAndVisAttsByMaterial);
1954 G4int nTetsTotal = 0, nFacetsTotal = 0;
1955 for (
const auto& entry: nameAndVisAttsByMaterial) {
1957 const auto& material = entry.first;
1958 const auto& nameAndVisAtts = nameAndVisAttsByMaterial[material];
1959 const auto& name = nameAndVisAtts.fName;
1960 const auto& visAtts = nameAndVisAtts.fVisAtts;
1962 std::vector<G4ThreeVector> verticesForPolyhedron;
1963 const auto& range = verticesByMaterial.equal_range(material);
1964 for (
auto vByMat = range.first; vByMat != range.second; ++vByMat) {
1965 const std::vector<G4ThreeVector>& vertices = vByMat->second;
1966 for (
const auto& vertex: vertices)
1967 verticesForPolyhedron.push_back(vertex);
1972 auto& polyhedron = surfacesByMaterial[material];
1975 polyhedron.SetVisAttributes(visAtts);
1976 polyhedron.SetInfo(name);
1980 << std::setw(30) << std::left << name.substr(0,30) << std::right
1981 <<
": " << std::setw(7) << nTets <<
" tetrahedra"
1982 <<
" (" << std::setw(7) << 4*nTets <<
" faces)"
1983 <<
": reduced to " << std::setw(7) << polyhedron.GetNoFacets() <<
" facets ("
1984 << std::setw(2) << std::fixed << std::setprecision(2) << 100*polyhedron.GetNoFacets()/(4*nTets)
1985 <<
"%): colour " << std::fixed << std::setprecision(2)
1986 << visAtts.GetColour() << std::defaultfloat
1990 nTetsTotal += nTets;
1991 nFacetsTotal += polyhedron.GetNoFacets();
1995 G4cout <<
"Total number of tetrahedra: " << nTetsTotal <<
" (" << 4*nTetsTotal <<
" faces)"
1996 <<
": reduced to " << nFacetsTotal <<
" facets ("
1997 << std::setw(2) << std::fixed << std::setprecision(2) << 100*nFacetsTotal/(4*nTetsTotal) <<
"%)"
2007 parameterisationName = pPVModel->GetFullPVPath().back().GetPhysicalVolume()->GetName();
2013 for (
const auto& entry: surfacesByMaterial) {
2014 const auto& poly = entry.second;
2021 const auto& fullPVPath = pPVModel->GetFullPVPath();
2022 auto leafPV = fullPVPath.back().GetPhysicalVolume();
2023 leafPV->SetName(poly.GetInfo());
2031 pPVModel->GetFullPVPath().back().GetPhysicalVolume()->SetName(parameterisationName);
2067 else if (p + q + r > 1.)
2074 return vertices[0]*a + vertices[1]*p + vertices[2]*q + vertices[3]*r;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
HepGeom::Plane3D< G4double > G4Plane3D
HepGeom::Point3D< G4double > G4Point3D
G4double G4QuickRand(uint32_t seed=0)
CLHEP::Hep3Vector G4ThreeVector
std::ostream & operator<<(std::ostream &os, const G4VSceneHandler &sh)
std::vector< G4VViewer * >::iterator G4ViewerListIterator
void print(G4double elem)
G4GLOB_DLL std::ostream G4cout
Hep3Vector orthogonal() const
void AddAtts(const std::vector< G4AttValue > *values, const std::map< G4String, G4AttDef > *defs)
G4BooleanSolid is the base class for solids created by Boolean operations between other solids.
G4Box is a cuboid of given half lengths dx,dy,dz. The Box is centred on the origin with sides paralle...
G4Cons is, in the general case, a Phi segment of a cone, with half-length fDz, inner and outer radii ...
G4DisplacedSolid is a solid that has been shifted from its original frame of reference to a new one....
G4Ellipsoid is an ellipsoidal solid, optionally cut at a given Z.
const G4VHit * GetCurrentHit() const
G4IntersectionSolid is a solid describing the Boolean intersection of two solids.
G4VSolid * GetSolid() const
const G4VisAttributes * GetVisAttributes() const
G4Material * GetMaterial() const
MeshType GetMeshType() const
G4VPhysicalVolume * GetContainerVolume() const
const G4Transform3D & GetTransform() const
const ThreeDRectangleParameters & GetThreeDRectParameters() const
G4int GetMeshDepth() const
void SetCBDParameters(const std::vector< G4double > &)
void SetTransparencyByDepth(G4double)
void SetNumberOfCloudPoints(G4int)
void SetCBDAlgorithmNumber(G4int)
void SetExplodeFactor(G4double explodeFactor)
void SetVisAttributesModifiers(const std::vector< VisAttributesModifier > &)
void SetExplodeCentre(const G4Point3D &explodeCentre)
void SetCutawayMode(CutawayMode)
void SetCutawaySolid(G4DisplacedSolid *pCutawaySolid)
void SetTimeParameters(const TimeParameters &)
void SetSectionSolid(G4DisplacedSolid *pSectionSolid)
void SetEvent(const G4Event *pEvent)
void SetCullingInvisible(G4bool)
void SetSpecialMeshVolumes(const std::vector< PVNameCopyNo > &)
void SetSpecialMeshRendering(G4bool)
void SetTransparencyByDepthOption(G4int)
G4Orb represents a full sphere.
G4Para represents a parallelepiped, essentially a box with half lengths dx,dy,dz 'skewed' so that the...
std::vector< G4AttValue > * CreateCurrentAttValues() const
void DescribeYourselfTo(G4VGraphicsScene &)
G4LogicalVolume * GetCurrentLV() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4int GetCurrentDepth() const
G4Polycone represents a composed closed shape (PCON) made of cones and cylinders, along the Z axis wi...
G4Polyhedra represents a composed closed polyhedra (PGON) made of planar sizes along the Z axis,...
void SetMarkerType(MarkerType)
MarkerType GetMarkerType() const
const G4Transform3D * fpCurrentObjectTransformation
static G4RunManager * GetMasterRunManager()
const G4Run * GetCurrentRun() const
std::vector< const G4Event * > * GetEventVector() const
G4VScoringMesh * GetMesh(G4int i) const
std::size_t GetNumberOfMesh() const
static G4ScoringManager * GetScoringManagerIfExist()
G4Sphere is, in the general case, a section of a spherical shell, between specified phi and theta ang...
const G4ApplicationState & GetCurrentState() const
static G4StateManager * GetStateManager()
G4SubtractionSolid is a solid describing the Boolean subtraction of two solids.
G4TessellatedSolid is a solid defined by a number of facets. It is important that the supplied facets...
G4Torus represents a torus or torus segment with curved sides parallel to the z-axis....
const G4VTrajectory * GetCurrentTrajectory() const
std::vector< G4AttValue > * CreateCurrentAttValues() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4Trap is a general trapezoid: the faces perpendicular to the Z planes are trapezia,...
G4Trd is a trapezoid with the X and Y dimensions varying along Z.
G4Tubs is a tube or tube segment with curved sides parallel to the Z-axis. The tube has a specified h...
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4double GetScreenSize() const
void SetScreenSize(G4double)
void SetWorldSize(G4double)
void SetPosition(const G4Point3D &)
G4double GetWorldSize() const
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
virtual void BeginModeling()
G4int GetNumberOfCloudPoints(const G4VisAttributes *) const
G4int GetNoOfSides(const G4VisAttributes *)
void DrawTetMeshAsSurfaces(const G4Mesh &)
virtual void ClearTransientStore()
void LoadAtts(const G4Visible &, G4AttHolder *)
void DrawEvent(const G4Event *)
G4ModelingParameters * CreateModelingParameters()
const G4Colour & GetTextColour(const G4Text &)
const G4Colour & GetColour()
void Draw3DRectMeshAsDots(const G4Mesh &)
void AddSolidT(const T &solid)
G4Transform3D fObjectTransformation
virtual void EndPrimitives()
G4bool fTransientsDrawnThisEvent
void AddSolidWithAuxiliaryEdges(const T &solid)
virtual G4DisplacedSolid * CreateSectionSolid()
virtual void EndModeling()
std::map< G4VPhysicalVolume *, G4String > fProblematicVolumes
const G4int fSceneHandlerId
virtual const G4VisExtent & GetExtent() const
virtual void ProcessScene()
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
virtual void ProcessTransients()
virtual void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &)
G4VSceneHandler(G4VGraphicsSystem &system, G4int id, const G4String &name="")
G4bool fTransientsDrawnThisRun
virtual void PostAddSolid()
const G4String & GetName() const
void AddViewerToList(G4VViewer *pView)
virtual void EndPrimitives2D()
virtual void SetScene(G4Scene *)
void DrawEndOfRunModels()
G4bool fMarkForClearingTransientStore
const G4VisAttributes * fpVisAttribs
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation=G4Transform3D())
G4ThreeVector GetPointInBox(const G4ThreeVector &pos, G4double halfX, G4double halfY, G4double halfZ) const
virtual void RequestPrimitives(const G4VSolid &solid)
G4bool fReadyForTransients
G4ViewParameters::DrawingStyle GetDrawingStyle(const G4VisAttributes *)
void RemoveViewerFromList(G4VViewer *pView)
virtual G4DisplacedSolid * CreateCutawaySolid()
void DrawTetMeshAsDots(const G4Mesh &)
virtual void BeginPrimitives(const G4Transform3D &objectTransformation=G4Transform3D())
G4double GetLineWidth(const G4VisAttributes *)
G4ThreeVector GetPointInTet(const std::vector< G4ThreeVector > &vertices) const
G4VGraphicsSystem & fSystem
virtual void AddSolid(const G4Box &)
virtual void ClearStore()
void Draw3DRectMeshAsSurfaces(const G4Mesh &)
virtual void AddCompound(const G4VTrajectory &)
virtual ~G4VSceneHandler()
virtual void AddPrimitive(const G4Polyline &)=0
G4bool GetAuxEdgeVisible(const G4VisAttributes *)
void StandardSpecialMeshRendering(const G4Mesh &)
std::map< G4String, RunScore * > MeshScoreMap
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
MeshScoreMap GetScoreMap() const
G4VSolid is an abstract base class for solids, physical shapes that can be tracked through....
virtual G4ThreeVector GetPointOnSurface() const
virtual G4Polyhedron * GetPolyhedron() const
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual G4VTrajectoryPoint * GetPoint(G4int i) const =0
virtual G4int GetPointEntries() const =0
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual void DrawTrajectory() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
static G4VVisManager * GetConcreteInstance()
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
G4int GetNoOfSides() const
G4bool IsSpecialMeshRendering() const
CutawayMode GetCutawayMode() const
G4double GetExplodeFactor() const
const G4ModelingParameters::TimeParameters & GetTimeParameters() const
G4int GetNumberOfCloudPoints() const
const std::vector< G4double > & GetCBDParameters() const
G4int GetCBDAlgorithmNumber() const
const std::vector< G4ModelingParameters::PVNameCopyNo > & GetSpecialMeshVolumes() const
G4int GetTransparencyByDepthOption() const
G4bool IsCullingInvisible() const
const G4VisAttributes * GetDefaultVisAttributes() const
G4bool IsDensityCulling() const
G4double GetVisibleDensity() const
const G4Point3D & GetExplodeCentre() const
G4bool IsCullingCovered() const
const G4Plane3D & GetSectionPlane() const
DrawingStyle GetDrawingStyle() const
G4double GetTransparencyByDepth() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4bool IsForceLineSegmentsPerCircle() const
G4double GetLineWidth() const
void SetColour(const G4Colour &)
void SetVisibility(G4bool=true)
void SetForceAuxEdgeVisible(G4bool=true)
G4int GetForcedLineSegmentsPerCircle() const
void SetForceWireframe(G4bool=true)
const std::vector< G4AttValue > * CreateAttValues() const
G4bool IsForcedAuxEdgeVisible() const
static G4int GetMinLineSegmentsPerCircle()
static const G4VisExtent & GetNullExtent()
void SetEventRefreshing(G4bool)
G4bool GetTransientsDrawnThisEvent() const
G4bool GetTransientsDrawnThisRun() const
static Verbosity GetVerbosity()
const G4Event * GetRequestedEvent() const
static G4VisManager * GetInstance()
friend class G4VSceneHandler
void SetVisAttributes(const G4VisAttributes *)
const G4VisAttributes * GetVisAttributes() const
virtual void SetInfo(const G4String &info)
static void SetNumberOfRotationSteps(G4int n)
static void ResetNumberOfRotationSteps()
const char * name(G4int ptype)