LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
CompositeCalorimeter.cc File Reference
#include "CCalDetectorConstruction.hh"
#include "CCalActionInitializer.hh"
#include "CCalAnalysis.hh"
#include "G4PhysListFactory.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.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 44 of file CompositeCalorimeter.cc.

44  {
45 
46  G4VisManager *visManager = nullptr;
47 
48  G4RunManager * runManager = new G4RunManager;
49  runManager->SetUserInitialization(new CCalDetectorConstruction);
50 
51  G4PhysListFactory factory;
52  runManager->SetUserInitialization(factory.ReferencePhysList());
53 
54  runManager->SetUserInitialization(new CCalActionInitializer());
55 
56  G4UImanager * UImanager = G4UImanager::GetUIpointer();
57  UImanager->ApplyCommand("/CCal/generator/verbose 2");
58  UImanager->ApplyCommand("/gun/position -1380. 0. 0. mm");
59  UImanager->ApplyCommand("/gun/direction 1. 0. 0.");
60  UImanager->ApplyCommand("/gun/energy 100 GeV");
61 
62  // Define (G)UI terminal for interactive mode
63  if (argc==1) { // No arguments - interactive assumed.
64 
65  visManager = new G4VisExecutive;
66  visManager->Initialize();
67 
68  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
69  if (ui->IsGUI()) {
70  // Customize the menubar with a macro file :
71  UImanager->ApplyCommand("/control/execute gui.mac");
72  }
73  G4cout <<" Run initializing ..."<<G4endl;
74  UImanager->ApplyCommand("/process/verbose 0");
75  UImanager->ApplyCommand("/run/verbose 2");
76  UImanager->ApplyCommand("/run/initialize");
77 
78  // Create empty scene
79  G4String visCommand = "/vis/scene/create";
80  UImanager->ApplyCommand(visCommand);
81 
82  // Choose one default viewer
83  // (the user can always change it later on)
84  // visCommand = "/vis/open DAWNFILE";
85  // visCommand = "/vis/open VRML2FILE";
86  visCommand = "/vis/open OGL";
87  UImanager->ApplyCommand(visCommand);
88 
89  visCommand = "/vis/viewer/flush";
90  UImanager->ApplyCommand(visCommand);
91  visCommand = "/tracking/storeTrajectory 1";
92  UImanager->ApplyCommand(visCommand);
93 
94  G4cout <<"Now, please, apply beamOn command..."<<G4endl;
95  ui->SessionStart();
96  delete ui;
97 
98  } else {
99 
100  // Batch mode
101  G4String command = "/control/execute ";
102  G4String fileName = argv[1];
103  UImanager->ApplyCommand(command+fileName);
104  }
105 
106  //Close-out analysis:
107  // Save histograms
108  G4AnalysisManager* man = G4AnalysisManager::Instance();
109  man->Write();
110  man->CloseFile();
111  // Complete clean-up
112  delete G4AnalysisManager::Instance();
113  delete runManager;
114  delete visManager;
115  return 0;
116 }