LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
GammaRayTel.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: GammaRayTel.cc 100697 2016-10-31 11:32:35Z gcosmo $
28 //
29 //
30 // ------------------------------------------------------------
31 // GEANT 4 main program
32 // CERN Geneva Switzerland
33 //
34 //
35 // ------------ GammaRayTel example main program ------
36 // by F.Longo, R.Giannitrapani & G.Santin (29 nov 2000)
37 // See README file for details on this example
38 // 20.11.01 G.Santin: new analysis management, and some modification in the
39 // construction of some Action's
40 // ************************************************************
41 
42 #ifdef G4MULTITHREADED
43 #include "G4MTRunManager.hh"
44 #else
45 #include "G4RunManager.hh"
46 #endif
47 
48 #include "G4UImanager.hh"
49 
50 #ifdef G4VIS_USE
51 #include "G4VisExecutive.hh"
52 #endif
53 
54 #ifdef G4UI_USE
55 #include "G4UIExecutive.hh"
56 #endif
57 
58 #include "GammaRayTelDetectorConstruction.hh"
59 #include "GammaRayTelPhysicsList.hh"
60 #include "GammaRayTelActionInitializer.hh"
61 
62 //#include "QGSP_BIC.hh"
63 #include "FTFP_BERT.hh"
64 
65 #include "GammaRayTelAnalysis.hh"
66 
67 // This is the main function
68 int main(int argc, char** argv)
69 {
70  // Construct the default run manager
71 #ifdef G4MULTITHREADED
72  G4MTRunManager* runManager = new G4MTRunManager;
73  //runManager->SetNumberOfThreads(2);
74 #else
75  G4RunManager* runManager = new G4RunManager;
76 #endif
77 
78  // Set mandatory user initialization classes
79  GammaRayTelDetectorConstruction* detector =
80  new GammaRayTelDetectorConstruction;
81  runManager->SetUserInitialization(detector);
82 
83  // POSSIBILITY TO SELECT ANOTHER PHYSICS LIST
84  // do not use GammaRayTelPhysicsList, this is old style and crashes at
85  // program exit
86  runManager->SetUserInitialization(new GammaRayTelPhysicsList);
87 
88  // runManager->SetUserInitialization(new QGSP_BIC);
89  //runManager->SetUserInitialization(new FTFP_BERT);
90 
91  //Initialize actions
92  runManager->SetUserInitialization(new GammaRayTelActionInitializer());
93 
94  // Creation of the analysis manager
95  GammaRayTelAnalysis* analysis = GammaRayTelAnalysis::getInstance();
96 
97  // Set visualization and user interface
98 #ifdef G4VIS_USE
99  // Visualization manager
100  G4VisManager* visManager = new G4VisExecutive;
101  visManager->Initialize();
102 #endif
103 
104  // Initialize G4 kernel
105  // runManager->Initialize();
106 
107  // Get the pointer to the UI manager
108  G4UImanager* UImanager = G4UImanager::GetUIpointer();
109  if (argc!=1) // batch mode
110  {
111  G4String command = "/control/execute ";
112  G4String fileName = argv[1];
113  UImanager->ApplyCommand(command+fileName);
114  }
115  else
116  {
117 #ifdef G4UI_USE
118  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
119  if (ui->IsGUI())
120  {
121  /* prerunGammaRayTel.mac is loaded by default */
122  UImanager->ApplyCommand("/control/execute prerunGammaRayTel.mac");
123  ui->SessionStart();
124  }
125  delete ui;
126 #endif
127  }
128  // Job termination
129 #ifdef G4VIS_USE
130  delete visManager;
131 #endif
132  delete analysis;
133  delete runManager;
134  return 0;
135 }
int main(int argc, char **argv)
Definition: GammaRayTel.cc:68