[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: RE01.cc,v 1.3 2006/06/29 17:42:25 gunter Exp $ |
---|
[1337] | 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
[807] | 29 | // |
---|
| 30 | // |
---|
| 31 | // -------------------------------------------------------------- |
---|
| 32 | // GEANT4 - RE01 exsample code |
---|
| 33 | // |
---|
| 34 | // -------------------------------------------------------------- |
---|
| 35 | // Comments |
---|
| 36 | // |
---|
| 37 | // |
---|
| 38 | // -------------------------------------------------------------- |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | #include "G4RunManager.hh" |
---|
| 42 | #include "G4UImanager.hh" |
---|
| 43 | #include "G4UIterminal.hh" |
---|
| 44 | #include "G4UItcsh.hh" |
---|
| 45 | |
---|
| 46 | #include "RE01DetectorConstruction.hh" |
---|
| 47 | #include "RE01PhysicsList.hh" |
---|
| 48 | #include "RE01PrimaryGeneratorAction.hh" |
---|
| 49 | #include "RE01RunAction.hh" |
---|
| 50 | #include "RE01EventAction.hh" |
---|
| 51 | #include "RE01StackingAction.hh" |
---|
| 52 | #include "RE01TrackingAction.hh" |
---|
| 53 | #include "RE01SteppingAction.hh" |
---|
| 54 | |
---|
| 55 | #ifdef G4VIS_USE |
---|
| 56 | #include "G4VisExecutive.hh" |
---|
| 57 | #endif |
---|
| 58 | |
---|
| 59 | int main(int argc,char** argv) |
---|
| 60 | { |
---|
| 61 | G4RunManager* runManager = new G4RunManager; |
---|
| 62 | |
---|
| 63 | #ifdef G4VIS_USE |
---|
| 64 | // Visualization manager construction |
---|
| 65 | G4VisManager* visManager = new G4VisExecutive; |
---|
| 66 | visManager->Initialize(); |
---|
| 67 | #endif |
---|
| 68 | |
---|
| 69 | runManager->SetUserInitialization(new RE01DetectorConstruction); |
---|
| 70 | runManager->SetUserInitialization(new RE01PhysicsList); |
---|
| 71 | |
---|
| 72 | runManager->Initialize(); |
---|
| 73 | |
---|
| 74 | runManager->SetUserAction(new RE01PrimaryGeneratorAction); |
---|
| 75 | runManager->SetUserAction(new RE01RunAction); |
---|
| 76 | runManager->SetUserAction(new RE01EventAction); |
---|
| 77 | runManager->SetUserAction(new RE01StackingAction); |
---|
| 78 | runManager->SetUserAction(new RE01TrackingAction); |
---|
| 79 | runManager->SetUserAction(new RE01SteppingAction); |
---|
| 80 | |
---|
| 81 | if(argc==1) |
---|
| 82 | { |
---|
| 83 | #ifdef G4UI_USE_TCSH |
---|
| 84 | G4UIsession* session = new G4UIterminal(new G4UItcsh); |
---|
| 85 | #else |
---|
| 86 | G4UIsession* session = new G4UIterminal(); |
---|
| 87 | #endif |
---|
| 88 | session->SessionStart(); |
---|
| 89 | delete session; |
---|
| 90 | } |
---|
| 91 | else |
---|
| 92 | { |
---|
| 93 | G4UImanager* UImanager = G4UImanager::GetUIpointer(); |
---|
| 94 | G4String command = "/control/execute "; |
---|
| 95 | G4String fileName = argv[1]; |
---|
| 96 | UImanager->ApplyCommand(command+fileName); |
---|
| 97 | } |
---|
| 98 | |
---|
| 99 | #ifdef G4VIS_USE |
---|
| 100 | delete visManager; |
---|
| 101 | #endif |
---|
| 102 | |
---|
| 103 | delete runManager; |
---|
| 104 | |
---|
| 105 | return 0; |
---|
| 106 | } |
---|
| 107 | |
---|