LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
phantom.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 // Previous authors: G. Guerrieri, S. Guatelli and M. G. Pia, INFN Genova, Italy
26 // Authors (since 2007): S. Guatelli,University of Wollongong, Australia
27 // Contributions by F. Ambroglini, INFN Perugia, Italy
28 
29 #include <stdexcept>
30 
31 #include "globals.hh"
32 
33 #include "G4UImanager.hh"
34 #include "G4UIsession.hh"
35 #include "G4TransportationManager.hh"
36 #include "G4VisExecutive.hh"
37 #include "G4UIExecutive.hh"
38 
39 
40 #include "G4HumanPhantomConstruction.hh"
41 #include "G4HumanPhantomPhysicsList.hh"
42 #include "G4HumanPhantomActionInitialization.hh"
43 
44 #ifdef G4MULTITHREADED
45  #include "G4MTRunManager.hh"
46 #else
47  #include "G4RunManager.hh"
48 #endif
49 
50 int main(int argc,char** argv)
51 {
52 #ifdef G4MULTITHREADED
53  G4MTRunManager* runManager = new G4MTRunManager;
54  runManager->SetNumberOfThreads(4); // Is equal to 2 by default
55 #else
56  G4RunManager* runManager = new G4RunManager;
57 #endif
58 
59  // Set mandatory initialization classes
60  G4HumanPhantomConstruction* userPhantom = new G4HumanPhantomConstruction();
61  runManager->SetUserInitialization(userPhantom);
62 
63  runManager->SetUserInitialization(new G4HumanPhantomPhysicsList);
64 
65  G4VisManager* visManager = new G4VisExecutive;
66  visManager->Initialize();
67 
68  G4HumanPhantomActionInitialization* actions = new G4HumanPhantomActionInitialization();
69  runManager->SetUserInitialization(actions);
70 
71  G4UImanager* UImanager = G4UImanager::GetUIpointer();
72 
73  if (argc==1) // Define UI session for interactive mode.
74  {
75 
76  G4cout << " UI session starts ..." << G4endl;
77  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
78  UImanager->ApplyCommand("/control/execute default.mac");
79  ui->SessionStart();
80  delete ui;
81 
82  }
83  else // Batch mode
84  {
85  G4String command = "/control/execute ";
86  G4String fileName = argv[1];
87  UImanager -> ApplyCommand(command+fileName);
88  }
89 
90  delete visManager;
91 
92 delete runManager;
93 
94 return 0;
95 }
int main(int argc, char **argv)
Definition: phantom.cc:50