Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VisManager Class Referenceabstract

#include <G4VisManager.hh>

+ Inheritance diagram for G4VisManager:

Classes

struct  UserVisAction
 

Public Types

enum  Verbosity {
  quiet , startup , errors , warnings ,
  confirmations , parameters , all
}
 

Public Member Functions

virtual ~G4VisManager ()
 
void Initialise ()
 
void Initialize ()
 
void RegisterRunDurationUserVisAction (const G4String &name, G4VUserVisAction *, const G4VisExtent &=G4VisExtent())
 
void RegisterEndOfEventUserVisAction (const G4String &name, G4VUserVisAction *, const G4VisExtent &=G4VisExtent())
 
void RegisterEndOfRunUserVisAction (const G4String &name, G4VUserVisAction *, const G4VisExtent &=G4VisExtent())
 
G4bool RegisterGraphicsSystem (G4VGraphicsSystem *)
 
void RegisterModelFactory (G4TrajDrawModelFactory *factory)
 
void RegisterModel (G4VTrajectoryModel *model)
 
void RegisterModelFactory (G4TrajFilterFactory *factory)
 
void RegisterModel (G4VFilter< G4VTrajectory > *filter)
 
void RegisterModelFactory (G4HitFilterFactory *factory)
 
void RegisterModel (G4VFilter< G4VHit > *filter)
 
void RegisterModelFactory (G4DigiFilterFactory *factory)
 
void RegisterModel (G4VFilter< G4VDigi > *filter)
 
void SelectTrajectoryModel (const G4String &model)
 
void RegisterMessenger (G4UImessenger *messenger)
 
void Draw (const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())
 
void Draw (const G4Polyhedron &, const G4Transform3D &objectTransformation=G4Transform3D())
 
void Draw (const G4Polyline &, const G4Transform3D &objectTransformation=G4Transform3D())
 
void Draw (const G4Polymarker &, const G4Transform3D &objectTransformation=G4Transform3D())
 
void Draw (const G4Square &, const G4Transform3D &objectTransformation=G4Transform3D())
 
void Draw (const G4Text &, const G4Transform3D &objectTransformation=G4Transform3D())
 
void Draw2D (const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())
 
void Draw2D (const G4Polyhedron &, const G4Transform3D &objectTransformation=G4Transform3D())
 
void Draw2D (const G4Polyline &, const G4Transform3D &objectTransformation=G4Transform3D())
 
void Draw2D (const G4Polymarker &, const G4Transform3D &objectTransformation=G4Transform3D())
 
void Draw2D (const G4Square &, const G4Transform3D &objectTransformation=G4Transform3D())
 
void Draw2D (const G4Text &, const G4Transform3D &objectTransformation=G4Transform3D())
 
void Draw (const G4VTrajectory &)
 
void Draw (const G4VHit &)
 
void Draw (const G4VDigi &)
 
void Draw (const G4LogicalVolume &, const G4VisAttributes &, const G4Transform3D &objectTransformation=G4Transform3D())
 
void Draw (const G4VPhysicalVolume &, const G4VisAttributes &, const G4Transform3D &objectTransformation=G4Transform3D())
 
void Draw (const G4VSolid &, const G4VisAttributes &, const G4Transform3D &objectTransformation=G4Transform3D())
 
void DrawGeometry (G4VPhysicalVolume *, const G4Transform3D &t=G4Transform3D())
 
void BeginDraw (const G4Transform3D &objectTransformation=G4Transform3D())
 
void EndDraw ()
 
void BeginDraw2D (const G4Transform3D &objectTransformation=G4Transform3D())
 
void EndDraw2D ()
 
void GeometryHasChanged ()
 
void IgnoreStateChanges (G4bool)
 
void NotifyHandlers ()
 
void DispatchToModel (const G4VTrajectory &)
 
G4bool FilterTrajectory (const G4VTrajectory &)
 
G4bool FilterHit (const G4VHit &)
 
G4bool FilterDigi (const G4VDigi &)
 
void CreateSceneHandler (const G4String &name="")
 
void CreateViewer (const G4String &name="", const G4String &XGeometry="")
 
void Enable ()
 
void Disable ()
 
G4bool IsEnabled () const
 
const G4VTrajectoryModelCurrentTrajDrawModel () const
 
const std::vector< UserVisAction > & GetRunDurationUserVisActions () const
 
const std::vector< UserVisAction > & GetEndOfEventUserVisActions () const
 
const std::vector< UserVisAction > & GetEndOfRunUserVisActions () const
 
const std::map< G4VUserVisAction *, G4VisExtent > & GetUserVisActionExtents () const
 
G4VGraphicsSystemGetCurrentGraphicsSystem () const
 
G4SceneGetCurrentScene () const
 
G4VSceneHandlerGetCurrentSceneHandler () const
 
G4VViewerGetCurrentViewer () const
 
const G4GraphicsSystemListGetAvailableGraphicsSystems ()
 
const G4SceneHandlerListGetAvailableSceneHandlers () const
 
const G4SceneListGetSceneList () const
 
G4bool GetTransientsDrawnThisRun () const
 
G4bool GetTransientsDrawnThisEvent () const
 
G4bool GetDrawEventOnlyIfToBeKept () const
 
const G4EventGetRequestedEvent () const
 
G4int GetNKeepRequests () const
 
G4bool GetReviewingKeptEvents () const
 
G4bool GetAbortReviewKeptEvents () const
 
G4bool GetReviewingPlots () const
 
G4bool GetAbortReviewPlots () const
 
const G4ViewParametersGetDefaultViewParameters () const
 
void SetCurrentGraphicsSystem (G4VGraphicsSystem *)
 
void SetCurrentScene (G4Scene *)
 
void SetCurrentSceneHandler (G4VSceneHandler *)
 
void SetCurrentViewer (G4VViewer *)
 
G4SceneHandlerListSetAvailableSceneHandlers ()
 
G4SceneListSetSceneList ()
 
void SetVerboseLevel (G4int)
 
void SetVerboseLevel (const G4String &)
 
void SetVerboseLevel (Verbosity)
 
void SetEventRefreshing (G4bool)
 
void ResetTransientsDrawnFlags ()
 
void SetTransientsDrawnThisRun (G4bool)
 
void SetTransientsDrawnThisEvent (G4bool)
 
void SetDrawEventOnlyIfToBeKept (G4bool)
 
void SetRequestedEvent (const G4Event *)
 
void SetReviewingKeptEvents (G4bool)
 
void SetAbortReviewKeptEvents (G4bool)
 
void SetReviewingPlots (G4bool)
 
void SetAbortReviewPlots (G4bool)
 
void SetDefaultViewParameters (const G4ViewParameters &)
 
G4String ViewerShortName (const G4String &viewerName) const
 
G4VViewerGetViewer (const G4String &viewerName) const
 
void PrintAvailableGraphicsSystems (Verbosity, std::ostream &=G4cout) const
 
- Public Member Functions inherited from G4VVisManager
 G4VVisManager ()
 
virtual ~G4VVisManager ()
 
virtual void Draw (const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void Draw (const G4Polyhedron &, const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void Draw (const G4Polyline &, const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void Draw (const G4Polymarker &, const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void Draw (const G4Square &, const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void Draw (const G4Text &, const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void Draw2D (const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void Draw2D (const G4Polyhedron &, const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void Draw2D (const G4Polyline &, const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void Draw2D (const G4Polymarker &, const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void Draw2D (const G4Square &, const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void Draw2D (const G4Text &, const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void Draw (const G4VTrajectory &)=0
 
virtual void Draw (const G4VHit &)=0
 
virtual void Draw (const G4VDigi &)=0
 
virtual void Draw (const G4LogicalVolume &, const G4VisAttributes &, const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void Draw (const G4VPhysicalVolume &, const G4VisAttributes &, const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void Draw (const G4VSolid &, const G4VisAttributes &, const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void DrawGeometry (G4VPhysicalVolume *, const G4Transform3D &t=G4Transform3D())
 
virtual void BeginDraw (const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void EndDraw ()=0
 
virtual void BeginDraw2D (const G4Transform3D &objectTransformation=G4Transform3D())=0
 
virtual void EndDraw2D ()=0
 
virtual void GeometryHasChanged ()=0
 
virtual void IgnoreStateChanges (G4bool)
 
virtual void NotifyHandlers ()
 
virtual void DispatchToModel (const G4VTrajectory &)=0
 
virtual G4bool FilterTrajectory (const G4VTrajectory &)=0
 
virtual G4bool FilterHit (const G4VHit &)=0
 
virtual G4bool FilterDigi (const G4VDigi &)=0
 

Static Public Member Functions

static G4VisManagerGetInstance ()
 
static Verbosity GetVerbosity ()
 
static Verbosity GetVerbosityValue (const G4String &)
 
static Verbosity GetVerbosityValue (G4int)
 
static G4String VerbosityString (Verbosity)
 
- Static Public Member Functions inherited from G4VVisManager
static G4VVisManagerGetConcreteInstance ()
 

Static Public Attributes

static std::vector< G4StringVerbosityGuidanceStrings
 

Protected Member Functions

 G4VisManager (const G4String &verbosityString="warnings")
 
virtual void RegisterGraphicsSystems ()=0
 
virtual void RegisterModelFactories ()
 
void RegisterMessengers ()
 

Protected Attributes

const G4int fVerbose
 

Friends

class G4VSceneHandler
 
class G4VViewer
 
class G4VisStateDependent
 
class G4VisCommandList
 
std::ostream & operator<< (std::ostream &, const G4VGraphicsSystem &)
 
std::ostream & operator<< (std::ostream &, const G4VSceneHandler &)
 

Additional Inherited Members

- Static Protected Member Functions inherited from G4VVisManager
static void SetConcreteInstance (G4VVisManager *)
 
- Static Protected Attributes inherited from G4VVisManager
static G4VVisManagerfpConcreteInstance = nullptr
 

Detailed Description

Definition at line 123 of file G4VisManager.hh.

Member Enumeration Documentation

◆ Verbosity

Enumerator
quiet 
startup 
errors 
warnings 
confirmations 
parameters 
all 

Definition at line 137 of file G4VisManager.hh.

137 {
138 quiet, // Nothing is printed.
139 startup, // Startup and endup messages are printed...
140 errors, // ...and errors...
141 warnings, // ...and warnings...
142 confirmations, // ...and confirming messages...
143 parameters, // ...and parameters of scenes and views...
144 all // ...and everything available.
145 };

Constructor & Destructor Documentation

◆ G4VisManager()

G4VisManager::G4VisManager ( const G4String verbosityString = "warnings")
protected

Definition at line 100 of file G4VisManager.cc.

101: fVerbose (1)
102, fInitialised (false)
103, fpGraphicsSystem (0)
104, fpScene (0)
105, fpSceneHandler (0)
106, fpViewer (0)
107, fpStateDependent (0)
108, fEventRefreshing (false)
109, fTransientsDrawnThisRun (false)
110, fTransientsDrawnThisEvent (false)
111, fNoOfEventsDrawnThisRun (0)
112, fNKeepRequests (0)
113, fEventKeepingSuspended (false)
114, fDrawEventOnlyIfToBeKept (false)
115, fpRequestedEvent (0)
116, fReviewingKeptEvents (false)
117, fAbortReviewKeptEvents (false)
118, fReviewingPlots (false)
119, fAbortReviewPlots (false)
120, fIsDrawGroup (false)
121, fDrawGroupNestingDepth (0)
122, fIgnoreStateChanges (false)
123#ifdef G4MULTITHREADED
124, fMaxEventQueueSize (100)
125, fWaitOnEventQueueFull (true)
126#endif
127// All other objects use default constructors.
128{
129 fpTrajDrawModelMgr = new G4VisModelManager<G4VTrajectoryModel>("/vis/modeling/trajectories");
130 fpTrajFilterMgr = new G4VisFilterManager<G4VTrajectory>("/vis/filtering/trajectories");
131 fpHitFilterMgr = new G4VisFilterManager<G4VHit>("/vis/filtering/hits");
132 fpDigiFilterMgr = new G4VisFilterManager<G4VDigi>("/vis/filtering/digi");
133
135 ("Simple graded message scheme - digit or string (1st character defines):");
137 (" 0) quiet, // Nothing is printed.");
139 (" 1) startup, // Startup and endup messages are printed...");
141 (" 2) errors, // ...and errors...");
143 (" 3) warnings, // ...and warnings...");
145 (" 4) confirmations, // ...and confirming messages...");
147 (" 5) parameters, // ...and parameters of scenes and views...");
149 (" 6) all // ...and everything available.");
150
151 if (fpInstance) {
153 ("G4VisManager::G4VisManager",
154 "visman0001", FatalException,
155 "Attempt to Construct more than one VisManager");
156 }
157
158 fpInstance = this;
160
161 fpStateDependent = new G4VisStateDependent (this);
162 // No need to delete this; G4StateManager does this.
163
164 fVerbosity = GetVerbosityValue(verbosityString);
165 if (fVerbosity >= startup) {
166 G4cout
167 << "Visualization Manager instantiating with verbosity \""
168 << VerbosityString(fVerbosity)
169 << "\"..." << G4endl;
170 }
171
172 // Note: The specific graphics systems must be instantiated in a
173 // higher level library to avoid circular dependencies. Also,
174 // some specifically need additional external libararies that the
175 // user must supply. Therefore we ask the user to implement
176 // RegisterGraphicsSystems() and RegisterModelFactories()
177 // in a subclass. We have to wait for the subclass to instantiate
178 // so RegisterGraphicsSystems() cannot be called from this
179 // constructor; it is called from Initialise(). So we ask the
180 // user:
181 // (a) to write a subclass and implement RegisterGraphicsSystems()
182 // and RegisterModelFactories(). See
183 // visualization/include/G4VisExecutive.hh/icc as an example.
184 // (b) instantiate the subclass.
185 // (c) invoke the Initialise() method of the subclass.
186 // For example:
187 // ...
188 // // Instantiate and initialise Visualization Manager.
189 // G4VisManager* visManager = new G4VisExecutive;
190 // visManager -> SetVerboseLevel (Verbose);
191 // visManager -> Initialise ();
192 // // (Don't forget to delete visManager;)
193 // ...
194
195 // Make top level command directory...
196 // vis commands should *not* be broadcast to workers
197 G4bool propagateToWorkers;
198 auto directory = new G4UIdirectory ("/vis/",propagateToWorkers=false);
199 directory -> SetGuidance ("Visualization commands.");
200 // Request commands in name order
201 directory -> Sort(); // Ordering propagates to sub-directories
202 fDirectoryList.push_back (directory);
203
204 // Instantiate *basic* top level commands so that they can be used
205 // immediately after instantiation of the vis manager. Other top
206 // level and lower level commands are instantiated later in
207 // RegisterMessengers.
208 G4VVisCommand::SetVisManager (this); // Sets shared pointer
211}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
bool G4bool
Definition: G4Types.hh:86
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static void SetVisManager(G4VisManager *pVisManager)
static void SetConcreteInstance(G4VVisManager *)
static std::vector< G4String > VerbosityGuidanceStrings
static G4String VerbosityString(Verbosity)
void RegisterMessenger(G4UImessenger *messenger)
friend class G4VisStateDependent
static Verbosity GetVerbosityValue(const G4String &)
const G4int fVerbose

◆ ~G4VisManager()

G4VisManager::~G4VisManager ( )
virtual

Definition at line 213 of file G4VisManager.cc.

214{
216 UImanager->SetCoutDestination(nullptr);
217 std::size_t i;
218 for (i = 0; i < fSceneList.size (); ++i) {
219 delete fSceneList[i];
220 }
221 for (i = 0; i < fAvailableSceneHandlers.size (); ++i) {
222 if (fAvailableSceneHandlers[i] != NULL) {
223 delete fAvailableSceneHandlers[i];
224 }
225 }
226 for (i = 0; i < fAvailableGraphicsSystems.size (); ++i) {
227 if (fAvailableGraphicsSystems[i]) {
228 delete fAvailableGraphicsSystems[i];
229 }
230 }
231 if (fVerbosity >= startup) {
232 G4cout << "Graphics systems deleted." << G4endl;
233 G4cout << "Visualization Manager deleting..." << G4endl;
234 }
235 for (i = 0; i < fMessengerList.size (); ++i) {
236 delete fMessengerList[i];
237 }
238 for (i = 0; i < fDirectoryList.size (); ++i) {
239 delete fDirectoryList[i];
240 }
241
242 delete fpDigiFilterMgr;
243 delete fpHitFilterMgr;
244 delete fpTrajFilterMgr;
245 delete fpTrajDrawModelMgr;
246 fpInstance = 0;
247}
void SetCoutDestination(G4UIsession *const value)
Definition: G4UImanager.cc:747
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77

Member Function Documentation

◆ BeginDraw()

void G4VisManager::BeginDraw ( const G4Transform3D objectTransformation = G4Transform3D())
virtual

Implements G4VVisManager.

Definition at line 900 of file G4VisManager.cc.

901{
902#ifdef G4MULTITHREADED
903 if (G4Threading::IsWorkerThread()) return;
904#endif
905 fDrawGroupNestingDepth++;
906 if (fDrawGroupNestingDepth > 1) {
908 ("G4VisManager::BeginDraw",
909 "visman0008", JustWarning,
910 "Nesting detected. It is illegal to nest Begin/EndDraw."
911 "\n Ignored");
912 return;
913 }
914 if (IsValidView ()) {
915 ClearTransientStoreIfMarked();
916 fpSceneHandler -> BeginPrimitives (objectTransform);
917 fIsDrawGroup = true;
918 }
919}
@ JustWarning
G4bool IsWorkerThread()
Definition: G4Threading.cc:123

◆ BeginDraw2D()

void G4VisManager::BeginDraw2D ( const G4Transform3D objectTransformation = G4Transform3D())
virtual

Implements G4VVisManager.

Definition at line 937 of file G4VisManager.cc.

938{
939#ifdef G4MULTITHREADED
940 if (G4Threading::IsWorkerThread()) return;
941#endif
942 fDrawGroupNestingDepth++;
943 if (fDrawGroupNestingDepth > 1) {
945 ("G4VisManager::BeginDraw2D",
946 "visman0009", JustWarning,
947 "Nesting detected. It is illegal to nest Begin/EndDraw2D."
948 "\n Ignored");
949 return;
950 }
951 if (IsValidView ()) {
952 ClearTransientStoreIfMarked();
953 fpSceneHandler -> BeginPrimitives2D (objectTransform);
954 fIsDrawGroup = true;
955 }
956}

◆ CreateSceneHandler()

void G4VisManager::CreateSceneHandler ( const G4String name = "")

Definition at line 1217 of file G4VisManager.cc.

1217 {
1218 if (!fInitialised) Initialise ();
1219 if (fpGraphicsSystem) {
1220 G4VSceneHandler* pSceneHandler =
1221 fpGraphicsSystem -> CreateSceneHandler (name);
1222 if (pSceneHandler) {
1223 fAvailableSceneHandlers.push_back (pSceneHandler);
1224 fpSceneHandler = pSceneHandler; // Make current.
1225 }
1226 else {
1227 if (fVerbosity >= errors) {
1228 G4warn << "ERROR in G4VisManager::CreateSceneHandler during "
1229 << fpGraphicsSystem -> GetName ()
1230 << " scene handler creation.\n No action taken."
1231 << G4endl;
1232 }
1233 }
1234 }
1235 else PrintInvalidPointers ();
1236}
#define G4warn
Definition: G4Scene.cc:41
void CreateSceneHandler(const G4String &name="")
void Initialise()

Referenced by CreateSceneHandler().

◆ CreateViewer()

void G4VisManager::CreateViewer ( const G4String name = "",
const G4String XGeometry = "" 
)

Definition at line 1238 of file G4VisManager.cc.

1240{
1241
1242 if (!fInitialised) Initialise ();
1243
1244 if (!fpSceneHandler) {
1245 PrintInvalidPointers ();
1246 return;
1247 }
1248
1249 G4VViewer* p = fpGraphicsSystem -> CreateViewer (*fpSceneHandler, name);
1250
1251 if (!p) {
1252 if (fVerbosity >= errors) {
1253 G4warn << "ERROR in G4VisManager::CreateViewer: null pointer during "
1254 << fpGraphicsSystem -> GetName ()
1255 << " viewer creation.\n No action taken."
1256 << G4endl;
1257 }
1258 return;
1259 }
1260
1261 if (p -> GetViewId() < 0) {
1262 if (fVerbosity >= errors) {
1263 G4warn << "ERROR in G4VisManager::CreateViewer during "
1264 << fpGraphicsSystem -> GetName ()
1265 << " viewer instantiation.\n No action taken."
1266 << G4endl;
1267 }
1268 return;
1269 }
1270
1271 // Viewer is created, now we can set geometry parameters
1272 // Before 12/2008, it was done in G4VViewer.cc but it did not have to be there!
1273
1274 G4ViewParameters initialvp = p -> GetViewParameters();
1275 initialvp.SetXGeometryString(XGeometry); //parse string and store parameters
1276 p -> SetViewParameters(initialvp);
1277 p -> Initialise (); // (Viewer itself may change view parameters further.)
1278 if (p -> GetViewId() < 0) {
1279 if (fVerbosity >= errors) {
1280 G4warn << "ERROR in G4VisManager::CreateViewer during "
1281 << fpGraphicsSystem -> GetName ()
1282 << " viewer initialisation.\n No action taken."
1283 << G4endl;
1284 }
1285 return;
1286 }
1287
1288 fpViewer = p; // Make current.
1289 fpSceneHandler -> AddViewerToList (fpViewer);
1290 fpSceneHandler -> SetCurrentViewer (fpViewer);
1291 if (fVerbosity >= confirmations) {
1292 G4cout << "G4VisManager::CreateViewer: new viewer created."
1293 << G4endl;
1294 }
1295
1296 const G4ViewParameters& vp = fpViewer->GetViewParameters();
1297 if (fVerbosity >= parameters) {
1298 G4cout << " view parameters are:\n " << vp << G4endl;
1299 }
1300
1301 if (vp.IsCulling () && vp.IsCullingInvisible ()) {
1302 static G4bool warned = false;
1303 if (fVerbosity >= confirmations) {
1304 if (!warned) {
1305 G4cout <<
1306 "NOTE: objects with visibility flag set to \"false\""
1307 " will not be drawn!"
1308 "\n \"/vis/viewer/set/culling global false\" to Draw such objects."
1309 "\n Also see other \"/vis/viewer/set\" commands."
1310 << G4endl;
1311 warned = true;
1312 }
1313 }
1314 }
1315 if (vp.IsCullingCovered ()) {
1316 static G4bool warned = false;
1317 if (fVerbosity >= warnings) {
1318 if (!warned) {
1319 G4warn <<
1320 "WARNING: covered objects in solid mode will not be rendered!"
1321 "\n \"/vis/viewer/set/culling coveredDaughters false\" to reverse this."
1322 "\n Also see other \"/vis/viewer/set\" commands."
1323 << G4endl;
1324 warned = true;
1325 }
1326 }
1327 }
1328}
const G4ViewParameters & GetViewParameters() const
void SetXGeometryString(const G4String &)
G4bool IsCulling() const
G4bool IsCullingInvisible() const
G4bool IsCullingCovered() const
void SetCurrentViewer(G4VViewer *)
void CreateViewer(const G4String &name="", const G4String &XGeometry="")

Referenced by CreateViewer().

◆ CurrentTrajDrawModel()

const G4VTrajectoryModel * G4VisManager::CurrentTrajDrawModel ( ) const

Definition at line 829 of file G4VisManager.cc.

830{
831 assert (0 != fpTrajDrawModelMgr);
832
833 const G4VTrajectoryModel* model = fpTrajDrawModelMgr->Current();
834
835 if (0 == model) {
836 // No model was registered with the trajectory model manager.
837 // Use G4TrajectoryDrawByCharge as a fallback.
838 fpTrajDrawModelMgr->Register(new G4TrajectoryDrawByCharge("DefaultModel"));
839 if (fVerbosity >= warnings) {
840 G4warn<<"G4VisManager: Using G4TrajectoryDrawByCharge as fallback trajectory model."<<G4endl;
841 G4warn<<"See commands in /vis/modeling/trajectories/ for other options."<<G4endl;
842 }
843 }
844
845 model = fpTrajDrawModelMgr->Current();
846 assert (0 != model); // Should definitely exist now
847
848 return model;
849}
const Model * Current() const
void Register(Model *)

Referenced by G4HepRepFileSceneHandler::BeginModeling(), and DispatchToModel().

◆ Disable()

void G4VisManager::Disable ( )

Definition at line 760 of file G4VisManager.cc.

760 {
762 if (fVerbosity >= confirmations) {
763 G4cout <<
764 "G4VisManager::Disable: visualization disabled."
765 "\n The pointer returned by GetConcreteInstance will be zero."
766 "\n Note that it will become enabled after some valid vis commands."
767 << G4endl;
768 }
769 if (fVerbosity >= warnings) {
770 G4int currentTrajectoryType =
772 if (currentTrajectoryType > 0) {
773 G4warn <<
774 "You may wish to disable trajectory production too:"
775 "\n \"/tracking/storeTrajectory 0\""
776 "\nbut don't forget to re-enable with"
777 "\n \"/vis/enable\""
778 "\n \"/tracking/storeTrajectory " << currentTrajectoryType
779 << "\"\n and maybe \"/vis/viewer/rebuild\""
780 << G4endl;
781 }
782 }
783}
int G4int
Definition: G4Types.hh:85
static G4RunManagerKernel * GetRunManagerKernel()
G4TrackingManager * GetTrackingManager() const
G4int GetStoreTrajectory() const

Referenced by G4VisCommandEnable::SetNewValue(), G4VisCommandReviewKeptEvents::SetNewValue(), G4VisCommandReviewPlots::SetNewValue(), and G4VisCommandPlot::SetNewValue().

◆ DispatchToModel()

void G4VisManager::DispatchToModel ( const G4VTrajectory trajectory)
virtual

Implements G4VVisManager.

Definition at line 1483 of file G4VisManager.cc.

1484{
1485 G4bool visible(true);
1486
1487 // See if trajectory passes filter
1488 G4bool passed = FilterTrajectory(trajectory);
1489
1490 if (!passed) {
1491 // Draw invisible trajectory if trajectory failed filter and
1492 // are filtering in soft mode
1493 if (fpTrajFilterMgr->GetMode() == FilterMode::Soft) visible = false;
1494 else {return;}
1495 }
1496
1497 // Go on to draw trajectory
1498 assert (0 != fpTrajDrawModelMgr);
1499
1500 const G4VTrajectoryModel* trajectoryModel = CurrentTrajDrawModel();
1501
1502 assert (0 != trajectoryModel); // Should exist
1503
1504 if (IsValidView()) {
1505 trajectoryModel->Draw(trajectory, visible);
1506 }
1507}
virtual void Draw(const G4VTrajectory &trajectory, const G4bool &visible=true) const =0
FilterMode::Mode GetMode() const
const G4VTrajectoryModel * CurrentTrajDrawModel() const
G4bool FilterTrajectory(const G4VTrajectory &)

◆ Draw() [1/12]

void G4VisManager::Draw ( const G4Circle circle,
const G4Transform3D objectTransformation = G4Transform3D() 
)
virtual

Implements G4VVisManager.

Definition at line 1020 of file G4VisManager.cc.

1022{
1023 DrawT (circle, objectTransform);
1024}

Referenced by Draw(), G4VVisCommand::DrawExtent(), and G4VisCommandsTouchable::SetNewValue().

◆ Draw() [2/12]

void G4VisManager::Draw ( const G4LogicalVolume logicalVol,
const G4VisAttributes attribs,
const G4Transform3D objectTransformation = G4Transform3D() 
)
virtual

Implements G4VVisManager.

Definition at line 1151 of file G4VisManager.cc.

1153 {
1154#ifdef G4MULTITHREADED
1155 if (G4Threading::IsWorkerThread()) return;
1156#endif
1157 // Find corresponding solid.
1158 G4VSolid* pSol = logicalVol.GetSolid ();
1159 Draw (*pSol, attribs, objectTransform);
1160}
G4VSolid * GetSolid() const
void Draw(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())

◆ Draw() [3/12]

void G4VisManager::Draw ( const G4Polyhedron polyhedron,
const G4Transform3D objectTransformation = G4Transform3D() 
)
virtual

Implements G4VVisManager.

Definition at line 1026 of file G4VisManager.cc.

1028{
1029 DrawT (polyhedron, objectTransform);
1030}

◆ Draw() [4/12]

void G4VisManager::Draw ( const G4Polyline line,
const G4Transform3D objectTransformation = G4Transform3D() 
)
virtual

Implements G4VVisManager.

Definition at line 1032 of file G4VisManager.cc.

1034{
1035 DrawT (line, objectTransform);
1036}

◆ Draw() [5/12]

void G4VisManager::Draw ( const G4Polymarker polymarker,
const G4Transform3D objectTransformation = G4Transform3D() 
)
virtual

Implements G4VVisManager.

Definition at line 1038 of file G4VisManager.cc.

1040{
1041 DrawT (polymarker, objectTransform);
1042}

◆ Draw() [6/12]

void G4VisManager::Draw ( const G4Square square,
const G4Transform3D objectTransformation = G4Transform3D() 
)
virtual

Implements G4VVisManager.

Definition at line 1044 of file G4VisManager.cc.

1046{
1047 DrawT (square, objectTransform);
1048}

◆ Draw() [7/12]

void G4VisManager::Draw ( const G4Text text,
const G4Transform3D objectTransformation = G4Transform3D() 
)
virtual

Implements G4VVisManager.

Definition at line 1050 of file G4VisManager.cc.

1052{
1053 DrawT (text, objectTransform);
1054}

◆ Draw() [8/12]

void G4VisManager::Draw ( const G4VDigi digi)
virtual

Implements G4VVisManager.

Definition at line 1106 of file G4VisManager.cc.

1106 {
1107#ifdef G4MULTITHREADED
1108 if (G4Threading::IsWorkerThread()) return;
1109#endif
1110 if (fIsDrawGroup) {
1111 fpSceneHandler -> AddCompound (digi);
1112 } else {
1113 if (IsValidView ()) {
1114 ClearTransientStoreIfMarked();
1115 fpSceneHandler -> AddCompound (digi);
1116 }
1117 }
1118}

◆ Draw() [9/12]

void G4VisManager::Draw ( const G4VHit hit)
virtual

Implements G4VVisManager.

Definition at line 1092 of file G4VisManager.cc.

1092 {
1093#ifdef G4MULTITHREADED
1094 if (G4Threading::IsWorkerThread()) return;
1095#endif
1096 if (fIsDrawGroup) {
1097 fpSceneHandler -> AddCompound (hit);
1098 } else {
1099 if (IsValidView ()) {
1100 ClearTransientStoreIfMarked();
1101 fpSceneHandler -> AddCompound (hit);
1102 }
1103 }
1104}

◆ Draw() [10/12]

void G4VisManager::Draw ( const G4VPhysicalVolume physicalVol,
const G4VisAttributes attribs,
const G4Transform3D objectTransformation = G4Transform3D() 
)
virtual

Implements G4VVisManager.

Definition at line 1182 of file G4VisManager.cc.

1184 {
1185#ifdef G4MULTITHREADED
1186 if (G4Threading::IsWorkerThread()) return;
1187#endif
1188 // Note: It is tempting to use a temporary model here, as for
1189 // trajectories, in order to get at the G4Atts of the physical
1190 // volume. I tried it (JA). But it's not easy to pass the
1191 // vis attributes. Also other aspects of the model seem not to
1192 // be properly set up. So, the idea has been abandoned for the time
1193 // being. The model pointer will be null. So when picking there
1194 // will be no G4Atts from this physical volume.
1195 //
1196 // If this is called from DrawHit, for example, the user may G4Atts to the
1197 // hit and these will be available with "/vis/scene/add/hits".
1198 //
1199 // Find corresponding logical volume and solid.
1200 G4LogicalVolume* pLV = physicalVol.GetLogicalVolume ();
1201 G4VSolid* pSol = pLV -> GetSolid ();
1202 Draw (*pSol, attribs, objectTransform);
1203}
G4LogicalVolume * GetLogicalVolume() const

◆ Draw() [11/12]

void G4VisManager::Draw ( const G4VSolid solid,
const G4VisAttributes attribs,
const G4Transform3D objectTransformation = G4Transform3D() 
)
virtual

Implements G4VVisManager.

Definition at line 1162 of file G4VisManager.cc.

1164 {
1165#ifdef G4MULTITHREADED
1166 if (G4Threading::IsWorkerThread()) return;
1167#endif
1168 if (fIsDrawGroup) {
1169 fpSceneHandler -> PreAddSolid (objectTransform, attribs);
1170 solid.DescribeYourselfTo (*fpSceneHandler);
1171 fpSceneHandler -> PostAddSolid ();
1172 } else {
1173 if (IsValidView ()) {
1174 ClearTransientStoreIfMarked();
1175 fpSceneHandler -> PreAddSolid (objectTransform, attribs);
1176 solid.DescribeYourselfTo (*fpSceneHandler);
1177 fpSceneHandler -> PostAddSolid ();
1178 }
1179 }
1180}
virtual void DescribeYourselfTo(G4VGraphicsScene &scene) const =0

◆ Draw() [12/12]

void G4VisManager::Draw ( const G4VTrajectory traj)
virtual

Implements G4VVisManager.

Definition at line 1120 of file G4VisManager.cc.

1120 {
1121#ifdef G4MULTITHREADED
1122 if (G4Threading::IsWorkerThread()) return;
1123#endif
1124 // A trajectory needs a trajectories model to provide G4Atts, etc.
1125 static G4TrajectoriesModel trajectoriesModel;
1126 trajectoriesModel.SetCurrentTrajectory(&traj);
1128 const G4Run* currentRun = runManager->GetCurrentRun();
1129 if (currentRun) {
1130 trajectoriesModel.SetRunID(currentRun->GetRunID());
1131 }
1132 const G4Event* currentEvent =
1134 if (currentEvent) {
1135 trajectoriesModel.SetEventID(currentEvent->GetEventID());
1136 }
1137 if (fIsDrawGroup) {
1138 fpSceneHandler -> SetModel (&trajectoriesModel);
1139 fpSceneHandler -> AddCompound (traj);
1140 fpSceneHandler -> SetModel (0);
1141 } else {
1142 if (IsValidView ()) {
1143 ClearTransientStoreIfMarked();
1144 fpSceneHandler -> SetModel (&trajectoriesModel);
1145 fpSceneHandler -> AddCompound (traj);
1146 fpSceneHandler -> SetModel (0);
1147 }
1148 }
1149}
const G4Event * GetConstCurrentEvent()
static G4EventManager * GetEventManager()
G4int GetEventID() const
Definition: G4Event.hh:118
static G4RunManager * GetMasterRunManager()
const G4Run * GetCurrentRun() const
Definition: G4Run.hh:49
G4int GetRunID() const
Definition: G4Run.hh:78
void SetCurrentTrajectory(const G4VTrajectory *pTraj)
void SetEventID(G4int eventID)
void SetRunID(G4int runID)

◆ Draw2D() [1/6]

void G4VisManager::Draw2D ( const G4Circle circle,
const G4Transform3D objectTransformation = G4Transform3D() 
)
virtual

Implements G4VVisManager.

Definition at line 1056 of file G4VisManager.cc.

1058{
1059 DrawT2D (circle, objectTransform);
1060}

◆ Draw2D() [2/6]

void G4VisManager::Draw2D ( const G4Polyhedron polyhedron,
const G4Transform3D objectTransformation = G4Transform3D() 
)
virtual

Implements G4VVisManager.

Definition at line 1062 of file G4VisManager.cc.

1064{
1065 DrawT2D (polyhedron, objectTransform);
1066}

◆ Draw2D() [3/6]

void G4VisManager::Draw2D ( const G4Polyline line,
const G4Transform3D objectTransformation = G4Transform3D() 
)
virtual

Implements G4VVisManager.

Definition at line 1068 of file G4VisManager.cc.

1070{
1071 DrawT2D (line, objectTransform);
1072}

◆ Draw2D() [4/6]

void G4VisManager::Draw2D ( const G4Polymarker polymarker,
const G4Transform3D objectTransformation = G4Transform3D() 
)
virtual

Implements G4VVisManager.

Definition at line 1074 of file G4VisManager.cc.

1076{
1077 DrawT2D (polymarker, objectTransform);
1078}

◆ Draw2D() [5/6]

void G4VisManager::Draw2D ( const G4Square square,
const G4Transform3D objectTransformation = G4Transform3D() 
)
virtual

Implements G4VVisManager.

Definition at line 1080 of file G4VisManager.cc.

1082{
1083 DrawT2D (square, objectTransform);
1084}

◆ Draw2D() [6/6]

void G4VisManager::Draw2D ( const G4Text text,
const G4Transform3D objectTransformation = G4Transform3D() 
)
virtual

Implements G4VVisManager.

Definition at line 1086 of file G4VisManager.cc.

1088{
1089 DrawT2D (text, objectTransform);
1090}

◆ DrawGeometry()

void G4VisManager::DrawGeometry ( G4VPhysicalVolume v,
const G4Transform3D t = G4Transform3D() 
)
virtual

Reimplemented from G4VVisManager.

Definition at line 1205 of file G4VisManager.cc.

1208{
1209 auto modelingParameters = fpSceneHandler->CreateModelingParameters();
1211 const G4bool useFullExtent = true;
1212 G4PhysicalVolumeModel aPVModel(v,depth,t,modelingParameters,useFullExtent);
1213 aPVModel.DescribeYourselfTo(*fpSceneHandler);
1214 delete modelingParameters;
1215}
G4ModelingParameters * CreateModelingParameters()

◆ Enable()

void G4VisManager::Enable ( )

Definition at line 725 of file G4VisManager.cc.

725 {
726 if (IsValidView ()) {
728 if (fVerbosity >= confirmations) {
729 G4cout << "G4VisManager::Enable: visualization enabled." << G4endl;
730 }
731 if (fVerbosity >= warnings) {
732 std::size_t nKeptEvents = 0;
734 if (run) nKeptEvents = run->GetEventVector()->size();
735 G4String isare("are"),plural("s");
736 if (nKeptEvents == 1) {isare = "is"; plural = "";}
737 G4cout <<
738 "There " << isare << ' ' << nKeptEvents << " kept event" << plural << '.'
739 << G4endl;
740 if (nKeptEvents > 0) {
741 G4cout <<
742 " \"/vis/reviewKeptEvents\" to review one by one."
743 "\n To see accumulated, \"/vis/enable\", then \"/vis/viewer/flush\" or \"/vis/viewer/rebuild\"."
744 << G4endl;
745 }
746 PrintListOfPlots();
747 }
748 }
749 else {
750 if (fVerbosity >= warnings) {
751 G4warn <<
752 "G4VisManager::Enable: WARNING: visualization remains disabled for"
753 "\n above reasons. Rectifying with valid vis commands will"
754 "\n automatically enable."
755 << G4endl;
756 }
757 }
758}
static G4RunManager * GetRunManager()
const std::vector< const G4Event * > * GetEventVector() const
Definition: G4Run.hh:96

Referenced by G4VisCommandEnable::SetNewValue(), G4VisCommandReviewKeptEvents::SetNewValue(), and G4VisCommandReviewPlots::SetNewValue().

◆ EndDraw()

void G4VisManager::EndDraw ( )
virtual

Implements G4VVisManager.

Definition at line 921 of file G4VisManager.cc.

922{
923#ifdef G4MULTITHREADED
924 if (G4Threading::IsWorkerThread()) return;
925#endif
926 fDrawGroupNestingDepth--;
927 if (fDrawGroupNestingDepth != 0) {
928 if (fDrawGroupNestingDepth < 0) fDrawGroupNestingDepth = 0;
929 return;
930 }
931 if (IsValidView ()) {
932 fpSceneHandler -> EndPrimitives ();
933 }
934 fIsDrawGroup = false;
935}

◆ EndDraw2D()

void G4VisManager::EndDraw2D ( )
virtual

Implements G4VVisManager.

Definition at line 958 of file G4VisManager.cc.

959{
960#ifdef G4MULTITHREADED
961 if (G4Threading::IsWorkerThread()) return;
962#endif
963 fDrawGroupNestingDepth--;
964 if (fDrawGroupNestingDepth != 0) {
965 if (fDrawGroupNestingDepth < 0) fDrawGroupNestingDepth = 0;
966 return;
967 }
968 if (IsValidView ()) {
969 fpSceneHandler -> EndPrimitives2D ();
970 }
971 fIsDrawGroup = false;
972}

◆ FilterDigi()

G4bool G4VisManager::FilterDigi ( const G4VDigi digi)
virtual

Implements G4VVisManager.

Definition at line 1478 of file G4VisManager.cc.

1479{
1480 return fpDigiFilterMgr->Accept(digi);
1481}
bool Accept(const T &)

◆ FilterHit()

G4bool G4VisManager::FilterHit ( const G4VHit hit)
virtual

Implements G4VVisManager.

Definition at line 1473 of file G4VisManager.cc.

1474{
1475 return fpHitFilterMgr->Accept(hit);
1476}

◆ FilterTrajectory()

G4bool G4VisManager::FilterTrajectory ( const G4VTrajectory trajectory)
virtual

Implements G4VVisManager.

Definition at line 1468 of file G4VisManager.cc.

1469{
1470 return fpTrajFilterMgr->Accept(trajectory);
1471}

Referenced by DispatchToModel().

◆ GeometryHasChanged()

void G4VisManager::GeometryHasChanged ( )
virtual

Implements G4VVisManager.

Definition at line 1330 of file G4VisManager.cc.

1330 {
1331 if (fVerbosity >= confirmations) {
1332 G4cout << "G4VisManager::GeometryHasChanged() called." << G4endl;
1333 }
1334
1335 // Change the world...
1336 G4VPhysicalVolume* pWorld =
1338 -> GetNavigatorForTracking () -> GetWorldVolume ();
1339 if (!pWorld) {
1340 if (fVerbosity >= warnings) {
1341 G4warn << "WARNING: There is no world volume!" << G4endl;
1342 }
1343 }
1344
1345 // Check scenes.
1346 G4SceneList& sceneList = fSceneList;
1347 std::size_t iScene, nScenes = sceneList.size ();
1348 for (iScene = 0; iScene < nScenes; ++iScene) {
1349 G4Scene* pScene = sceneList [iScene];
1350 std::vector<G4Scene::Model>& modelList = pScene -> SetRunDurationModelList ();
1351 if (modelList.size ()) {
1352 G4bool modelInvalid;
1353 do { // Remove, if required, one at a time.
1354 modelInvalid = false;
1355 std::vector<G4Scene::Model>::iterator iterModel;
1356 for (iterModel = modelList.begin();
1357 iterModel != modelList.end();
1358 ++iterModel) {
1359 modelInvalid = !(iterModel->fpModel->Validate(fVerbosity>=warnings));
1360 if (modelInvalid) {
1361 // Model invalid - remove and break.
1362 if (fVerbosity >= warnings) {
1363 G4warn << "WARNING: Model \""
1364 << iterModel->fpModel->GetGlobalDescription ()
1365 <<
1366 "\" is no longer valid - being removed\n from scene \""
1367 << pScene -> GetName () << "\""
1368 << G4endl;
1369 }
1370 modelList.erase (iterModel);
1371 break;
1372 }
1373 }
1374 } while (modelInvalid);
1375
1376 if (modelList.size () == 0) {
1377 if (fVerbosity >= warnings) {
1378 G4warn << "WARNING: No run-duration models left in this scene \""
1379 << pScene -> GetName ()
1380 << "\"."
1381 << G4endl;
1382 }
1383 if (pWorld) {
1384 if (fVerbosity >= warnings) {
1385 G4warn << " Adding current world to \""
1386 << pScene -> GetName ()
1387 << "\"."
1388 << G4endl;
1389 }
1390 pScene->AddRunDurationModel(new G4PhysicalVolumeModel(pWorld),fVerbosity>=warnings);
1391 // (The above includes a re-calculation of the extent.)
1393 ApplyCommand (G4String("/vis/scene/notifyHandlers " + pScene->GetName()));
1394 }
1395 }
1396 else {
1397 pScene->CalculateExtent(); // Recalculate extent
1399 ApplyCommand (G4String("/vis/scene/notifyHandlers " + pScene->GetName()));
1400 }
1401 }
1402 }
1403
1404 // Check the manager's current scene...
1405 if (fpScene && fpScene -> GetRunDurationModelList ().size () == 0) {
1406 if (fVerbosity >= warnings) {
1407 G4warn << "WARNING: The current scene \""
1408 << fpScene -> GetName ()
1409 << "\" has no run duration models."
1410 << "\n Use \"/vis/scene/add/volume\" or create a new scene."
1411 << G4endl;
1412 }
1413 // Clean up
1414 if (fpSceneHandler) {
1415 fpSceneHandler->ClearTransientStore();
1416 fpSceneHandler->ClearStore();
1417 if (fpViewer) {
1418 fpViewer->NeedKernelVisit();
1419 fpViewer->SetView();
1420 fpViewer->ClearView();
1421 fpViewer->FinishView();
1422 }
1423 }
1424 }
1425}
void CalculateExtent()
Definition: G4Scene.cc:64
G4bool AddRunDurationModel(G4VModel *, G4bool warn=false)
Definition: G4Scene.cc:160
const G4String & GetName() const
static G4TransportationManager * GetTransportationManager()
virtual void ClearTransientStore()
virtual void ClearStore()
void NeedKernelVisit()
Definition: G4VViewer.cc:80
virtual void FinishView()
Definition: G4VViewer.cc:103
virtual void ClearView()=0
virtual void SetView()=0

◆ GetAbortReviewKeptEvents()

G4bool G4VisManager::GetAbortReviewKeptEvents ( ) const

◆ GetAbortReviewPlots()

G4bool G4VisManager::GetAbortReviewPlots ( ) const

◆ GetAvailableGraphicsSystems()

const G4GraphicsSystemList & G4VisManager::GetAvailableGraphicsSystems ( )

Definition at line 785 of file G4VisManager.cc.

785 {
786 std::size_t nSystems = fAvailableGraphicsSystems.size ();
787 if (nSystems == 0) {
788 if (fVerbosity >= warnings) {
789 G4warn << "G4VisManager::GetAvailableGraphicsSystems: WARNING: no"
790 "\n graphics system available!"
791 "\n 1) Did you have environment variables G4VIS_BUILD_xxxx_DRIVER set"
792 "\n when you compiled/built the visualization code?"
793 "\n 2) Did you instantiate your own Visualization Manager and forget"
794 "\n to implement RegisterGraphicsSystems correctly?"
795 "\n 3) You can register your own graphics system, e.g.,"
796 "\n visManager->RegisterGraphicsSystem(new MyGraphicsSystem);)"
797 "\n after instantiating your vis manager and before"
798 "\n visManager->Initialize()."
799 << G4endl;
800 }
801 }
802 return fAvailableGraphicsSystems;
803}

◆ GetAvailableSceneHandlers()

const G4SceneHandlerList & G4VisManager::GetAvailableSceneHandlers ( ) const

◆ GetCurrentGraphicsSystem()

G4VGraphicsSystem * G4VisManager::GetCurrentGraphicsSystem ( ) const

◆ GetCurrentScene()

G4Scene * G4VisManager::GetCurrentScene ( ) const

Referenced by G4RayTracerSceneHandler::G4RayTracerSceneHandler(), G4VisCommandReviewKeptEvents::SetNewValue(), G4VisCommandReviewPlots::SetNewValue(), G4VisCommandDrawTree::SetNewValue(), G4VisCommandSceneActivateModel::SetNewValue(), G4VisCommandSceneEndOfEventAction::SetNewValue(), G4VisCommandSceneEndOfRunAction::SetNewValue(), G4VisCommandSceneRemoveModel::SetNewValue(), G4VisCommandSceneAddArrow::SetNewValue(), G4VisCommandSceneAddArrow2D::SetNewValue(), G4VisCommandSceneAddAxes::SetNewValue(), G4VisCommandSceneAddDate::SetNewValue(), G4VisCommandSceneAddDigis::SetNewValue(), G4VisCommandSceneAddEventID::SetNewValue(), G4VisCommandSceneAddExtent::SetNewValue(), G4VisCommandSceneAddElectricField::SetNewValue(), G4VisCommandSceneAddFrame::SetNewValue(), G4VisCommandSceneAddGPS::SetNewValue(), G4VisCommandSceneAddHits::SetNewValue(), G4VisCommandSceneAddLine::SetNewValue(), G4VisCommandSceneAddLine2D::SetNewValue(), G4VisCommandSceneAddLocalAxes::SetNewValue(), G4VisCommandSceneAddLogicalVolume::SetNewValue(), G4VisCommandSceneAddLogo::SetNewValue(), G4VisCommandSceneAddLogo2D::SetNewValue(), G4VisCommandSceneAddMagneticField::SetNewValue(), G4VisCommandSceneAddPSHits::SetNewValue(), G4VisCommandSceneAddScale::SetNewValue(), G4VisCommandSceneAddText::SetNewValue(), G4VisCommandSceneAddText2D::SetNewValue(), G4VisCommandSceneAddTrajectories::SetNewValue(), G4VisCommandSceneAddUserAction::SetNewValue(), G4VisCommandSceneAddVolume::SetNewValue(), G4VisCommandSceneAddPlotter::SetNewValue(), and G4VisCommandsTouchable::SetNewValue().

◆ GetCurrentSceneHandler()

◆ GetCurrentViewer()

◆ GetDefaultViewParameters()

◆ GetDrawEventOnlyIfToBeKept()

G4bool G4VisManager::GetDrawEventOnlyIfToBeKept ( ) const

◆ GetEndOfEventUserVisActions()

const std::vector< UserVisAction > & G4VisManager::GetEndOfEventUserVisActions ( ) const

◆ GetEndOfRunUserVisActions()

const std::vector< UserVisAction > & G4VisManager::GetEndOfRunUserVisActions ( ) const

◆ GetInstance()

◆ GetNKeepRequests()

G4int G4VisManager::GetNKeepRequests ( ) const

◆ GetRequestedEvent()

const G4Event * G4VisManager::GetRequestedEvent ( ) const

◆ GetReviewingKeptEvents()

G4bool G4VisManager::GetReviewingKeptEvents ( ) const

◆ GetReviewingPlots()

G4bool G4VisManager::GetReviewingPlots ( ) const

◆ GetRunDurationUserVisActions()

const std::vector< UserVisAction > & G4VisManager::GetRunDurationUserVisActions ( ) const

◆ GetSceneList()

const G4SceneList & G4VisManager::GetSceneList ( ) const

◆ GetTransientsDrawnThisEvent()

G4bool G4VisManager::GetTransientsDrawnThisEvent ( ) const

◆ GetTransientsDrawnThisRun()

G4bool G4VisManager::GetTransientsDrawnThisRun ( ) const

◆ GetUserVisActionExtents()

const std::map< G4VUserVisAction *, G4VisExtent > & G4VisManager::GetUserVisActionExtents ( ) const

◆ GetVerbosity()

G4VisManager::Verbosity G4VisManager::GetVerbosity ( )
static

Definition at line 2537 of file G4VisManager.cc.

2537 {
2538 return fVerbosity;
2539}

Referenced by G4GMocrenFileSceneHandler::AddPrimitive(), G4GMocrenFileSceneHandler::AddSolid(), G4GMocrenFileSceneHandler::BeginPrimitives(), G4DAWNFILESceneHandler::BeginSavingG4Prim(), G4GMocrenFileSceneHandler::BeginSavingGdd(), G4RayTracerSceneHandler::BuildVisAttsMap(), G4VVisCommand::CheckSceneAndNotifyHandlers(), G4VVisCommand::CheckView(), G4DAWNFILEViewer::ClearView(), G4GMocrenFileViewer::ClearView(), G4VRML2FileViewer::ClearView(), G4VRML2FileSceneHandler::closePort(), G4VRML2FileSceneHandler::connectPort(), G4VVisCommand::ConvertToColour(), G4VVisCommand::ConvertToDoublePair(), G4OpenGLXViewer::CreateGLXContext(), G4OpenGLXViewer::CreateMainWindow(), G4VSceneHandler::CreateModelingParameters(), G4VSceneHandler::Draw3DRectMeshAsDots(), G4VSceneHandler::Draw3DRectMeshAsSurfaces(), G4VSceneHandler::DrawTetMeshAsDots(), G4VSceneHandler::DrawTetMeshAsSurfaces(), G4DAWNFILEViewer::DrawView(), G4GMocrenFileViewer::DrawView(), G4ToolsSGOffscreenViewer::DrawView(), G4VRML2FileViewer::DrawView(), G4GMocrenFileSceneHandler::EndPrimitives(), G4DAWNFILESceneHandler::EndSavingG4Prim(), G4GMocrenFileSceneHandler::EndSavingGdd(), G4VRML2FileViewer::FinishView(), G4DAWNFILESceneHandler::FRBeginModeling(), G4OpenInventorQtViewer::G4OpenInventorQtViewer(), G4OpenInventorWinViewer::G4OpenInventorWinViewer(), G4OpenInventorXtExtendedViewer::G4OpenInventorXtExtendedViewer(), G4OpenInventorXtViewer::G4OpenInventorXtViewer(), G4GMocrenIO::getDetector(), GMocrenDetector::getEdge(), G4GMocrenIO::getShortDoseDist(), GMocrenTrack::getStep(), G4GMocrenIO::getTrack(), G4GMocrenFileSceneHandler::GFBeginModeling(), G4GMocrenFileSceneHandler::GFEndModeling(), G4GMocrenIO::mergeDoseDist(), GMocrenDataPrimitive< T >::operator+(), GMocrenDataPrimitive< T >::operator+=(), G4VSceneHandler::ProcessScene(), G4VVisCommand::ProvideValueOfUnit(), G4VVisCommand::RefreshIfRequired(), G4VSceneHandler::RequestPrimitives(), G4GMocrenIO::retrieveData(), G4GMocrenIO::retrieveData2(), G4GMocrenIO::retrieveData3(), G4GMocrenIO::retrieveData4(), G4DAWNFILEViewer::SendViewParameters(), G4VVisCommandGeometrySet::Set(), G4DAWNFILESceneHandler::SetG4PrimFileName(), G4GMocrenFileSceneHandler::SetGddFileName(), G4VVisCommandGeometrySet::SetLVVisAtts(), G4ToolsSGOffscreenViewer::Messenger::SetNewValue(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::Messenger::SetNewValue(), G4VisCommandDrawOnlyToBeKeptEvents::SetNewValue(), G4VisCommandReviewKeptEvents::SetNewValue(), G4VisCommandReviewPlots::SetNewValue(), G4VisCommandDrawTree::SetNewValue(), G4VisCommandDrawView::SetNewValue(), G4VisCommandDrawLogicalVolume::SetNewValue(), G4VisCommandDrawVolume::SetNewValue(), G4VisCommandSpecify::SetNewValue(), G4VisCommandGeometryList::SetNewValue(), G4VisCommandGeometryRestore::SetNewValue(), G4VisCommandGeometrySetDaughtersInvisible::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValue(), G4VisCommandSceneActivateModel::SetNewValue(), G4VisCommandSceneCreate::SetNewValue(), G4VisCommandSceneEndOfEventAction::SetNewValue(), G4VisCommandSceneEndOfRunAction::SetNewValue(), G4VisCommandSceneNotifyHandlers::SetNewValue(), G4VisCommandSceneRemoveModel::SetNewValue(), G4VisCommandSceneSelect::SetNewValue(), G4VisCommandSceneShowExtents::SetNewValue(), G4VisCommandSceneAddArrow::SetNewValue(), G4VisCommandSceneAddArrow2D::SetNewValue(), G4VisCommandSceneAddAxes::SetNewValue(), G4VisCommandSceneAddDate::SetNewValue(), G4VisCommandSceneAddDigis::SetNewValue(), G4VisCommandSceneAddEventID::SetNewValue(), G4VisCommandSceneAddExtent::SetNewValue(), G4VisCommandSceneAddElectricField::SetNewValue(), G4VisCommandSceneAddFrame::SetNewValue(), G4VisCommandSceneAddGPS::SetNewValue(), G4VisCommandSceneAddHits::SetNewValue(), G4VisCommandSceneAddLine::SetNewValue(), G4VisCommandSceneAddLine2D::SetNewValue(), G4VisCommandSceneAddLocalAxes::SetNewValue(), G4VisCommandSceneAddLogicalVolume::SetNewValue(), G4VisCommandSceneAddLogo::SetNewValue(), G4VisCommandSceneAddLogo2D::SetNewValue(), G4VisCommandSceneAddMagneticField::SetNewValue(), G4VisCommandSceneAddPSHits::SetNewValue(), G4VisCommandSceneAddScale::SetNewValue(), G4VisCommandSceneAddText::SetNewValue(), G4VisCommandSceneAddText2D::SetNewValue(), G4VisCommandSceneAddTrajectories::SetNewValue(), G4VisCommandSceneAddUserAction::SetNewValue(), G4VisCommandSceneAddVolume::SetNewValue(), G4VisCommandSceneAddPlotter::SetNewValue(), G4VisCommandSceneHandlerAttach::SetNewValue(), G4VisCommandSceneHandlerCreate::SetNewValue(), G4VisCommandSceneHandlerSelect::SetNewValue(), G4VisCommandSetArrow3DLineSegmentsPerCircle::SetNewValue(), G4VisCommandSetColour::SetNewValue(), G4VisCommandSetExtentForField::SetNewValue(), G4VisCommandSetLineWidth::SetNewValue(), G4VisCommandSetTextColour::SetNewValue(), G4VisCommandSetTextLayout::SetNewValue(), G4VisCommandSetTextSize::SetNewValue(), G4VisCommandSetTouchable::SetNewValue(), G4VisCommandSetVolumeForField::SetNewValue(), G4VisCommandsTouchable::SetNewValue(), G4VisCommandsTouchableSet::SetNewValue(), G4VisCommandViewerAddCutawayPlane::SetNewValue(), G4VisCommandViewerCentreOn::SetNewValue(), G4VisCommandViewerChangeCutawayPlane::SetNewValue(), G4VisCommandViewerClear::SetNewValue(), G4VisCommandViewerClearCutawayPlanes::SetNewValue(), G4VisCommandViewerClearTransients::SetNewValue(), G4VisCommandViewerClearVisAttributesModifiers::SetNewValue(), G4VisCommandViewerClone::SetNewValue(), G4VisCommandViewerColourByDensity::SetNewValue(), G4VisCommandViewerCopyViewFrom::SetNewValue(), G4VisCommandViewerCreate::SetNewValue(), G4VisCommandViewerDolly::SetNewValue(), G4VisCommandViewerFlush::SetNewValue(), G4VisCommandViewerInterpolate::SetNewValue(), G4VisCommandViewerPan::SetNewValue(), G4VisCommandViewerRebuild::SetNewValue(), G4VisCommandViewerRefresh::SetNewValue(), G4VisCommandViewerReset::SetNewValue(), G4VisCommandViewerResetCameraParameters::SetNewValue(), G4VisCommandViewerSave::SetNewValue(), G4VisCommandViewerScale::SetNewValue(), G4VisCommandViewerSelect::SetNewValue(), G4VisCommandViewerUpdate::SetNewValue(), G4VisCommandViewerZoom::SetNewValue(), G4VisCommandViewerDefaultHiddenEdge::SetNewValue(), G4VisCommandViewerDefaultStyle::SetNewValue(), G4VisCommandsViewerSet::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValueOnLV(), G4DAWNFILEViewer::SetView(), G4GMocrenFileViewer::SetView(), G4DAWNFILEViewer::ShowView(), G4GMocrenFileViewer::ShowView(), G4VRML2FileViewer::ShowView(), G4GMocrenIO::storeData3(), G4DAWNFILESceneHandler::~G4DAWNFILESceneHandler(), G4GMocrenFileSceneHandler::~G4GMocrenFileSceneHandler(), and G4VRML2FileSceneHandler::~G4VRML2FileSceneHandler().

◆ GetVerbosityValue() [1/2]

G4VisManager::Verbosity G4VisManager::GetVerbosityValue ( const G4String verbosityString)
static

Definition at line 2498 of file G4VisManager.cc.

2498 {
2499 G4String ss = G4StrUtil::to_lower_copy(verbosityString);
2500 Verbosity verbosity;
2501 if (ss[0] == 'q') verbosity = quiet;
2502 else if (ss[0] == 's') verbosity = startup;
2503 else if (ss[0] == 'e') verbosity = errors;
2504 else if (ss[0] == 'w') verbosity = warnings;
2505 else if (ss[0] == 'c') verbosity = confirmations;
2506 else if (ss[0] == 'p') verbosity = parameters;
2507 else if (ss[0] == 'a') verbosity = all;
2508 else {
2509 G4int intVerbosity;
2510 std::istringstream is(ss);
2511 is >> intVerbosity;
2512 if (!is) {
2513 G4warn << "ERROR: G4VisManager::GetVerbosityValue: invalid verbosity \""
2514 << verbosityString << "\"";
2515 for (std::size_t i = 0; i < VerbosityGuidanceStrings.size(); ++i) {
2516 G4warn << '\n' << VerbosityGuidanceStrings[i];
2517 }
2518 verbosity = warnings;
2519 G4warn << "\n Returning " << VerbosityString(verbosity)
2520 << G4endl;
2521 }
2522 else {
2523 verbosity = GetVerbosityValue(intVerbosity);
2524 }
2525 }
2526 return verbosity;
2527}
G4String to_lower_copy(G4String str)
Return lowercased copy of string.

Referenced by G4VisManager(), GetVerbosityValue(), G4VisCommandList::SetNewValue(), G4VisCommandVerbose::SetNewValue(), G4VisCommandSceneList::SetNewValue(), G4VisCommandSceneHandlerList::SetNewValue(), G4VisCommandViewerList::SetNewValue(), and SetVerboseLevel().

◆ GetVerbosityValue() [2/2]

G4VisManager::Verbosity G4VisManager::GetVerbosityValue ( G4int  intVerbosity)
static

Definition at line 2529 of file G4VisManager.cc.

2529 {
2530 Verbosity verbosity;
2531 if (intVerbosity < quiet) verbosity = quiet;
2532 else if (intVerbosity > all) verbosity = all;
2533 else verbosity = Verbosity(intVerbosity);
2534 return verbosity;
2535}

◆ GetViewer()

G4VViewer * G4VisManager::GetViewer ( const G4String viewerName) const

Definition at line 2459 of file G4VisManager.cc.

2459 {
2460 G4String viewerShortName = ViewerShortName (viewerName);
2461 std::size_t nHandlers = fAvailableSceneHandlers.size ();
2462 std::size_t iHandler, iViewer;
2463 G4VViewer* viewer = 0;
2464 G4bool found = false;
2465 for (iHandler = 0; iHandler < nHandlers; iHandler++) {
2466 G4VSceneHandler* sceneHandler = fAvailableSceneHandlers [iHandler];
2467 const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
2468 for (iViewer = 0; iViewer < viewerList.size (); iViewer++) {
2469 viewer = viewerList [iViewer];
2470 if (viewerShortName == viewer -> GetShortName ()) {
2471 found = true;
2472 break;
2473 }
2474 }
2475 if (found) break;
2476 }
2477 if (found) return viewer;
2478 else return 0;
2479}
G4String ViewerShortName(const G4String &viewerName) const

Referenced by G4VisCommandsViewerSet::SetNewValue().

◆ IgnoreStateChanges()

void G4VisManager::IgnoreStateChanges ( G4bool  val)
virtual

Reimplemented from G4VVisManager.

Definition at line 2675 of file G4VisManager.cc.

2676{
2677 fIgnoreStateChanges = val;
2678}

◆ Initialise()

void G4VisManager::Initialise ( )

Definition at line 258 of file G4VisManager.cc.

258 {
259
260 if (fInitialised && fVerbosity >= warnings) {
261 G4warn << "WARNING: G4VisManager::Initialise: already initialised."
262 << G4endl;
263 return;
264 }
265
266 if (fVerbosity >= startup) {
267 G4cout << "Visualization Manager initialising..." << G4endl;
268 }
269
270 if (fVerbosity >= parameters) {
271 G4cout <<
272 "\nYou have instantiated your own Visualization Manager, inheriting"
273 "\n G4VisManager and implementing RegisterGraphicsSystems(), in which"
274 "\n you should, normally, instantiate drivers which do not need"
275 "\n external packages or libraries, and, optionally, drivers under"
276 "\n control of environment variables."
277 "\n Also you should implement RegisterModelFactories()."
278 "\n See visualization/management/include/G4VisExecutive.hh/icc, for example."
279 "\n In your main() you will have something like:"
280 "\n G4VisManager* visManager = new G4VisExecutive;"
281 "\n visManager -> SetVerboseLevel (Verbose);"
282 "\n visManager -> Initialize ();"
283 "\n (Don't forget to delete visManager;)"
284 "\n"
285 << G4endl;
286 }
287
288 if (fVerbosity >= startup) {
289 G4cout << "Registering graphics systems..." << G4endl;
290 }
291
293
294 if (fVerbosity >= startup) {
295 G4cout <<
296 "\nYou have successfully registered the following graphics systems."
297 << G4endl;
299 G4cout << G4endl;
300 }
301
302 // Make command directories for commands instantiated in the
303 // modeling subcategory...
304 G4UIcommand* directory;
305 directory = new G4UIdirectory ("/vis/modeling/");
306 directory -> SetGuidance ("Modeling commands.");
307 fDirectoryList.push_back (directory);
308 directory = new G4UIdirectory ("/vis/modeling/trajectories/");
309 directory -> SetGuidance ("Trajectory model commands.");
310 fDirectoryList.push_back (directory);
311 directory = new G4UIdirectory ("/vis/modeling/trajectories/create/");
312 directory -> SetGuidance ("Create trajectory models and messengers.");
313 fDirectoryList.push_back (directory);
314
315 // Filtering command directory
316 directory = new G4UIdirectory ("/vis/filtering/");
317 directory -> SetGuidance ("Filtering commands.");
318 fDirectoryList.push_back (directory);
319 directory = new G4UIdirectory ("/vis/filtering/trajectories/");
320 directory -> SetGuidance ("Trajectory filtering commands.");
321 fDirectoryList.push_back (directory);
322 directory = new G4UIdirectory ("/vis/filtering/trajectories/create/");
323 directory -> SetGuidance ("Create trajectory filters and messengers.");
324 fDirectoryList.push_back (directory);
325 directory = new G4UIdirectory ("/vis/filtering/hits/");
326 directory -> SetGuidance ("Hit filtering commands.");
327 fDirectoryList.push_back (directory);
328 directory = new G4UIdirectory ("/vis/filtering/hits/create/");
329 directory -> SetGuidance ("Create hit filters and messengers.");
330 fDirectoryList.push_back (directory);
331 directory = new G4UIdirectory ("/vis/filtering/digi/");
332 directory -> SetGuidance ("Digi filtering commands.");
333 fDirectoryList.push_back (directory);
334 directory = new G4UIdirectory ("/vis/filtering/digi/create/");
335 directory -> SetGuidance ("Create digi filters and messengers.");
336 fDirectoryList.push_back (directory);
337
339
340 if (fVerbosity >= startup) {
341 G4cout << "Registering model factories..." << G4endl;
342 }
343
345
346 if (fVerbosity >= startup) {
347 G4cout <<
348 "\nYou have successfully registered the following model factories."
349 << G4endl;
350 PrintAvailableModels (fVerbosity);
351 G4cout << G4endl;
352 }
353
354 if (fVerbosity >= startup) {
355 PrintAvailableUserVisActions (fVerbosity);
356 G4cout << G4endl;
357 }
358
359 InitialiseG4ColourMap();
360
361 if (fVerbosity >= startup) {
362 G4cout <<
363 "Some /vis commands (optionally) take a string to specify colour."
364 "\n\"/vis/list\" to see available colours."
365 << G4endl;
366 }
367
368 fInitialised = true;
369}
void PrintAvailableGraphicsSystems(Verbosity, std::ostream &=G4cout) const
virtual void RegisterGraphicsSystems()=0
virtual void RegisterModelFactories()
void RegisterMessengers()

Referenced by CreateSceneHandler(), and CreateViewer().

◆ Initialize()

void G4VisManager::Initialize ( )

◆ IsEnabled()

G4bool G4VisManager::IsEnabled ( ) const

◆ NotifyHandlers()

void G4VisManager::NotifyHandlers ( )
virtual

Reimplemented from G4VVisManager.

Definition at line 1427 of file G4VisManager.cc.

1427 {
1428
1429 if (fVerbosity >= confirmations) {
1430 G4cout << "G4VisManager::NotifyHandler() called." << G4endl;
1431 }
1432
1433 if (IsValidView()) {
1434
1435 // Check scenes.
1436 G4SceneList& sceneList = fSceneList;
1437 std::size_t iScene, nScenes = sceneList.size ();
1438 for (iScene = 0; iScene < nScenes; ++iScene) {
1439 G4Scene* pScene = sceneList [iScene];
1440 std::vector<G4Scene::Model>& modelList = pScene -> SetRunDurationModelList ();
1441
1442 if (modelList.size ()) {
1443 pScene->CalculateExtent();
1445 ApplyCommand (G4String("/vis/scene/notifyHandlers " + pScene->GetName()));
1446 }
1447 }
1448
1449 // Check the manager's current scene...
1450 if (fpScene && fpScene -> GetRunDurationModelList ().size () == 0) {
1451 if (fVerbosity >= warnings) {
1452 G4warn << "WARNING: The current scene \""
1453 << fpScene -> GetName ()
1454 << "\" has no run duration models."
1455 << "\n Use \"/vis/scene/add/volume\" or create a new scene."
1456 << G4endl;
1457 }
1458 fpSceneHandler->ClearTransientStore();
1459 fpSceneHandler->ClearStore();
1460 fpViewer->NeedKernelVisit();
1461 fpViewer->SetView();
1462 fpViewer->ClearView();
1463 fpViewer->FinishView();
1464 }
1465 }
1466}

◆ PrintAvailableGraphicsSystems()

void G4VisManager::PrintAvailableGraphicsSystems ( Verbosity  verbosity,
std::ostream &  out = G4cout 
) const

Definition at line 1717 of file G4VisManager.cc.

1719{
1720 out << "Registered graphics systems are:\n";
1721 if (fAvailableGraphicsSystems.size ()) {
1722 for (const auto& gs: fAvailableGraphicsSystems) {
1723 const G4String& name = gs->GetName();
1724 const std::vector<G4String>& nicknames = gs->GetNicknames();
1725 if (verbosity <= warnings) {
1726 // Brief output
1727 out << " " << name << " (";
1728 for (std::size_t i = 0; i < nicknames.size(); ++i) {
1729 if (i != 0) {
1730 out << ", ";
1731 }
1732 out << nicknames[i];
1733 }
1734 out << ')';
1735 } else {
1736 // Full output
1737 out << *gs;
1738 }
1739 out << G4endl;
1740 }
1741 } else {
1742 out << " NONE!!! None registered - yet! Mmmmm!" << G4endl;
1743 }
1744}
const char * name(G4int ptype)

Referenced by Initialise(), G4VisCommandList::SetNewValue(), G4VisCommandOpen::SetNewValue(), and G4VisCommandSceneHandlerCreate::SetNewValue().

◆ RegisterEndOfEventUserVisAction()

void G4VisManager::RegisterEndOfEventUserVisAction ( const G4String name,
G4VUserVisAction pVisAction,
const G4VisExtent extent = G4VisExtent() 
)

Definition at line 1530 of file G4VisManager.cc.

1533 {
1534 fEndOfEventUserVisActions.push_back(UserVisAction(name,pVisAction));
1535 if (extent.GetExtentRadius() > 0.) {
1536 fUserVisActionExtents[pVisAction] = extent;
1537 } else {
1538 if (fVerbosity >= warnings) {
1539 G4warn <<
1540 "WARNING: No extent set for user vis action \"" << name << "\"."
1541 << G4endl;
1542 }
1543 }
1544 if (fVerbosity >= confirmations) {
1545 G4cout
1546 << "End of event user vis action \"" << name << "\" registered"
1547 << G4endl;
1548 }
1549}
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:75

◆ RegisterEndOfRunUserVisAction()

void G4VisManager::RegisterEndOfRunUserVisAction ( const G4String name,
G4VUserVisAction pVisAction,
const G4VisExtent extent = G4VisExtent() 
)

Definition at line 1551 of file G4VisManager.cc.

1554 {
1555 fEndOfRunUserVisActions.push_back(UserVisAction(name,pVisAction));
1556 if (extent.GetExtentRadius() > 0.) {
1557 fUserVisActionExtents[pVisAction] = extent;
1558 } else {
1559 if (fVerbosity >= warnings) {
1560 G4warn <<
1561 "WARNING: No extent set for user vis action \"" << name << "\"."
1562 << G4endl;
1563 }
1564 }
1565 if (fVerbosity >= confirmations) {
1566 G4cout
1567 << "End of run user vis action \"" << name << "\" registered"
1568 << G4endl;
1569 }
1570}

◆ RegisterGraphicsSystem()

G4bool G4VisManager::RegisterGraphicsSystem ( G4VGraphicsSystem pSystem)

Definition at line 805 of file G4VisManager.cc.

805 {
806 G4bool happy = true;
807 if (pSystem) {
808 fAvailableGraphicsSystems.push_back (pSystem);
809 if (fVerbosity >= confirmations) {
810 G4cout << "G4VisManager::RegisterGraphicsSystem: "
811 << pSystem -> GetName ();
812 if (pSystem -> GetNickname () != "") {
813 G4cout << " (" << pSystem -> GetNickname () << ")";
814 }
815 G4cout << " registered." << G4endl;
816 }
817 }
818 else {
819 if (fVerbosity >= errors) {
820 G4warn << "G4VisManager::RegisterGraphicsSystem: null pointer!"
821 << G4endl;
822 }
823 happy=false;
824 }
825 return happy;
826}

◆ RegisterGraphicsSystems()

virtual void G4VisManager::RegisterGraphicsSystems ( )
protectedpure virtual

Referenced by Initialise().

◆ RegisterMessenger()

void G4VisManager::RegisterMessenger ( G4UImessenger messenger)

Referenced by G4VisManager(), and RegisterMessengers().

◆ RegisterMessengers()

void G4VisManager::RegisterMessengers ( )
protected

Definition at line 465 of file G4VisManager.cc.

465 {
466
467 // Instantiate individual messengers/commands (often - but not
468 // always - one command per messenger).
469
470 G4UIcommand* directory;
471
472 directory = new G4UIdirectory ("/vis/geometry/");
473 directory -> SetGuidance("Operations on vis attributes of Geant4 geometry.");
474 fDirectoryList.push_back (directory);
477
478 directory = new G4UIdirectory ("/vis/geometry/set/");
479 directory -> SetGuidance("Set vis attributes of Geant4 geometry.");
480 fDirectoryList.push_back (directory);
491
492#ifdef G4MULTITHREADED
493 directory = new G4UIdirectory ("/vis/multithreading/");
494 directory -> SetGuidance("Commands unique to multithreading mode.");
495 fDirectoryList.push_back (directory);
496 RegisterMessenger(new G4VisCommandMultithreadingActionOnEventQueueFull);
497 RegisterMessenger(new G4VisCommandMultithreadingMaxEventQueueSize);
498#endif
499
500 directory = new G4UIdirectory ("/vis/set/");
501 directory -> SetGuidance
502 ("Set quantities for use in future commands where appropriate.");
503 fDirectoryList.push_back (directory);
513
514 directory = new G4UIdirectory ("/vis/scene/");
515 directory -> SetGuidance ("Operations on Geant4 scenes.");
516 fDirectoryList.push_back (directory);
526
527 directory = new G4UIdirectory ("/vis/scene/add/");
528 directory -> SetGuidance ("Add model to current scene.");
529 fDirectoryList.push_back (directory);
556
557 RegisterMessenger(new G4VisCommandPlotterCreate);
558 RegisterMessenger(new G4VisCommandPlotterSetLayout);
559 RegisterMessenger(new G4VisCommandPlotterAddStyle);
560 RegisterMessenger(new G4VisCommandPlotterAddRegionStyle);
561 RegisterMessenger(new G4VisCommandPlotterAddRegionParameter);
562 RegisterMessenger(new G4VisCommandPlotterClear);
563 RegisterMessenger(new G4VisCommandPlotterClearRegion);
564 RegisterMessenger(new G4VisCommandPlotterList);
565 RegisterMessenger(new G4VisCommandPlotterAddRegionH1);
566 RegisterMessenger(new G4VisCommandPlotterAddRegionH2);
567
568 directory = new G4UIdirectory ("/vis/sceneHandler/");
569 directory -> SetGuidance ("Operations on Geant4 scene handlers.");
570 fDirectoryList.push_back (directory);
575
576 directory = new G4UIdirectory ("/vis/touchable/");
577 directory -> SetGuidance ("Operations on touchables.");
578 fDirectoryList.push_back (directory);
580
581 directory = new G4UIdirectory ("/vis/touchable/set/");
582 directory -> SetGuidance ("Set vis attributes of current touchable.");
583 fDirectoryList.push_back (directory);
585
586 directory = new G4UIdirectory ("/vis/viewer/");
587 directory -> SetGuidance ("Operations on Geant4 viewers.");
588 fDirectoryList.push_back (directory);
614
615 directory = new G4UIdirectory ("/vis/viewer/default/");
616 directory -> SetGuidance("Set default values for future viewers.");
617 fDirectoryList.push_back (directory);
620
621 directory = new G4UIdirectory ("/vis/viewer/set/");
622 directory -> SetGuidance ("Set view parameters of current viewer.");
623 fDirectoryList.push_back (directory);
625
626 // *Basic* top level commands were instantiated in the constructor
627 // so that they can be used immediately after instantiation of the
628 // vis manager. Other top level commands, including "compound commands"
629 // (i.e., commands that invoke other commands) are instantiated here.
630
645
646 // List manager commands
648 (fpTrajDrawModelMgr, fpTrajDrawModelMgr->Placement()));
650 (fpTrajDrawModelMgr, fpTrajDrawModelMgr->Placement()));
651
652 // Trajectory filter manager commands
654 (fpTrajFilterMgr, fpTrajFilterMgr->Placement()));
656 (fpTrajFilterMgr, fpTrajFilterMgr->Placement()));
657
658 // Hit filter manager commands
660 (fpHitFilterMgr, fpHitFilterMgr->Placement()));
662 (fpHitFilterMgr, fpHitFilterMgr->Placement()));
663
664 // Digi filter manager commands
666 (fpDigiFilterMgr, fpDigiFilterMgr->Placement()));
668 (fpDigiFilterMgr, fpDigiFilterMgr->Placement()));
669}
G4String Placement() const
G4String Placement() const

Referenced by Initialise().

◆ RegisterModel() [1/4]

void G4VisManager::RegisterModel ( G4VFilter< G4VDigi > *  filter)

Definition at line 884 of file G4VisManager.cc.

885{
886 fpDigiFilterMgr->Register(model);
887}

◆ RegisterModel() [2/4]

void G4VisManager::RegisterModel ( G4VFilter< G4VHit > *  filter)

Definition at line 873 of file G4VisManager.cc.

874{
875 fpHitFilterMgr->Register(model);
876}

◆ RegisterModel() [3/4]

void G4VisManager::RegisterModel ( G4VFilter< G4VTrajectory > *  filter)

Definition at line 862 of file G4VisManager.cc.

863{
864 fpTrajFilterMgr->Register(model);
865}

◆ RegisterModel() [4/4]

void G4VisManager::RegisterModel ( G4VTrajectoryModel model)

Definition at line 851 of file G4VisManager.cc.

852{
853 fpTrajDrawModelMgr->Register(model);
854}

◆ RegisterModelFactories()

void G4VisManager::RegisterModelFactories ( )
protectedvirtual

Definition at line 2659 of file G4VisManager.cc.

2660{
2661 if (fVerbosity >= warnings) {
2662 G4warn<<"G4VisManager: No model factories registered with G4VisManager."<<G4endl;
2663 G4warn<<"G4VisManager::RegisterModelFactories() should be overridden in derived"<<G4endl;
2664 G4warn<<"class. See G4VisExecutive for an example."<<G4endl;
2665 }
2666}

Referenced by Initialise().

◆ RegisterModelFactory() [1/4]

void G4VisManager::RegisterModelFactory ( G4DigiFilterFactory factory)

Definition at line 890 of file G4VisManager.cc.

891{
892 fpDigiFilterMgr->Register(factory);
893}

◆ RegisterModelFactory() [2/4]

void G4VisManager::RegisterModelFactory ( G4HitFilterFactory factory)

Definition at line 879 of file G4VisManager.cc.

880{
881 fpHitFilterMgr->Register(factory);
882}

◆ RegisterModelFactory() [3/4]

void G4VisManager::RegisterModelFactory ( G4TrajDrawModelFactory factory)

Definition at line 857 of file G4VisManager.cc.

858{
859 fpTrajDrawModelMgr->Register(factory);
860}

◆ RegisterModelFactory() [4/4]

void G4VisManager::RegisterModelFactory ( G4TrajFilterFactory factory)

Definition at line 868 of file G4VisManager.cc.

869{
870 fpTrajFilterMgr->Register(factory);
871}

◆ RegisterRunDurationUserVisAction()

void G4VisManager::RegisterRunDurationUserVisAction ( const G4String name,
G4VUserVisAction pVisAction,
const G4VisExtent extent = G4VisExtent() 
)

Definition at line 1509 of file G4VisManager.cc.

1512 {
1513 fRunDurationUserVisActions.push_back(UserVisAction(name,pVisAction));
1514 if (extent.GetExtentRadius() > 0.) {
1515 fUserVisActionExtents[pVisAction] = extent;
1516 } else {
1517 if (fVerbosity >= warnings) {
1518 G4warn <<
1519 "WARNING: No extent set for user vis action \"" << name << "\"."
1520 << G4endl;
1521 }
1522 }
1523 if (fVerbosity >= confirmations) {
1524 G4cout
1525 << "Run duration user vis action \"" << name << "\" registered"
1526 << G4endl;
1527 }
1528}

◆ ResetTransientsDrawnFlags()

void G4VisManager::ResetTransientsDrawnFlags ( )

Definition at line 2442 of file G4VisManager.cc.

2443{
2444 fTransientsDrawnThisRun = false;
2445 fTransientsDrawnThisEvent = false;
2447 for (i = fAvailableSceneHandlers.begin();
2448 i != fAvailableSceneHandlers.end(); ++i) {
2449 (*i)->SetTransientsDrawnThisEvent(false);
2450 (*i)->SetTransientsDrawnThisRun(false);
2451 }
2452}
std::vector< G4VSceneHandler * >::const_iterator G4SceneHandlerListConstIterator

Referenced by SetCurrentScene(), G4VisCommandSceneEndOfEventAction::SetNewValue(), G4VisCommandSceneEndOfRunAction::SetNewValue(), and G4VisCommandViewerClearTransients::SetNewValue().

◆ SelectTrajectoryModel()

void G4VisManager::SelectTrajectoryModel ( const G4String model)

Definition at line 895 of file G4VisManager.cc.

896{
897 fpTrajDrawModelMgr->SetCurrent(model);
898}
void SetCurrent(const G4String &)

◆ SetAbortReviewKeptEvents()

void G4VisManager::SetAbortReviewKeptEvents ( G4bool  )

◆ SetAbortReviewPlots()

void G4VisManager::SetAbortReviewPlots ( G4bool  )

◆ SetAvailableSceneHandlers()

G4SceneHandlerList & G4VisManager::SetAvailableSceneHandlers ( )

◆ SetCurrentGraphicsSystem()

void G4VisManager::SetCurrentGraphicsSystem ( G4VGraphicsSystem pSystem)

Definition at line 1581 of file G4VisManager.cc.

1581 {
1582 fpGraphicsSystem = pSystem;
1583 if (fVerbosity >= confirmations) {
1584 G4cout << "G4VisManager::SetCurrentGraphicsSystem: system now "
1585 << pSystem -> GetName () << G4endl;
1586 }
1587 // If current scene handler is of same graphics system, leave unchanged.
1588 // Else find the most recent scene handler of same graphics system.
1589 // Or clear pointers.
1590 if (!(fpSceneHandler && fpSceneHandler -> GetGraphicsSystem () == pSystem)) {
1591 const G4SceneHandlerList& sceneHandlerList = fAvailableSceneHandlers;
1592 G4int nSH = (G4int)sceneHandlerList.size (); // No. of scene handlers.
1593 G4int iSH;
1594 for (iSH = nSH - 1; iSH >= 0; iSH--) {
1595 if (sceneHandlerList [iSH] -> GetGraphicsSystem () == pSystem) break;
1596 }
1597 if (iSH >= 0) {
1598 fpSceneHandler = sceneHandlerList [iSH];
1599 if (fVerbosity >= confirmations) {
1600 G4cout << " Scene Handler now "
1601 << fpSceneHandler -> GetName () << G4endl;
1602 }
1603 if (fpScene != fpSceneHandler -> GetScene ()) {
1604 fpScene = fpSceneHandler -> GetScene ();
1605 if (fVerbosity >= confirmations) {
1606 G4cout << " Scene now \""
1607 << fpScene -> GetName () << "\"" << G4endl;
1608 }
1609 }
1610 const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
1611 if (viewerList.size ()) {
1612 fpViewer = viewerList [0];
1613 if (fVerbosity >= confirmations) {
1614 G4cout << " Viewer now " << fpViewer -> GetName () << G4endl;
1615 }
1616 }
1617 else {
1618 fpViewer = 0;
1619 }
1620 }
1621 else {
1622 fpSceneHandler = 0;
1623 fpViewer = 0;
1624 }
1625 }
1626}

Referenced by G4VisCommandDrawTree::SetNewValue().

◆ SetCurrentScene()

void G4VisManager::SetCurrentScene ( G4Scene pScene)

Definition at line 1572 of file G4VisManager.cc.

1572 {
1573 if (pScene != fpScene) {
1574 // A change of scene. Therefore reset transients drawn flags. All
1575 // memory of previous transient proceessing thereby erased...
1577 }
1578 fpScene = pScene;
1579}
void ResetTransientsDrawnFlags()

Referenced by G4RayTracerSceneHandler::G4RayTracerSceneHandler(), and G4VisCommandDrawTree::SetNewValue().

◆ SetCurrentSceneHandler()

void G4VisManager::SetCurrentSceneHandler ( G4VSceneHandler pSceneHandler)

Definition at line 1628 of file G4VisManager.cc.

1628 {
1629 fpSceneHandler = pSceneHandler;
1630 if (fVerbosity >= confirmations) {
1631 G4cout << "G4VisManager::SetCurrentSceneHandler: scene handler now \""
1632 << pSceneHandler -> GetName () << "\"" << G4endl;
1633 }
1634 if (fpScene != fpSceneHandler -> GetScene ()) {
1635 fpScene = fpSceneHandler -> GetScene ();
1636 if (fVerbosity >= confirmations) {
1637 G4cout << " Scene now \""
1638 << fpScene -> GetName () << "\"" << G4endl;
1639 }
1640 }
1641 if (fpGraphicsSystem != pSceneHandler -> GetGraphicsSystem ()) {
1642 fpGraphicsSystem = pSceneHandler -> GetGraphicsSystem ();
1643 if (fVerbosity >= confirmations) {
1644 G4cout << " Graphics system now \""
1645 << fpGraphicsSystem -> GetName () << "\"" << G4endl;
1646 }
1647 }
1648 const G4ViewerList& viewerList = fpSceneHandler -> GetViewerList ();
1649 std::size_t nViewers = viewerList.size ();
1650 if (nViewers) {
1651 std::size_t iViewer;
1652 for (iViewer = 0; iViewer < nViewers; ++iViewer) {
1653 if (fpViewer == viewerList [iViewer]) break;
1654 }
1655 if (iViewer >= nViewers) {
1656 fpViewer = viewerList [0];
1657 if (fVerbosity >= confirmations) {
1658 G4cout << " Viewer now \"" << fpViewer -> GetName () << "\""
1659 << G4endl;
1660 }
1661 }
1662 if (!IsValidView ()) {
1663 if (fVerbosity >= warnings) {
1664 G4warn <<
1665 "WARNING: Problem setting scene handler - please report circumstances."
1666 << G4endl;
1667 }
1668 }
1669 }
1670 else {
1671 fpViewer = 0;
1672 if (fVerbosity >= warnings) {
1673 G4warn <<
1674 "WARNING: No viewers for this scene handler - please create one."
1675 << G4endl;
1676 }
1677 }
1678}

Referenced by G4VisCommandDrawTree::SetNewValue().

◆ SetCurrentViewer()

void G4VisManager::SetCurrentViewer ( G4VViewer pViewer)

Definition at line 1680 of file G4VisManager.cc.

1680 {
1681 fpViewer = pViewer;
1682 if (fpViewer == nullptr) {
1683 if (fVerbosity >= confirmations) {
1684 G4cout << "G4VisManager::SetCurrentViewer: current viewer pointer zeroed "
1685 << G4endl;
1686 }
1687 return;
1688 }
1689 if (fVerbosity >= confirmations) {
1690 G4cout << "G4VisManager::SetCurrentViewer: viewer now "
1691 << pViewer -> GetName ()
1692 << G4endl;
1693 }
1694 fpSceneHandler = fpViewer -> GetSceneHandler ();
1695 if (!fpSceneHandler) {
1696 if (fVerbosity >= warnings) {
1697 G4warn <<
1698 "WARNING: No scene handler for this viewer - please create one."
1699 << G4endl;
1700 }
1701 return;
1702 }
1703 // JA: I don't think we need this. Setview will be called when needed.
1704 // fpViewer->SetView();
1705 fpSceneHandler -> SetCurrentViewer (pViewer);
1706 fpScene = fpSceneHandler -> GetScene ();
1707 fpGraphicsSystem = fpSceneHandler -> GetGraphicsSystem ();
1708 if (!IsValidView ()) {
1709 if (fVerbosity >= warnings) {
1710 G4warn <<
1711 "WARNING: Problem setting viewer - please report circumstances."
1712 << G4endl;
1713 }
1714 }
1715}

Referenced by CreateViewer(), SetCurrentViewer(), and G4VisCommandDrawTree::SetNewValue().

◆ SetDefaultViewParameters()

void G4VisManager::SetDefaultViewParameters ( const G4ViewParameters )

◆ SetDrawEventOnlyIfToBeKept()

void G4VisManager::SetDrawEventOnlyIfToBeKept ( G4bool  )

◆ SetEventRefreshing()

void G4VisManager::SetEventRefreshing ( G4bool  )

◆ SetRequestedEvent()

void G4VisManager::SetRequestedEvent ( const G4Event )

◆ SetReviewingKeptEvents()

void G4VisManager::SetReviewingKeptEvents ( G4bool  )

◆ SetReviewingPlots()

void G4VisManager::SetReviewingPlots ( G4bool  )

◆ SetSceneList()

G4SceneList & G4VisManager::SetSceneList ( )

◆ SetTransientsDrawnThisEvent()

void G4VisManager::SetTransientsDrawnThisEvent ( G4bool  )

◆ SetTransientsDrawnThisRun()

void G4VisManager::SetTransientsDrawnThisRun ( G4bool  )

◆ SetVerboseLevel() [1/3]

void G4VisManager::SetVerboseLevel ( const G4String verbosityString)

Definition at line 2545 of file G4VisManager.cc.

2545 {
2546 fVerbosity = GetVerbosityValue(verbosityString);
2547}

◆ SetVerboseLevel() [2/3]

◆ SetVerboseLevel() [3/3]

void G4VisManager::SetVerboseLevel ( Verbosity  )

◆ VerbosityString()

G4String G4VisManager::VerbosityString ( Verbosity  verbosity)
static

Definition at line 2483 of file G4VisManager.cc.

2483 {
2484 G4String rs;
2485 switch (verbosity) {
2486 case quiet: rs = "quiet (0)"; break;
2487 case startup: rs = "startup (1)"; break;
2488 case errors: rs = "errors (2)"; break;
2489 case warnings: rs = "warnings (3)"; break;
2490 case confirmations: rs = "confirmations (4)"; break;
2491 case parameters: rs = "parameters (5)"; break;
2492 case all: rs = "all (6)"; break;
2493 }
2494 return rs;
2495}

Referenced by G4VisManager(), GetVerbosityValue(), and G4VisCommandVerbose::SetNewValue().

◆ ViewerShortName()

G4String G4VisManager::ViewerShortName ( const G4String viewerName) const

Definition at line 2454 of file G4VisManager.cc.

2454 {
2455 G4String viewerShortName = viewerName.substr(0, viewerName.find (' '));
2456 return G4StrUtil::strip_copy(viewerShortName);
2457}
G4String strip_copy(G4String str, char ch=' ')
Return copy of string with leading and trailing characters removed.

Referenced by GetViewer().

Friends And Related Function Documentation

◆ G4VisCommandList

friend class G4VisCommandList
friend

Definition at line 129 of file G4VisManager.hh.

◆ G4VisStateDependent

friend class G4VisStateDependent
friend

Definition at line 128 of file G4VisManager.hh.

Referenced by G4VisManager().

◆ G4VSceneHandler

friend class G4VSceneHandler
friend

Definition at line 126 of file G4VisManager.hh.

◆ G4VViewer

friend class G4VViewer
friend

Definition at line 127 of file G4VisManager.hh.

◆ operator<< [1/2]

std::ostream & operator<< ( std::ostream &  os,
const G4VGraphicsSystem gs 
)
friend

Definition at line 73 of file G4VGraphicsSystem.cc.

74{
75 os << "Graphics System: " << gs.GetName ();
76 os << ", nicknames:"; for (const auto& nickname: gs.GetNicknames())
77 {os << ' ' << nickname;}
78 os << "\n Description: " << gs.GetDescription ();
79 os << "\n Functionality: ";
80 switch (gs.GetFunctionality()) {
82 os << "None";
83 break;
85 os << "nonEuclidian, e.g., tree representation of geometry hierarchy.";
86 break;
88 os << "twoD: Simple 2D, e.g., X (no stored structures).";
89 break;
91 os << "twoDStore: 2D with stored structures.";
92 break;
94 os << "threeD: Passive 3D (with stored structures)";
95 break;
97 os << "threeDInteractive: 3D with mouse control and \"pick\" functionality.";
98 break;
100 os << "virtualReality";
101 break;
103 os << "fileWriter";
104 break;
105 default:
106 os << "unknown";
107 break;
108 }
109
111 const G4SceneHandlerList& scenes = pVMan -> GetAvailableSceneHandlers ();
112 if (pVMan -> GetVerbosity() >= G4VisManager::parameters) {
113 size_t nScenes = scenes.size ();
114 if (nScenes) {
115 G4int nScenesOfThisSystem = 0;
116 for (size_t i = 0; i < nScenes; i++) {
117 if (scenes [i] -> GetGraphicsSystem () == &gs) {
118 nScenesOfThisSystem++;
119 }
120 }
121 if (nScenesOfThisSystem) {
122 os << "\n Its scenes are: ";
123 for (size_t i = 0; i < nScenes; i++) {
124 if (scenes [i] -> GetGraphicsSystem () == &gs) {
125 os << "\n " << *(scenes [i]);
126 }
127 }
128 }
129 else {
130 os << "\n It has no scenes at present.";
131 }
132 }
133 else {
134 os << "\n There are no scenes instantiated at present.";
135 }
136 }
137
138 return os;
139}
const std::vector< G4String > & GetNicknames() const
Functionality GetFunctionality() const
const G4String & GetDescription() const
const G4String & GetName() const
static Verbosity GetVerbosity()
const G4SceneHandlerList & GetAvailableSceneHandlers() const
static G4VisManager * GetInstance()

◆ operator<< [2/2]

std::ostream & operator<< ( std::ostream &  os,
const G4VSceneHandler sh 
)
friend

Definition at line 1204 of file G4VSceneHandler.cc.

1204 {
1205
1206 os << "Scene handler " << sh.fName << " has "
1207 << sh.fViewerList.size () << " viewer(s):";
1208 for (std::size_t i = 0; i < sh.fViewerList.size (); ++i) {
1209 os << "\n " << *(sh.fViewerList [i]);
1210 }
1211
1212 if (sh.fpScene) {
1213 os << "\n " << *sh.fpScene;
1214 }
1215 else {
1216 os << "\n This scene handler currently has no scene.";
1217 }
1218
1219 return os;
1220}
G4ViewerList fViewerList

Member Data Documentation

◆ fVerbose

const G4int G4VisManager::fVerbose
protected

Definition at line 479 of file G4VisManager.hh.

◆ VerbosityGuidanceStrings

std::vector< G4String > G4VisManager::VerbosityGuidanceStrings
static

The documentation for this class was generated from the following files: