source: trunk/examples/extended/exoticphysics/monopole/monopole.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// $Id: monopole.cc,v 1.1 2007/08/16 10:32:04 vnivanch Exp $
27// GEANT4 tag $Name:  $
28//
29//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31
32#include "G4RunManager.hh"
33#include "G4UImanager.hh"
34#include "G4UIterminal.hh"
35#include "G4UItcsh.hh"
36#include "Randomize.hh"
37
38#include "DetectorConstruction.hh"
39#include "G4MonopolePhysics.hh"
40#include "QGSP.hh"
41#include "PrimaryGeneratorAction.hh"
42
43#include "RunAction.hh"
44#include "EventAction.hh"
45#include "TrackingAction.hh"
46#include "SteppingAction.hh"
47
48#ifdef G4VIS_USE
49#include "G4VisExecutive.hh"
50#endif
51
52//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53
54int main(int argc,char** argv) {
55
56  //choose the Random engine
57  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
58
59  //Construct the default run manager
60  G4RunManager * runManager = new G4RunManager;
61
62  //set mandatory initialization classes
63  DetectorConstruction* det;
64
65        //ceate physicsList
66  QGSP* phys = new QGSP();
67  G4MonopolePhysics * theMonopole = new G4MonopolePhysics;
68  phys->RegisterPhysics(theMonopole);
69
70  PrimaryGeneratorAction* kin;
71  runManager->SetUserInitialization(det  = new DetectorConstruction);
72        runManager->SetUserInitialization(phys);
73  runManager->SetUserAction(kin = new PrimaryGeneratorAction(det));
74
75#ifdef G4VIS_USE
76  //visualization manager
77  G4VisManager* visManager = 0;
78#endif
79
80  //set user action classes
81  RunAction* run;
82
83  runManager->SetUserAction(run = new RunAction(det, kin));
84  runManager->SetUserAction(new EventAction);
85  runManager->SetUserAction(new TrackingAction(run));
86  runManager->SetUserAction(new SteppingAction(det, run));
87
88  //get the pointer to the User Interface manager
89  G4UImanager* UI = G4UImanager::GetUIpointer();
90  G4cout << "User actions are instantiated" << G4endl;
91
92  if (argc == 1)   // Define UI terminal for interactive mode
93    {
94      visManager = new G4VisExecutive();
95      visManager->Initialize();
96      G4UIsession* session = 0;
97#ifdef G4UI_USE_TCSH
98      session = new G4UIterminal(new G4UItcsh);
99#else
100      session = new G4UIterminal();
101#endif
102     session->SessionStart();
103     delete session;
104    }
105  else           // Batch mode
106    {
107     G4String command = "/control/execute ";
108     G4String fileName = argv[1];
109     UI->ApplyCommand(command+fileName);
110    }
111
112  //job termination
113#ifdef G4VIS_USE
114  delete visManager;
115#endif
116 
117  delete runManager;
118
119  return 0;
120}
121
122//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.