-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDetSim.cpp
More file actions
91 lines (72 loc) · 2.31 KB
/
DetSim.cpp
File metadata and controls
91 lines (72 loc) · 2.31 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include "DetectorConstruction.hh"
#include "DetectorPhysicsList.hh"
#include "DetectorPrimaryGeneratorAction.hh"
#include "DetectorRunAction.hh"
#include "DetectorEventAction.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "G4UItcsh.hh"
#include "G4SystemOfUnits.hh"
#include "G4VisExecutive.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc,char** argv)
{
// Run manager
//
G4RunManager * runManager = new G4RunManager;
// User Initialization classes (mandatory)
//
DetectorConstruction* detector = new DetectorConstruction;
runManager -> SetUserInitialization(detector);
G4VUserPhysicsList* physics = new DetectorPhysicsList();
runManager -> SetUserInitialization(physics);
G4VisManager* visManager = new G4VisExecutive;
visManager -> Initialize();
// User Action classes
//
G4VUserPrimaryGeneratorAction* gen_action = new DetectorPrimaryGeneratorAction();
runManager -> SetUserAction(gen_action);
//
G4UserRunAction* run_action = new DetectorRunAction;
runManager -> SetUserAction(run_action);
//
G4UserEventAction* event_action = new DetectorEventAction;
runManager -> SetUserAction(event_action);
// Initialize G4 kernel
//
runManager -> Initialize();
// Get the pointer to the User Interface manager
//
G4UImanager * UI = G4UImanager::GetUIpointer();
UI -> ApplyCommand("/control/macroPath ../macro");
if(argc==1) // Define (G)UI terminal for interactive mode
{
// G4UIterminal is a (dumb) terminal
//
G4UIsession * session = 0;
#ifdef G4UI_USE_TCSH
session = new G4UIterminal(new G4UItcsh);
#else
session = new G4UIterminal();
#endif
UI -> ApplyCommand("/control/execute");
session->SessionStart();
delete session;
}
else // Batch mode
{
G4String command = "/control/execute ";
G4String fileName = argv[1];
UI -> ApplyCommand(command+fileName);
}
// Free the store: user actions, physics_list and detector_description are
// owned and deleted by the run manager, so they should not
// be deleted in the main() program !
#ifdef G4VIS_USE
delete visManager;
#endif
delete runManager;
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......