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

Main program of the persistency/P01 example. More...

#include "ExP01DetectorConstruction.hh"
#include "ExP01PrimaryGeneratorAction.hh"
#include "ExP01RunAction.hh"
#include "ExP01EventAction.hh"
#include "ExP01SteppingAction.hh"
#include "ExP01SteppingVerbose.hh"
#include "FTFP_BERT.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the persistency/P01 example.

Definition in file exampleP01.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 58 of file exampleP01.cc.

58  {
59 
60  //my Verbose output class
61  G4VSteppingVerbose::SetInstance(new ExP01SteppingVerbose);
62 
63  // Run manager
64  G4RunManager * runManager = new G4RunManager;
65 
66  // UserInitialization classes (mandatory)
67  ExP01DetectorConstruction* ExP01detector = new ExP01DetectorConstruction;
68  runManager->SetUserInitialization(ExP01detector);
69 
70  G4VModularPhysicsList* physicsList = new FTFP_BERT;
71  runManager->SetUserInitialization(physicsList);
72 
73 #ifdef G4VIS_USE
74  // Visualization, if you choose to have it!
75  G4VisManager* visManager = new G4VisExecutive;
76  visManager->Initialize();
77 #endif
78 
79  // UserAction classes
80  runManager->SetUserAction(new ExP01PrimaryGeneratorAction(ExP01detector));
81  runManager->SetUserAction(new ExP01RunAction);
82  runManager->SetUserAction(new ExP01EventAction);
83  runManager->SetUserAction(new ExP01SteppingAction);
84 
85  //Initialize G4 kernel
86  runManager->Initialize();
87 
88  //get the pointer to the User Interface manager
89  G4UImanager * UImanager = G4UImanager::GetUIpointer();
90 
91  if(argc==1)
92  // Define (G)UI terminal for interactive mode
93  {
94 #ifdef G4UI_USE
95  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
96 #ifdef G4VIS_USE
97  UImanager->ApplyCommand("/control/execute vis.mac");
98 #endif
99  ui->SessionStart();
100  delete ui;
101 #endif
102  }
103  else
104  // Batch mode
105  {
106  G4String command = "/control/execute ";
107  G4String fileName = argv[1];
108  UImanager->ApplyCommand(command+fileName);
109  }
110 
111 #ifdef G4VIS_USE
112  delete visManager;
113 #endif
114 
115  delete runManager;
116 
117  return 0;
118 }