7 #include "G4RunManager.hh" 8 #include "G4VisExecutive.hh" 9 #include "G4TrajectoryDrawByParticleID.hh" 21 vector<string> commands;
24 double PHI_VERB = gemcOpt.
optMap[
"PHY_VERBOSITY"].arg ;
25 int OVERL = (int) gemcOpt.
optMap[
"CHECK_OVERLAPS"].arg ;
26 int DAWN_N = (
int) gemcOpt.
optMap[
"DAWN_N"].arg ;
27 int SAVE_ALL_MOTHERS = (int) gemcOpt.
optMap[
"SAVE_ALL_MOTHERS"].arg ;
30 sprintf(phi_verb,
"%d", (
int) PHI_VERB);
31 string proc_verb1 =
"/process/setVerbose ";
32 string proc_verb2 =
"/process/verbose ";
33 proc_verb1.append(phi_verb);
34 proc_verb1.append(
" all");
35 proc_verb2.append(phi_verb);
39 double TRACK_VERB = gemcOpt.
optMap[
"G4TRACK_VERBOSITY"].arg ;
41 sprintf(track_verb,
"%d", (
int) TRACK_VERB);
42 string tra_verb =
"/tracking/verbose ";
43 tra_verb.append(track_verb);
44 commands.push_back(tra_verb);
48 commands.push_back(
"/tracking/storeTrajectory 2");
50 commands.push_back(
"/tracking/storeTrajectory 0");
54 commands.push_back(
"/control/verbose 0");
55 commands.push_back(
"/geometry/navigator/verbose 0");
56 commands.push_back(
"/event/verbose 0");
57 commands.push_back(
"/run/verbose 0");
58 commands.push_back(
"/run/particle/verbose 0");
59 commands.push_back(
"/material/verbose 0");
60 commands.push_back(proc_verb1.c_str());
61 commands.push_back(proc_verb2.c_str());
62 commands.push_back(
"/process/eLoss/verbose 0");
63 commands.push_back(
"/vis/verbose 0");
64 commands.push_back(
"/vis/viewer/flush");
65 commands.push_back(
"/process/setVerbose 0 all");
71 commands.push_back(
"/geometry/test/grid_test 1");
74 commands.push_back(
"/geometry/test/cylinder_test 1");
80 sprintf(dawn,
"%d", DAWN_N);
81 string DN =
"/run/beamOn ";
84 commands.push_back(
"/vis/open DAWNFILE");
85 commands.push_back(
"/vis/drawVolume");
86 commands.push_back(
"/vis/scene/add/trajectories rich smooth");
87 commands.push_back(
"/vis/scene/add/hits");
88 commands.push_back(
"/vis/scene/endOfEventAction accumulate -1");
89 commands.push_back(DN);
102 vector<string> commands;
103 commands.push_back(
"/vis/scene/create Hall-B");
104 double use_gui = gemcOpt.
optMap[
"USE_GUI"].arg;
105 int HIGH_RES = (int) gemcOpt.
optMap[
"HIGH_RES"].arg ;
110 string newpos =
"+" +
stringify(newxpos) +
"+" + wpos[1];
114 commands.push_back(
"/vis/open OGLSQt " + gemcOpt.
optMap[
"geometry"].args + newpos);
117 commands.push_back(
"/vis/open OGLIQt " + gemcOpt.
optMap[
"geometry"].args + newpos);
119 commands.push_back(
"/vis/viewer/set/autoRefresh 1");
123 commands.push_back(
"/vis/scene/add/trajectories rich smooth");
124 commands.push_back(
"/vis/viewer/set/background .8 .9 .98 1");
125 commands.push_back(
"/vis/scene/add/hits");
129 commands.push_back(
"/vis/scene/endOfEventAction accumulate -1");
132 commands.push_back(
"/vis/ogl/set/displayListLimit 500000");
136 commands.push_back(
"/vis/scene/add/trajectories");
137 commands.push_back(
"/vis/scene/add/hits");
138 commands.push_back(
"/vis/scene/endOfEventAction accumulate -1");
150 G4TrajectoryDrawByParticleID* gemcColorIDModel =
new G4TrajectoryDrawByParticleID(
"gemcColorIDModel");
151 gemcColorIDModel->SetDefault(
"gray");
152 gemcColorIDModel->Set(
"neutron",
"black");
153 gemcColorIDModel->Set(
"gamma",
"blue");
154 gemcColorIDModel->Set(
"e-",
"cyan");
155 gemcColorIDModel->Set(
"pi+",
"magenta");
156 gemcColorIDModel->Set(
"pi-",
"yellow");
157 gemcColorIDModel->Set(
"proton", G4Colour(0.95, 0.6, 0.3));
159 G4ParticleTable *particleTable = G4ParticleTable::GetParticleTable();
160 for(
int i=0; i<particleTable->entries(); i++)
162 string pname = particleTable->GetParticleName(i);
163 double charge = particleTable->FindParticle(pname)->GetPDGCharge();
165 if(pname !=
"neutron" &&
173 gemcColorIDModel->Set(pname,
"red");
175 gemcColorIDModel->Set(pname,
"white");
177 gemcColorIDModel->Set(pname,
"green");
181 VM->RegisterModel(gemcColorIDModel);
182 VM->SelectTrajectoryModel(gemcColorIDModel->Name());
vector< string > init_dvmesg(goptions gemcOpt, G4VisManager *VM)
Initialization Routine for Visualization.
vector< string > get_info(string input, string chars)
get information from strings such as "5*GeV, 2*deg, 10*deg", parses out strings in second argument ...
double get_number(string v, int warn_no_unit)
Returns number with dimension from string, i.e. 100*cm.
string stringify(double x)
map< string, aopt > optMap
Options map.
vector< string > init_dmesg(goptions gemcOpt)
General Initialization Routine.