53BDSVisManager::BDSVisManager(
const G4String& visMacroFileNameIn,
84 visManager->Initialize();
87 G4TrajectoryDrawByCharge* trajModel1 =
new G4TrajectoryDrawByCharge(
"bdsim_traj_by_charge");
89 trajModel1->Set(G4TrajectoryDrawByCharge::Charge::Neutral, *(colours->GetColour(
"traj_neutral")));
90 trajModel1->Set(G4TrajectoryDrawByCharge::Charge::Positive, *(colours->GetColour(
"traj_positive")));
91 trajModel1->Set(G4TrajectoryDrawByCharge::Charge::Negative, *(colours->GetColour(
"traj_negative")));
92 visManager->RegisterModel(trajModel1);
93 visManager->SelectTrajectoryModel(trajModel1->Name());
97 G4UIExecutive* uiExecutive =
new G4UIExecutive(argc, argv);
100 G4UImanager* UIManager = G4UImanager::GetUIpointer();
103 G4String macroPaths = bdsimExecPath +
"../share/bdsim/vis:@CMAKE_BINARY_DIR@/vis:./";
104 G4cout << __METHOD_NAME__ <<
"Setting macro path to: " << macroPaths << G4endl;
105 UIManager->ApplyCommand(
"/control/macroPath "+macroPaths);
108 G4String visMacPath = visMacName;
109 if (visMacName.empty())
111#if G4VERSION_NUMBER > 1119
112 visMacName =
"bdsim_default_vis_11p2.mac";
114#ifdef G4VIS_USE_OPENGLQT
115 visMacName =
"bdsim_default_vis.mac";
117 visMacName =
"bdsim_default_dawnfile.mac";
121 visMacPath = UIManager->FindMacroPath(visMacName);
122 G4cout << __METHOD_NAME__ <<
"Visualisation macro name: " << visMacName << G4endl;
123 G4cout << __METHOD_NAME__ <<
"Visualisation macro path: " << visMacPath << G4endl;
124 if (visMacPath == visMacName)
126 G4cout << __METHOD_NAME__ <<
"bdsim_default_vis.mac missing from BDSIM installation directory." << G4endl;
134 std::cout << __METHOD_NAME__ <<
"ERROR: visualisation file " << visMacPath <<
" not present!" << G4endl;
137 G4cout << __METHOD_NAME__ <<
"Using visualisation macro: " << visMacName << G4endl;
140 UIManager->ApplyCommand(
"/control/execute " + visMacPath);
145 G4cout << __METHOD_NAME__ <<
"Applying geant4MacroFileName: " <<
geant4MacroFileName << G4endl;
149#if G4VERSION_NUMBER < 1030
150 if (uiExecutive->IsGUI())
152 UIManager->ApplyCommand(
"/control/execute bdsim_default_icons.mac");
153 UIManager->ApplyCommand(
"/gui/addIcon \"Run beam on\" user_icon \"/run/beamOn 1\" run.png");
154 UIManager->ApplyCommand(
"/control/execute bdsim_default_gui.mac");
159 uiExecutive->SessionStart();