Geant4 11.1.1
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 ()=default
 
 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 G4VisManagerGetVisManager ()
 
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="")
 
void Twinkle (G4VViewer *currentViewer, const G4ViewParameters &baseVP, const std::vector< std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > > &paths)
 
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 CopyCameraParameters (G4ViewParameters &target, const G4ViewParameters &from)
 
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 (const G4String &s)
 
G4long StoL (const G4String &s)
 
G4double StoD (const 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 = nullptr
 
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
 
static G4bool fThereWasAViewer = false
 
static G4ViewParameters fExistingVP
 

Detailed Description

Definition at line 77 of file G4VisCommandsScene.hh.

Constructor & Destructor Documentation

◆ G4VisCommandSceneEndOfEventAction()

G4VisCommandSceneEndOfEventAction::G4VisCommandSceneEndOfEventAction ( )

Definition at line 255 of file G4VisCommandsScene.cc.

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

◆ ~G4VisCommandSceneEndOfEventAction()

G4VisCommandSceneEndOfEventAction::~G4VisCommandSceneEndOfEventAction ( )
virtual

Definition at line 277 of file G4VisCommandsScene.cc.

277 {
278 delete fpCommand;
279}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandSceneEndOfEventAction::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 281 of file G4VisCommandsScene.cc.

281 {
282 return "";
283}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 285 of file G4VisCommandsScene.cc.

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