52BDSVisManager::BDSVisManager(
const G4String& visMacroFileNameIn,
83 visManager->Initialize();
86 G4TrajectoryDrawByCharge* trajModel1 =
new G4TrajectoryDrawByCharge(
"bdsim_traj_by_charge");
88 trajModel1->Set(G4TrajectoryDrawByCharge::Charge::Neutral, *(colours->GetColour(
"traj_neutral")));
89 trajModel1->Set(G4TrajectoryDrawByCharge::Charge::Positive, *(colours->GetColour(
"traj_positive")));
90 trajModel1->Set(G4TrajectoryDrawByCharge::Charge::Negative, *(colours->GetColour(
"traj_negative")));
91 visManager->RegisterModel(trajModel1);
92 visManager->SelectTrajectoryModel(trajModel1->Name());
96 G4UIExecutive* uiExecutive =
new G4UIExecutive(argc, argv);
99 G4UImanager* UIManager = G4UImanager::GetUIpointer();
102 G4String macroPaths = bdsimExecPath +
"../share/bdsim/vis:@CMAKE_BINARY_DIR@/vis:./";
103 G4cout << __METHOD_NAME__ <<
"Setting macro path to: " << macroPaths << G4endl;
104 UIManager->ApplyCommand(
"/control/macroPath "+macroPaths);
107 G4String visMacPath = visMacName;
108 if (visMacName.empty())
110#if G4VERSION_NUMBER > 1119
111 visMacName =
"bdsim_default_vis_11p2.mac";
113#ifdef G4VIS_USE_OPENGLQT
114 visMacName =
"bdsim_default_vis.mac";
116 visMacName =
"bdsim_default_dawnfile.mac";
120 visMacPath = UIManager->FindMacroPath(visMacName);
121 G4cout << __METHOD_NAME__ <<
"Visualisation macro name: " << visMacName << G4endl;
122 G4cout << __METHOD_NAME__ <<
"Visualisation macro path: " << visMacPath << G4endl;
123 if (visMacPath == visMacName)
125 G4cout << __METHOD_NAME__ <<
"bdsim_default_vis.mac missing from BDSIM installation directory." << G4endl;
133 std::cout << __METHOD_NAME__ <<
"ERROR: visualisation file " << visMacPath <<
" not present!" << G4endl;
136 G4cout << __METHOD_NAME__ <<
"Using visualisation macro: " << visMacName << G4endl;
139 UIManager->ApplyCommand(
"/control/execute " + visMacPath);
144 G4cout << __METHOD_NAME__ <<
"Applying geant4MacroFileName: " <<
geant4MacroFileName << G4endl;
148#if G4VERSION_NUMBER < 1030
149 if (uiExecutive->IsGUI())
151 UIManager->ApplyCommand(
"/control/execute bdsim_default_icons.mac");
152 UIManager->ApplyCommand(
"/gui/addIcon \"Run beam on\" user_icon \"/run/beamOn 1\" run.png");
153 UIManager->ApplyCommand(
"/control/execute bdsim_default_gui.mac");
158 uiExecutive->SessionStart();