ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
microelectronics.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file microelectronics.cc
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 // -------------------------------------------------------------------
28 
29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
30 
31 #include "G4Types.hh"
32 
33 #ifdef G4MULTITHREADED
34  #include "G4MTRunManager.hh"
35 #else
36  #include "G4RunManager.hh"
37 #endif
38 
39 #include "G4UImanager.hh"
40 
41 #include "G4UIExecutive.hh"
42 
43 #include "G4VisExecutive.hh"
44 #include "ActionInitialization.hh"
45 #include "DetectorConstruction.hh"
46 #include "PhysicsList.hh"
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
49 
50 int main(int argc,char** argv)
51 {
52  G4UIExecutive* session = NULL;
53  if (argc==1) // Define UI session for interactive mode.
54  {
55  session = new G4UIExecutive(argc, argv);
56  }
57 
58  // Choose the Random engine
59 
60  G4Random::setTheEngine(new CLHEP::RanecuEngine);
61 
62  // Construct the default run manager
63 
64 #ifdef G4MULTITHREADED
65  G4MTRunManager* runManager = new G4MTRunManager;
66  // runManager->SetNumberOfThreads(2); // Is equal to 2 by default
67 #else
68  G4RunManager* runManager = new G4RunManager;
69 #endif
70 
71  // Set mandatory user initialization classes
73  runManager->SetUserInitialization(detector);
74 
75  runManager->SetUserInitialization(new PhysicsList);
76 
77  // User action initialization
78  runManager->SetUserInitialization(new ActionInitialization(detector));
79 
80  // Initialize G4 kernel
81  runManager->Initialize();
82 
83  G4VisManager* visManager = new G4VisExecutive;
84  visManager->Initialize();
85 
86  // Get the pointer to the User Interface manager
88 
89  if (argc==1) // Define UI session for interactive mode.
90  {
91  UImanager->ApplyCommand("/control/execute microelectronics.mac");
92  session->SessionStart();
93  delete session;
94  }
95  else // Batch mode
96  {
97  G4String command = "/control/execute ";
98  G4String fileName = argv[1];
99  UImanager->ApplyCommand(command+fileName);
100  }
101 
102  delete visManager;
103 
104  delete runManager;
105 
106  return 0;
107 }
108