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

Main program of the exoticphysics/phonon example. More...

#include "G4Types.hh"
#include "G4UImanager.hh"
#include "G4UserSteppingAction.hh"
#include "G4RunManager.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "XActionInitialization.hh"
#include "XDetectorConstruction.hh"
#include "XPhysicsList.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the exoticphysics/phonon example.

Definition in file XGeBox.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 52 of file XGeBox.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  // Construct the run manager
61  //
62 #ifdef G4MULTITHREADED
63  G4MTRunManager* runManager = new G4MTRunManager;
64 #else
65  G4RunManager* runManager = new G4RunManager;
66 #endif
67 
68  // Set mandatory initialization classes
69  //
70  XDetectorConstruction* detector = new XDetectorConstruction();
71  runManager->SetUserInitialization(detector);
72  //
73  G4VUserPhysicsList* physics = new XPhysicsList();
74  physics->SetCuts();
75  runManager->SetUserInitialization(physics);
76 
77  // Set user action classes
78  //
79  runManager->SetUserInitialization(new XActionInitialization);
80 
81  // Visualization manager
82  //
83  G4VisManager* visManager = new G4VisExecutive;
84  visManager->Initialize();
85 
86  // Initialize G4 kernel (replaces /run/initialize macro command)
87  //
88  runManager->Initialize();
89 
90  // Get the pointer to the User Interface manager
91  //
92  G4UImanager* UImanager = G4UImanager::GetUIpointer();
93 
94  if (ui) // Define UI session for interactive mode
95  {
96  UImanager->ApplyCommand("/control/execute vis.mac");
97  ui->SessionStart();
98  delete ui;
99  }
100  else // Batch mode
101  {
102  G4String command = "/control/execute ";
103  G4String fileName = argv[1];
104  UImanager->ApplyCommand(command+fileName);
105  }
106 
107  delete visManager;
108  delete runManager;
109 
110  return 0;
111 }