83 #ifdef G4MULTITHREADED
100 fMarkForClearingTransientStore (true),
104 fReadyForTransients (true),
105 fProcessingSolid (false),
106 fProcessing2D (false),
112 fpScene = pVMan -> GetCurrentScene ();
114 std::ostringstream ost;
164 if (fNestingDepth > 1)
166 (
"G4VSceneHandler::BeginPrimitives",
168 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
169 fObjectTransformation = objectTransformation;
186 if (fNestingDepth > 1)
188 (
"G4VSceneHandler::BeginPrimitives2D",
190 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
191 fObjectTransformation = objectTransformation;
192 fProcessing2D =
true;
223 fpVisAttribs = fpViewer->GetApplicableVisAttributes(fpVisAttribs);
224 RequestPrimitives (solid);
231 fpVisAttribs = fpViewer->GetApplicableVisAttributes(fpVisAttribs);
233 if (!fpVisAttribs->IsForceAuxEdgeVisible()) {
238 visAttsWithAuxEdges = *fpVisAttribs;
241 fpVisAttribs = &visAttsWithAuxEdges;
243 RequestPrimitives (solid);
316 if (trajectoriesModel)
320 (
"G4VSceneHandler::AddCompound(const G4VTrajectory&)",
327 const_cast<G4VHit&
>(hit).Draw();
332 const_cast<G4VDigi&
>(digi).Draw();
337 G4bool scoreMapHits =
false;
339 if (scoringManager) {
341 for (
size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
346 for(MeshScoreMap::const_iterator i = scoreMap.begin();
347 i != scoreMap.end(); ++i) {
349 if (scoreMapName == mapNam) {
352 mesh->
DrawMesh(scoreMapName, &colorMap);
359 static G4bool first =
true;
363 "Scoring map drawn with default parameters."
364 "\n To get gMocren file for gMocren browser:"
365 "\n /vis/open gMocrenFile"
366 "\n /vis/viewer/flush"
367 "\n Many other options available with /score/draw... commands."
368 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
379 G4bool scoreMapHits =
false;
381 if (scoringManager) {
383 for (
size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
387 for(MeshScoreMap::const_iterator i = scoreMap.begin();
388 i != scoreMap.end(); ++i) {
391 if (foundHits == &hits) {
394 mesh->
DrawMesh(scoreMapName, &colorMap);
401 static G4bool first =
true;
405 "Scoring map drawn with default parameters."
406 "\n To get gMocren file for gMocren browser:"
407 "\n /vis/open gMocrenFile"
408 "\n /vis/viewer/flush"
409 "\n Many other options available with /score/draw... commands."
410 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
428 const G4double oneMinusMargin (1. - margin);
434 const G4double halfLength(length / 2.);
435 const G4double tickLength(length / 20.);
447 G4Polyline scaleLine, tick11, tick12, tick21, tick22;
459 scaleLine.push_back(r1);
460 scaleLine.push_back(r2);
463 tick11.push_back(r1 + ticky);
464 tick11.push_back(r1 - ticky);
465 tick12.push_back(r1 + tickz);
466 tick12.push_back(r1 - tickz);
467 tick21.push_back(r2 + ticky);
468 tick21.push_back(r2 - ticky);
469 tick22.push_back(r2 + tickz);
470 tick22.push_back(r2 - tickz);
471 G4Point3D textPosition(0., tickLength, 0.);
491 sxmid = xmin + oneMinusMargin * (xmax - xmin);
492 symid = ymin + margin * (ymax - ymin);
493 szmid = zmin + oneMinusMargin * (zmax - zmin);
506 transformation = translation * rotation;
522 text.SetVisAttributes(va);
532 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
543 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
552 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
571 (*i) -> SetNeedKernelVisit (
true);
578 G4Polyhedron::ResetNumberOfRotationSteps ();
589 "ERROR: G4VSceneHandler::RequestPrimitives"
590 "\n Polyhedron not available for " << solid.
GetName () <<
591 "\n Touchable path: ";
597 "\n This means it cannot be visualized on most systems (try RayTracer)."
598 "\n 1) The solid may not have implemented the CreatePolyhedron method."
599 "\n 2) For Boolean solids, the BooleanProcessor, which attempts to create"
600 "\n the resultant polyhedron, may have failed."
629 const std::vector<G4Scene::Model>& runDurationModelList =
630 fpScene -> GetRunDurationModelList ();
632 if (runDurationModelList.size ()) {
642 for (
size_t i = 0; i < runDurationModelList.size (); i++) {
643 if (runDurationModelList[i].fActive) {
644 G4VModel* pModel = runDurationModelList[i].fpModel;
649 pModel -> SetModelingParameters (pMP);
651 pModel -> DescribeYourselfTo (*
this);
652 pModel -> SetModelingParameters (0);
676 #ifdef G4MULTITHREADED
682 const std::vector<const G4Event*>* events =
684 size_t nKeptEvents = 0;
685 if (events) nKeptEvents = events->size();
694 if (events && events->size()) event = events->back();
702 for (
const auto& event: *events) {
709 "WARNING: Cannot refresh events accumulated over more"
710 "\n than one runs. Refreshed just the last run."
732 const std::vector<G4Scene::Model>& EOEModelList =
733 fpScene -> GetEndOfEventModelList ();
734 size_t nModels = EOEModelList.size();
738 for (
size_t i = 0; i < nModels; i++) {
739 if (EOEModelList[i].fActive) {
740 G4VModel* pModel = EOEModelList[i].fpModel;
741 pModel -> SetModelingParameters(pMP);
743 pModel -> DescribeYourselfTo (*
this);
744 pModel -> SetModelingParameters(0);
754 const std::vector<G4Scene::Model>& EORModelList =
755 fpScene -> GetEndOfRunModelList ();
756 size_t nModels = EORModelList.size();
760 for (
size_t i = 0; i < nModels; i++) {
761 if (EORModelList[i].fActive) {
762 G4VModel* pModel = EORModelList[i].fpModel;
763 pModel -> SetModelingParameters(pMP);
765 pModel -> DescribeYourselfTo (*
this);
766 pModel -> SetModelingParameters(0);
801 G4bool reallyCullCovered =
830 return pModelingParams;
841 new G4Box(
"_sectioner", safe, safe, 1.e-5 * radius);
852 transform =
G4Rotate3D(angle, axis) * transform;
855 (
"_displaced_sectioning_box", sectionBox, transform);
895 const std::map<G4String,G4AttDef>* vaDefs =
906 const std::map<G4String,G4AttDef>* pvDefs = pPVModel->
GetAttDefs();
915 const std::map<G4String,G4AttDef>* trajModelDefs = trajModel->
GetAttDefs();
922 const std::map<G4String,G4AttDef>* trajDefs = traj->
GetAttDefs();
927 for (
G4int i = 0; i < nPoints; ++i) {
930 const std::map<G4String,G4AttDef>* pointDefs = trajPoint->
GetAttDefs();
943 const std::map<G4String,G4AttDef>* hitsDefs = hit->
GetAttDefs();
962 if (lineWidth < 1.) lineWidth = 1.;
963 lineWidth *=
fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
964 if (lineWidth < 1.) lineWidth = 1.;
974 fpViewer->GetViewParameters().GetDrawingStyle();
975 if (pVisAttribs -> IsForceDrawingStyle ()) {
977 pVisAttribs -> GetForcedDrawingStyle ();
980 switch (forcedStyle) {
1010 if (pVisAttribs -> IsForceAuxEdgeVisible()) {
1013 return isAuxEdgeVisible;
1022 fpViewer -> GetViewParameters().GetDefaultMarker();
1027 markerSizeType = world;
1030 size = userSpecified ?
1033 markerSizeType = screen;
1035 size *= fpViewer -> GetViewParameters().GetGlobalMarkerScale();
1036 if (markerSizeType == screen && size < 1.) size = 1.;
1049 if (lineSegmentsPerCircle < pVisAttribs->GetMinLineSegmentsPerCircle()) {
1052 "G4VSceneHandler::GetNoOfSides: attempt to set the"
1053 "\nnumber of line segements per circle < " << lineSegmentsPerCircle
1057 return lineSegmentsPerCircle;
1062 os <<
"Scene handler " << sh.
fName <<
" has "
1064 for (
size_t i = 0; i < sh.
fViewerList.size (); i++) {
1072 os <<
"\n This scene handler currently has no scene.";
virtual G4Polyhedron * GetPolyhedron() const
G4bool GetTransientsDrawnThisRun() const
Direction GetDirection() const
void SetWorldSize(G4double)
virtual void ClearStore()
virtual ~G4VSceneHandler()
void AddAtts(const std::vector< G4AttValue > *values, const std::map< G4String, G4AttDef > *defs)
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
virtual void AddSolid(const G4Box &)
static const G4VisExtent NullExtent
virtual G4VSolid * CreateSectionSolid()
MarkerType GetMarkerType() const
G4bool GetAutoPlacing() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4double GetVisibleDensity() const
virtual void BeginModeling()
G4ModelingParameters * CreateModelingParameters()
virtual void BeginPrimitives(const G4Transform3D &objectTransformation)
static G4VVisManager * GetConcreteInstance()
G4double GetWorldSize() const
G4double GetLineWidth() const
const G4Point3D & GetExplodeCentre() const
std::vector< ExP01TrackerHit * > a
std::vector< G4AttValue > * CreateCurrentAttValues() const
void SetEventRefreshing(G4bool)
void LoadAtts(const G4Visible &, G4AttHolder *)
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4bool IsCullingInvisible() const
G4double GetExplodeFactor() const
virtual G4VTrajectoryPoint * GetPoint(G4int i) const =0
void RemoveViewerFromList(G4VViewer *pView)
virtual void PostAddSolid()
const G4ViewParameters & GetViewParameters() const
const G4Transform3D & GetTransformation() const
G4bool IsDensityCulling() const
static G4double angle[DIM]
const G4String & GetName() const
const std::vector< const G4Event * > * GetEventVector() const
G4Transform3D fObjectTransformation
const G4Point3D & GetExtentCentre() const
HepGeom::Point3D< G4double > G4Point3D
HepGeom::Vector3D< G4double > G4Vector3D
const char * name(G4int ptype)
const G4VisAttributes * GetVisAttributes() const
G4int GetNoOfSides(const G4VisAttributes *)
virtual const G4VisExtent & GetExtent() const
G4bool GetRefreshAtEndOfEvent() const
virtual void AddPrimitive(const G4Polyline &)=0
const G4Run * GetCurrentRun() const
virtual G4VSolid * CreateCutawaySolid()
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4double GetScreenSize() const
G4VSceneHandler(G4VGraphicsSystem &system, G4int id, const G4String &name="")
virtual void DrawTrajectory() const
virtual std::vector< G4AttValue > * CreateAttValues() const
static double normal(HepRandomEngine *eptr)
void SetCutawaySolid(G4VSolid *pCutawaySolid)
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
static const G4Colour & GetCurrentTextColour()
static G4StateManager * GetStateManager()
G4double GetLineWidth(const G4VisAttributes *)
virtual int GetPointEntries() const =0
const G4int fSceneHandlerId
G4double GetExtentRadius() const
void AddViewerToList(G4VViewer *pView)
G4GLOB_DLL std::ostream G4cout
G4bool IsAuxEdgeVisible() const
static G4ScoringManager * GetScoringManagerIfExist()
const G4VisExtent & GetExtent() const
static G4int GetMinLineSegmentsPerCircle()
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
const G4Colour & GetColour()
void SetEvent(const G4Event *pEvent)
static G4MTRunManager * GetMasterRunManager()
G4bool GetRefreshAtEndOfRun() const
static G4VisManager * GetInstance()
const G4VHit * GetCurrentHit() const
virtual void EndModeling()
virtual void EndPrimitives()
void DrawEndOfRunModels()
G4bool IsCullingCovered() const
G4ApplicationState GetCurrentState() const
G4bool IsForcedAuxEdgeVisible() const
G4bool IsMultithreadedApplication()
std::ostream & operator<<(std::ostream &os, const G4VSceneHandler &sh)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
void SetVisAttributes(const G4VisAttributes *)
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation)
G4bool GetTransientsDrawnThisEvent() const
const std::vector< G4PhysicalVolumeNodeID > & GetFullPVPath() const
virtual void SetScene(G4Scene *)
G4int GetForcedLineSegmentsPerCircle() const
void SetSectionSolid(G4VSolid *pSectionSolid)
static G4RunManager * GetRunManager()
void SetVisAttributesModifiers(const std::vector< VisAttributesModifier > &)
const G4VisAttributes * fpVisAttribs
const G4String & GetName() const
G4bool fMarkForClearingTransientStore
virtual void AddCompound(const G4VTrajectory &)
const G4VTrajectory * GetCurrentTrajectory() const
virtual std::vector< G4AttValue > * CreateAttValues() const
void SetPosition(const G4Point3D &)
std::vector< G4AttValue > * CreateCurrentAttValues() const
const std::vector< G4AttValue > * CreateAttValues() const
void DrawEvent(const G4Event *)
G4double GetAnnotationSize() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4int GetNoOfSides() const
virtual void ProcessScene()
G4bool fTransientsDrawnThisEvent
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4double GetLength() const
G4ViewParameters::DrawingStyle GetDrawingStyle(const G4VisAttributes *)
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
static Verbosity GetVerbosity()
const G4Event * GetRequestedEvent() const
G4bool GetAuxEdgeVisible(const G4VisAttributes *)
MeshScoreMap GetScoreMap() const
DrawingStyle GetDrawingStyle() const
virtual void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &)
virtual std::vector< G4AttValue > * CreateAttValues() const
void SetExplodeFactor(G4double explodeFactor)
HepGeom::Plane3D< G4double > G4Plane3D
const G4Plane3D & GetSectionPlane() const
void SetForceAuxEdgeVisible(G4bool=true)
virtual void RequestPrimitives(const G4VSolid &solid)
std::vector< G4VViewer * >::iterator G4ViewerListIterator
static constexpr double halfpi
G4bool fReadyForTransients
void AddSolidWithAuxiliaryEdges(const T &solid)
void SetModel(G4VModel *)
size_t GetNumberOfMesh() const
const G4VisAttributes * GetDefaultVisAttributes() const
virtual void ClearTransientStore()
G4bool fTransientsDrawnThisRun
void SetExplodeCentre(const G4Point3D &explodeCentre)
G4VGraphicsSystem & fSystem
G4bool IsForceLineSegmentsPerCircle() const
const G4String & GetAnnotation() const
G4VScoringMesh * GetMesh(G4int i) const
G4Polyline & transform(const G4Transform3D &)
std::map< G4String, RunScore * > MeshScoreMap
virtual void EndPrimitives2D()
G4GLOB_DLL std::ostream G4cerr
void SetScreenSize(G4double)
void AddSolidT(const T &solid)
HepGeom::Normal3D< G4double > G4Normal3D
const G4Colour & GetTextColour(const G4Text &)