-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cc
More file actions
44 lines (33 loc) · 1.18 KB
/
main.cc
File metadata and controls
44 lines (33 loc) · 1.18 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
#include "G4RunManagerFactory.hh"
#include "G4UImanager.hh"
#include "G4PhysListFactory.hh"
#include "G4VModularPhysicsList.hh"
#include "MyDetectorConstruction.hh"
#include "MyPrimaryGeneratorAction.hh"
#include "MyActionInitialization.hh"
#include "Randomize.hh"
#include <ctime>
#include <iostream>
int main(int argc, char** argv)
{
// Random seed
CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
CLHEP::HepRandom::setTheSeed(time(NULL));
// Create Run Manager
auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Serial);
// User Initialization classes
runManager->SetUserInitialization(new MyDetectorConstruction());
// Use built-in physics list
G4PhysListFactory factory;
G4VModularPhysicsList* phys = factory.GetReferencePhysList("FTFP_BERT");
runManager->SetUserInitialization(phys);
// User Action Initialization
runManager->SetUserInitialization(new MyActionInitialization());
// Initialize
runManager->Initialize();
// Run a few events to test
G4UImanager* UImanager = G4UImanager::GetUIpointer();
UImanager->ApplyCommand("/run/beamOn 10000");
delete runManager;
return 0;
}