Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4VisCommandSceneEndOfEventAction Class Reference

#include <G4VisCommandsScene.hh>

Inheritance diagram for G4VisCommandSceneEndOfEventAction:
Collaboration 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 ()
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Static Public Member Functions inherited from G4VVisCommand
static void SetVisManager (G4VisManager *)
 
static const G4ColourGetCurrentColour ()
 
static G4double GetCurrentLineWidth ()
 
static const G4ColourGetCurrentTextColour ()
 
static G4Text::Layout GetCurrentTextLayout ()
 
static G4double GetCurrentTextSize ()
 
- 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, 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 void ConvertToDoublePair (const G4String &paramString, G4double &xval, G4double &yval)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 
- Static Protected Attributes inherited from G4VVisCommand
static G4VisManagerfpVisManager = 0
 
static G4int fErrorCode = 0
 
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
G4ModelingParameters::PVNameCopyNoPath 
fCurrentTouchablePath
 

Detailed Description

Definition at line 78 of file G4VisCommandsScene.hh.

Constructor & Destructor Documentation

G4VisCommandSceneEndOfEventAction::G4VisCommandSceneEndOfEventAction ( )

Definition at line 256 of file G4VisCommandsScene.cc.

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

Definition at line 278 of file G4VisCommandsScene.cc.

278  {
279  delete fpCommand;
280 }

Member Function Documentation

G4String G4VisCommandSceneEndOfEventAction::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 282 of file G4VisCommandsScene.cc.

282  {
283  return "";
284 }
void G4VisCommandSceneEndOfEventAction::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 286 of file G4VisCommandsScene.cc.

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

Here is the call graph for this function:


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