Analysis Software
Documentation for sPHENIX simulation 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 // stupid macro to turn on the geant4 display
2 // we ask Fun4All for a pointer to PHG4Reco
3 // using the ApplyCommand will start up the
4 // G4 cmd interpreter and graphics system
5 // the vis.mac contains the necessary commands to
6 // start up the visualization, the next event will
7 // be displayed. Do not execute this macro
8 // before PHG4Reco was registered with Fun4All
9 PHG4Reco * DisplayOn(const char *mac = "block.mac")
10 {
11  char cmd[100];
13  PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO");
14  sprintf(cmd, "/control/execute %s", mac);
15  g4->ApplyCommand(cmd);
16  return g4;
17 }
18 // print out the commands I always forget
19 void displaycmd()
20 {
21  cout << "draw axis: " << endl;
22  cout << " g4->ApplyCommand(\"/vis/scene/add/axes 0 0 0 50 cm\")" << endl;
23  cout << "zoom" << endl;
24  cout << " g4->ApplyCommand(\"/vis/viewer/zoom 1\")" << endl;
25  cout << "viewpoint:" << endl;
26  cout << " g4->ApplyCommand(\"/vis/viewer/set/viewpointThetaPhi 0 0\")" << endl;
27  cout << "panTo:" << endl;
28  cout << " g4->ApplyCommand(\"/vis/viewer/panTo 0 0 cm\")" << endl;
29 }
30 
31 void
32 G4Cmd(const char * cmd)
33 {
35  PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO");
36  g4->ApplyCommand(cmd);
37 }