EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DisplayOn.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DisplayOn.C
1 #pragma once
2 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
4 #include <g4main/PHG4Reco.h>
5 #endif
6 
7 // This starts the QT based G4 gui which takes control
8 // when x'ed out it will return a pointer to PHG4Reco so
9 // the gui can be startrd again
11 {
13  PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO");
14  g4->InitRun(se->topNode());
15  g4->ApplyDisplayAction();
16  g4->StartGui();
17  return g4;
18 }
19 
20 // stupid macro to turn on the geant4 display
21 // we ask Fun4All for a pointer to PHG4Reco
22 // using the ApplyCommand will start up the
23 // G4 cmd interpreter and graphics system
24 // the vis.mac contains the necessary commands to
25 // start up the visualization, the next event will
26 // be displayed. Do not execute this macro
27 // before PHG4Reco was registered with Fun4All
28 PHG4Reco * DisplayOn(const char *mac = "vis.mac")
29 {
30  char cmd[100];
32  PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO");
33  g4->InitRun(se->topNode());
34  g4->ApplyDisplayAction();
35  sprintf(cmd, "/control/execute %s", mac);
36  g4->ApplyCommand(cmd);
37  return g4;
38 }
39 // print out the commands I always forget
40 void displaycmd()
41 {
42  cout << "draw axis: " << endl;
43  cout << " g4->ApplyCommand(\"/vis/scene/add/axes 0 0 0 50 cm\")" << endl;
44  cout << "zoom" << endl;
45  cout << " g4->ApplyCommand(\"/vis/viewer/zoom 1\")" << endl;
46  cout << "viewpoint:" << endl;
47  cout << " g4->ApplyCommand(\"/vis/viewer/set/viewpointThetaPhi 0 0\")" << endl;
48  cout << "panTo:" << endl;
49  cout << " g4->ApplyCommand(\"/vis/viewer/panTo 0 0 cm\")" << endl;
50  cout << "print to eps:" << endl;
51  cout << " g4->ApplyCommand(\"/vis/ogl/printEPS\")" << endl;
52  cout << "set background color:" << endl;
53  cout << " g4->ApplyCommand(\"/vis/viewer/set/background white\")" << endl;
54 }