LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lArCal.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 //
28 // --------------------------------------------------------------
29 // GEANT 4 - exampleN03
30 //
31 // For information related to this code contact:
32 // CERN, IT Division, ASD Group
33 // --------------------------------------------------------------
34 // Comments
35 //
36 // --------------------------------------------------------------
37 
38 #include "G4Types.hh"
39 
40 #ifdef G4MULTITHREADED
41 #include "G4MTRunManager.hh"
42 #else
43 #include "G4RunManager.hh"
44 #endif
45 #include "G4UImanager.hh"
46 
47 #include "Randomize.hh"
48 
49 #include "G4VisExecutive.hh"
50 
51 #include "G4UIExecutive.hh"
52 
53 #include "FCALTestbeamSetup.hh"
54 #include "G4PhysListFactory.hh"
55 #include "FCALActionInitialization.hh"
56 
57 
58 int main(int argc,char** argv) {
59 
60  // choose the Random engine
61  G4Random::setTheEngine(new CLHEP::RanecuEngine);
62 
63  // Construct the default run manager
64 #ifdef G4MULTITHREADED
65  G4MTRunManager* runManager = new G4MTRunManager;
66 #else
67  G4RunManager* runManager = new G4RunManager;
68 #endif
69 
70  // set mandatory initialization classes
71  FCALTestbeamSetup* detector = new FCALTestbeamSetup;
72  runManager->SetUserInitialization(detector);
73 
74  G4PhysListFactory factory;
75  runManager->SetUserInitialization(factory.ReferencePhysList());
76 
77  runManager->SetUserInitialization(new FCALActionInitialization);
78 
79  // get the pointer to the User Interface manager
80  G4UImanager* UImanager = G4UImanager::GetUIpointer();
81 
82  // visualization manager
83  G4VisManager* visManager = new G4VisExecutive;
84  visManager->Initialize();
85 
86  if (argc==1) // Define UI session for interactive mode.
87  {
88  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
89  UImanager->ApplyCommand("/control/execute prerunlArcal.mac");
90  if (ui->IsGUI())
91  UImanager->ApplyCommand("/control/execute gui.mac");
92  ui->SessionStart();
93  delete ui;
94  }
95  else // Batch mode
96  {
97  G4String command = "/control/execute ";
98  G4String fileName = argv[1];
99  UImanager->ApplyCommand(command+fileName);
100  }
101 
102  // job termination
103  delete visManager;
104  delete runManager;
105 
106  return 0;
107 }
108 
int main(int argc, char **argv)
Definition: lArCal.cc:58