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

Main program of the polarisation/Pol01 example. More...

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

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the polarisation/Pol01 example.

Definition in file Pol01.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 56 of file Pol01.cc.

56  {
57 
58  //choose the Random engine
59  // CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
60  CLHEP::HepRandom::setTheEngine(new CLHEP::RanluxEngine());
61 
62  // Construct the default run manager
63  G4RunManager * runManager = new G4RunManager;
64 
65  // set mandatory initialization classes
68  runManager->SetUserInitialization(det = new DetectorConstruction);
69  runManager->SetUserInitialization(new PhysicsList);
70  runManager->SetUserAction(prim = new PrimaryGeneratorAction(det));
71 
72 #ifdef G4VIS_USE
73  G4VisManager* visManager = 0;
74 #endif
75 
76  // set user action classes
77  RunAction* run;
78  runManager->SetUserAction(run = new RunAction(det,prim));
79  runManager->SetUserAction(new EventAction(run));
80  runManager->SetUserAction(new SteppingAction(det,prim,run));
81 
82  // get the pointer to the User Interface manager
83  G4UImanager* UImanager = G4UImanager::GetUIpointer();
84 
85  if (argc==1) // Define UI terminal for interactive mode
86  {
87 #ifdef G4VIS_USE
88  visManager = new G4VisExecutive;
89  visManager->Initialize();
90 #endif
91 #ifdef G4UI_USE
92  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
93  ui->SessionStart();
94  delete ui;
95 #endif
96  }
97  else // Batch mode
98  {
99  G4String command = "/control/execute ";
100  G4String fileName = argv[1];
101  UImanager->ApplyCommand(command+fileName);
102  }
103 
104  // job termination
105 #ifdef G4VIS_USE
106  delete visManager;
107 #endif
108  delete runManager;
109 
110  return 0;
111 }