[807] | 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: ParN04.cc,v 1.6 2006/07/05 13:07:54 gcosmo Exp $ |
---|
| 28 | // GEANT4 tag $Name: $ |
---|
| 29 | // |
---|
| 30 | // |
---|
| 31 | // -------------------------------------------------------------- |
---|
| 32 | // GEANT 4 - ParN04 |
---|
| 33 | // -------------------------------------------------------------- |
---|
| 34 | |
---|
| 35 | |
---|
| 36 | #include "G4RunManager.hh" |
---|
| 37 | #include "G4UImanager.hh" |
---|
| 38 | #include "G4UIterminal.hh" |
---|
| 39 | #include "G4UItcsh.hh" |
---|
| 40 | |
---|
| 41 | #include "ExN04DetectorConstruction.hh" |
---|
| 42 | #include "QGSP.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 | #include "ParTopC.icc" |
---|
| 56 | |
---|
| 57 | int main(int argc,char** argv) |
---|
| 58 | { |
---|
| 59 | // User Verbose output class |
---|
| 60 | // |
---|
| 61 | G4VSteppingVerbose* verbosity = new ExN04SteppingVerbose; |
---|
| 62 | G4VSteppingVerbose::SetInstance(verbosity); |
---|
| 63 | |
---|
| 64 | // Run manager |
---|
| 65 | // |
---|
| 66 | G4RunManager* runManager = new G4RunManager; |
---|
| 67 | |
---|
| 68 | // User Initialization classes (mandatory) |
---|
| 69 | // |
---|
| 70 | G4VUserDetectorConstruction* detector = new ExN04DetectorConstruction; |
---|
| 71 | runManager->SetUserInitialization(detector); |
---|
| 72 | // |
---|
| 73 | G4VUserPhysicsList* physics = new QGSP; |
---|
| 74 | runManager->SetUserInitialization(physics); |
---|
| 75 | |
---|
| 76 | #ifdef G4VIS_USE |
---|
| 77 | // Visualization, if you choose to have it! |
---|
| 78 | // |
---|
| 79 | G4VisManager* visManager = new G4VisExecutive; |
---|
| 80 | visManager->Initialize(); |
---|
| 81 | #endif |
---|
| 82 | |
---|
| 83 | runManager->Initialize(); |
---|
| 84 | |
---|
| 85 | // User Action classes |
---|
| 86 | // |
---|
| 87 | G4VUserPrimaryGeneratorAction* gen_action = new ExN04PrimaryGeneratorAction; |
---|
| 88 | runManager->SetUserAction(gen_action); |
---|
| 89 | // |
---|
| 90 | G4UserRunAction* run_action = new ExN04RunAction; |
---|
| 91 | runManager->SetUserAction(run_action); |
---|
| 92 | // |
---|
| 93 | G4UserEventAction* event_action = new ExN04EventAction; |
---|
| 94 | runManager->SetUserAction(event_action); |
---|
| 95 | // |
---|
| 96 | G4UserStackingAction* stacking_action = new ExN04StackingAction; |
---|
| 97 | runManager->SetUserAction(stacking_action); |
---|
| 98 | // |
---|
| 99 | G4UserTrackingAction* tracking_action = new ExN04TrackingAction; |
---|
| 100 | runManager->SetUserAction(tracking_action); |
---|
| 101 | // |
---|
| 102 | G4UserSteppingAction* stepping_action = new ExN04SteppingAction; |
---|
| 103 | runManager->SetUserAction(stepping_action); |
---|
| 104 | |
---|
| 105 | // Get the pointer to the User Interface manager |
---|
| 106 | // |
---|
| 107 | G4UImanager* UImanager = G4UImanager::GetUIpointer(); |
---|
| 108 | |
---|
| 109 | if(argc==1) // Define (G)UI terminal for interactive mode |
---|
| 110 | { |
---|
| 111 | // G4UIterminal is a (dumb) terminal |
---|
| 112 | // |
---|
| 113 | #ifdef G4UI_USE_TCSH |
---|
| 114 | G4UIsession* session = new G4UIterminal(new G4UItcsh); |
---|
| 115 | #else |
---|
| 116 | G4UIsession* session = new G4UIterminal(); |
---|
| 117 | #endif |
---|
| 118 | UImanager->ApplyCommand("/control/execute vis.mac"); |
---|
| 119 | session->SessionStart(); |
---|
| 120 | delete session; |
---|
| 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 | } |
---|