Geant4_10
dnageometry.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 // This example is provided by the Geant4-DNA collaboration
27 // Any report or published results obtained using the Geant4-DNA software
28 // and the DNA geometry given in the Geom_DNA example
29 // shall cite the following Geant4-DNA collaboration publications:
30 // [1] NIM B 298 (2013) 47-54
31 // [2] Med. Phys. 37 (2010) 4692-4708
32 // The Geant4-DNA web site is available at http://geant4-dna.org
33 //
34 
35 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
36 
37 #include "G4RunManager.hh"
38 
39 #include "G4UImanager.hh"
40 #include "G4UIterminal.hh"
41 #include "G4UItcsh.hh"
42 
43 #ifdef G4VIS_USE
44  #include "G4VisExecutive.hh"
45 #endif
46 
47 #include "DetectorConstruction.hh"
48 #include "PhysicsList.hh"
49 #include "PrimaryGeneratorAction.hh"
50 #include "RunAction.hh"
51 #include "SteppingAction.hh"
52 #include "HistoManager.hh"
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
55 
56 int main(int argc,char** argv)
57 {
58  // Choose the Random engine
59 
60  G4Random::setTheEngine(new CLHEP::RanecuEngine);
61 
62  // Construct the default run manager
63  G4RunManager * runManager = new G4RunManager;
64 
65  // Set mandatory user initialization classes
67  runManager->SetUserInitialization(detector);
68 
69  runManager->SetUserInitialization(new PhysicsList);
70 
71  // Set mandatory user action classes
72  runManager->SetUserAction(new PrimaryGeneratorAction(detector));
73  PrimaryGeneratorAction* primary = new PrimaryGeneratorAction(detector);
74 
75  HistoManager* histo = new HistoManager();
76 
77  // Set optional user action classes
78  RunAction* RunAct = new RunAction(detector,histo);
79  runManager->SetUserAction(RunAct);
80 
81  runManager->SetUserAction(new SteppingAction(RunAct,detector,primary,histo));
82 
83 #ifdef G4VIS_USE
84  G4VisManager* visManager = new G4VisExecutive;
85  visManager->Initialize();
86 #endif
87 
88  // Initialize G4 kernel
89  runManager->Initialize();
90 
91  remove ("geom_dna.root");
92 
93  // Get the pointer to the User Interface manager
94  G4UImanager* UImanager = G4UImanager::GetUIpointer();
95 
96  if (argc==1) // Define UI session for interactive mode.
97  {
98 #ifdef _WIN32
99  G4UIsession * session = new G4UIterminal();
100 #else
101  G4UIsession * session = new G4UIterminal(new G4UItcsh);
102 #endif
103  UImanager->ApplyCommand("/control/execute dnageometry.mac");
104  session->SessionStart();
105  delete session;
106  }
107  else // Batch mode
108  {
109  G4String command = "/control/execute ";
110  G4String fileName = argv[1];
111  UImanager->ApplyCommand(command+fileName);
112  }
113 
114 #ifdef G4VIS_USE
115  delete visManager;
116 #endif
117 
118  delete runManager;
119 
120  return 0;
121 }
122 
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
int main(int argc, char **argv)
Definition: genwindef.cpp:30
virtual G4UIsession * SessionStart()
Definition: G4UIsession.cc:38
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
virtual void Initialize()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
virtual void SetUserAction(G4UserRunAction *userAction)