LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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"

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 54 of file transforms.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  runManager->SetUserInitialization(new DetectorConstruction);
67  runManager->SetUserInitialization(new PhysicsList);
68 
69  // set user action classes
70  runManager->SetUserAction(new PrimaryGeneratorAction);
71 
72  //Initialize G4 kernel
73  runManager->Initialize();
74 
75  // get the pointer to the User Interface manager
76  G4UImanager* UI = G4UImanager::GetUIpointer();
77 
78  if (argc!=1) // batch mode
79  {
80  G4String command = "/control/execute ";
81  G4String fileName = argv[1];
82  UI->ApplyCommand(command+fileName);
83  }
84 
85  else // define visualization and UI terminal for interactive mode
86  {
87 #ifdef G4VIS_USE
88  G4VisManager* visManager = new G4VisExecutive;
89  visManager->Initialize();
90 #endif
91 
92 #ifdef G4UI_USE
93  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
94 #ifdef G4VIS_USE
95  UI->ApplyCommand("/control/execute vis.mac");
96 #endif
97  ui->SessionStart();
98  delete ui;
99 #endif
100 
101 #ifdef G4VIS_USE
102  delete visManager;
103 #endif
104  }
105 
106  // job termination
107  //
108  delete runManager;
109 
110  return 0;
111 }