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