1 |
|
2 |
|
3 |
#include "G4RunManager.hh" |
4 |
#include "G4UImanager.hh" |
5 |
#include "G4UIterminal.hh" |
6 |
#include "G4UItcsh.hh" |
7 |
|
8 |
|
9 |
#include "Randomize.hh" |
10 |
|
11 |
#ifdef G4VIS_USE |
12 |
#include "VisManager.hh" |
13 |
#endif |
14 |
|
15 |
#include "DetectorConstruction.hh" |
16 |
#include "PhysicsList.hh" |
17 |
#include "PrimaryGeneratorAction.hh" |
18 |
#include "RunAction.hh" |
19 |
#include "EventAction.hh" |
20 |
#include "SteppingAction.hh" |
21 |
#include "SteppingVerbose.hh" |
22 |
#include "TrackingAction.hh" |
23 |
|
24 |
|
25 |
|
26 |
int main(int argc,char** argv) { |
27 |
|
28 |
// choose the Random engine---------------------------------- |
29 |
// G4int index=5; |
30 |
// G4long seeds[2]; |
31 |
// HepRandom::getTheTableSeeds(seeds,index); |
32 |
// HepRandom::setTheSeed(345354); |
33 |
// HepRandom::setTheSeed(975354); |
34 |
// HepRandom::setTheSeed(1299961164); |
35 |
// HepRandom::setTheSeed(16697008517); |
36 |
// HepRandom::setTheSeed(190904760); |
37 |
// HepRandom::setTheSeed(59502945); |
38 |
// HepRandom::setTheSeed(350557787); |
39 |
// HepRandom::setTheSeed(489854550); |
40 |
// HepRandom::setTheEngine(new RanecuEngine); |
41 |
// G4int index=2; |
42 |
// G4long seeds[2]; |
43 |
// const G4long* table; |
44 |
// table = HepRandom::getTheSeeds(); |
45 |
// HepRandom::setTheSeeds(seeds,index); |
46 |
|
47 |
// HepRandom::setTheEngine(new RanluxEngine); |
48 |
// HepRandom::setTheSeed( |
49 |
// 19780503 |
50 |
// 29780503 |
51 |
// 19781543 |
52 |
// 23781519 |
53 |
// ,4); |
54 |
|
55 |
//my Verbose output class |
56 |
G4VSteppingVerbose::SetInstance(new SteppingVerbose); |
57 |
|
58 |
// Construct the default run manager |
59 |
G4RunManager * runManager = new G4RunManager; |
60 |
|
61 |
// set mandatory initialization classes |
62 |
DetectorConstruction* detector = new DetectorConstruction; |
63 |
RunAction* run = new RunAction; |
64 |
runManager->SetUserInitialization(detector); |
65 |
runManager->SetUserInitialization(new PhysicsList); |
66 |
|
67 |
#ifdef G4VIS_USE |
68 |
// Visualization, if you choose to have it! |
69 |
G4VisManager* visManager = new VisManager; |
70 |
visManager->Initialize(); |
71 |
#endif |
72 |
|
73 |
// set user action classes |
74 |
runManager->SetUserAction(new PrimaryGeneratorAction(detector)); |
75 |
runManager->SetUserAction(new RunAction); |
76 |
runManager->SetUserAction(new EventAction(run)); |
77 |
runManager->SetUserAction(new SteppingAction(detector,run)); |
78 |
runManager->SetUserAction(new TrackingAction); |
79 |
|
80 |
|
81 |
runManager->Initialize(); |
82 |
|
83 |
// get the pointer to the User Interface manager |
84 |
G4UImanager* UI = G4UImanager::GetUIpointer(); |
85 |
|
86 |
if(argc==1) |
87 |
// Define (G)UI terminal for interactive mode |
88 |
{ |
89 |
// G4UIterminal is a (dumb) terminal. |
90 |
G4UIsession * session = 0; |
91 |
#ifdef G4UI_USE_TCSH |
92 |
session = new G4UIterminal(new G4UItcsh); |
93 |
#else |
94 |
session = new G4UIterminal(); |
95 |
#endif |
96 |
|
97 |
UI->ApplyCommand("/control/execute vi.mac"); |
98 |
session->SessionStart(); |
99 |
delete session; |
100 |
} |
101 |
else |
102 |
// Batch mode |
103 |
{ |
104 |
G4String command = "/control/execute "; |
105 |
G4String fileName = argv[1]; |
106 |
UI->ApplyCommand(command+fileName); |
107 |
} |
108 |
|
109 |
#ifdef G4VIS_USE |
110 |
delete visManager; |
111 |
#endif |
112 |
delete runManager; |
113 |
|
114 |
return 0; |
115 |
} |
116 |
|
117 |
2005 by G.I.Vasilye |