Geant4  10.00.p03
microelectronics.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 //
26 // -------------------------------------------------------------------
27 // $Id: Microelectronics.cc,v 1.5 2010-11-18 11:48:21 allison Exp $
28 // -------------------------------------------------------------------
29 
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
31 
32 #ifdef G4MULTITHREADED
33  #include "G4MTRunManager.hh"
34 #else
35  #include "G4RunManager.hh"
36 #endif
37 
38 #include "G4UImanager.hh"
39 #include "G4UIterminal.hh"
40 #include "G4UItcsh.hh"
41 
42 #ifdef G4VIS_USE
43  #include "G4VisExecutive.hh"
44 #endif
45 
46 #include "ActionInitialization.hh"
47 #include "DetectorConstruction.hh"
48 #include "PhysicsList.hh"
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
51 
52 int main(int argc,char** argv)
53 {
54  // Choose the Random engine
55 
56  G4Random::setTheEngine(new CLHEP::RanecuEngine);
57 
58  // Construct the default run manager
59 
60 #ifdef G4MULTITHREADED
61  G4MTRunManager* runManager = new G4MTRunManager;
62  // runManager->SetNumberOfThreads(2); // Is equal to 2 by default
63 #else
64  G4RunManager* runManager = new G4RunManager;
65 #endif
66 
67  // Set mandatory user initialization classes
69  runManager->SetUserInitialization(detector);
70 
71  runManager->SetUserInitialization(new PhysicsList);
72 
73  // User action initialization
74  runManager->SetUserInitialization(new ActionInitialization(detector));
75 
76  // Initialize G4 kernel
77  runManager->Initialize();
78 
79 #ifdef G4VIS_USE
80  G4VisManager* visManager = new G4VisExecutive;
81  visManager->Initialize();
82 #endif
83 
84  // Get the pointer to the User Interface manager
85  G4UImanager* UImanager = G4UImanager::GetUIpointer();
86 
87  if (argc==1) // Define UI session for interactive mode.
88  {
89 #ifdef _WIN32
91 #else
92  G4UIsession * session = new G4UIterminal(new G4UItcsh);
93 #endif
94  UImanager->ApplyCommand("/control/execute microelectronics.mac");
95  session->SessionStart();
96  delete session;
97  }
98  else // Batch mode
99  {
100  G4String command = "/control/execute ";
101  G4String fileName = argv[1];
102  UImanager->ApplyCommand(command+fileName);
103  }
104 
105 #ifdef G4VIS_USE
106  delete visManager;
107 #endif
108 
109  delete runManager;
110 
111  return 0;
112 }
113 
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
virtual G4UIsession * SessionStart()
Definition: G4UIsession.cc:38
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
static G4UIterminal * session
Action initialization class.
void Initialize()
int main(int argc, char **argv)
virtual void Initialize()
Detector construction class to demonstrate various ways of placement.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:432