Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:20:35

0001 #pragma once
0002 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
0003 #include <fun4all/Fun4AllServer.h>
0004 #include <g4main/PHG4Reco.h>
0005 #endif
0006 
0007 // stupid macro to turn on the geant4 display
0008 // we ask Fun4All for a pointer to PHG4Reco
0009 // using the ApplyCommand will start up the
0010 // G4 cmd interpreter and graphics system
0011 // the vis.mac contains the necessary commands to
0012 // start up the visualization, the next event will
0013 // be displayed. Do not execute this macro
0014 // before PHG4Reco was registered with Fun4All
0015 PHG4Reco * DisplayOn(const char *mac = "vis_prototype3.mac")
0016 {
0017   char cmd[100];
0018   Fun4AllServer *se = Fun4AllServer::instance();
0019   PHG4Reco *g4 = (PHG4Reco *) se->getSubsysReco("PHG4RECO");
0020   g4->InitRun(se->topNode());
0021   g4->ApplyDisplayAction();
0022   sprintf(cmd, "/control/execute %s", mac);
0023   g4->ApplyCommand(cmd);
0024   return g4;
0025 }
0026 // print out the commands I always forget
0027 void displaycmd()
0028 {
0029   cout << "draw axis: " << endl;
0030   cout << " g4->ApplyCommand(\"/vis/scene/add/axes 0 0 0 50 cm\")" << endl;
0031   cout << "zoom" << endl;
0032   cout << " g4->ApplyCommand(\"/vis/viewer/zoom 1\")" << endl;
0033   cout << "viewpoint:" << endl;
0034   cout << " g4->ApplyCommand(\"/vis/viewer/set/viewpointThetaPhi 0 0\")" << endl;
0035   cout << "panTo:" << endl;
0036   cout << " g4->ApplyCommand(\"/vis/viewer/panTo 0 0 cm\")" << endl;
0037   cout << "print to eps:" << endl;
0038   cout << " g4->ApplyCommand(\"/vis/ogl/printEPS\")" << endl;
0039   cout << "set background color:" << endl;
0040   cout << " g4->ApplyCommand(\"/vis/viewer/set/background white\")" << endl;
0041 }