100 fMarkForClearingTransientStore (true),
104 fReadyForTransients (true),
105 fProcessingSolid (false),
106 fProcessing2D (false),
112 fpScene = pVMan -> GetCurrentScene ();
114 std::ostringstream ost;
140 return defaultExtent;
167 (
"G4VSceneHandler::BeginPrimitives",
169 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
189 (
"G4VSceneHandler::BeginPrimitives2D",
191 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
321 if (trajectoriesModel)
325 (
"G4VSceneHandler::AddCompound(const G4VTrajectory&)",
332 const_cast<G4VHit&
>(hit).Draw();
337 const_cast<G4VDigi&
>(digi).Draw();
343 G4bool scoreMapHits =
false;
345 if (scoringManager) {
347 for (
size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
352 for(MeshScoreMap::const_iterator i = scoreMap.begin();
353 i != scoreMap.end(); ++i) {
355 if (scoreMapName == mapNam) {
358 mesh->
DrawMesh(scoreMapName, &colorMap);
365 static G4bool first =
true;
369 "Scoring map drawn with default parameters."
370 "\n To get gMocren file for gMocren browser:"
371 "\n /vis/open gMocrenFile"
372 "\n /vis/viewer/flush"
373 "\n Many other options available with /score/draw... commands."
374 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
386 G4bool scoreMapHits =
false;
388 if (scoringManager) {
390 for (
size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
394 for(MeshScoreMap::const_iterator i = scoreMap.begin();
395 i != scoreMap.end(); ++i) {
398 if (foundHits == &hits) {
401 mesh->
DrawMesh(scoreMapName, &colorMap);
408 static G4bool first =
true;
412 "Scoring map drawn with default parameters."
413 "\n To get gMocren file for gMocren browser:"
414 "\n /vis/open gMocrenFile"
415 "\n /vis/viewer/flush"
416 "\n Many other options available with /score/draw... commands."
417 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
435 const G4double oneMinusMargin (1. - margin);
441 const G4double halfLength(length / 2.);
442 const G4double tickLength(length / 20.);
454 G4Polyline scaleLine, tick11, tick12, tick21, tick22;
466 scaleLine.push_back(r1);
467 scaleLine.push_back(r2);
470 tick11.push_back(r1 + ticky);
471 tick11.push_back(r1 - ticky);
472 tick12.push_back(r1 + tickz);
473 tick12.push_back(r1 - tickz);
474 tick21.push_back(r2 + ticky);
475 tick21.push_back(r2 - ticky);
476 tick22.push_back(r2 + tickz);
477 tick22.push_back(r2 - tickz);
478 G4Point3D textPosition(0., tickLength, 0.);
498 sxmid = xmin + oneMinusMargin * (xmax - xmin);
499 symid = ymin + margin * (ymax - ymin);
500 szmid = zmin + oneMinusMargin * (zmax - zmin);
513 transformation = translation * rotation;
542 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
551 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
560 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
578 (*i) -> SetNeedKernelVisit (
true);
606 static std::set<const G4VSolid*> problematicSolids;
608 problematicSolids.find(&solid) == problematicSolids.end()) {
609 problematicSolids.insert(&solid);
611 "ERROR: G4VSceneHandler::RequestPrimitives"
612 "\n Polyhedron not available for " << solid.
GetName ();
617 static G4bool explanation =
false;
621 "\n This means it cannot be visualized in the usual way on most systems."
622 "\n 1) The solid may not have implemented the CreatePolyhedron method."
623 "\n 2) For Boolean solids, the BooleanProcessor, which attempts to create"
624 "\n the resultant polyhedron, may have failed."
625 "\n Try RayTracer. It uses Geant4's tracking algorithms instead.";
627 G4cerr <<
"\n Drawing solid with cloud of points.";
646 for (
G4int i = 0; i < numberOfCloudPoints; ++i) {
669 "The scene has no extent.");
689 const std::vector<G4Scene::Model>& runDurationModelList =
692 if(runDurationModelList.size())
704 for(
size_t i = 0; i < runDurationModelList.size(); i++)
706 if(runDurationModelList[i].fActive)
708 fpModel = runDurationModelList[i].fpModel;
745 const std::vector<const G4Event*>* events =
747 size_t nKeptEvents = 0;
749 nKeptEvents = events->size();
759 if(events && events->size())
760 event = events->back();
771 for(
const auto& event : *events)
781 G4cout <<
"WARNING: Cannot refresh events accumulated over more"
782 "\n than one runs. Refreshed just the last run."
805 const std::vector<G4Scene::Model>& EOEModelList =
806 fpScene -> GetEndOfEventModelList ();
807 size_t nModels = EOEModelList.size();
811 for (
size_t i = 0; i < nModels; i++) {
812 if (EOEModelList[i].fActive) {
813 fpModel = EOEModelList[i].fpModel;
814 fpModel -> SetModelingParameters(pMP);
815 fpModel -> DescribeYourselfTo (*
this);
816 fpModel -> SetModelingParameters(0);
826 const std::vector<G4Scene::Model>& EORModelList =
827 fpScene -> GetEndOfRunModelList ();
828 size_t nModels = EORModelList.size();
832 for (
size_t i = 0; i < nModels; i++) {
833 if (EORModelList[i].fActive) {
834 fpModel = EORModelList[i].fpModel;
835 fpModel -> SetModelingParameters(pMP);
836 fpModel -> DescribeYourselfTo (*
this);
837 fpModel -> SetModelingParameters(0);
875 G4bool reallyCullCovered =
908 return pModelingParams;
921 new G4Box(
"_sectioner", safe, safe, 1.e-5 * radius);
933 if (newNormal != originalNormal) {
934 const G4double& angle = std::acos(newNormal.
dot(originalNormal));
942 (
"_displaced_sectioning_box", sectionBox, requiredTransform);
983 const std::map<G4String,G4AttDef>* vaDefs =
994 const std::map<G4String,G4AttDef>* pvDefs = pPVModel->
GetAttDefs();
1003 const std::map<G4String,G4AttDef>* trajModelDefs = trajModel->
GetAttDefs();
1004 if (trajModelDefs) {
1010 const std::map<G4String,G4AttDef>* trajDefs = traj->
GetAttDefs();
1015 for (
G4int i = 0; i < nPoints; ++i) {
1018 const std::map<G4String,G4AttDef>* pointDefs = trajPoint->
GetAttDefs();
1031 const std::map<G4String,G4AttDef>* hitsDefs = hit->
GetAttDefs();
1050 if (lineWidth < 1.) lineWidth = 1.;
1051 lineWidth *=
fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
1052 if (lineWidth < 1.) lineWidth = 1.;
1064 if (pVisAttribs -> IsForceDrawingStyle ()) {
1066 pVisAttribs -> GetForcedDrawingStyle ();
1069 switch (forcedStyle) {
1071 switch (viewerStyle) {
1099 return resultantStyle;
1108 if (pVisAttribs -> IsForceDrawingStyle() &&
1110 pVisAttribs -> GetForcedNumberOfCloudPoints() > 0) {
1111 numberOfCloudPoints = pVisAttribs -> GetForcedNumberOfCloudPoints();
1113 return numberOfCloudPoints;
1118 if (pVisAttribs -> IsForceAuxEdgeVisible()) {
1121 return isAuxEdgeVisible;
1130 fpViewer -> GetViewParameters().GetDefaultMarker();
1135 markerSizeType =
world;
1138 size = userSpecified ?
1143 size *=
fpViewer -> GetViewParameters().GetGlobalMarkerScale();
1144 if (markerSizeType ==
screen && size < 1.) size = 1.;
1157 if (lineSegmentsPerCircle < pVisAttribs->GetMinLineSegmentsPerCircle()) {
1160 "G4VSceneHandler::GetNoOfSides: attempt to set the"
1161 "\nnumber of line segments per circle < " << lineSegmentsPerCircle
1165 return lineSegmentsPerCircle;
1170 os <<
"Scene handler " << sh.
fName <<
" has "
1172 for (
size_t i = 0; i < sh.
fViewerList.size (); i++) {
1180 os <<
"\n This scene handler currently has no scene.";
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
HepGeom::Point3D< G4double > G4Point3D
std::ostream & operator<<(std::ostream &os, const G4VSceneHandler &sh)
std::vector< G4VViewer * >::iterator G4ViewerListIterator
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
void AddAtts(const std::vector< G4AttValue > *values, const std::map< G4String, G4AttDef > *defs)
const G4VHit * GetCurrentHit() const
void SetCBDParameters(const std::vector< G4double > &)
void SetNumberOfCloudPoints(G4int)
void SetCBDAlgorithmNumber(G4int)
void SetExplodeFactor(G4double explodeFactor)
void SetVisAttributesModifiers(const std::vector< VisAttributesModifier > &)
void SetExplodeCentre(const G4Point3D &explodeCentre)
void SetCutawaySolid(G4DisplacedSolid *pCutawaySolid)
void SetSectionSolid(G4DisplacedSolid *pSectionSolid)
void SetEvent(const G4Event *pEvent)
std::vector< G4AttValue > * CreateCurrentAttValues() const
const std::vector< G4PhysicalVolumeNodeID > & GetFullPVPath() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4Polyline & transform(const G4Transform3D &)
void SetMarkerType(MarkerType)
MarkerType GetMarkerType() const
static G4RunManager * GetMasterRunManager()
const G4Run * GetCurrentRun() const
const std::vector< const G4Event * > * GetEventVector() const
Direction GetDirection() const
const G4String & GetAnnotation() const
G4double GetLength() const
G4double GetAnnotationSize() const
G4bool GetAutoPlacing() const
const std::vector< Model > & GetRunDurationModelList() const
G4bool GetRefreshAtEndOfEvent() const
const G4VisExtent & GetExtent() const
G4bool GetRefreshAtEndOfRun() const
G4VScoringMesh * GetMesh(G4int i) const
size_t GetNumberOfMesh() const
static G4ScoringManager * GetScoringManagerIfExist()
const G4ApplicationState & GetCurrentState() const
static G4StateManager * GetStateManager()
std::size_t first(char) const
const G4VTrajectory * GetCurrentTrajectory() const
std::vector< G4AttValue > * CreateCurrentAttValues() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
const G4String & GetName() const
virtual std::vector< G4AttValue > * CreateAttValues() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4double GetScreenSize() const
void SetSize(SizeType, G4double)
void SetScreenSize(G4double)
void SetWorldSize(G4double)
void SetPosition(const G4Point3D &)
G4double GetWorldSize() const
void SetModelingParameters(const G4ModelingParameters *)
const G4Transform3D & GetTransformation() const
virtual void DescribeYourselfTo(G4VGraphicsScene &)=0
virtual void BeginModeling()
G4int GetNumberOfCloudPoints(const G4VisAttributes *) const
G4int GetNoOfSides(const G4VisAttributes *)
virtual void ClearTransientStore()
void LoadAtts(const G4Visible &, G4AttHolder *)
void DrawEvent(const G4Event *)
G4ModelingParameters * CreateModelingParameters()
const G4Colour & GetTextColour(const G4Text &)
const G4Colour & GetColour()
void AddSolidT(const T &solid)
G4Transform3D fObjectTransformation
virtual void EndPrimitives()
G4bool fTransientsDrawnThisEvent
void AddSolidWithAuxiliaryEdges(const T &solid)
virtual G4DisplacedSolid * CreateSectionSolid()
virtual void EndModeling()
const G4int fSceneHandlerId
virtual const G4VisExtent & GetExtent() const
virtual void ProcessScene()
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
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())
virtual void RequestPrimitives(const G4VSolid &solid)
G4bool fReadyForTransients
G4ViewParameters::DrawingStyle GetDrawingStyle(const G4VisAttributes *)
void RemoveViewerFromList(G4VViewer *pView)
virtual G4DisplacedSolid * CreateCutawaySolid()
virtual void BeginPrimitives(const G4Transform3D &objectTransformation=G4Transform3D())
G4double GetLineWidth(const G4VisAttributes *)
G4VGraphicsSystem & fSystem
virtual void AddSolid(const G4Box &)
virtual void ClearStore()
virtual void AddCompound(const G4VTrajectory &)
virtual ~G4VSceneHandler()
virtual void AddPrimitive(const G4Polyline &)=0
G4bool GetAuxEdgeVisible(const G4VisAttributes *)
std::map< G4String, RunScore * > MeshScoreMap
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
MeshScoreMap GetScoreMap() const
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
const G4VisAttributes * GetApplicableVisAttributes(const G4VisAttributes *) const
const G4ViewParameters & GetViewParameters() const
static const G4Colour & GetCurrentTextColour()
static G4VVisManager * GetConcreteInstance()
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
G4int GetNoOfSides() const
G4double GetExplodeFactor() const
G4int GetNumberOfCloudPoints() const
const std::vector< G4double > & GetCBDParameters() const
G4int GetCBDAlgorithmNumber() 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
G4bool IsAuxEdgeVisible() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4bool IsForceLineSegmentsPerCircle() const
G4double GetLineWidth() const
void SetForceAuxEdgeVisible(G4bool=true)
G4int GetForcedLineSegmentsPerCircle() const
const std::vector< G4AttValue > * CreateAttValues() const
G4bool IsForceAuxEdgeVisible() const
G4bool IsForcedAuxEdgeVisible() const
static G4int GetMinLineSegmentsPerCircle()
static const G4VisExtent & GetNullExtent()
G4double GetExtentRadius() const
const G4Point3D & GetExtentCentre() const
void SetEventRefreshing(G4bool)
G4bool GetTransientsDrawnThisEvent() const
G4bool GetTransientsDrawnThisRun() const
static Verbosity GetVerbosity()
const G4Event * GetRequestedEvent() const
static G4VisManager * GetInstance()
void SetVisAttributes(const G4VisAttributes *)
const G4VisAttributes * GetVisAttributes() const
BasicVector3D< T > cross(const BasicVector3D< T > &v) const
T dot(const BasicVector3D< T > &v) const
static void SetNumberOfRotationSteps(G4int n)
static void ResetNumberOfRotationSteps()