Loading...
Searching...
No Matches
saxs.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27//
28//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
29
30#include "G4RunManagerFactory.hh"
31
32#include "G4UImanager.hh"
33
35#include "SAXSPhysicsList.hh"
37#include "SAXSRunAction.hh"
38#include "SAXSEventAction.hh"
39#include "SAXSSteppingAction.hh"
40
41#include "G4VisExecutive.hh"
42#include "G4UIExecutive.hh"
43#include "G4Timer.hh"
44
45#include "Randomize.hh"
46#include <time.h>
47
48//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
49
50int main(int argc,char** argv)
51{
52
53 G4Timer* theTimer = new G4Timer();
54 theTimer->Start();
55
56 //Choose the Random engine and reset the seed (before the RunManager)
57 /*
58 G4int seed = time(0);
59 G4cout << "Random seed: " << seed << G4endl;
60 CLHEP::HepRandom::setTheSeed(seed);
61 */
62 //Construct the run manager
63 auto* runManager = G4RunManagerFactory::CreateRunManager();
64 int vNumberOfThreads = 2;
65 if (argc>2) {
66 vNumberOfThreads = atoi(argv[2]);
67 }
68 if (vNumberOfThreads > 0) {
69 runManager->SetNumberOfThreads(vNumberOfThreads);
70 }
71
72 //Set mandatory initialization classes
73 runManager->SetUserInitialization(new SAXSDetectorConstruction);
74 runManager->SetUserInitialization(new SAXSPhysicsList());
75
76 //Set user action classes
77 runManager->SetUserInitialization(new SAXSActionInitialization());
78
79 //Get the pointer to the User Interface manager
80 G4UImanager* UImanager = G4UImanager::GetUIpointer();
81
82 //No arguments: set the batch mode
83 if (argc!=1) {
84 //Batch mode
85 G4String command = "/control/execute ";
86 G4String fileName = argv[1];
87 UImanager->ApplyCommand(command+fileName);
88 } else {
89 //Visualization manager
90 G4VisManager* visManager = new G4VisExecutive;
91 visManager->Initialize();
92
93 //Define UI session for interactive mode
94 G4UIExecutive* ui = new G4UIExecutive(argc,argv);
95 UImanager->ApplyCommand("/control/execute init_vis.mac");
96 if (ui->IsGUI())
97 UImanager->ApplyCommand("/control/execute gui.mac");
98 ui->SessionStart();
99
100 delete ui;
101 delete visManager;
102 }
103
104 //Job termination
105 delete runManager;
106
107 theTimer->Stop();
108 G4cout << "Execution completed" << G4endl;
109 G4cout << (*theTimer) << G4endl;
110 delete theTimer;
111
112 return 0;
113}
114
115//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
116
Definition of the SAXSActionInitialization class.
Implementation of the SAXSDetectorConstruction class.
Implementation of the SAXSEventAction class.
Implementation of the SAXSPhysicsList class.
Definition of the SAXSRunAction class.
Definition of the SAXSSteppingAction class.
Action initialization class.
int main()
Definition testCommon.cc:47

Applications | User Support | Publications | Collaboration