-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnaidetector.cc
executable file
·61 lines (55 loc) · 1.91 KB
/
naidetector.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <iostream>
#include "G4RunManager.hh"
#include "G4MTRunManager.hh"
#include "G4UIExecutive.hh"
#include "G4VisManager.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "G4VisExecutive.hh"
/*create principal function
create autoshell of Geant4*/
#include "detectorconstruction.hh"
#include "physicslist.hh"
#include "action.hh"
int main (int argc, char** argv)
{
G4UIExecutive *ui = 0;
#ifdef G4MULTITHREADED
G4MTRunManager* runmanager= new G4MTRunManager();
G4cout<<"Multithread execution"<<G4endl;
#else
/* always use G4RunManager which is the top of execution of Geant4*/
G4RunManager* runmanager= new G4RunManager();
G4cout<<"Single execution"<<G4endl;
#endif
// runmanager->SetNumberOfThreads(6);
// tell geant4 to inizilitation of detector construction
runmanager->SetUserInitialization(new detectorconstruction());
runmanager->SetUserInitialization(new physicslist());
runmanager->SetUserInitialization(new actioninitialization());
// only initialize runmanger just in case you have all mandatory classes
// runmanager->Initialize();
// need user interfase
// define the graphical execution only without an entry
if (argc==1)
{
ui= new G4UIExecutive(argc, argv);
}
// need a visualization, it has to be first to have a view and after that have the volumes
G4VisManager *vis= new G4VisExecutive();
vis->Initialize();
// only when we have arguments this line is executing
G4UImanager* UIManager= G4UImanager::GetUIpointer();
if(ui)
{
// Open the example with OPENGL
UIManager->ApplyCommand("/control/execute vis.mac");
ui->SessionStart();
}
else{
G4String command = "/control/execute "; // tell g4 to execute a macrofile
G4String filename = argv[1];
UIManager->ApplyCommand(command+filename);
}
return 0;
}