ECCE @ 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 // stupid macro to turn on the geant4 display
8 // we ask Fun4All for a pointer to PHG4Reco
9 // using the ApplyCommand will start up the
10 // G4 cmd interpreter and graphics system
11 // the iongun.mac contains the necessary commands to
12 // start up the visualization, the next event will
13 // be displayed. Execute this macro after you run
14 // Fun4All_G4_IonGun.C(0), then do
15 // PHG4Reco *g4 = DisplayOn();
16 PHG4Reco * DisplayOn(const char *mac = "iongun.mac")
17 {
18  char cmd[100];
20  PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO");
21  g4->InitRun(se->topNode());
22  g4->ApplyDisplayAction();
23  sprintf(cmd, "/control/execute %s", mac);
24  g4->ApplyCommand(cmd);
25  return g4;
26 }
27 // print out the commands I always forget
28 void displaycmd()
29 {
30  cout << "draw axis: " << endl;
31  cout << " g4->ApplyCommand(\"/vis/scene/add/axes 0 0 0 50 cm\")" << endl;
32  cout << "zoom" << endl;
33  cout << " g4->ApplyCommand(\"/vis/viewer/zoom 1\")" << endl;
34  cout << "viewpoint:" << endl;
35  cout << " g4->ApplyCommand(\"/vis/viewer/set/viewpointThetaPhi 0 0\")" << endl;
36  cout << "panTo:" << endl;
37  cout << " g4->ApplyCommand(\"/vis/viewer/panTo 0 0 cm\")" << endl;
38  cout << "print to eps:" << endl;
39  cout << " g4->ApplyCommand(\"/vis/ogl/printEPS\")" << endl;
40  cout << "set background color:" << endl;
41  cout << " g4->ApplyCommand(\"/vis/viewer/set/background white\")" << endl;
42 }