[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: exampleRE02.cc,v 1.3 2006/11/18 01:37:22 asaim Exp $ |
---|
[1230] | 28 | // GEANT4 tag $Name: geant4-09-03-cand-01 $ |
---|
[807] | 29 | // |
---|
| 30 | // |
---|
| 31 | // |
---|
| 32 | // |
---|
| 33 | #include "RE02DetectorConstruction.hh" |
---|
| 34 | #include "RE02PhysicsList.hh" |
---|
| 35 | #include "RE02PrimaryGeneratorAction.hh" |
---|
| 36 | #include "RE02RunAction.hh" |
---|
| 37 | #include "RE02EventAction.hh" |
---|
| 38 | |
---|
| 39 | #include "G4RunManager.hh" |
---|
| 40 | #include "G4UImanager.hh" |
---|
| 41 | #include "G4UIterminal.hh" |
---|
| 42 | #include "G4UItcsh.hh" |
---|
| 43 | |
---|
| 44 | #ifdef G4VIS_USE |
---|
| 45 | #include "G4VisExecutive.hh" |
---|
| 46 | #endif |
---|
| 47 | |
---|
| 48 | // |
---|
| 49 | int main(int argc,char** argv) { |
---|
| 50 | |
---|
| 51 | // Run manager |
---|
| 52 | G4RunManager * runManager = new G4RunManager; |
---|
| 53 | |
---|
| 54 | // UserInitialization classes (mandatory) |
---|
| 55 | //--- |
---|
| 56 | // Create Detector |
---|
| 57 | RE02DetectorConstruction* detector = new RE02DetectorConstruction; |
---|
| 58 | detector->SetPhantomSize(G4ThreeVector(200*mm,200*mm,400*mm)); //Default |
---|
| 59 | detector->SetNumberOfSegmentsInPhantom(100,100,200); //Default |
---|
| 60 | // If your machine does not have enough memory, |
---|
| 61 | // please try to reduce Number of Segements in phantom. |
---|
| 62 | //detector->SetNumberOfSegmentsInPhantom(1,1,100); // For small memory size. |
---|
| 63 | // |
---|
| 64 | detector->SetLeadSegment(TRUE); // Default (Water and Lead) |
---|
| 65 | // Water and Lead segments are placed alternately, by defult., |
---|
| 66 | // If you want to simulation homogeneous water phantom, please set it FALSE. |
---|
| 67 | //detector->SetLeadSegment(FALSE); // Homogeneous water phantom |
---|
| 68 | // |
---|
| 69 | runManager->SetUserInitialization(detector); |
---|
| 70 | runManager->SetUserInitialization(new RE02PhysicsList); |
---|
| 71 | |
---|
| 72 | #ifdef G4VIS_USE |
---|
| 73 | // Visualization, if you choose to have it! |
---|
| 74 | G4VisManager* visManager = new G4VisExecutive; |
---|
| 75 | visManager->Initialize(); |
---|
| 76 | #endif |
---|
| 77 | |
---|
| 78 | // UserAction classes |
---|
| 79 | runManager->SetUserAction(new RE02PrimaryGeneratorAction); |
---|
| 80 | runManager->SetUserAction(new RE02RunAction); |
---|
| 81 | runManager->SetUserAction(new RE02EventAction); |
---|
| 82 | |
---|
| 83 | //Initialize G4 kernel |
---|
| 84 | runManager->Initialize(); |
---|
| 85 | |
---|
| 86 | //get the pointer to the User Interface manager |
---|
| 87 | G4UImanager * UI = G4UImanager::GetUIpointer(); |
---|
| 88 | |
---|
| 89 | if(argc==1) |
---|
| 90 | // Define (G)UI terminal for interactive mode |
---|
| 91 | { |
---|
| 92 | // G4UIterminal is a (dumb) terminal. |
---|
| 93 | G4UIsession * session = 0; |
---|
| 94 | #ifdef G4UI_USE_TCSH |
---|
| 95 | session = new G4UIterminal(new G4UItcsh); |
---|
| 96 | #else |
---|
| 97 | session = new G4UIterminal(); |
---|
| 98 | #endif |
---|
| 99 | |
---|
| 100 | UI->ApplyCommand("/control/execute vis.mac"); |
---|
| 101 | session->SessionStart(); |
---|
| 102 | delete session; |
---|
| 103 | } |
---|
| 104 | else |
---|
| 105 | // Batch mode |
---|
| 106 | { |
---|
| 107 | G4String command = "/control/execute "; |
---|
| 108 | G4String fileName = argv[1]; |
---|
| 109 | UI->ApplyCommand(command+fileName); |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | #ifdef G4VIS_USE |
---|
| 113 | delete visManager; |
---|
| 114 | #endif |
---|
| 115 | delete runManager; |
---|
| 116 | |
---|
| 117 | return 0; |
---|
| 118 | } |
---|
| 119 | |
---|
| 120 | // |
---|
| 121 | |
---|