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

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

#include "G4Types.hh"
#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"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.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 52 of file Pol01.cc.

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