source: trunk/examples/extended/eventgenerator/exgps/exGPS.cc

Last change on this file was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 3.7 KB
RevLine 
[807]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#include "G4RunManager.hh"
27#include "G4UImanager.hh"
28
29#ifdef G4UI_USE_XM
30#include "G4UIXm.hh"
31#endif
32
33#ifdef G4ANALYSIS_USE
34#include "exGPSAnalysisManager.hh"
35#endif
36
[1230]37#ifdef G4VIS_USE
[807]38#include "G4VisExecutive.hh"
[1230]39#endif
[807]40
[1337]41#ifdef G4UI_USE
42#include "G4UIExecutive.hh"
43#endif
44
[807]45#include "exGPSGeometryConstruction.hh"
46#include "exGPSPhysicsList.hh"
47#include "exGPSPrimaryGeneratorAction.hh"
48#include "exGPSRunAction.hh"
49#include "exGPSEventAction.hh"
50
51
52int main(int argc,char** argv) {
53
54  // Construct the default run manager
55  G4RunManager * runManager = new G4RunManager;
56
57#ifdef G4ANALYSIS_USE
58  //constructe the analysis manager (need here to activate the UI)
[1230]59  exGPSAnalysisManager::getInstance(); 
[807]60#endif
61
62  // set mandatory initialization classes
63  exGPSGeometryConstruction* detector = new exGPSGeometryConstruction;
64  runManager->SetUserInitialization(detector);
65  runManager->SetUserInitialization(new exGPSPhysicsList);
66 
67  // Set optional user action classes
68  exGPSEventAction* eventAction = new exGPSEventAction();
69  exGPSRunAction* runAction = new exGPSRunAction();
70
71  // set user action classes
72  runManager->SetUserAction(new exGPSPrimaryGeneratorAction);
73  runManager->SetUserAction(runAction);
74  runManager->SetUserAction(eventAction);
75 
[1337]76  //Initialize G4 kernel
77  runManager->Initialize();
78   
[807]79  // visualization manager
[1230]80#ifdef G4VIS_USE
[807]81  G4VisManager* visManager = new G4VisExecutive;
82  visManager->Initialize();
[1230]83#endif
[807]84   
85  // get the pointer to the User Interface manager
[1337]86  G4UImanager* UImanager = G4UImanager::GetUIpointer(); 
[807]87  // UI->ApplyCommand("/control/execute display.mac");   
88
[1337]89  if (argc!=1)   // batch mode
[807]90    {
91      G4String command = "/control/execute ";
92      G4String fileName = argv[1];
[1337]93      UImanager->ApplyCommand(command+fileName);   
[807]94    }
[1337]95  else
96    {  // interactive mode : define UI session
97#ifdef G4UI_USE
98      G4UIExecutive* ui = new G4UIExecutive(argc, argv);
99      ui->SessionStart();
100      delete ui;
101#endif
102    }
103
[807]104  // job termination
105
106#ifdef G4ANALYSIS_USE
[1230]107  exGPSAnalysisManager::dispose();
[807]108#endif
109
[1230]110#ifdef G4VIS_USE
[807]111  delete visManager;
[1230]112#endif
[807]113  delete runManager;
114 
115  return 0;
116}
Note: See TracBrowser for help on using the repository browser.