83 #ifdef G4MULTITHREADED
100 fMarkForClearingTransientStore (true),
104 fReadyForTransients (true),
105 fProcessingSolid (false),
106 fProcessing2D (false),
112 fpScene = pVMan -> GetCurrentScene ();
114 std::ostringstream ost;
140 return defaultExtent;
165 if (fNestingDepth > 1)
167 (
"G4VSceneHandler::BeginPrimitives",
169 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
170 fObjectTransformation = objectTransformation;
187 if (fNestingDepth > 1)
189 (
"G4VSceneHandler::BeginPrimitives2D",
191 "Nesting detected. It is illegal to nest Begin/EndPrimitives.");
192 fObjectTransformation = objectTransformation;
193 fProcessing2D =
true;
224 fpVisAttribs = fpViewer->GetApplicableVisAttributes(fpVisAttribs);
225 RequestPrimitives (solid);
232 fpVisAttribs = fpViewer->GetApplicableVisAttributes(fpVisAttribs);
234 if (!fpVisAttribs->IsForceAuxEdgeVisible()) {
239 visAttsWithAuxEdges = *fpVisAttribs;
242 fpVisAttribs = &visAttsWithAuxEdges;
244 RequestPrimitives (solid);
317 if (trajectoriesModel)
321 (
"G4VSceneHandler::AddCompound(const G4VTrajectory&)",
338 G4bool scoreMapHits =
false;
340 if (scoringManager) {
342 for (
size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
347 for(MeshScoreMap::const_iterator i = scoreMap.begin();
348 i != scoreMap.end(); ++i) {
350 if (scoreMapName == mapNam) {
353 mesh->
DrawMesh(scoreMapName, &colorMap);
364 "Scoring map drawn with default parameters."
365 "\n To get gMocren file for gMocren browser:"
366 "\n /vis/open gMocrenFile"
367 "\n /vis/viewer/flush"
368 "\n Many other options available with /score/draw... commands."
369 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
380 G4bool scoreMapHits =
false;
382 if (scoringManager) {
384 for (
size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
388 for(MeshScoreMap::const_iterator i = scoreMap.begin();
389 i != scoreMap.end(); ++i) {
392 if (foundHits == &hits) {
395 mesh->
DrawMesh(scoreMapName, &colorMap);
406 "Scoring map drawn with default parameters."
407 "\n To get gMocren file for gMocren browser:"
408 "\n /vis/open gMocrenFile"
409 "\n /vis/viewer/flush"
410 "\n Many other options available with /score/draw... commands."
411 "\n You might want to \"/vis/viewer/set/autoRefresh false\"."
429 const G4double oneMinusMargin (1. - margin);
435 const G4double halfLength(length / 2.);
436 const G4double tickLength(length / 20.);
448 G4Polyline scaleLine, tick11, tick12, tick21, tick22;
460 scaleLine.push_back(r1);
461 scaleLine.push_back(r2);
464 tick11.push_back(r1 + ticky);
465 tick11.push_back(r1 - ticky);
466 tick12.push_back(r1 + tickz);
467 tick12.push_back(r1 - tickz);
468 tick21.push_back(r2 + ticky);
469 tick21.push_back(r2 - ticky);
470 tick22.push_back(r2 + tickz);
471 tick22.push_back(r2 - tickz);
472 G4Point3D textPosition(0., tickLength, 0.);
492 sxmid = xmin + oneMinusMargin * (xmax - xmin);
493 symid = ymin + margin * (ymax -
ymin);
494 szmid = zmin + oneMinusMargin * (zmax - zmin);
507 transformation = translation * rotation;
523 text.SetVisAttributes(va);
533 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
544 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
553 for (
size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
572 (*i) -> SetNeedKernelVisit (
true);
590 "ERROR: G4VSceneHandler::RequestPrimitives"
591 "\n Polyhedron not available for " << solid.
GetName () <<
592 "\n Touchable path: ";
597 static G4bool explanation =
false;
601 "\n This means it cannot be visualized on most systems (try RayTracer)."
602 "\n 1) The solid may not have implemented the CreatePolyhedron method."
603 "\n 2) For Boolean solids, the BooleanProcessor, which attempts to create"
604 "\n the resultant polyhedron, may have failed.";
634 const std::vector<G4Scene::Model>& runDurationModelList =
635 fpScene -> GetRunDurationModelList ();
637 if (runDurationModelList.size ()) {
647 for (
size_t i = 0; i < runDurationModelList.size (); i++) {
648 if (runDurationModelList[i].fActive) {
649 G4VModel* pModel = runDurationModelList[i].fpModel;
654 pModel -> SetModelingParameters (pMP);
656 pModel -> DescribeYourselfTo (*
this);
657 pModel -> SetModelingParameters (0);
681 #ifdef G4MULTITHREADED
687 const std::vector<const G4Event*>* events =
689 size_t nKeptEvents = 0;
690 if (events) nKeptEvents = events->size();
699 if (events && events->size()) event = events->back();
707 for (
const auto& event: *events) {
714 "WARNING: Cannot refresh events accumulated over more"
715 "\n than one runs. Refreshed just the last run."
737 const std::vector<G4Scene::Model>& EOEModelList =
738 fpScene -> GetEndOfEventModelList ();
739 size_t nModels = EOEModelList.size();
743 for (
size_t i = 0; i < nModels; i++) {
744 if (EOEModelList[i].fActive) {
745 G4VModel* pModel = EOEModelList[i].fpModel;
746 pModel -> SetModelingParameters(pMP);
748 pModel -> DescribeYourselfTo (*
this);
749 pModel -> SetModelingParameters(0);
759 const std::vector<G4Scene::Model>& EORModelList =
760 fpScene -> GetEndOfRunModelList ();
761 size_t nModels = EORModelList.size();
765 for (
size_t i = 0; i < nModels; i++) {
766 if (EORModelList[i].fActive) {
767 G4VModel* pModel = EORModelList[i].fpModel;
768 pModel -> SetModelingParameters(pMP);
770 pModel -> DescribeYourselfTo (*
this);
771 pModel -> SetModelingParameters(0);
806 G4bool reallyCullCovered =
838 return pModelingParams;
849 new G4Box(
"_sectioner", safe, safe, 1.
e-5 * radius);
860 transform =
G4Rotate3D(angle, axis) * transform;
863 (
"_displaced_sectioning_box", sectionBox, transform);
903 const std::map<G4String,G4AttDef>* vaDefs =
914 const std::map<G4String,G4AttDef>* pvDefs = pPVModel->
GetAttDefs();
923 const std::map<G4String,G4AttDef>* trajModelDefs = trajModel->
GetAttDefs();
930 const std::map<G4String,G4AttDef>* trajDefs = traj->
GetAttDefs();
935 for (
G4int i = 0; i < nPoints; ++i) {
938 const std::map<G4String,G4AttDef>* pointDefs = trajPoint->
GetAttDefs();
951 const std::map<G4String,G4AttDef>* hitsDefs = hit->
GetAttDefs();
970 if (lineWidth < 1.) lineWidth = 1.;
971 lineWidth *=
fpViewer -> GetViewParameters().GetGlobalLineWidthScale();
972 if (lineWidth < 1.) lineWidth = 1.;
982 fpViewer->GetViewParameters().GetDrawingStyle();
983 if (pVisAttribs -> IsForceDrawingStyle ()) {
985 pVisAttribs -> GetForcedDrawingStyle ();
988 switch (forcedStyle) {
1018 if (pVisAttribs -> IsForceAuxEdgeVisible()) {
1021 return isAuxEdgeVisible;
1030 fpViewer -> GetViewParameters().GetDefaultMarker();
1035 markerSizeType = world;
1038 size = userSpecified ?
1041 markerSizeType = screen;
1043 size *= fpViewer -> GetViewParameters().GetGlobalMarkerScale();
1044 if (markerSizeType == screen && size < 1.) size = 1.;
1057 if (lineSegmentsPerCircle < pVisAttribs->GetMinLineSegmentsPerCircle()) {
1060 "G4VSceneHandler::GetNoOfSides: attempt to set the"
1061 "\nnumber of line segements per circle < " << lineSegmentsPerCircle
1065 return lineSegmentsPerCircle;
1070 os <<
"Scene handler " << sh.
fName <<
" has "
1072 for (
size_t i = 0; i < sh.
fViewerList.size (); i++) {
1080 os <<
"\n This scene handler currently has no scene.";
const G4String & GetName() const
void SetPosition(const G4Point3D &)
MeshScoreMap GetScoreMap() const
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
virtual const G4VisExtent & GetExtent() const
static G4MTRunManager * GetMasterRunManager()
static G4RunManager * GetRunManager()
const G4Run * GetCurrentRun() const
G4double GetExplodeFactor() const
G4VSceneHandler(G4VGraphicsSystem &system, G4int id, const G4String &name="")
G4bool GetAutoPlacing() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
void SetForceAuxEdgeVisible(G4bool=true)
G4Transform3D fObjectTransformation
virtual std::vector< G4AttValue > * CreateAttValues() const
std::vector< ExP01TrackerHit * > a
system("rm -rf microbeam.root")
const G4Colour & GetColour()
virtual void BeginPrimitives(const G4Transform3D &objectTransformation)
void AddSolidT(const T &solid)
size_t GetNumberOfMesh() const
std::ostream & operator<<(std::ostream &, const BasicVector3D< float > &)
void AddAtts(const std::vector< G4AttValue > *values, const std::map< G4String, G4AttDef > *defs)
G4bool GetTransientsDrawnThisRun() const
void SetExplodeCentre(const G4Point3D &explodeCentre)
virtual G4Polyhedron * GetPolyhedron() const
G4bool fReadyForTransients
virtual void ClearStore()
G4bool IsDensityCulling() const
static void ResetNumberOfRotationSteps()
const G4Plane3D & GetSectionPlane() const
G4double GetScreenSize() const
const G4Event * GetRequestedEvent() const
const G4VisAttributes * GetVisAttributes() const
virtual G4VSolid * CreateSectionSolid()
const G4VTrajectory * GetCurrentTrajectory() const
void SetCBDParameters(const std::vector< G4double > &)
virtual std::vector< G4AttValue > * CreateAttValues() const
static G4VisManager * GetInstance()
G4bool IsAuxEdgeVisible() const
G4ViewParameters::DrawingStyle GetDrawingStyle(const G4VisAttributes *)
static double normal(HepRandomEngine *eptr)
virtual void ClearTransientStore()
void SetWorldSize(G4double)
G4ModelingParameters * CreateModelingParameters()
void SetModel(G4VModel *)
void SetEvent(const G4Event *pEvent)
const G4ViewParameters & GetViewParameters() const
G4bool fMarkForClearingTransientStore
const G4Point3D & GetExtentCentre() const
G4Polyline & transform(const G4Transform3D &)
const G4Point3D & GetExplodeCentre() const
void DrawMesh(const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
const G4Colour & GetTextColour(const G4Text &)
const std::vector< G4PhysicalVolumeNodeID > & GetFullPVPath() const
G4bool IsForceLineSegmentsPerCircle() const
static void SetNumberOfRotationSteps(G4int n)
void LoadAtts(const G4Visible &, G4AttHolder *)
G4VGraphicsSystem & fSystem
virtual void ProcessScene()
const std::vector< G4double > & GetCBDParameters() const
static G4VVisManager * GetConcreteInstance()
void SetSectionSolid(G4VSolid *pSectionSolid)
virtual std::vector< G4AttValue > * CreateAttValues() const
G4int GetNoOfSides(const G4VisAttributes *)
void RemoveViewerFromList(G4VViewer *pView)
void SetExplodeFactor(G4double explodeFactor)
static G4int GetMinLineSegmentsPerCircle()
G4bool IsForcedAuxEdgeVisible() const
void SetScreenSize(G4double)
Direction GetDirection() const
virtual void AddCompound(const G4VTrajectory &)
const std::vector< G4AttValue > * CreateAttValues() const
G4bool GetRefreshAtEndOfEvent() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual void PostAddSolid()
G4int GetCBDAlgorithmNumber() const
static G4ScoringManager * GetScoringManagerIfExist()
virtual int GetPointEntries() const =0
virtual void BeginModeling()
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation)
void DrawEvent(const G4Event *)
HepGeom::Normal3D< G4double > G4Normal3D
G4double GetLineWidth() const
G4double GetWorldSize() const
const G4VisAttributes * GetDefaultVisAttributes() const
static constexpr double halfpi
virtual void SetScene(G4Scene *)
T dot(const BasicVector3D< T > &v) const
G4int GetNoOfSides() const
static Verbosity GetVerbosity()
G4double GetLength() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
G4bool IsCullingInvisible() const
G4double GetAnnotationSize() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual void EndModeling()
G4GLOB_DLL std::ostream G4cerr
void SetVisAttributesModifiers(const std::vector< VisAttributesModifier > &)
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
const G4VisAttributes * fpVisAttribs
virtual void PreAddSolid(const G4Transform3D &objectTransformation, const G4VisAttributes &)
G4bool GetRefreshAtEndOfRun() const
virtual void AddSolid(const G4Box &)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
DrawingStyle GetDrawingStyle() const
G4bool GetAuxEdgeVisible(const G4VisAttributes *)
G4bool fTransientsDrawnThisRun
G4bool IsMultithreadedApplication()
void AddSolidWithAuxiliaryEdges(const T &solid)
void SetEventRefreshing(G4bool)
G4bool GetTransientsDrawnThisEvent() const
G4ApplicationState GetCurrentState() const
virtual void AddPrimitive(const G4Polyline &)=0
virtual void DrawTrajectory() const
G4double GetExtentRadius() const
static const G4Colour & GetCurrentTextColour()
const std::vector< const G4Event * > * GetEventVector() const
void AddViewerToList(G4VViewer *pView)
G4GLOB_DLL std::ostream G4cout
std::vector< G4AttValue > * CreateCurrentAttValues() const
const G4VisExtent & GetExtent() const
G4VScoringMesh * GetMesh(G4int i) const
void SetCutawaySolid(G4VSolid *pCutawaySolid)
G4bool fTransientsDrawnThisEvent
const G4String & GetName() const
void SetCBDAlgorithmNumber(G4int)
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
G4bool IsCullingCovered() const
G4double GetVisibleDensity() const
virtual G4VSolid * CreateCutawaySolid()
std::vector< G4VViewer * >::iterator G4ViewerListIterator
HepGeom::Point3D< G4double > G4Point3D
G4double GetLineWidth(const G4VisAttributes *)
G4int GetForcedLineSegmentsPerCircle() const
void DrawEndOfRunModels()
MarkerType GetMarkerType() const
virtual void EndPrimitives2D()
virtual G4VTrajectoryPoint * GetPoint(G4int i) const =0
const G4VHit * GetCurrentHit() const
std::vector< G4AttValue > * CreateCurrentAttValues() const
void SetVisAttributes(const G4VisAttributes *)
virtual ~G4VSceneHandler()
virtual void EndPrimitives()
const G4int fSceneHandlerId
virtual void RequestPrimitives(const G4VSolid &solid)
const G4Transform3D & GetTransformation() const
static G4StateManager * GetStateManager()
std::map< G4String, RunScore * > MeshScoreMap
const G4String & GetAnnotation() const