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

Main program of the optical/LXe example. More...

#include "G4Types.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4String.hh"
#include "FTFP_BERT.hh"
#include "G4OpticalPhysics.hh"
#include "G4EmStandardPhysics_option4.hh"
#include "LXeDetectorConstruction.hh"
#include "LXeActionInitialization.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the optical/LXe example.

Definition in file LXe.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 55 of file LXe.cc.

56 {
57  //detect interactive mode (if no arguments) and define UI session
58  G4UIExecutive* ui = nullptr;
59  if (argc == 1) { ui = new G4UIExecutive(argc,argv); }
60 
61 #ifdef G4MULTITHREADED
62  G4MTRunManager * runManager = new G4MTRunManager;
63  G4int nThreads = std::min(G4Threading::G4GetNumberOfCores(), 4);
64  runManager->SetNumberOfThreads(nThreads);
65  G4cout << "===== LXe is started with "
66  << runManager->GetNumberOfThreads() << " threads =====" << G4endl;
67 #else
68  G4RunManager * runManager = new G4RunManager;
69 #endif
70  LXeDetectorConstruction* det = new LXeDetectorConstruction();
71  runManager->SetUserInitialization(det);
72 
73  G4VModularPhysicsList* physicsList = new FTFP_BERT;
74  physicsList->ReplacePhysics(new G4EmStandardPhysics_option4());
75  G4OpticalPhysics* opticalPhysics = new G4OpticalPhysics();
76  opticalPhysics->SetWLSTimeProfile("delta");
77 
78  opticalPhysics->SetScintillationYieldFactor(1.0);
79  opticalPhysics->SetScintillationExcitationRatio(0.0);
80 
81  opticalPhysics->SetMaxNumPhotonsPerStep(100);
82  opticalPhysics->SetMaxBetaChangePerStep(10.0);
83 
84  opticalPhysics->SetTrackSecondariesFirst(kCerenkov, true);
85  opticalPhysics->SetTrackSecondariesFirst(kScintillation, true);
86 
87  physicsList->RegisterPhysics(opticalPhysics);
88  runManager->SetUserInitialization(physicsList);
89 
90  runManager->SetUserInitialization(new LXeActionInitialization(det));
91 
92  //initialize visualization
93  G4VisManager* visManager = new G4VisExecutive;
94  visManager->Initialize();
95 
96  //get the pointer to the User Interface manager
97  G4UImanager* UImanager = G4UImanager::GetUIpointer();
98 
99  if (ui) {
100  //interactive mode
101  UImanager->ApplyCommand("/control/execute vis.mac");
102  if (ui->IsGUI()) {
103  UImanager->ApplyCommand("/control/execute gui.mac");
104  }
105  ui->SessionStart();
106  delete ui;
107  } else {
108  //batch mode
109  G4String command = "/control/execute ";
110  G4String fileName = argv[1];
111  UImanager->ApplyCommand(command+fileName);
112  }
113 
114  // job termination
115  delete visManager;
116  delete runManager;
117  return 0;
118 }