Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VisCommandSceneEndOfEventAction Class Reference

#include <G4VisCommandsScene.hh>

+ Inheritance diagram for G4VisCommandSceneEndOfEventAction:

Public Member Functions

 G4VisCommandSceneEndOfEventAction ()
 
virtual ~G4VisCommandSceneEndOfEventAction ()
 
G4String GetCurrentValue (G4UIcommand *command)
 
void SetNewValue (G4UIcommand *command, G4String newValue)
 
- Public Member Functions inherited from G4VVisCommandScene
 G4VVisCommandScene ()
 
virtual ~G4VVisCommandScene ()
 
- Public Member Functions inherited from G4VVisCommand
 G4VVisCommand ()
 
virtual ~G4VVisCommand ()
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static void SetVisManager (G4VisManager *)
 
- Protected Member Functions inherited from G4VVisCommandScene
G4String CurrentSceneName ()
 
- Protected Member Functions inherited from G4VVisCommand
void UpdateVisManagerScene (const G4String &sceneName="")
 
- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Static Protected Member Functions inherited from G4VVisCommand
static G4String ConvertToString (G4double x, G4double y, const char *unitName)
 
static void ConvertToDoublePair (const G4String &paramString, G4double &xval, G4double &yval)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
- Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = 0
 
static G4Colour fCurrentColour = G4Colour::White()
 
static G4Colour fCurrentTextColour = G4Colour::Blue()
 
static G4Text::Layout fCurrentTextLayout = G4Text::left
 
static G4double fCurrentLineWidth = 1.
 
static G4ModelingParameters::PVNameCopyNoPath fCurrentTouchablePath
 

Detailed Description

Definition at line 78 of file G4VisCommandsScene.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSceneEndOfEventAction()

G4VisCommandSceneEndOfEventAction::G4VisCommandSceneEndOfEventAction ( )

Definition at line 253 of file G4VisCommandsScene.cc.

253 {
254 G4bool omitable;
255 fpCommand = new G4UIcommand ("/vis/scene/endOfEventAction", this);
256 fpCommand -> SetGuidance
257 ("Accumulate or refresh the viewer for each new event.");
258 fpCommand -> SetGuidance
259 ("\"accumulate\": viewer accumulates hits, etc., event by event, or");
260 fpCommand -> SetGuidance
261 ("\"refresh\": viewer shows them at end of event or, for direct-screen"
262 "\n viewers, refreshes the screen just before drawing the next event.");
263 G4UIparameter* parameter;
264 parameter = new G4UIparameter ("action", 's', omitable = true);
265 parameter -> SetParameterCandidates ("accumulate refresh");
266 parameter -> SetDefaultValue ("refresh");
267 fpCommand -> SetParameter (parameter);
268 parameter = new G4UIparameter ("maxNumber", 'i', omitable = true);
269 parameter -> SetDefaultValue (100);
270 parameter -> SetGuidance
271 ("Maximum number of events kept. Unlimited if negative.");
272 fpCommand -> SetParameter (parameter);
273}
bool G4bool
Definition: G4Types.hh:67

◆ ~G4VisCommandSceneEndOfEventAction()

G4VisCommandSceneEndOfEventAction::~G4VisCommandSceneEndOfEventAction ( )
virtual

Definition at line 275 of file G4VisCommandsScene.cc.

275 {
276 delete fpCommand;
277}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSceneEndOfEventAction::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 279 of file G4VisCommandsScene.cc.

279 {
280 return "";
281}

◆ SetNewValue()

void G4VisCommandSceneEndOfEventAction::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 283 of file G4VisCommandsScene.cc.

284 {
285
287
288 G4String action;
289 G4int maxNumberOfKeptEvents;
290 std::istringstream is (newValue);
291 is >> action >> maxNumberOfKeptEvents;
292
294 if (!pScene) {
295 if (verbosity >= G4VisManager::errors) {
296 G4cout << "ERROR: No current scene. Please create one." << G4endl;
297 }
298 return;
299 }
300
302 if (!pSceneHandler) {
303 if (verbosity >= G4VisManager::errors) {
304 G4cout << "ERROR: No current sceneHandler. Please create one." << G4endl;
305 }
306 return;
307 }
308
309 if (action == "accumulate") {
310 pScene->SetRefreshAtEndOfEvent(false);
311 pScene->SetMaxNumberOfKeptEvents(maxNumberOfKeptEvents);
312 }
313 else if (action == "refresh") {
314 if (!pScene->GetRefreshAtEndOfRun()) {
315 if (verbosity >= G4VisManager::errors) {
316 G4cout <<
317 "ERROR: Cannot refresh events unless runs refresh too."
318 "\n Use \"/vis/scene/endOfRun refresh\"."
319 << G4endl;
320 }
321 } else {
322 pScene->SetRefreshAtEndOfEvent(true);
323 pSceneHandler->SetMarkForClearingTransientStore(true);
324 }
325 }
326 else {
327 if (verbosity >= G4VisManager::errors) {
328 G4cout <<
329 "ERROR: unrecognised parameter \"" << action << "\"."
330 << G4endl;
331 }
332 return;
333 }
334
335 // Change of transients behaviour, so...
337
338 // Are there any events currently kept...
339 size_t nCurrentlyKept = 0;
341 if (runManager) {
342 const G4Run* currentRun = runManager->GetCurrentRun();
343 if (currentRun) {
344 const std::vector<const G4Event*>* events =
345 currentRun->GetEventVector();
346 if (events) nCurrentlyKept = events->size();
347 }
348 }
349
350 if (verbosity >= G4VisManager::confirmations) {
351 G4cout << "End of event action set to ";
352 if (pScene->GetRefreshAtEndOfEvent()) G4cout << "\"refresh\".";
353 else {
354 G4cout << "\"accumulate\"."
355 "\n Maximum number of events to be kept: "
356 << maxNumberOfKeptEvents
357 << " (unlimited if negative)."
358 "\n This may be changed with, e.g., "
359 "\"/vis/scene/endOfEventAction accumulate 1000\".";
360 }
361 G4cout << G4endl;
362 }
363
364 if (!pScene->GetRefreshAtEndOfEvent() &&
365 maxNumberOfKeptEvents != 0 &&
366 verbosity >= G4VisManager::warnings) {
367 G4cout << "WARNING: ";
368 if (nCurrentlyKept) {
369 G4cout <<
370 "\n There are currently " << nCurrentlyKept
371 << " events kept for refreshing and/or reviewing.";
372 } else {
373 G4cout << "The vis manager will keep ";
374 if (maxNumberOfKeptEvents < 0) G4cout << "an unlimited number of";
375 else G4cout << "up to " << maxNumberOfKeptEvents;
376 G4cout << " events.";
377 if (maxNumberOfKeptEvents > 1 || maxNumberOfKeptEvents < 0)
378 G4cout <<
379 "\n This may use a lot of memory."
380 "\n It may be changed with, e.g., "
381 "\"/vis/scene/endOfEventAction accumulate 10\".";
382 }
383 G4cout << G4endl;
384 }
385}
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:62
const G4Run * GetCurrentRun() const
Definition: G4Run.hh:47
const std::vector< const G4Event * > * GetEventVector() const
Definition: G4Run.hh:112
G4bool GetRefreshAtEndOfEvent() const
void SetRefreshAtEndOfEvent(G4bool)
void SetMaxNumberOfKeptEvents(G4int)
G4bool GetRefreshAtEndOfRun() const
void SetMarkForClearingTransientStore(G4bool)
static G4VisManager * fpVisManager
G4Scene * GetCurrentScene() const
G4VSceneHandler * GetCurrentSceneHandler() const
static Verbosity GetVerbosity()
void ResetTransientsDrawnFlags()

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