LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
fanoCavity2.cc File Reference

Main program of the medical/fanoCavity2 example. More...

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "ActionInitialization.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "TrackingAction.hh"
#include "SteppingAction.hh"
#include "SteppingVerbose.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the medical/fanoCavity2 example.

Definition in file fanoCavity2.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 64 of file fanoCavity2.cc.

64  {
65 
66  //choose the Random engine
67  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
68 
69 
70 #ifdef G4MULTITHREADED
71  G4MTRunManager* runManager = new G4MTRunManager;
72  G4int nThreads = G4Threading::G4GetNumberOfCores();
73  if (argc==3) nThreads = G4UIcommand::ConvertToInt(argv[2]);
74  runManager->SetNumberOfThreads(nThreads);
75 #else
76  G4VSteppingVerbose::SetInstance(new SteppingVerbose);
77  G4RunManager* runManager = new G4RunManager;
78 #endif
79 
80 
81  //my Verbose output class
82  //G4VSteppingVerbose::SetInstance(new SteppingVerbose);
83 
84  //Construct the default run manager
85  //G4RunManager * runManager = new G4RunManager;
86 
87  //set mandatory initialization classes
89  PhysicsList* phys;
90 
91 
92  runManager->SetUserInitialization(det = new DetectorConstruction);
93  runManager->SetUserInitialization(phys = new PhysicsList());
94 
95  // set user action classes
96  runManager->SetUserInitialization(new ActionInitialization(det));
97 
98 
99  //get the pointer to the User Interface manager
100  G4UImanager* UImanager = G4UImanager::GetUIpointer();
101 
102 #ifdef G4VIS_USE
103  G4VisManager* visManager = new G4VisExecutive;
104  visManager->Initialize();
105 #endif
106 
107  if (argc!=1) // batch mode
108  {
109  G4String command = "/control/execute ";
110  G4String fileName = argv[1];
111  UImanager->ApplyCommand(command+fileName);
112  }
113 
114  else // interactive mode :define visualization and UI terminal
115  {
116 #ifdef G4UI_USE
117  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
118 #ifdef G4VIS_USE
119  UImanager->ApplyCommand("/control/execute vis.mac");
120 #endif
121  ui->SessionStart();
122  delete ui;
123 #endif
124 
125 #ifdef G4VIS_USE
126  delete visManager;
127 #endif
128  }
129 
130  //job termination
131  //
132  delete runManager;
133 
134  return 0;
135 }
TConfigurablePhysicsList< ModularPhysicsList > PhysicsList
Definition: PhysicsList.h:86