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

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

update

File size: 3.5 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.8 2006/11/06 19:46:06 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#include "G4UIterminal.hh"
40#ifdef G4UI_USE_TCSH
41#include "G4UItcsh.hh"
42#endif
43
44#include "A01DetectorConstruction.hh"
45#include "A01PhysicsList.hh"
46#include "A01PrimaryGeneratorAction.hh"
47
48#include "A01EventAction.hh"
49
50#ifdef G4VIS_USE
51#include "G4VisExecutive.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_TCSH
90    G4UIsession* session = new G4UIterminal(new G4UItcsh);
91#else
92    G4UIsession* session = new G4UIterminal();
93#endif
94    session->SessionStart();
95    delete session;
96  }
97
98#ifdef G4VIS_USE
99  delete visManager;
100#endif
101
102  delete runManager;
103
104  return 0;
105}
106
Note: See TracBrowser for help on using the repository browser.