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

Main program of the eventgenerator/userPrimaryGenerator example. More...

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.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 eventgenerator/userPrimaryGenerator example.

Definition in file userPrimaryGenerator.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 54 of file userPrimaryGenerator.cc.

54  {
55 
56  //choose the Random engine
57  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
58 
59  //my Verbose output class
60  G4VSteppingVerbose::SetInstance(new SteppingVerbose);
61 
62  // Construct the default run manager
63  G4RunManager* runManager = new G4RunManager;
64 
65  // set mandatory initialization classes
66  //
67  runManager->SetUserInitialization(new DetectorConstruction);
68  runManager->SetUserInitialization(new PhysicsList);
69 
70  runManager->SetUserAction(new PrimaryGeneratorAction);
71 
72  // get the pointer to the User Interface manager
73  G4UImanager* UI = G4UImanager::GetUIpointer();
74 
75 #ifdef G4VIS_USE
76  G4VisManager* visManager = new G4VisExecutive;
77  visManager->Initialize();
78 #endif
79 
80  if (argc!=1) // batch mode
81  {
82  G4String command = "/control/execute ";
83  G4String fileName = argv[1];
84  UI->ApplyCommand(command+fileName);
85  }
86 
87  else // define visualization and UI terminal for interactive mode
88  {
89 #ifdef G4UI_USE
90  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
91 #ifdef G4VIS_USE
92  UI->ApplyCommand("/control/execute vis.mac");
93 #endif
94  ui->SessionStart();
95  delete ui;
96 #endif
97 
98 #ifdef G4VIS_USE
99  delete visManager;
100 #endif
101  }
102 
103  // job termination
104  //
105  delete runManager;
106 
107  return 0;
108 }