Geant4 10.7.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, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static void SetVisManager (G4VisManager *pVisManager)
 
static const G4ColourGetCurrentTextColour ()
 
- Protected Member Functions inherited from G4VVisCommandScene
G4String CurrentSceneName ()
 
- Protected Member Functions inherited from G4VVisCommand
void SetViewParameters (G4VViewer *viewer, const G4ViewParameters &viewParams)
 
void RefreshIfRequired (G4VViewer *viewer)
 
void InterpolateViews (G4VViewer *currentViewer, std::vector< G4ViewParameters > viewVector, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")
 
void InterpolateToNewView (G4VViewer *currentViewer, const G4ViewParameters &oldVP, const G4ViewParameters &newVP, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")
 
const G4StringConvertToColourGuidance ()
 
void ConvertToColour (G4Colour &colour, const G4String &redOrString, G4double green, G4double blue, G4double opacity)
 
G4bool ProvideValueOfUnit (const G4String &where, const G4String &unit, const G4String &category, G4double &value)
 
void CheckSceneAndNotifyHandlers (G4Scene *=nullptr)
 
G4bool CheckView ()
 
void G4VisCommandsSceneAddUnsuccessful (G4VisManager::Verbosity verbosity)
 
void CopyGuidanceFrom (const G4UIcommand *fromCmd, G4UIcommand *toCmd, G4int startLine=0)
 
void CopyParametersFrom (const G4UIcommand *fromCmd, G4UIcommand *toCmd)
 
void DrawExtent (const G4VisExtent &)
 
- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4long StoL (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
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 G4bool ConvertToDoublePair (const G4String &paramString, G4double &xval, G4double &yval)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 
- Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = 0
 
static G4int fCurrentArrow3DLineSegmentsPerCircle = 6
 
static G4Colour fCurrentColour = G4Colour::White()
 
static G4double fCurrentLineWidth = 1.
 
static G4Colour fCurrentTextColour = G4Colour::Blue()
 
static G4Text::Layout fCurrentTextLayout = G4Text::left
 
static G4double fCurrentTextSize = 12.
 
static G4PhysicalVolumeModel::TouchableProperties fCurrentTouchableProperties
 
static G4VisExtent fCurrentExtentForField
 
static std::vector< G4PhysicalVolumesSearchScene::FindingsfCurrrentPVFindingsForField
 

Detailed Description

Definition at line 77 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:86

◆ ~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 G4cerr << "ERROR: No current scene. Please create one." << G4endl;
297 }
298 return;
299 }
300
302 if (!pSceneHandler) {
303 if (verbosity >= G4VisManager::errors) {
304 G4cerr << "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 G4cerr <<
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 pScene->SetMaxNumberOfKeptEvents(maxNumberOfKeptEvents);
324 pSceneHandler->SetMarkForClearingTransientStore(true);
325 }
326 }
327 else {
328 if (verbosity >= G4VisManager::errors) {
329 G4cerr <<
330 "ERROR: unrecognised parameter \"" << action << "\"."
331 << G4endl;
332 }
333 return;
334 }
335
336 // Change of transients behaviour, so...
338
339 // Are there any events currently kept...
340 size_t nCurrentlyKept = 0;
342 if(runManager)
343 {
344 const G4Run* currentRun = runManager->GetCurrentRun();
345 if(currentRun)
346 {
347 const std::vector<const G4Event*>* events = currentRun->GetEventVector();
348 if(events)
349 nCurrentlyKept = events->size();
350 }
351 }
352
353 if (verbosity >= G4VisManager::confirmations) {
354 G4cout << "End of event action set to ";
355 if (pScene->GetRefreshAtEndOfEvent()) G4cout << "\"refresh\".";
356 else {
357 G4cout << "\"accumulate\"."
358 "\n Maximum number of events to be kept: "
359 << maxNumberOfKeptEvents
360 << " (unlimited if negative)."
361 "\n This may be changed with, e.g., "
362 "\"/vis/scene/endOfEventAction accumulate 1000\".";
363 }
364 G4cout << G4endl;
365 }
366
367 if (!pScene->GetRefreshAtEndOfEvent() &&
368 maxNumberOfKeptEvents != 0 &&
369 verbosity >= G4VisManager::warnings) {
370 G4cout << "WARNING: ";
371 if (nCurrentlyKept) {
372 G4cout <<
373 "\n There are currently " << nCurrentlyKept
374 << " events kept for refreshing and/or reviewing.";
375 } else {
376 G4cout << "The vis manager will keep ";
377 if (maxNumberOfKeptEvents < 0) G4cout << "an unlimited number of";
378 else G4cout << "up to " << maxNumberOfKeptEvents;
379 G4cout << " events.";
380 if (maxNumberOfKeptEvents > 1 || maxNumberOfKeptEvents < 0)
381 G4cout <<
382 "\n This may use a lot of memory."
383 "\n It may be changed with, e.g., "
384 "\"/vis/scene/endOfEventAction accumulate 10\".";
385 }
386 G4cout << G4endl;
387 }
388}
int G4int
Definition: G4Types.hh:85
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
static G4RunManager * GetMasterRunManager()
const G4Run * GetCurrentRun() const
Definition: G4Run.hh:49
const std::vector< const G4Event * > * GetEventVector() const
Definition: G4Run.hh:119
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: