ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ParN02.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ParN02.cc
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 //
28 //
29 //
30 //
31 //
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
36 #include "ExN02PhysicsList.hh"
38 #include "ExN02RunAction.hh"
39 #include "ExN02EventAction.hh"
40 #include "ExN02SteppingAction.hh"
41 #include "ExN02SteppingVerbose.hh"
42 
43 #include "G4RunManager.hh"
44 #include "G4UImanager.hh"
45 #include "G4VisExecutive.hh"
46 #include "G4UIExecutive.hh"
47 
48 #include "ParTopC.icc"
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
52 int main(int argc,char** argv)
53 {
54  // Detect interactive mode (if no arguments) and define UI session
55  //
56  G4UIExecutive* ui = 0;
57  if ( argc == 1 ) {
58  ui = new G4UIExecutive(argc, argv);
59  }
60 
61  // User Verbose output class
62  //
65 
66  // Run manager
67  //
68  G4RunManager * runManager = new G4RunManager;
69 
70  // User Initialization classes (mandatory)
71  //
73  runManager->SetUserInitialization(detector);
74  //
75  G4VUserPhysicsList* physics = new ExN02PhysicsList;
76  runManager->SetUserInitialization(physics);
77 
78  // User Action classes
79  //
81  runManager->SetUserAction(gen_action);
82  //
83  G4UserRunAction* run_action = new ExN02RunAction;
84  runManager->SetUserAction(run_action);
85  //
86  G4UserEventAction* event_action = new ExN02EventAction;
87  runManager->SetUserAction(event_action);
88  //
89  G4UserSteppingAction* stepping_action = new ExN02SteppingAction;
90  runManager->SetUserAction(stepping_action);
91 
92  // Visualization, if you choose to have it!
93  //
94  G4VisManager* visManager = new G4VisExecutive;
95  visManager->Initialize();
96 
97  // Initialize G4 kernel
98  //
99  runManager->Initialize();
100 
101  // Get the pointer to the User Interface manager
102  //
103  G4UImanager * UImanager = G4UImanager::GetUIpointer();
104 
105  // Process macro or start UI session
106  //
107  if ( ! ui ) {
108  // batch mode
109  G4String command = "/control/execute ";
110  G4String fileName = argv[1];
111  UImanager->ApplyCommand(command+fileName);
112  }
113  else {
114  // interactive mode
115  UImanager->ApplyCommand("/run/beamOn 10");
116  ui->SessionStart();
117  delete ui;
118  }
119 
120  // Free the store: user actions, physics_list and detector_description are
121  // owned and deleted by the run manager, so they should not
122  // be deleted in the main() program !
123 
124  delete visManager;
125  delete runManager;
126  delete verbosity;
127 }
128 
129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
130