Geant4  10.01.p02
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 
40 #include "G4UIExecutive.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  G4UIExecutive* session = NULL;
55  if (argc==1) // Define UI session for interactive mode.
56  {
57  session = new G4UIExecutive(argc, argv);
58  }
59 
60  // Choose the Random engine
61 
62  G4Random::setTheEngine(new CLHEP::RanecuEngine);
63 
64  // Construct the default run manager
65 
66 #ifdef G4MULTITHREADED
67  G4MTRunManager* runManager = new G4MTRunManager;
68  // runManager->SetNumberOfThreads(2); // Is equal to 2 by default
69 #else
70  G4RunManager* runManager = new G4RunManager;
71 #endif
72 
73  // Set mandatory user initialization classes
75  runManager->SetUserInitialization(detector);
76 
77  runManager->SetUserInitialization(new PhysicsList);
78 
79  // User action initialization
80  runManager->SetUserInitialization(new ActionInitialization(detector));
81 
82  // Initialize G4 kernel
83  runManager->Initialize();
84 
85  G4VisManager* visManager = new G4VisExecutive;
86  visManager->Initialize();
87 
88  // Get the pointer to the User Interface manager
89  G4UImanager* UImanager = G4UImanager::GetUIpointer();
90 
91  if (argc==1) // Define UI session for interactive mode.
92  {
93  UImanager->ApplyCommand("/control/execute microelectronics.mac");
94  session->SessionStart();
95  delete session;
96  }
97  else // Batch mode
98  {
99  G4String command = "/control/execute ";
100  G4String fileName = argv[1];
101  UImanager->ApplyCommand(command+fileName);
102  }
103 
104  delete visManager;
105 
106  delete runManager;
107 
108  return 0;
109 }
110 
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
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