83 #ifdef G4MULTITHREADED
102 fMarkForClearingTransientStore (
true),
106 fReadyForTransients (
true),
107 fProcessingSolid (
false),
108 fProcessing2D (
false),
114 fpScene = pVMan -> GetCurrentScene ();
116 std::ostringstream ost;
142 return defaultExtent;
167 if (fNestingDepth > 1)
169 (
"G4VSceneHandler::BeginPrimitives",
171 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
172 fObjectTransformation = objectTransformation;
189 if (fNestingDepth > 1)
191 (
"G4VSceneHandler::BeginPrimitives2D",
193 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
194 fObjectTransformation = objectTransformation;
195 fProcessing2D =
true;
226 fpVisAttribs = fpViewer->GetApplicableVisAttributes(fpVisAttribs);
227 RequestPrimitives (solid);
234 fpVisAttribs = fpViewer->GetApplicableVisAttributes(fpVisAttribs);
236 if (!fpVisAttribs->IsForceAuxEdgeVisible()) {
241 visAttsWithAuxEdges = *fpVisAttribs;
244 fpVisAttribs = &visAttsWithAuxEdges;
246 RequestPrimitives (solid);
323 if (trajectoriesModel)
327 (
"G4VSceneHandler::AddCompound(const G4VTrajectory&)",
345 G4bool scoreMapHits =
false;
347 if (scoringManager) {
349 for (
size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
354 for(MeshScoreMap::const_iterator i = scoreMap.begin();
355 i != scoreMap.end(); ++i) {
357 if (scoreMapName == mapNam) {
360 mesh->
DrawMesh(scoreMapName, &colorMap);
367 static G4bool first =
true;
371 "Scoring map drawn with default parameters."
372 "\n To get gMocren file for gMocren browser:"
373 "\n /vis/open gMocrenFile"
374 "\n /vis/viewer/flush"
375 "\n Many other options available with /score/draw... commands."
376 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
388 G4bool scoreMapHits =
false;
390 if (scoringManager) {
392 for (
size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
396 for(MeshScoreMap::const_iterator i = scoreMap.begin();
397 i != scoreMap.end(); ++i) {
400 if (foundHits == &hits) {
403 mesh->
DrawMesh(scoreMapName, &colorMap);
410 static G4bool first =
true;
414 "Scoring map drawn with default parameters."
415 "\n To get gMocren file for gMocren browser:"
416 "\n /vis/open gMocrenFile"
417 "\n /vis/viewer/flush"
418 "\n Many other options available with /score/draw... commands."
419 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
437 const G4double oneMinusMargin (1. - margin);
456 G4Polyline scaleLine, tick11, tick12, tick21, tick22;
468 scaleLine.push_back(r1);
469 scaleLine.push_back(r2);
472 tick11.push_back(r1 + ticky);
473 tick11.push_back(r1 - ticky);
474 tick12.push_back(r1 + tickz);
475 tick12.push_back(r1 - tickz);
476 tick21.push_back(r2 + ticky);
477 tick21.push_back(r2 - ticky);
478 tick22.push_back(r2 + tickz);
479 tick22.push_back(r2 - tickz);
480 G4Point3D textPosition(0., tickLength, 0.);
500 sxmid = xmin + oneMinusMargin * (xmax -
xmin);
501 symid = ymin + margin * (ymax -
ymin);
502 szmid = zmin + oneMinusMargin * (zmax - zmin);
515 transformation = translation * rotation;
531 text.SetVisAttributes(va);
544 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
553 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
562 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
580 (*i) -> SetNeedKernelVisit (
true);
608 static std::set<const G4VSolid*> problematicSolids;
610 problematicSolids.find(&solid) == problematicSolids.end()) {
611 problematicSolids.insert(&solid);
613 "ERROR: G4VSceneHandler::RequestPrimitives"
614 "\n Polyhedron not available for " << solid.
GetName ();
619 static G4bool explanation =
false;
623 "\n This means it cannot be visualized in the usual way on most systems."
624 "\n 1) The solid may not have implemented the CreatePolyhedron method."
625 "\n 2) For Boolean solids, the BooleanProcessor, which attempts to create"
626 "\n the resultant polyhedron, may have failed."
627 "\n Try RayTracer. It uses Geant4's tracking algorithms instead.";
629 G4cerr <<
"\n Drawing solid with cloud of points.";
648 for (
G4int i = 0; i < numberOfCloudPoints; ++i) {
669 (
"G4VSceneHandler::ProcessScene",
671 "The scene has no extent.");
690 const std::vector<G4Scene::Model>& runDurationModelList =
691 fpScene -> GetRunDurationModelList ();
693 if (runDurationModelList.size ()) {
703 for (
size_t i = 0; i < runDurationModelList.size (); i++) {
704 if (runDurationModelList[i].fActive) {
705 fpModel = runDurationModelList[i].fpModel;
710 fpModel -> SetModelingParameters (pMP);
711 fpModel -> DescribeYourselfTo (*
this);
712 fpModel -> SetModelingParameters (0);
738 #ifdef G4MULTITHREADED
744 const std::vector<const G4Event*>* events =
746 size_t nKeptEvents = 0;
747 if (events) nKeptEvents = events->size();
756 if (events && events->size()) event = events->back();
764 for (
const auto& event: *events) {
771 "WARNING: Cannot refresh events accumulated over more"
772 "\n than one runs. Refreshed just the last run."
794 const std::vector<G4Scene::Model>& EOEModelList =
795 fpScene -> GetEndOfEventModelList ();
796 size_t nModels = EOEModelList.size();
800 for (
size_t i = 0; i < nModels; i++) {
801 if (EOEModelList[i].fActive) {
802 fpModel = EOEModelList[i].fpModel;
803 fpModel -> SetModelingParameters(pMP);
804 fpModel -> DescribeYourselfTo (*
this);
805 fpModel -> SetModelingParameters(0);
815 const std::vector<G4Scene::Model>& EORModelList =
816 fpScene -> GetEndOfRunModelList ();
817 size_t nModels = EORModelList.size();
821 for (
size_t i = 0; i < nModels; i++) {
822 if (EORModelList[i].fActive) {
823 fpModel = EORModelList[i].fpModel;
824 fpModel -> SetModelingParameters(pMP);
825 fpModel -> DescribeYourselfTo (*
this);
826 fpModel -> SetModelingParameters(0);
864 G4bool reallyCullCovered =
897 return pModelingParams;
910 new G4Box(
"_sectioner", safe, safe, 1.
e-5 * radius);
922 if (newNormal != originalNormal) {
931 (
"_displaced_sectioning_box", sectionBox, requiredTransform);
972 const std::map<G4String,G4AttDef>* vaDefs =
983 const std::map<G4String,G4AttDef>* pvDefs = pPVModel->
GetAttDefs();
992 const std::map<G4String,G4AttDef>* trajModelDefs = trajModel->
GetAttDefs();
999 const std::map<G4String,G4AttDef>* trajDefs = traj->
GetAttDefs();
1004 for (
G4int i = 0; i < nPoints; ++i) {
1007 const std::map<G4String,G4AttDef>* pointDefs = trajPoint->
GetAttDefs();
1020 const std::map<G4String,G4AttDef>* hitsDefs = hit->
GetAttDefs();
1039 if (lineWidth < 1.) lineWidth = 1.;
1040 lineWidth *=
fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
1041 if (lineWidth < 1.) lineWidth = 1.;
1053 if (pVisAttribs -> IsForceDrawingStyle ()) {
1055 pVisAttribs -> GetForcedDrawingStyle ();
1058 switch (forcedStyle) {
1060 switch (viewerStyle) {
1088 return resultantStyle;
1096 G4int numberOfCloudPoints = fpViewer->GetViewParameters().GetNumberOfCloudPoints();
1097 if (pVisAttribs -> IsForceDrawingStyle() &&
1099 pVisAttribs -> GetForcedNumberOfCloudPoints() > 0) {
1100 numberOfCloudPoints = pVisAttribs -> GetForcedNumberOfCloudPoints();
1102 return numberOfCloudPoints;
1107 if (pVisAttribs -> IsForceAuxEdgeVisible()) {
1110 return isAuxEdgeVisible;
1119 fpViewer -> GetViewParameters().GetDefaultMarker();
1124 markerSizeType =
world;
1127 size = userSpecified ?
1130 markerSizeType = screen;
1132 size *= fpViewer -> GetViewParameters().GetGlobalMarkerScale();
1133 if (markerSizeType == screen && size < 1.) size = 1.;
1146 if (lineSegmentsPerCircle < pVisAttribs->GetMinLineSegmentsPerCircle()) {
1149 "G4VSceneHandler::GetNoOfSides: attempt to set the"
1150 "\nnumber of line segements per circle < " << lineSegmentsPerCircle
1154 return lineSegmentsPerCircle;
1159 os <<
"Scene handler " << sh.
fName <<
" has "
1161 for (
size_t i = 0; i < sh.
fViewerList.size (); i++) {
1169 os <<
"\n This scene handler currently has no scene.";