-
Notifications
You must be signed in to change notification settings - Fork 0
/
ElecBackScat.cc
65 lines (47 loc) · 1.87 KB
/
ElecBackScat.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
62
63
64
65
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGenerator.hh"
#include "UserRunAction.hh"
#include "UserEventAction.hh"
#include "UserTrackingAction.hh"
#include "UserStepAction.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Materials.hh"
#include "globals.hh"
int main(int argc, char** argv) {
if(argc != 2) {
G4cerr << "Error. Wrong number of arguments." << G4endl;
G4cout << "INFORMATION: Usage " << argv[0]
<< " macrofile " << G4endl;
}
G4String fileName = argv[1];
G4String detectorName = "Detector";
G4RunManager* runManager = new G4RunManager;
Materials::Instance();
DetectorConstruction* detector =
new DetectorConstruction( detectorName );
runManager -> SetUserInitialization( detector );
PhysicsList* physics = new PhysicsList();
runManager -> SetUserInitialization( physics );
PrimaryGenerator* beam = new PrimaryGenerator();
runManager -> SetUserAction( beam );
UserStepAction* steppingAction = new UserStepAction();
runManager -> SetUserAction( steppingAction );
UserTrackingAction* trackingAction = new UserTrackingAction( detectorName );
runManager -> SetUserAction( trackingAction );
UserEventAction* eventAction = new UserEventAction( detector );
runManager -> SetUserAction( eventAction );
UserRunAction* runAction = new UserRunAction( fileName, detector,
beam, eventAction,
trackingAction );
runManager -> SetUserAction( runAction );
G4UImanager * UI = G4UImanager::GetUIpointer();
G4cout << "INFORMATION: Commands in file " << fileName
<< " used to control simulation"
<< G4endl;
UI -> ApplyCommand("/control/execute " + fileName);
delete runManager;
Materials::Destroy();
return 0;
}