Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
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
#ifndef MACRO_DISPLAYON_C
2
#define MACRO_DISPLAYON_C
3
4
#include <
g4main/PHG4Reco.h
>
5
6
#include <
fun4all/Fun4AllServer.h
>
7
8
// This starts the QT based G4 gui which takes control
9
// when x'ed out it will return a pointer to PHG4Reco so
10
// the gui can be startrd again
11
PHG4Reco
*
QTGui
()
12
{
13
Fun4AllServer
*se =
Fun4AllServer::instance
();
14
PHG4Reco
*
g4
= (
PHG4Reco
*) se->
getSubsysReco
(
"PHG4RECO"
);
15
g4->
InitRun
(se->
topNode
());
16
g4->
ApplyDisplayAction
();
17
g4->
StartGui
();
18
return
g4
;
19
}
20
21
// stupid macro to turn on the geant4 display
22
// we ask Fun4All for a pointer to PHG4Reco
23
// using the ApplyCommand will start up the
24
// G4 cmd interpreter and graphics system
25
// the vis.mac contains the necessary commands to
26
// start up the visualization, the next event will
27
// be displayed. Do not execute this macro
28
// before PHG4Reco was registered with Fun4All
29
PHG4Reco
*
DisplayOn
(
const
char
*mac =
"vis.mac"
)
30
{
31
char
cmd
[100];
32
Fun4AllServer
*se =
Fun4AllServer::instance
();
33
PHG4Reco
*
g4
= (
PHG4Reco
*) se->
getSubsysReco
(
"PHG4RECO"
);
34
g4->
InitRun
(se->
topNode
());
35
g4->
ApplyDisplayAction
();
36
sprintf(cmd,
"/control/execute %s"
, mac);
37
g4->
ApplyCommand
(cmd);
38
return
g4
;
39
}
40
// print out the commands I always forget
41
void
displaycmd
()
42
{
43
cout <<
"draw axis: "
<< endl;
44
cout <<
" g4->ApplyCommand(\"/vis/scene/add/axes 0 0 0 50 cm\")"
<< endl;
45
cout <<
"zoom"
<< endl;
46
cout <<
" g4->ApplyCommand(\"/vis/viewer/zoom 1\")"
<< endl;
47
cout <<
"viewpoint:"
<< endl;
48
cout <<
" g4->ApplyCommand(\"/vis/viewer/set/viewpointThetaPhi 0 0\")"
<< endl;
49
cout <<
"panTo:"
<< endl;
50
cout <<
" g4->ApplyCommand(\"/vis/viewer/panTo 0 0 cm\")"
<< endl;
51
cout <<
"print to eps:"
<< endl;
52
cout <<
" g4->ApplyCommand(\"/vis/ogl/printEPS\")"
<< endl;
53
cout <<
"set background color:"
<< endl;
54
cout <<
" g4->ApplyCommand(\"/vis/viewer/set/background white\")"
<< endl;
55
}
56
57
#endif
g4exampledetector
blob
master
parameter
macros
DisplayOn.C
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:17:48
using
1.8.2 with
sPHENIX GitHub integration