| 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: testDrawVox.cc,v 1.5 2006/06/29 18:34:55 gunter Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
|
|---|
| 29 | //
|
|---|
| 30 | //
|
|---|
| 31 | // --------------------------------------------------------------
|
|---|
| 32 | // GEANT4 - test01
|
|---|
| 33 | //
|
|---|
| 34 | // --------------------------------------------------------------
|
|---|
| 35 | // Comments
|
|---|
| 36 | //
|
|---|
| 37 | //
|
|---|
| 38 | // --------------------------------------------------------------
|
|---|
| 39 |
|
|---|
| 40 | #include "TstDrawVox01DetectorConstruction.hh"
|
|---|
| 41 | #include "TstDrawVox01RunAction.hh"
|
|---|
| 42 | #include "TstDrawVox01PrimaryGeneratorAction.hh"
|
|---|
| 43 | #include "TstDrawVox01SteppingAction.hh"
|
|---|
| 44 | #include "TstDrawVox01PhysicsList.hh"
|
|---|
| 45 |
|
|---|
| 46 | #include "G4UImanager.hh"
|
|---|
| 47 | #include "G4UIterminal.hh"
|
|---|
| 48 |
|
|---|
| 49 | #include "G4RunManager.hh"
|
|---|
| 50 |
|
|---|
| 51 | #ifdef G4VIS_USE
|
|---|
| 52 | #include "G4VisExecutive.hh"
|
|---|
| 53 | #endif
|
|---|
| 54 |
|
|---|
| 55 | #include "G4ios.hh"
|
|---|
| 56 |
|
|---|
| 57 | int main(int argc,char** argv) {
|
|---|
| 58 |
|
|---|
| 59 | // Set the default random engine to RanecuEngine
|
|---|
| 60 | CLHEP::RanecuEngine defaultEngine;
|
|---|
| 61 | CLHEP::HepRandom::setTheEngine(&defaultEngine);
|
|---|
| 62 |
|
|---|
| 63 | // Run manager
|
|---|
| 64 | G4RunManager * runManager = new G4RunManager;
|
|---|
| 65 |
|
|---|
| 66 | // UserInitialization classes
|
|---|
| 67 | runManager->SetUserInitialization(new TstDrawVox01DetectorConstruction);
|
|---|
| 68 | runManager->SetUserInitialization(new TstDrawVox01PhysicsList);
|
|---|
| 69 |
|
|---|
| 70 | #ifdef G4VIS_USE
|
|---|
| 71 | // Visualization, if you choose to have it!
|
|---|
| 72 | G4VisManager* visManager = new G4VisExecutive;
|
|---|
| 73 | visManager->Initialize();
|
|---|
| 74 | #endif
|
|---|
| 75 |
|
|---|
| 76 | // UserAction classes
|
|---|
| 77 | runManager->SetUserAction(new TstDrawVox01RunAction);
|
|---|
| 78 | runManager->SetUserAction(new TstDrawVox01PrimaryGeneratorAction);
|
|---|
| 79 | runManager->SetUserAction(new TstDrawVox01SteppingAction);
|
|---|
| 80 |
|
|---|
| 81 | // User interactions
|
|---|
| 82 | // Define (G)UI for interactive mode
|
|---|
| 83 |
|
|---|
| 84 | // User interactions
|
|---|
| 85 | G4UImanager * UI = G4UImanager::GetUIpointer();
|
|---|
| 86 |
|
|---|
| 87 | if(argc==1)
|
|---|
| 88 | {
|
|---|
| 89 | // G4UIterminal is a (dumb) terminal.
|
|---|
| 90 | G4UIsession * session = new G4UIterminal;
|
|---|
| 91 | UI->ApplyCommand("/control/execute prerun.g4mac");
|
|---|
| 92 | session->SessionStart();
|
|---|
| 93 | delete session;
|
|---|
| 94 | }
|
|---|
| 95 | else
|
|---|
| 96 | // Batch mode
|
|---|
| 97 | {
|
|---|
| 98 | G4String command = "/control/execute ";
|
|---|
| 99 | G4String fileName = argv[1];
|
|---|
| 100 | UI->ApplyCommand(command+fileName);
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| 103 | #ifdef G4VIS_USE
|
|---|
| 104 | delete visManager;
|
|---|
| 105 | #endif
|
|---|
| 106 | delete runManager;
|
|---|
| 107 | return 0;
|
|---|
| 108 | }
|
|---|
| 109 |
|
|---|