LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
DMX.cc File Reference
#include "G4Types.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "DMXAnalysisManager.hh"
#include "DMXDetectorConstruction.hh"
#include "DMXPhysicsList.hh"
#include "DMXActionInitializer.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 61 of file DMX.cc.

61  {
62 
63  // choose the Random engine
64  G4Random::setTheEngine(new CLHEP::RanecuEngine);
65 
66  // Construct the default run manager
67 #ifdef G4MULTITHREADED
68  G4MTRunManager* runManager = new G4MTRunManager;
69  //runManager->SetNumberOfThreads(2);
70 #else
71  G4RunManager* runManager = new G4RunManager;
72 #endif
73 
74  // set mandatory initialization classes
75  runManager->SetUserInitialization(new DMXDetectorConstruction);
76  runManager->SetUserInitialization(new DMXPhysicsList);
77  runManager->SetUserInitialization(new DMXActionInitializer());
78 
79  // visualization manager
80  G4VisManager* visManager = new G4VisExecutive;
81  visManager->Initialize();
82 
83 #ifdef DMXENV_GPS_USE
84  G4cout << " Using GPS and not DMX gun " << G4endl;
85 #else
86  G4cout << " Using the DMX gun " << G4endl;
87 #endif
88 
89 
90  //Initialize G4 kernel
91  runManager->Initialize();
92 
93  // get the pointer to the User Interface manager
94  G4UImanager* UImanager = G4UImanager::GetUIpointer();
95 
96  // Define UI session for interactive mode.
97  if(argc == 1)
98  {
99  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
100  UImanager->ApplyCommand("/control/execute initInter.mac");
101  ui->SessionStart();
102  delete ui;
103  }
104  // Batch mode
105  else
106  {
107  G4String command = "/control/execute ";
108  G4String fileName = argv[1];
109  UImanager->ApplyCommand(command+fileName);
110  }
111 
112  //Close-out analysis:
113  // Save histograms
114  G4AnalysisManager* man = G4AnalysisManager::Instance();
115  man->Write();
116  man->CloseFile();
117  // Complete clean-up
118  delete G4AnalysisManager::Instance();
119 
120  if(visManager) delete visManager;
121 
122  delete runManager;
123 
124  return 0;
125 }