-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFPFSim.cc
More file actions
77 lines (62 loc) · 2.15 KB
/
FPFSim.cc
File metadata and controls
77 lines (62 loc) · 2.15 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
#include <G4RunManager.hh>
#include <G4UImanager.hh>
#include <G4VisExecutive.hh>
#include <G4UIExecutive.hh>
#include <G4String.hh>
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "AnalysisManager.hh"
#include "PhysicsList.hh"
using namespace std;
/* Main function that enables to:
* - run macros
* - start interactive UI mode (no arguments)
*/
int main(int argc, char** argv)
{
G4cout<< " FPFSim starting..." << G4endl;
//G4long myseed = 345354;
//CLHEP::HepRandom::setTheSeed(myseed);
// invoke analysis manager before ui manager to invoke analysis manager messenger
AnalysisManager* analysis = AnalysisManager::GetInstance();
// Create the run manager (MT or non-MT) and make it a bit verbose.
auto runManager = new G4RunManager();
runManager->SetVerboseLevel(1);
// Set mandatory initialization classes
runManager->SetUserInitialization(new DetectorConstruction());
runManager->SetUserInitialization(new PhysicsList());
// Set user action classes
runManager->SetUserInitialization(new ActionInitialization());
// Initialize visualization
G4VisManager* visManager = new G4VisExecutive();
visManager->SetVerboseLevel(1); // Default, you can always override this using macro commands
visManager->Initialize();
G4UImanager* UImanager = G4UImanager::GetUIpointer();
// Parse command line arguments
if ( argc==1 ){
G4UIExecutive* ui = new G4UIExecutive(argc, argv);
UImanager->ApplyCommand("/control/execute macros/vis.mac");
ui->SessionStart();
delete ui;
} else {
//G4UIExecutive* ui = new G4UIExecutive(argc, argv);
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
if (argc==3) {
G4String mode = argv[2];
if (mode == "vis") {
G4UIExecutive* ui = new G4UIExecutive(argc, argv);
ui->SessionStart();
delete ui;
} else {
G4cout << "Please specify the second argument as vis to visualize the event" << G4endl;
return 0;
}
}
}
delete visManager;
delete runManager;
G4cout << "Application sucessfully ended.\nBye :-)" << G4endl;
return 0;
}