Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:22:10

0001 #pragma once
0002 
0003 #include <g4main/PHG4Reco.h>
0004 
0005 #include <fun4all/Fun4AllServer.h>
0006 
0007 R__LOAD_LIBRARY(libfun4all.so)
0008 R__LOAD_LIBRARY(libg4testbench.so)
0009 
0010 namespace Enable
0011 {
0012   bool DISPLAY = false;
0013 }
0014 
0015 // This starts the QT based G4 gui which takes control
0016 // when x'ed out it will return a pointer to PHG4Reco so
0017 // the gui can be startrd again
0018 PHG4Reco *QTGui()
0019 {
0020   Fun4AllServer *se = Fun4AllServer::instance();
0021   PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO");
0022   g4->InitRun(se->topNode());
0023   g4->ApplyDisplayAction();
0024   g4->StartGui();
0025   return g4;
0026 }
0027 
0028 // stupid macro to turn on the geant4 display
0029 // we ask Fun4All for a pointer to PHG4Reco
0030 // using the ApplyCommand will start up the
0031 // G4 cmd interpreter and graphics system
0032 // the vis.mac contains the necessary commands to
0033 // start up the visualization, the next event will
0034 // be displayed. Do not execute this macro
0035 // before PHG4Reco was registered with Fun4All
0036 PHG4Reco *DisplayOn(const char *mac = "vis.mac")
0037 {
0038   char cmd[100];
0039   Fun4AllServer *se = Fun4AllServer::instance();
0040   PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO");
0041   g4->InitRun(se->topNode());
0042   g4->ApplyDisplayAction();
0043   sprintf(cmd, "/control/execute %s", mac);
0044   g4->ApplyCommand(cmd);
0045   return g4;
0046 }
0047 // print out the commands I always forget
0048 void displaycmd()
0049 {
0050   cout << "draw axis: " << endl;
0051   cout << " g4->ApplyCommand(\"/vis/scene/add/axes 0 0 0 50 cm\")" << endl;
0052   cout << "zoom" << endl;
0053   cout << " g4->ApplyCommand(\"/vis/viewer/zoom 1\")" << endl;
0054   cout << "viewpoint:" << endl;
0055   cout << " g4->ApplyCommand(\"/vis/viewer/set/viewpointThetaPhi 0 0\")" << endl;
0056   cout << "panTo:" << endl;
0057   cout << " g4->ApplyCommand(\"/vis/viewer/panTo 0 0 cm\")" << endl;
0058   cout << "print to eps:" << endl;
0059   cout << " g4->ApplyCommand(\"/vis/ogl/printEPS\")" << endl;
0060   cout << "set background color:" << endl;
0061   cout << " g4->ApplyCommand(\"/vis/viewer/set/background white\")" << endl;
0062   cout << "Overlap check:" << endl;
0063   cout << " g4->ApplyCommand(\"/geometry/test/run\")" << endl;
0064 }