LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
dnaphysics.cc File Reference

Implementation of the dnaphysics example. More...

#include "G4Types.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIExecutive.hh"
#include "G4VisExecutive.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 53 of file dnaphysics.cc.

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