Geant4 11.1.1
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 ()=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 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 111 of file G4VisCommands.hh.

Constructor & Destructor Documentation

◆ G4VisCommandReviewKeptEvents()

G4VisCommandReviewKeptEvents::G4VisCommandReviewKeptEvents ( )

Definition at line 269 of file G4VisCommands.cc.

270{
271 G4bool omitable;
272
273 fpCommand = new G4UIcmdWithAString("/vis/reviewKeptEvents", this);
274 fpCommand -> SetGuidance("Review kept events.");
275 fpCommand -> SetGuidance
276 ("If a macro file is specified, it is executed for each event.");
277 fpCommand -> SetGuidance(
278 "If a macro file is not specified, each event is drawn to the current"
279 "\nviewer. After each event, the session is paused. The user may issue"
280 "\nany allowed command. Then enter \"cont[inue]\" to continue to the next"
281 "\nevent."
282 "\nUseful commands might be:"
283 "\n \"/vis/viewer/...\" to change the view (zoom, set/viewpoint,...)."
284 "\n \"/vis/ogl/export\" to get hard copy."
285 "\n \"/vis/open\" to get alternative viewer."
286 "\n \"/vis/abortReviewKeptEvents\", then \"cont[inue]\", to abort.");
287 fpCommand -> SetParameterName("macro-file-name", omitable=true);
288 fpCommand -> SetDefaultValue("");
289}
bool G4bool
Definition: G4Types.hh:86

◆ ~G4VisCommandReviewKeptEvents()

G4VisCommandReviewKeptEvents::~G4VisCommandReviewKeptEvents ( )
virtual

Definition at line 291 of file G4VisCommands.cc.

292{
293 delete fpCommand;
294}

Member Function Documentation

◆ GetCurrentValue()

G4String G4VisCommandReviewKeptEvents::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 296 of file G4VisCommands.cc.

297{
298 return "";
299}

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 301 of file G4VisCommands.cc.

302{
304 G4warn <<
305 "\"/vis/reviewKeptEvents\" not allowed within an already started review."
306 "\n No action taken."
307 << G4endl;
308 return;
309 }
310
311 G4String& macroFileName = newValue;
313
315 const G4Run* run = runManager ? runManager->GetCurrentRun() : nullptr;
316 const std::vector<const G4Event*>* events =
317 run ? run->GetEventVector() : nullptr;
318 size_t nKeptEvents = events ? events->size() : 0;
319
320 if (!nKeptEvents) {
321 if (verbosity >= G4VisManager::errors) {
322 G4warn <<
323 "ERROR: G4VisCommandReviewKeptEvents::SetNewValue: No kept events,"
324 "\n or kept events not accessible."
325 << G4endl;
326 }
327 return;
328 }
329
331 if (!viewer) {
332 if (verbosity >= G4VisManager::errors) {
333 G4warn <<
334 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
335 << G4endl;
336 }
337 return;
338 }
339
341 if (!pScene) {
342 if (verbosity >= G4VisManager::errors) {
343 G4warn << "ERROR: No current scene. Please create one." << G4endl;
344 }
345 return;
346 }
347
349 G4int keepControlVerbose = UImanager->GetVerboseLevel();
350 G4int newVerbose(0);
351 if (keepControlVerbose >= 2 || verbosity >= G4VisManager::confirmations)
352 newVerbose = 2;
353 UImanager->SetVerboseLevel(newVerbose);
354
355 G4VVisManager* keepConcreteInstance = fpVisManager->GetConcreteInstance();
357
358 // Start on clean view
359 UImanager->ApplyCommand("/vis/viewer/rebuild");
360
361 // Event by event refreshing...
363 G4bool currentRefreshAtEndOfEvent = pScene->GetRefreshAtEndOfEvent();
364 pScene->SetRefreshAtEndOfEvent(true);
365 if (macroFileName.empty()) {
366
367 // Draw to viewer and pause session...
368 G4UIsession* session = UImanager->GetSession();
369 for (size_t i = 0; i < nKeptEvents; ++i) {
370 const G4Event* event = (*events)[i];
371 if (verbosity >= G4VisManager::warnings) {
372 G4warn << "Drawing event : " << event->GetEventID() <<
373 ". At EndOfEvent, enter any command, then \"cont[inue]\"..."
374 << G4endl;
375 static G4bool first = true;
376 if (first) {
377 first = false;
378 G4warn <<
379 " Useful commands might be:"
380 "\n \"/vis/scene/add/trajectories\" if not already added."
381 "\n \"/vis/viewer/...\" to change the view (zoom, set/viewpoint,...)."
382 "\n \"/vis/ogl/export\" to get hard copy."
383 "\n \"/vis/open\" to get alternative viewer."
384 "\n \"/vis/abortReviewKeptEvents\", then \"cont[inue]\", to abort."
385 << G4endl;
386 }
387 }
389 UImanager->ApplyCommand("/vis/viewer/rebuild");
390 /* The above command forces a rebuild of the scene, including
391 the detector. This is fine for "immediate" viewers - a
392 refresh requires a rebuild anyway. But for "stored mode"
393 viewers, you could, in principle, avoid a rebuild of the
394 detector with something like the following:
395 sceneHandler->ClearTransientStore();
396 viewer->DrawView();
397 sceneHandler->DrawEvent(event);
398 but this causes mayhem for "immediate" viewers because
399 ClearTransientStore issues a DrawView and some curious sort
400 of recursion takes place. For "stored" viewers, the event
401 gets drawn but not the eventID, so something odd is happening
402 there too. This needs further investigation - enhanced
403 features or a complete re-think.
404 */
405 UImanager->ApplyCommand("/vis/viewer/flush");
406 session->PauseSessionStart("EndOfEvent");
409 }
411
412 } else {
413
414 // Execute macro file...
415 for (size_t i = 0; i < nKeptEvents; ++i) {
416 const G4Event* event = (*events)[i];
417 if (verbosity >= G4VisManager::warnings) {
418 G4warn << "Drawing event : " << event->GetEventID()
419 << " with macro file \"" << macroFileName << G4endl;
420 }
422 UImanager->ApplyCommand("/control/execute " + macroFileName);
424 }
425 }
426 pScene->SetRefreshAtEndOfEvent(currentRefreshAtEndOfEvent);
428
429 if (keepConcreteInstance) fpVisManager->Enable();
430 else fpVisManager->Disable();
431 UImanager->SetVerboseLevel(keepControlVerbose);
432}
#define G4warn
Definition: G4Scene.cc:41
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
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)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:495
G4int GetVerboseLevel() const
Definition: G4UImanager.hh:200
G4UIsession * GetSession() const
Definition: G4UImanager.hh:187
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
void SetVerboseLevel(G4int val)
Definition: G4UImanager.hh:199
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: