source: trunk/examples/extended/hadronic/Hadr01/hadr01.cc @ 807

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

update

File size: 4.2 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//
27// $Id: hadr01.cc,v 1.9 2006/11/24 16:48:57 vnivanch Exp $
28// GEANT4 tag $Name:  $
29//
30// -------------------------------------------------------------
31//      GEANT4 hadr01
32//
33//  Application demonstrating Geant4 hadronic physics:
34//  beam interaction with a target
35//
36//  Authors: A.Bagulya, I.Gudowska, V.Ivanchenko, N.Starkov
37//
38//  Modified:
39//
40// -------------------------------------------------------------
41//
42//
43//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45
46#include "G4RunManager.hh"
47#include "G4UImanager.hh"
48#include "G4UIterminal.hh"
49#include "G4UItcsh.hh"
50#include "Randomize.hh"
51
52#include "DetectorConstruction.hh"
53#include "PhysicsList.hh"
54#include "QBBC.hh"
55#include "QGSP.hh"
56#include "PrimaryGeneratorAction.hh"
57
58#include "RunAction.hh"
59#include "EventAction.hh"
60#include "StackingAction.hh"
61
62#include "G4VisExecutive.hh"
63
64//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
65
66int main(int argc,char** argv) {
67
68  //choose the Random engine
69  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine());
70
71  //Construct the default run manager
72  G4RunManager * runManager = new G4RunManager();
73
74  //set mandatory initialization classes
75  runManager->SetUserInitialization(new DetectorConstruction());
76
77  runManager->SetUserInitialization(new PhysicsList);
78  //runManager->SetUserInitialization(new QBBC(1,"QBEC_HP"));
79  //runManager->SetUserInitialization(new QGSP);
80
81  runManager->SetUserAction(new PrimaryGeneratorAction());
82
83  //set user action classes
84  runManager->SetUserAction(new RunAction());
85  runManager->SetUserAction(new EventAction());
86  runManager->SetUserAction(new StackingAction());
87
88  //get the pointer to the User Interface manager
89  G4UImanager* UI = G4UImanager::GetUIpointer();
90  G4VisManager* visManager = 0;
91
92  if (argc==1)   // Define UI terminal for interactive mode
93    {
94#ifdef G4VIS_USE
95      //visualization manager
96      visManager = new G4VisExecutive;
97      visManager->Initialize();
98#endif
99      G4UIsession* session = 0;
100#ifdef G4UI_USE_TCSH
101      session = new G4UIterminal(new G4UItcsh);
102#else
103      session = new G4UIterminal();
104#endif
105      session->SessionStart();
106      delete session;
107    }
108  else           // Batch mode
109    {
110     G4String command = "/control/execute ";
111     G4String fileName = argv[1];
112     UI->ApplyCommand(command+fileName);
113    }
114
115  //job termination
116  if(visManager) delete visManager;
117  delete runManager;
118
119  return 0;
120}
121
122//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.