58 fpCommand -> SetGuidance(
"Abort review of kept events.");
59 fpCommand -> SetParameterName(
"abort", omitable=
true);
60 fpCommand -> SetDefaultValue(
true);
74 G4warn <<
"Type \"continue\" to complete the abort." <<
G4endl;
83 fpCommand -> SetGuidance(
"Abort review of plots.");
84 fpCommand -> SetParameterName(
"abort", omitable=
true);
85 fpCommand -> SetDefaultValue(
true);
99 G4warn <<
"Type \"continue\" to complete the abort." <<
G4endl;
109 fpCommand -> SetGuidance
110 (
"DURING A RUN draw only those events that have been \"to be kept\" by the user"
111 "\nwith G4EventManager::GetEventManager()->KeepTheCurrentEvent() or"
112 "\nwith \"/event/keepCurrentEvent\".");
113 fpCommand -> SetGuidance(
114 "To draw selected events the user should set this flag, then in a user action:"
115 "\n if ( some criterion ) {"
116 "\n G4EventManager::GetEventManager()->KeepTheCurrentEvent();"
118 fpCommand -> SetParameterName(
"draw", omitable=
true);
119 fpCommand -> SetDefaultValue(
true);
136 G4warn <<
"Only events that have been kept will be drawn." <<
G4endl;
149 fpCommand -> SetGuidance(
"Enables/disables visualization system.");
150 fpCommand -> SetParameterName(
"enabled", omitable=
true);
151 fpCommand -> SetDefaultValue(
true);
154 fpCommand1 -> SetGuidance(
"Disables visualization system.");
168 if (command == fpCommand) {
181 fpCommand -> SetGuidance(
"Initialise visualisation manager.");
200 fpCommand -> SetGuidance(
"Lists visualization parameters.");
201 fpCommand -> SetParameterName(
"verbosity", omitable=
true);
202 fpCommand -> SetDefaultValue(
"warnings");
217 G4String& verbosityString = newValue;
230 UImanager->
ApplyCommand(
"/vis/scene/list ! " + newValue);
231 UImanager->
ApplyCommand(
"/vis/viewer/list ! " + newValue);
234 "\nAttributes available for modeling and filtering with"
235 "\n \"/vis/modeling/trajectories/create/drawByAttribute\" and"
236 "\n \"/vis/filtering/trajectories/create/attributeFilter\" commands"
252 "\nGeometry attributes available for touchables by picking:\n";
258 "\nTo get more information, \"/vis/list all\" or use individual commands"
259 "\n such as (use \"ls\" or \"help\"):"
260 "\n /vis/scene/list all all"
261 "\n /vis/viewer/list all all"
262 "\n /vis/modeling/trajectories/list"
263 "\n /vis/filtering/trajectories/list"
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"
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(
"");
305 "\"/vis/reviewKeptEvents\" not allowed within an already started review."
306 "\n No action taken."
316 const std::vector<const G4Event*>* events =
318 size_t nKeptEvents = events ? events->size() : 0;
323 "ERROR: G4VisCommandReviewKeptEvents::SetNewValue: No kept events,"
324 "\n or kept events not accessible."
334 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
343 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
365 if (macroFileName.empty()) {
369 for (
size_t i = 0; i < nKeptEvents; ++i) {
370 const G4Event*
event = (*events)[i];
372 G4warn <<
"Drawing event : " <<
event->GetEventID() <<
373 ". At EndOfEvent, enter any command, then \"cont[inue]\"..."
375 static G4bool first =
true;
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."
406 session->PauseSessionStart(
"EndOfEvent");
415 for (
size_t i = 0; i < nKeptEvents; ++i) {
416 const G4Event*
event = (*events)[i];
418 G4warn <<
"Drawing event : " <<
event->GetEventID()
419 <<
" with macro file \"" << macroFileName <<
G4endl;
422 UImanager->
ApplyCommand(
"/control/execute " + macroFileName);
439 fpCommand -> SetGuidance(
"Review plots.");
440 fpCommand -> SetGuidance
441 (
"Each plot is drawn, one by one, to the current viewer. After each"
442 "\nplot the session is paused. The user may issue any allowed command."
443 "\nThen enter \"cont[inue]\" to continue to the next plot."
444 "\nUseful commands might be:"
445 "\n \"/vis/tsg/export\" to get hard copy."
446 "\n \"/vis/abortReviewPlots\", then \"cont[inue]\", to abort.");
459#include <tools/histo/h1d>
460#include <tools/histo/h2d>
463 template <
typename HT>
467 auto session = ui->GetSession();
469 auto keepControlVerbose = ui->GetVerboseLevel();
470 ui->SetVerboseLevel(0);
471 auto status = ui->ApplyCommand(
"/analysis/" + plotType +
"/getVector");
472 ui->SetVerboseLevel(keepControlVerbose);
474 G4String hexString = ui->GetCurrentValues(
G4String(
"/analysis/" + plotType +
"/getVector"));
475 if(hexString.size()) {
477 std::istringstream is(hexString);
479 auto _v = (
const std::vector<HT*>*)ptr;
480 auto _n = _v->size();
481 for (
size_t i = 0; i < _n; ++i) {
483 std::ostringstream oss;
484 oss <<
"/vis/plot " << plotType <<
' ' << i;
485 ui->ApplyCommand(oss.str());
486 session->PauseSessionStart(
"EndOfEvent");
487 if (visManager->GetAbortReviewPlots()) {
502 "\"/vis/reviewPlots\" not allowed within an already started review."
503 "\n No action taken."
511 if (!currentViewer) {
514 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
520 if (currentViewer->GetName().find(
"TOOLSSG") == std::string::npos) {
522 "WARNING: Current viewer not able to draw plots."
523 "\n Try \"/vis/open TSG\", then \"/vis/reviewPlots\" again."
531 G4warn <<
"ERROR: No current scene. Please create one." <<
G4endl;
538 auto keepControlVerbose = ui->GetVerboseLevel();
539 ui->SetVerboseLevel(0);
546 if (ReviewPlots<tools::histo::h1d>(
"h1"))
goto finish;
547 if (ReviewPlots<tools::histo::h2d>(
"h2"))
goto finish;
553 ui->SetVerboseLevel(keepControlVerbose);
565 fpCommand -> SetParameterName(
"verbosity", omitable=
true);
566 fpCommand -> SetDefaultValue(
"warnings");
583 G4cout <<
"Visualization verbosity changed to "
G4GLOB_DLL std::ostream G4cout
const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
static G4RunManager * GetMasterRunManager()
const G4Run * GetCurrentRun() const
const std::vector< const G4Event * > * GetEventVector() const
G4bool GetRefreshAtEndOfEvent() const
void SetRefreshAtEndOfEvent(G4bool)
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
virtual const std::map< G4String, G4AttDef > * GetAttDefs() const
static G4bool ConvertToBool(const char *st)
G4int ApplyCommand(const char *aCommand)
G4int GetVerboseLevel() const
G4UIsession * GetSession() const
static G4UImanager * GetUIpointer()
void SetVerboseLevel(G4int val)
static G4VisManager * fpVisManager
static G4VVisManager * GetConcreteInstance()
virtual ~G4VisCommandAbortReviewKeptEvents()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandAbortReviewKeptEvents()
virtual ~G4VisCommandAbortReviewPlots()
G4VisCommandAbortReviewPlots()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandDrawOnlyToBeKeptEvents()
G4VisCommandDrawOnlyToBeKeptEvents()
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandEnable()
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandInitialize()
void SetNewValue(G4UIcommand *command, G4String newValue)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandList()
void SetNewValue(G4UIcommand *command, G4String newValue)
virtual ~G4VisCommandReviewKeptEvents()
G4String GetCurrentValue(G4UIcommand *command)
G4VisCommandReviewKeptEvents()
G4VisCommandReviewPlots()
virtual ~G4VisCommandReviewPlots()
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
void SetNewValue(G4UIcommand *command, G4String newValue)
G4String GetCurrentValue(G4UIcommand *command)
virtual ~G4VisCommandVerbose()
G4Scene * GetCurrentScene() const
void PrintAvailableGraphicsSystems(Verbosity, std::ostream &=G4cout) const
void SetDrawEventOnlyIfToBeKept(G4bool)
static std::vector< G4String > VerbosityGuidanceStrings
static G4String VerbosityString(Verbosity)
G4bool GetAbortReviewKeptEvents() const
void SetAbortReviewPlots(G4bool)
void SetAbortReviewKeptEvents(G4bool)
void SetReviewingPlots(G4bool)
G4VViewer * GetCurrentViewer() const
void SetRequestedEvent(const G4Event *)
G4bool GetDrawEventOnlyIfToBeKept() const
void SetReviewingKeptEvents(G4bool)
G4bool GetReviewingPlots() const
static Verbosity GetVerbosity()
void SetVerboseLevel(G4int)
G4bool GetReviewingKeptEvents() const
static Verbosity GetVerbosityValue(const G4String &)
static G4VisManager * GetInstance()