LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
dnaphysics.cc File Reference

Implementation of the dnaphysics example. More...

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Implementation of the dnaphysics example.

Definition in file dnaphysics.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 56 of file dnaphysics.cc.

57 {
58  // Detect interactive mode (if no arguments) and define UI session
59  //
60  G4UIExecutive* ui = 0;
61  if ( argc == 1 ) {
62  ui = new G4UIExecutive(argc, argv);
63  }
64 
65  // Choose the Random engine
66 
67  G4Random::setTheEngine(new CLHEP::RanecuEngine);
68 
69  // Construct the default run manager
70 
71 #ifdef G4MULTITHREADED
72  G4MTRunManager* runManager = new G4MTRunManager;
73  if(argc==3) runManager->SetNumberOfThreads(atoi(argv[2]));
74  else runManager->SetNumberOfThreads(2);
75 #else
76  G4RunManager* runManager = new G4RunManager;
77 #endif
78 
79  // Set mandatory user initialization classes
80  runManager->SetUserInitialization(new DetectorConstruction);
81  runManager->SetUserInitialization(new PhysicsList);
82 
83  // User action initialization
84 
85  runManager->SetUserInitialization(new ActionInitialization());
86 
87 #ifdef G4VIS_USE
88  G4VisManager* visManager = new G4VisExecutive;
89  visManager->Initialize();
90 #endif
91 
92  // Get the pointer to the User Interface manager
93  G4UImanager* UImanager = G4UImanager::GetUIpointer();
94 
95  // Process macro or start UI session
96  //
97  if ( ! ui ) {
98  // batch mode
99  G4String command = "/control/execute ";
100  G4String fileName = argv[1];
101  UImanager->ApplyCommand(command+fileName);
102  }
103  else {
104  // interactive mode
105  UImanager->ApplyCommand("/control/execute vis.mac");
106  ui->SessionStart();
107  delete ui;
108  }
109 
110 #ifdef G4VIS_USE
111  delete visManager;
112 #endif
113 
114  delete runManager;
115 
116  return 0;
117 }