forked from ECCE-EIC/macros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDisplayOn.C
64 lines (58 loc) · 1.94 KB
/
DisplayOn.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef MACRO_DISPLAYON_C
#define MACRO_DISPLAYON_C
#include <g4main/PHG4Reco.h>
#include <fun4all/Fun4AllServer.h>
R__LOAD_LIBRARY(libfun4all.so)
R__LOAD_LIBRARY(libg4testbench.so)
namespace Enable
{
bool DISPLAY = false;
}
// This starts the QT based G4 gui which takes control
// when x'ed out it will return a pointer to PHG4Reco so
// the gui can be startrd again
PHG4Reco *QTGui()
{
Fun4AllServer *se = Fun4AllServer::instance();
PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO");
g4->InitRun(se->topNode());
g4->ApplyDisplayAction();
g4->StartGui();
return g4;
}
// stupid macro to turn on the geant4 display
// we ask Fun4All for a pointer to PHG4Reco
// using the ApplyCommand will start up the
// G4 cmd interpreter and graphics system
// the vis.mac contains the necessary commands to
// start up the visualization, the next event will
// be displayed. Do not execute this macro
// before PHG4Reco was registered with Fun4All
PHG4Reco *DisplayOn(const char *mac = "vis.mac")
{
char cmd[100];
Fun4AllServer *se = Fun4AllServer::instance();
PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO");
g4->InitRun(se->topNode());
g4->ApplyDisplayAction();
sprintf(cmd, "/control/execute %s", mac);
g4->ApplyCommand(cmd);
return g4;
}
// print out the commands I always forget
void displaycmd()
{
cout << "draw axis: " << endl;
cout << " g4->ApplyCommand(\"/vis/scene/add/axes 0 0 0 50 cm\")" << endl;
cout << "zoom" << endl;
cout << " g4->ApplyCommand(\"/vis/viewer/zoom 1\")" << endl;
cout << "viewpoint:" << endl;
cout << " g4->ApplyCommand(\"/vis/viewer/set/viewpointThetaPhi 0 0\")" << endl;
cout << "panTo:" << endl;
cout << " g4->ApplyCommand(\"/vis/viewer/panTo 0 0 cm\")" << endl;
cout << "print to eps:" << endl;
cout << " g4->ApplyCommand(\"/vis/ogl/printEPS\")" << endl;
cout << "set background color:" << endl;
cout << " g4->ApplyCommand(\"/vis/viewer/set/background white\")" << endl;
}
#endif