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

#include <G4VisCommands.hh>

+ Inheritance diagram for G4VisCommandReviewKeptEvents:

Public Member Functions

 G4VisCommandReviewKeptEvents ()
 
virtual ~G4VisCommandReviewKeptEvents ()
 
G4String GetCurrentValue (G4UIcommand *command)
 
void SetNewValue (G4UIcommand *command, G4String newValue)
 
- 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 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 99 of file G4VisCommands.hh.

Constructor & Destructor Documentation

◆ G4VisCommandReviewKeptEvents()

G4VisCommandReviewKeptEvents::G4VisCommandReviewKeptEvents ( )

Definition at line 242 of file G4VisCommands.cc.

243{
244 G4bool omitable;
245
246 fpCommand = new G4UIcmdWithAString("/vis/reviewKeptEvents", this);
247 fpCommand -> SetGuidance("Review kept events.");
248 fpCommand -> SetGuidance
249 ("If a macro file is specified, it is executed for each event.");
250 fpCommand -> SetGuidance(
251 "If a macro file is not specified, each event is drawn to the current"
252 "\nviewer. After each event, the session is paused. The user may issue"
253 "\nany allowed command. Then enter \"cont[inue]\" to continue to the next"
254 "\nevent."
255 "\nUseful commands might be:"
256 "\n \"/vis/viewer/...\" to change the view (zoom, set/viewpoint,...)."
257 "\n \"/vis/oglx/printEPS\" to get hard copy."
258 "\n \"/vis/open\" to get alternative viewer."
259 "\n \"/vis/abortReviewKeptEvents\", then \"cont[inue]\", to abort.");
260 fpCommand -> SetParameterName("macro-file-name", omitable=true);
261 fpCommand -> SetDefaultValue("");
262}
bool G4bool
Definition: G4Types.hh:86

◆ ~G4VisCommandReviewKeptEvents()

G4VisCommandReviewKeptEvents::~G4VisCommandReviewKeptEvents ( )
virtual

Definition at line 264 of file G4VisCommands.cc.

265{
266 delete fpCommand;
267}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandReviewKeptEvents::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 269 of file G4VisCommands.cc.

270{
271 return "";
272}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 274 of file G4VisCommands.cc.

275{
277 G4cout <<
278 "\"/vis/reviewKeptEvents\" not allowed within an already started review."
279 "\n No action taken."
280 << G4endl;
281 return;
282 }
283
284 G4String& macroFileName = newValue;
286
288 const G4Run* run = runManager ? runManager->GetCurrentRun() : nullptr;
289 const std::vector<const G4Event*>* events =
290 run ? run->GetEventVector() : nullptr;
291 size_t nKeptEvents = events ? events->size() : 0;
292
293 if (!nKeptEvents) {
294 if (verbosity >= G4VisManager::errors) {
295 G4cerr <<
296 "ERROR: G4VisCommandReviewKeptEvents::SetNewValue: No kept events,"
297 "\n or kept events not accessible."
298 << G4endl;
299 }
300 return;
301 }
302
304 if (!viewer) {
305 if (verbosity >= G4VisManager::errors) {
306 G4cerr <<
307 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
308 << G4endl;
309 }
310 return;
311 }
312
314 if (!pScene) {
315 if (verbosity >= G4VisManager::errors) {
316 G4cerr << "ERROR: No current scene. Please create one." << G4endl;
317 }
318 return;
319 }
320
322 G4int keepVerbose = UImanager->GetVerboseLevel();
323 G4int newVerbose(0);
324 if (keepVerbose >= 2 || verbosity >= G4VisManager::confirmations)
325 newVerbose = 2;
326 UImanager->SetVerboseLevel(newVerbose);
327
328 G4VVisManager* keepConcreteInstance = fpVisManager->GetConcreteInstance();
330
331 // Start on clean view
332 UImanager->ApplyCommand("/vis/viewer/rebuild");
333
334 // Event by event refreshing...
336 G4bool currentRefreshAtEndOfEvent = pScene->GetRefreshAtEndOfEvent();
337 pScene->SetRefreshAtEndOfEvent(true);
338 if (macroFileName.empty()) {
339
340 // Draw to viewer and pause session...
341 G4UIsession* session = UImanager->GetSession();
342 for (size_t i = 0; i < nKeptEvents; ++i) {
343 const G4Event* event = (*events)[i];
344 if (verbosity >= G4VisManager::warnings) {
345 G4cout << "Drawing event : " << event->GetEventID() <<
346 ". At EndOfEvent, enter any command, then \"cont[inue]\"..."
347 << G4endl;
348 static G4bool first = true;
349 if (first) {
350 first = false;
351 G4cout <<
352 " Useful commands might be:"
353 "\n \"/vis/scene/add/trajectories\" if not already added."
354 "\n \"/vis/viewer/...\" to change the view (zoom, set/viewpoint,...)."
355 "\n \"/vis/oglx/printEPS\" to get hard copy."
356 "\n \"/vis/open\" to get alternative viewer."
357 "\n \"/vis/abortReviewKeptEvents\", then \"cont[inue]\", to abort."
358 << G4endl;
359 }
360 }
362 UImanager->ApplyCommand("/vis/viewer/rebuild");
363 /* The above command forces a rebuild of the scene, including
364 the detector. This is fine for "immediate" viewers - a
365 refresh requires a rebuild anyway. But for "stored mode"
366 viewers, you could, in principle, avoid a rebuild of the
367 detector with something like the following:
368 sceneHandler->ClearTransientStore();
369 viewer->DrawView();
370 sceneHandler->DrawEvent(event);
371 but this causes mayhem for "immediate" viewers because
372 ClearTransientStore issues a DrawView and some curious sort
373 of recursion takes place. For "stored" viewers, the event
374 gets drawn but not the eventID, so something odd is happening
375 there too. This needs further investigation - enhanced
376 features or a complete re-think.
377 */
378 UImanager->ApplyCommand("/vis/viewer/flush");
379 session->PauseSessionStart("EndOfEvent");
382 }
384
385 } else {
386
387 // Execute macro file...
388 for (size_t i = 0; i < nKeptEvents; ++i) {
389 const G4Event* event = (*events)[i];
390 if (verbosity >= G4VisManager::warnings) {
391 G4cout << "Drawing event : " << event->GetEventID()
392 << " with macro file \"" << macroFileName << G4endl;
393 }
395 UImanager->ApplyCommand("/control/execute " + macroFileName);
397 }
398 }
399 pScene->SetRefreshAtEndOfEvent(currentRefreshAtEndOfEvent);
401
402 if (keepConcreteInstance) fpVisManager->Enable();
403 else fpVisManager->Disable();
404 UImanager->SetVerboseLevel(keepVerbose);
405}
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)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:485
G4int GetVerboseLevel() const
Definition: G4UImanager.hh:193
G4UIsession * GetSession() const
Definition: G4UImanager.hh:180
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
void SetVerboseLevel(G4int val)
Definition: G4UImanager.hh:192
virtual void PauseSessionStart(const G4String &Prompt)
Definition: G4UIsession.cc:63
static G4VisManager * fpVisManager
static G4VVisManager * GetConcreteInstance()
G4Scene * GetCurrentScene() const
G4bool GetAbortReviewKeptEvents() const
void SetAbortReviewKeptEvents(G4bool)
G4VViewer * GetCurrentViewer() const
void SetRequestedEvent(const G4Event *)
void SetReviewingKeptEvents(G4bool)
static Verbosity GetVerbosity()
G4bool GetReviewingKeptEvents() const

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