source: trunk/examples/extended/analysis/A01/A01app.cc@ 1330

Last change on this file since 1330 was 1230, checked in by garnier, 16 years ago

update to geant4.9.3

File size: 3.4 KB
Line 
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// $Id: A01app.cc,v 1.9 2009/11/14 14:41:13 allison Exp $
27// --------------------------------------------------------------
28//
29// --------------------------------------------------------------
30// GEANT 4 - A01app
31// --------------------------------------------------------------
32// Comments
33// Tutorial for Geant4 lectures
34// --------------------------------------------------------------
35
36
37#include "G4RunManager.hh"
38#include "G4UImanager.hh"
39
40#include "A01DetectorConstruction.hh"
41#include "A01PhysicsList.hh"
42#include "A01PrimaryGeneratorAction.hh"
43
44#include "A01EventAction.hh"
45
46#ifdef G4VIS_USE
47#include "G4VisExecutive.hh"
48#endif
49
50#ifdef G4UI_USE
51#include "G4UIExecutive.hh"
52#endif
53
54int main(int argc,char** argv)
55{
56 // RunManager construction
57 G4RunManager* runManager = new G4RunManager;
58
59#ifdef G4VIS_USE
60 // Visualization manager construction
61 G4VisManager* visManager = new G4VisExecutive;
62 visManager->Initialize();
63#endif
64
65 // mandatory user initialization classes
66 runManager->SetUserInitialization(new A01DetectorConstruction);
67 runManager->SetUserInitialization(new A01PhysicsList);
68
69 // initialize Geant4 kernel
70 runManager->Initialize();
71
72 // mandatory user action class
73 runManager->SetUserAction(new A01PrimaryGeneratorAction);
74
75 // optional user action classes
76 runManager->SetUserAction(new A01EventAction);
77
78 if(argc>1)
79 // execute an argument macro file if exist
80 {
81 G4UImanager* UImanager = G4UImanager::GetUIpointer();
82 G4String command = "/control/execute ";
83 G4String fileName = argv[1];
84 UImanager->ApplyCommand(command+fileName);
85 }
86 else
87 // start interactive session
88 {
89#ifdef G4UI_USE
90 G4UIExecutive* ui = new G4UIExecutive(argc, argv);
91 ui->SessionStart();
92 delete ui;
93#endif
94 }
95
96#ifdef G4VIS_USE
97 delete visManager;
98#endif
99
100 delete runManager;
101
102 return 0;
103}
104
Note: See TracBrowser for help on using the repository browser.