[1316] | 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: SolidsChecker.cc,v 1.4 2006/10/20 14:51:40 gcosmo Exp $ |
---|
[1347] | 28 | // GEANT4 tag $Name: geant4-09-04-ref-00 $ |
---|
[1316] | 29 | // |
---|
| 30 | // |
---|
| 31 | // -------------------------------------------------------------- |
---|
| 32 | // GEANT4 - test10 |
---|
| 33 | // |
---|
| 34 | // -------------------------------------------------------------- |
---|
| 35 | // Comments |
---|
| 36 | // |
---|
| 37 | // |
---|
| 38 | // -------------------------------------------------------------- |
---|
| 39 | #include "Sc01DetectorConstruction.hh" |
---|
| 40 | #include "Sc01RunAction.hh" |
---|
| 41 | #include "Sc01EventAction.hh" |
---|
| 42 | #include "SteppingAction.hh" |
---|
| 43 | #include "Sc01PrimaryGeneratorAction.hh" |
---|
| 44 | #include "Sc01PhysicsList.hh" |
---|
| 45 | #include "Sc01VisManager.hh" |
---|
| 46 | |
---|
| 47 | #include "G4UImanager.hh" |
---|
| 48 | #include "G4UIterminal.hh" |
---|
| 49 | #include "G4RunManager.hh" |
---|
| 50 | #include "G4UItcsh.hh" |
---|
| 51 | |
---|
| 52 | #include "G4ios.hh" |
---|
| 53 | |
---|
| 54 | int main(int argc,char** argv) { |
---|
| 55 | |
---|
| 56 | // Set the default random engine to RanecuEngine |
---|
| 57 | CLHEP::RanecuEngine defaultEngine; |
---|
| 58 | CLHEP::HepRandom::setTheEngine(&defaultEngine); |
---|
| 59 | |
---|
| 60 | // Run manager |
---|
| 61 | G4RunManager * runManager = new G4RunManager; |
---|
| 62 | |
---|
| 63 | // UserInitialization classes |
---|
| 64 | Sc01DetectorConstruction* detector = new Sc01DetectorConstruction(); |
---|
| 65 | runManager->SetUserInitialization(detector); |
---|
| 66 | runManager->SetUserInitialization(new Sc01PhysicsList); |
---|
| 67 | |
---|
| 68 | // UserAction classes |
---|
| 69 | runManager->SetUserAction(new Sc01RunAction); |
---|
| 70 | runManager->SetUserAction(new Sc01EventAction); |
---|
| 71 | runManager->SetUserAction(new SteppingAction); |
---|
| 72 | runManager->SetUserAction(new Sc01PrimaryGeneratorAction(detector)); |
---|
| 73 | |
---|
| 74 | #ifdef G4VIS_USE |
---|
| 75 | G4cout << "Visualization init\n"; |
---|
| 76 | G4VisManager* visManager = new Sc01VisManager(); |
---|
| 77 | visManager -> Initialize (); |
---|
| 78 | #endif |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | // User interactions |
---|
| 83 | // Define (G)UI for interactive mode |
---|
| 84 | |
---|
| 85 | G4UImanager * UI = G4UImanager::GetUIpointer(); |
---|
| 86 | |
---|
| 87 | if( argc == 1 ) |
---|
| 88 | { |
---|
| 89 | // G4UIterminal is a (dumb) terminal. |
---|
| 90 | G4UIsession * session = 0; |
---|
| 91 | #ifdef G4UI_USE_TCSH |
---|
| 92 | session = new G4UIterminal(new G4UItcsh); |
---|
| 93 | #else |
---|
| 94 | session = new G4UIterminal(); |
---|
| 95 | #endif |
---|
| 96 | UI->ApplyCommand("/control/execute vis.mac"); |
---|
| 97 | session->SessionStart(); |
---|
| 98 | delete session; |
---|
| 99 | } |
---|
| 100 | else |
---|
| 101 | // Batch mode |
---|
| 102 | { |
---|
| 103 | G4String command = "/control/execute "; |
---|
| 104 | G4String fileName = argv[1]; |
---|
| 105 | UI->ApplyCommand(command+fileName); |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | delete runManager; |
---|
| 109 | return 0; |
---|
| 110 | } |
---|
| 111 | |
---|