| 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: load_gdml.cc,v 1.6 2007/12/11 13:13:25 gcosmo Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-01-patch-02 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // --------------------------------------------------------------
|
|---|
| 32 | // GEANT 4 - load_gdml
|
|---|
| 33 | //
|
|---|
| 34 | // --------------------------------------------------------------
|
|---|
| 35 |
|
|---|
| 36 | #include "G4RunManager.hh"
|
|---|
| 37 | #include "G4UImanager.hh"
|
|---|
| 38 | #include "G4UIsession.hh"
|
|---|
| 39 | #include "G4UIterminal.hh"
|
|---|
| 40 | #include "G4UItcsh.hh"
|
|---|
| 41 | #include "G4TransportationManager.hh"
|
|---|
| 42 | #include "G4VisExecutive.hh"
|
|---|
| 43 |
|
|---|
| 44 | #include "PrimaryGeneratorAction.hh"
|
|---|
| 45 | #include "DetectorConstruction.hh"
|
|---|
| 46 | #include "PhysicsList.hh"
|
|---|
| 47 |
|
|---|
| 48 | #include "G4GDMLParser.hh"
|
|---|
| 49 |
|
|---|
| 50 | int main(int argc, char **argv) {
|
|---|
| 51 |
|
|---|
| 52 | if (argc<2) {
|
|---|
| 53 |
|
|---|
| 54 | G4cout << "Usage: load_gdml <filename>" << G4endl;
|
|---|
| 55 | return 0;
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | G4GDMLParser parser;
|
|---|
| 59 |
|
|---|
| 60 | parser.Read(argv[1]);
|
|---|
| 61 |
|
|---|
| 62 | G4RunManager* runManager = new G4RunManager;
|
|---|
| 63 | G4VisManager* visManager = new G4VisExecutive;
|
|---|
| 64 |
|
|---|
| 65 | runManager->SetUserInitialization(new DetectorConstruction(parser.GetWorldVolume()));
|
|---|
| 66 | runManager->SetUserInitialization(new PhysicsList);
|
|---|
| 67 | runManager->SetUserAction(new PrimaryGeneratorAction);
|
|---|
| 68 |
|
|---|
| 69 | runManager->Initialize();
|
|---|
| 70 | visManager->Initialize();
|
|---|
| 71 |
|
|---|
| 72 | G4UImanager* UI = G4UImanager::GetUIpointer();
|
|---|
| 73 |
|
|---|
| 74 | G4UIsession * session = 0;
|
|---|
| 75 | #ifdef G4UI_USE_TCSH
|
|---|
| 76 | session = new G4UIterminal(new G4UItcsh);
|
|---|
| 77 | #else
|
|---|
| 78 | session = new G4UIterminal();
|
|---|
| 79 | #endif
|
|---|
| 80 |
|
|---|
| 81 | UI->ApplyCommand("/control/execute vis.mac");
|
|---|
| 82 |
|
|---|
| 83 | session->SessionStart();
|
|---|
| 84 |
|
|---|
| 85 | delete visManager;
|
|---|
| 86 | delete runManager;
|
|---|
| 87 |
|
|---|
| 88 | return 0;
|
|---|
| 89 | }
|
|---|