EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
Fun4All_EIC_Generator_Display.C
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file Fun4All_EIC_Generator_Display.C
1
#pragma once
2
#if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
3
#include <
fun4all/SubsysReco.h
>
4
#include <
fun4all/Fun4AllServer.h
>
5
#include <
fun4all/Fun4AllInputManager.h
>
6
#include <
fun4all/Fun4AllDummyInputManager.h
>
7
#include <
g4main/PHG4Reco.h
>
8
#include <
g4main/HepMCNodeReader.h
>
9
#include <
g4main/ReadEICFiles.h
>
10
#include <
phool/recoConsts.h
>
11
R__LOAD_LIBRARY
(libfun4all.so)
12
R__LOAD_LIBRARY
(libg4testbench.so)
13
#endif
14
15
using namespace
std;
16
17
PHG4Reco
*
g4
=
nullptr
;
18
const
double
magfield
= 1.5;
// in T
19
20
int
Fun4All_EIC_Generator_Display
(
21
const
std::string &inputFile =
"MILOU_5x100_TOTAL_01_20evt.root"
22
)
23
{
24
//===============
25
// Input options
26
//===============
27
// read in EIC files
28
Fun4AllServer
*se =
Fun4AllServer::instance
();
29
se->
Verbosity
(0);
30
31
ReadEICFiles
*eicfile =
new
ReadEICFiles
();
32
eicfile->
OpenInputFile
(inputFile);
33
se->
registerSubsystem
(eicfile);
34
35
// read-in HepMC events to Geant4 if there is any
36
HepMCNodeReader
*hr =
new
HepMCNodeReader
();
37
se->
registerSubsystem
(hr);
38
g4
=
new
PHG4Reco
();
39
g4
->
set_rapidity_coverage
(1.1);
// according to drawings
40
g4
->
set_field
(
magfield
);
41
g4
->
save_DST_geometry
(
false
);
// saving the geometry crashes here
42
se->
registerSubsystem
(
g4
);
43
44
Fun4AllInputManager
*
in
=
new
Fun4AllDummyInputManager
(
"JADE"
);
45
se->
registerInputManager
(in);
46
47
// Start the display
48
g4
->
InitRun
(se->
topNode
());
49
g4
->
ApplyDisplayAction
();
50
g4
->
ApplyCommand
(
"/control/execute vis.mac"
);
51
// draw 1m long axis
52
g4
->
ApplyCommand
(
"/vis/scene/add/axes 0 0 0 100 cm"
);
53
se->
run
(1);
54
// print some empty lines so the instructions stick out
55
for
(
int
i=0; i<5; i++)
56
{
57
cout << endl;
58
}
59
cout <<
"Type displaycmd() to see some commands to change the display"
<< endl;
60
cout <<
"If you want to run more events, do:"
<< endl;
61
cout <<
"Fun4AllServer *se = Fun4AllServer::instance();"
<< endl;
62
cout <<
"se->run(1);"
<< endl;
63
return
0;
64
}
65
66
void
displaycmd
()
67
{
68
cout <<
"draw 1m axis: "
<< endl;
69
cout <<
" g4->ApplyCommand(\"/vis/scene/add/axes 0 0 0 100 cm\")"
<< endl;
70
cout <<
"zoom"
<< endl;
71
cout <<
" g4->ApplyCommand(\"/vis/viewer/zoom 1\")"
<< endl;
72
cout <<
"viewpoint:"
<< endl;
73
cout <<
" g4->ApplyCommand(\"/vis/viewer/set/viewpointThetaPhi 0 0\")"
<< endl;
74
cout <<
"panTo:"
<< endl;
75
cout <<
" g4->ApplyCommand(\"/vis/viewer/panTo 0 0 cm\")"
<< endl;
76
cout <<
"print to eps:"
<< endl;
77
cout <<
" g4->ApplyCommand(\"/vis/ogl/printEPS\")"
<< endl;
78
cout <<
"set background color:"
<< endl;
79
cout <<
" g4->ApplyCommand(\"/vis/viewer/set/background white\")"
<< endl;
80
}
fun4all_eic_tutorials
blob
master
ReadEICGeneratorOutput
Fun4All_EIC_Generator_Display.C
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:51
using
1.8.2 with
EIC GitHub integration