LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
ts_scorers.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 //
30 // $Id: ts_scorers.cc 93110 2015-11-05 08:37:42Z jmadsen $
31 //
32 //
42 //
43 //
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
47 
48 #ifdef G4MULTITHREADED
49  #include "G4MTRunManager.hh"
50  #include "G4Threading.hh"
51  typedef G4MTRunManager RunManager;
52 #else
53  #include "G4RunManager.hh"
54  typedef G4RunManager RunManager;
55 #endif
56 
57 #include "Randomize.hh"
58 
59 // User Defined Classes
60 #include "TSDetectorConstruction.hh"
61 #include "TSPhysicsList.hh"
62 #include "TSActionInitialization.hh"
63 
64 #include "G4UImanager.hh"
65 #include "G4VisExecutive.hh"
66 #include "G4UIExecutive.hh"
67 
68 int main(int argc, char** argv)
69 {
70 
71  // Detect interactive mode (if no arguments) and define UI session
72  //
73  G4UIExecutive* ui = 0;
74  if(argc == 1)
75  ui = new G4UIExecutive(argc, argv);
76 
77  // Choose the Random engine
78  //G4Random::setTheEngine(new CLHEP::RanecuEngine);
79 
80  CLHEP::HepRandom::setTheSeed(1245214);
81 
82  RunManager* runmanager = new RunManager();
83 
84  runmanager->SetUserInitialization(new TSDetectorConstruction);
85 
86  runmanager->SetUserInitialization(new TSPhysicsList);
87 
88  runmanager->SetUserInitialization(new TSActionInitialization);
89 
90  runmanager->Initialize();
91 
92 
93  // Initialize visualization
94  //
95  G4VisManager* visManager = new G4VisExecutive;
96  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
97  // G4VisManager* visManager = new G4VisExecutive("Quiet");
98  visManager->Initialize();
99 
100  // Get the pointer to the User Interface manager
101  G4UImanager* UImanager = G4UImanager::GetUIpointer();
102 
103  // Process macro or start UI session
104  //
105  if (!ui)
106  {
107  // batch mode
108  G4String command = "/control/execute ";
109  G4String fileName = argv[1];
110  UImanager->ApplyCommand(command+fileName);
111  } else
112  {
113  // interactive mode
114  UImanager->ApplyCommand("/control/execute vis.mac");
115  ui->SessionStart();
116  delete ui;
117  }
118 
119  // Job termination
120  // Free the store: user actions, physics_list and detector_description are
121  // owned and deleted by the run manager, so they should not be deleted
122  // in the main() program !
123 
124  delete visManager;
125  delete runmanager;
126 
127  return 0;
128 }
int main(int argc, char **argv)
Definition: ts_scorers.cc:68
G4RunManager RunManager
Definition: ts_scorers.cc:54