Loading...
Searching...
No Matches
XGeBox.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/// \file exoticphysics/phonon/XGeBox.cc
27/// \brief Main program of the exoticphysics/phonon example
28//
29//
30
31#include "G4Types.hh"
32
33#include "G4UImanager.hh"
34#include "G4UserSteppingAction.hh"
35
36#include "G4RunManagerFactory.hh"
37
38#include "G4VisExecutive.hh"
39#include "G4UIExecutive.hh"
40
43#include "XPhysicsList.hh"
44
45
46//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
47
48int main(int argc,char** argv) {
49
50 // Instantiate G4UIExecutive if interactive mode
51 G4UIExecutive* ui = nullptr;
52 if ( argc == 1 ) {
53 ui = new G4UIExecutive(argc, argv);
54 }
55
56 // Construct the run manager
57 //
58 auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
59
60 // Set mandatory initialization classes
61 //
63 runManager->SetUserInitialization(detector);
64 //
65 G4VUserPhysicsList* physics = new XPhysicsList();
66 physics->SetCuts();
67 runManager->SetUserInitialization(physics);
68
69 // Set user action classes
70 //
71 runManager->SetUserInitialization(new XActionInitialization);
72
73 // Visualization manager
74 //
75 G4VisManager* visManager = new G4VisExecutive;
76 visManager->Initialize();
77
78 // Initialize G4 kernel (replaces /run/initialize macro command)
79 //
80 runManager->Initialize();
81
82 // Get the pointer to the User Interface manager
83 //
84 G4UImanager* UImanager = G4UImanager::GetUIpointer();
85
86 if (ui) // Define UI session for interactive mode
87 {
88 UImanager->ApplyCommand("/control/execute vis.mac");
89 ui->SessionStart();
90 delete ui;
91 }
92 else // Batch mode
93 {
94 G4String command = "/control/execute ";
95 G4String fileName = argv[1];
96 UImanager->ApplyCommand(command+fileName);
97 }
98
99 delete visManager;
100 delete runManager;
101
102 return 0;
103}
104
105
Definition of the XActionInitialization class.
Definition of the XDetectorConstruction class.
Definition of the XPhysicsList class.
int main()
Definition testCommon.cc:47

Applications | User Support | Publications | Collaboration