Loading...
Searching...
No Matches
examplePar02.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//
29// --------------------------------------------------------------
30// GEANT 4 - examplePar02
31// --------------------------------------------------------------
32// Comments
33//
34// Example of a main program making use of track smearing.
35//
36// Note: for the time being, the program runs only in sequential mode,
37// because the histogram manager - i.e. the class Par02Output -
38// is a singleton...
39//
40//-------------------------------------------------------------------
41
42#include "G4Types.hh"
43
44#include "G4UImanager.hh"
45#include "G4RunManagerFactory.hh"
46
48#include "Par02PhysicsList.hh"
50
51#include "G4VisExecutive.hh"
52#include "G4UIExecutive.hh"
53
54int main( int argc, char** argv ) {
55
56 // Instantiate G4UIExecutive if interactive mode
57 G4UIExecutive* ui = nullptr;
58 if ( argc == 1 ) {
59 ui = new G4UIExecutive(argc, argv);
60 }
61
62 //-------------------------------
63 // Initialization of Run manager
64 //-------------------------------
65 auto* runManager = G4RunManagerFactory::CreateRunManager();
66 runManager->SetNumberOfThreads(4);
67
68 // Detector/mass geometry:
69 auto detector = new Par02DetectorConstruction();
70 runManager->SetUserInitialization( detector );
71
72 // PhysicsList (including G4FastSimulationManagerProcess)
73 auto physicsList = new Par02PhysicsList;
74 runManager->SetUserInitialization( physicsList );
75
76 //-------------------------------
77 // UserAction classes
78 //-------------------------------
79 runManager->SetUserInitialization( new Par02ActionInitialization );
80
81 // Initialize Run manager
82 runManager->Initialize();
83
84 //----------------
85 // Visualization:
86 //----------------
87 G4cout << "Instantiating Visualization Manager......." << G4endl;
88 G4VisManager* visManager = new G4VisExecutive;
89 visManager->Initialize();
90
91 if ( ui ) {
92 //--------------------------
93 // Define (G)UI
94 //--------------------------
95 ui->SessionStart();
96 delete ui;
97 } else {
98 G4String command = "/control/execute ";
99 G4String fileName = argv[1];
100 G4UImanager * UImanager = G4UImanager::GetUIpointer();
101 UImanager->ApplyCommand( command+fileName );
102 }
103
104 // Free the store: user actions, physics_list and detector_description are
105 // owned and deleted by the run manager, so they should not
106 // be deleted in the main() program !
107
108 delete visManager;
109 delete runManager;
110
111 return 0;
112}
Definition of the Par02ActionInitialization class.
Definition of the Par02DetectorConstruction class.
Definition of the Par02PhysicsList class.
Construction of detector geometry.
Construction of a physics list.
int main()
Definition testCommon.cc:47

Applications | User Support | Publications | Collaboration