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

Main program of the geometry/transforms example. More...

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "SteppingVerbose.hh"
#include "G4UIExecutive.hh"
#include "G4VisExecutive.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the geometry/transforms example.

Definition in file transforms.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 48 of file transforms.cc.

48  {
49 
50  //detect interactive mode (if no arguments) and define UI session
51  G4UIExecutive* ui = 0;
52  if (argc == 1) ui = new G4UIExecutive(argc,argv);
53 
54  //choose the Random engine
55  CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
56 
57  //my Verbose output class
58  G4VSteppingVerbose::SetInstance(new SteppingVerbose);
59 
60  //construct the default run manager
61  G4RunManager * runManager = new G4RunManager;
62 
63  //set mandatory initialization classes
64  runManager->SetUserInitialization(new DetectorConstruction);
65  runManager->SetUserInitialization(new PhysicsList);
66 
67  //set user action classes
68  runManager->SetUserAction(new PrimaryGeneratorAction);
69 
70  //initialize G4 kernel
71  runManager->Initialize();
72 
73  //initialize visualization
74  G4VisManager* visManager = new G4VisExecutive;
75  visManager->Initialize();
76 
77  //get the pointer to the User Interface manager
78  G4UImanager* UImanager = G4UImanager::GetUIpointer();
79 
80  if (ui) {
81  //interactive mode
82  UImanager->ApplyCommand("/control/execute vis.mac");
83  ui->SessionStart();
84  delete ui;
85  }
86  else {
87  //batch mode
88  G4String command = "/control/execute ";
89  G4String fileName = argv[1];
90  UImanager->ApplyCommand(command+fileName);
91  }
92 
93  //job termination
94  delete visManager;
95  delete runManager;
96 }