Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
fanoCavity.cc
Go to the documentation of this file.
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 //
28 //
29 // $Id: fanoCavity.cc 90848 2015-06-10 13:44:30Z gcosmo $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #ifdef G4MULTITHREADED
35 #include "G4MTRunManager.hh"
36 #else
37 #include "G4RunManager.hh"
38 #endif
39 
40 #include "G4UImanager.hh"
41 #include "Randomize.hh"
42 
43 #include "DetectorConstruction.hh"
44 #include "PhysicsList.hh"
45 #include "PrimaryGeneratorAction.hh"
46 #include "ActionInitialization.hh"
47 
48 #include "RunAction.hh"
49 #include "EventAction.hh"
50 #include "TrackingAction.hh"
51 #include "SteppingAction.hh"
52 #include "SteppingVerbose.hh"
53 #include "StackingAction.hh"
54 
55 #ifdef G4VIS_USE
56  #include "G4VisExecutive.hh"
57 #endif
58 
59 #ifdef G4UI_USE
60 #include "G4UIExecutive.hh"
61 #endif
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64 
65 int main(int argc,char** argv) {
66 
67  //choose the Random engine
69 
70 
71  //Construct the default run manager
72 #ifdef G4MULTITHREADED
73  G4MTRunManager* runManager = new G4MTRunManager;
75  if (argc==3) nThreads = G4UIcommand::ConvertToInt(argv[2]);
76  runManager->SetNumberOfThreads(nThreads);
77 #else
79  G4RunManager* runManager = new G4RunManager;
80 #endif
81 
82  //set mandatory initialization classes
84  PhysicsList* phys;
85 
86  runManager->SetUserInitialization(det = new DetectorConstruction);
87  runManager->SetUserInitialization(phys = new PhysicsList(det));
88 
89  // set user action classes
90  runManager->SetUserInitialization(new ActionInitialization(det));
91 
92  /*
93  //set user action classes
94  RunAction* run = new RunAction(det,kin);
95  EventAction* event = new EventAction(run);
96  TrackingAction* track = new TrackingAction(run);
97  SteppingAction* step = new SteppingAction(det,run,track);
98  StackingAction* stack = new StackingAction(det,run);
99 
100  runManager->SetUserAction(run);
101  runManager->SetUserAction(event);
102  runManager->SetUserAction(track);
103  runManager->SetUserAction(step);
104  runManager->SetUserAction(stack);
105 */
106  //get the pointer to the User Interface manager
108 
109  if (argc!=1) // batch mode
110  {
111  G4String command = "/control/execute ";
112  G4String fileName = argv[1];
113  UI->ApplyCommand(command+fileName);
114  }
115 
116  else // interactive mode :define visualization and UI terminal
117  {
118 #ifdef G4VIS_USE
119  G4VisManager* visManager = new G4VisExecutive;
120  visManager->Initialize();
121 #endif
122 
123 #ifdef G4UI_USE
124  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
125  ui->SessionStart();
126  delete ui;
127 #endif
128 
129 #ifdef G4VIS_USE
130  delete visManager;
131 #endif
132  }
133 
134  //job termination
135  //
136  delete runManager;
137 
138  return 0;
139 }
140 
141 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetNumberOfThreads(G4int n)
int main(int argc, char **argv)
Definition: genwindef.cpp:30
int G4int
Definition: G4Types.hh:78
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
G4int G4GetNumberOfCores()
Definition: G4Threading.cc:143
static G4int ConvertToInt(const char *st)
Definition: G4UIcommand.cc:447
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
Detector construction class to define materials and geometry.
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:270
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447
Physics list class.
Definition: PhysicsList.hh:47