Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dnaphysics.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: Microdosimetry.cc,v 1.4 2010/10/06 14:39:41 sincerti Exp $
28 // -------------------------------------------------------------------
29 
30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
31 
32 #include "G4RunManager.hh"
33 #include "G4UImanager.hh"
34 #include "G4UIterminal.hh"
35 #include "G4UItcsh.hh"
36 
37 #ifdef G4VIS_USE
38  #include "G4VisExecutive.hh"
39 #endif
40 
41 #include "DetectorConstruction.hh"
42 #include "PhysicsList.hh"
43 #include "PrimaryGeneratorAction.hh"
44 #include "RunAction.hh"
45 #include "SteppingAction.hh"
46 #include "SteppingVerbose.hh"
47 #include "HistoManager.hh"
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
50 
51 int main(int argc,char** argv)
52 {
53  // Construct the default run manager
54  G4RunManager * runManager = new G4RunManager;
55 
56  // Set mandatory user initialization classes
58  runManager->SetUserInitialization(detector);
59  runManager->SetUserInitialization(new PhysicsList);
60 
61  // Set mandatory user action classes
62  PrimaryGeneratorAction* primary = new PrimaryGeneratorAction(detector);
63  runManager->SetUserAction(primary);
64 
65  HistoManager* histo = new HistoManager();
66 
67  // Set optional user action classes
68  RunAction* RunAct = new RunAction(detector,histo);
69  runManager->SetUserAction(RunAct);
70 
71  runManager->SetUserAction(new SteppingAction(RunAct,detector,primary,histo));
72 
73 #ifdef G4VIS_USE
74  G4VisManager* visManager = new G4VisExecutive;
75  visManager->Initialize();
76 #endif
77 
78  // Initialize G4 kernel
79  runManager->Initialize();
80 
81  remove ("dna.root");
82 
83  // Get the pointer to the User Interface manager
85 
86  if (argc==1) // Define UI session for interactive mode.
87  {
88 #ifdef _WIN32
89  G4UIsession * session = new G4UIterminal();
90 #else
91  G4UIsession * session = new G4UIterminal(new G4UItcsh);
92 #endif
93  UI->ApplyCommand("/control/execute dna.mac");
94  session->SessionStart();
95  delete session;
96  }
97  else // Batch mode
98  {
99  G4String command = "/control/execute ";
100  G4String fileName = argv[1];
101  UI->ApplyCommand(command+fileName);
102  }
103 
104 #ifdef G4VIS_USE
105  delete visManager;
106 #endif
107 
108  delete runManager;
109 
110  return 0;
111 }
112