Geant4  10.01.p01
ParN04.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 //
28 //
29 //
30 // $Id: ParN04.cc 66241 2012-12-13 18:34:42Z gunter $
31 //
32 //
33 // --------------------------------------------------------------
34 // GEANT 4 - ParN04
35 // --------------------------------------------------------------
36 
37 
38 #include "G4RunManager.hh"
39 #include "G4UImanager.hh"
40 
41 #include "ExN04DetectorConstruction.hh"
42 #include "QGSP_BERT.hh"
43 #include "ExN04PrimaryGeneratorAction.hh"
44 #include "ExN04RunAction.hh"
45 #include "ExN04EventAction.hh"
46 #include "ExN04StackingAction.hh"
47 #include "ExN04TrackingAction.hh"
48 #include "ExN04SteppingAction.hh"
49 #include "ExN04SteppingVerbose.hh"
50 
51 #ifdef G4VIS_USE
52 #include "G4VisExecutive.hh"
53 #endif
54 
55 #ifdef G4UI_USE
56 #include "G4UIExecutive.hh"
57 #endif
58 
59 #include "ParTopC.icc"
60 
61 int main(int argc,char** argv)
62 {
63  // User Verbose output class
64  //
67 
68  // Run manager
69  //
70  G4RunManager* runManager = new G4RunManager;
71 
72  // User Initialization classes (mandatory)
73  //
75  runManager->SetUserInitialization(detector);
76  //
77  G4VUserPhysicsList* physics = new QGSP_BERT();
78  runManager->SetUserInitialization(physics);
79 
80 #ifdef G4VIS_USE
81  // Visualization, if you choose to have it!
82  //
83  G4VisManager* visManager = new G4VisExecutive;
84  visManager->Initialize();
85 #endif
86 
87  runManager->Initialize();
88 
89  // User Action classes
90  //
92  runManager->SetUserAction(gen_action);
93  //
94  G4UserRunAction* run_action = new ExN04RunAction;
95  runManager->SetUserAction(run_action);
96  //
97  G4UserEventAction* event_action = new ExN04EventAction;
98  runManager->SetUserAction(event_action);
99  //
100  G4UserStackingAction* stacking_action = new ExN04StackingAction;
101  runManager->SetUserAction(stacking_action);
102  //
103  G4UserTrackingAction* tracking_action = new ExN04TrackingAction;
104  runManager->SetUserAction(tracking_action);
105  //
106  G4UserSteppingAction* stepping_action = new ExN04SteppingAction;
107  runManager->SetUserAction(stepping_action);
108 
109  // Get the pointer to the User Interface manager
110  //
111  G4UImanager* UImanager = G4UImanager::GetUIpointer();
112 
113  if(argc==1) // Define (G)UI terminal for interactive mode
114  {
115 #ifdef G4UI_USE
116  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
117  UImanager->ApplyCommand("/control/execute vis.mac");
118  ui->SessionStart();
119  delete ui;
120 #endif
121  }
122  else // Batch mode
123  {
124  G4String command = "/control/execute ";
125  G4String fileName = argv[1];
126  UImanager->ApplyCommand(command+fileName);
127  }
128 
129  // Free the store: user actions, physics_list and detector_description are
130  // owned and deleted by the run manager, so they should not
131  // be deleted in the main() program !
132 
133 #ifdef G4VIS_USE
134  delete visManager;
135 #endif
136  delete runManager;
137  delete verbosity;
138 
139  return 0;
140 }
int main(int argc, char **argv)
Definition: ParN04.cc:61
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
TQGSP_BERT< G4VModularPhysicsList > QGSP_BERT
Definition: QGSP_BERT.hh:63
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
virtual void Initialize()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:432
virtual void SetUserAction(G4UserRunAction *userAction)