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

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

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

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the medical/fanoCavity example.

Definition in file fanoCavity.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 65 of file fanoCavity.cc.

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