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

Main program of the pythia6Decayer example. More...

#include "P6DExtDecayerPhysics.hh"
#include "DetectorConstruction.hh"
#include "GunPrimaryGeneratorAction.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "QGSP_BERT.hh"
#include "G4ThreeVector.hh"
#include "G4SystemOfUnits.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "Randomize.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the pythia6Decayer example.

Definition in file pythia6_decayer.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 46 of file pythia6_decayer.cc.

47 {
48  // Detect interactive mode (if no arguments) and define UI session
49  //
50  G4UIExecutive* ui = 0;
51  if ( argc == 1 ) {
52  ui = new G4UIExecutive(argc, argv);
53  }
54 
55  // Choose the Random engine
56  //
57  G4Random::setTheEngine(new CLHEP::RanecuEngine);
58 
59  // Construct the default run manager
60  //
61  G4RunManager * runManager = new G4RunManager;
62 
63  // Set mandatory initialization classes
64  //
65  runManager->SetUserInitialization(new DetectorConstruction);
66 
67  //
68  G4VModularPhysicsList* physicsList = new QGSP_BERT;
69  physicsList->RegisterPhysics(new P6DExtDecayerPhysics());
70  runManager->SetUserInitialization(physicsList);
71 
72  // Set user action classes
73  //
74  runManager->SetUserAction(
75  new GunPrimaryGeneratorAction("B-", 50.*MeV));
76  // B- meson has not defined decay in Geant4
77 
78  // Initialize visualization
79  //
80  G4VisManager* visManager = new G4VisExecutive;
81  // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
82  // G4VisManager* visManager = new G4VisExecutive("Quiet");
83  visManager->Initialize();
84 
85  // Get the pointer to the User Interface manager
86  G4UImanager* UImanager = G4UImanager::GetUIpointer();
87 
88  // Process macro or start UI session
89  //
90  if ( ! ui ) {
91  // batch mode
92  G4String command = "/control/execute ";
93  G4String fileName = argv[1];
94  UImanager->ApplyCommand(command+fileName);
95  }
96  else {
97  // interactive mode
98  UImanager->ApplyCommand("/control/execute init_vis.mac");
99  ui->SessionStart();
100  delete ui;
101  }
102 
103  // Job termination
104  // Free the store: user actions, physics_list and detector_description are
105  // owned and deleted by the run manager, so they should not
106  // be deleted in the main() program !
107  delete visManager;
108  delete runManager;
109 }