source: trunk/examples/extended/exoticphysics/monopole/monopole.cc @ 1358

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

tag geant4.9.4 beta 1 + modifs locales

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.6 2010/06/06 04:53:49 perl Exp $
27// GEANT4 tag $Name: geant4-09-04-beta-01 $
28//
29//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31
32#include "G4RunManager.hh"
33#include "G4UImanager.hh"
34#include "Randomize.hh"
35#include "globals.hh"
36
37#include "DetectorConstruction.hh"
38#include "G4MonopolePhysics.hh"
39#include "QGSP_BERT.hh"
40#include "PrimaryGeneratorAction.hh"
41
42#include "RunAction.hh"
43#include "EventAction.hh"
44#include "TrackingAction.hh"
45#include "SteppingAction.hh"
46
47#ifdef G4VIS_USE
48#include "G4VisExecutive.hh"
49#endif
50
51#ifdef G4UI_USE
52#include "G4UIExecutive.hh"
53#endif
54
55//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56
57int main(int argc,char** argv) {
58
59  //choose the Random engine
60  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
61
62  //Construct the default run manager
63  G4RunManager * runManager = new G4RunManager;
64
65  //create physicsList
66  QGSP_BERT* phys = new QGSP_BERT();
67  G4MonopolePhysics * theMonopole = new G4MonopolePhysics();
68  phys->RegisterPhysics(theMonopole);
69   
70        // visualization manager
71#ifdef G4VIS_USE
72        G4VisManager* visManager = new G4VisExecutive;
73        visManager->Initialize();
74#endif
75       
76  //get the pointer to the User Interface manager
77  G4UImanager* UImanager = G4UImanager::GetUIpointer();
78
79  // Setup monopole
80  G4String s = ""; 
81  if(argc > 2) { s = argv[2]; }
82  UImanager->ApplyCommand("/control/verbose 1");
83  UImanager->ApplyCommand("/monopole/setup "+s);
84
85  // mandator user classes
86  DetectorConstruction* det = new DetectorConstruction();
87
88  runManager->SetUserInitialization(det); 
89  runManager->SetUserInitialization(phys);
90
91  PrimaryGeneratorAction* kin = new PrimaryGeneratorAction(det);
92  runManager->SetUserAction(kin);
93
94  //user action classes
95  RunAction* run;
96
97  runManager->SetUserAction(run = new RunAction(det, kin));
98  runManager->SetUserAction(new EventAction);
99  runManager->SetUserAction(new TrackingAction(run));
100  runManager->SetUserAction(new SteppingAction(det, run));
101
102  if (argc!=1)   // batch mode
103    {
104      G4String command = "/control/execute ";
105      G4String fileName = argv[1];
106      UImanager->ApplyCommand(command+fileName);   
107    }
108  else
109    {  // interactive mode : define UI session
110#ifdef G4UI_USE
111      G4UIExecutive* ui = new G4UIExecutive(argc, argv);
112      ui->SessionStart();
113      delete ui;
114#endif
115    }
116
117  //job termination
118#ifdef G4VIS_USE
119  delete visManager;
120#endif
121 
122  delete runManager;
123
124  return 0;
125}
126
127//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.