| [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 | // * *
|
|---|
| 28 | // * cosmicray_charging advanced example for Geant4 *
|
|---|
| 29 | // * (adapted simulation of test-mass charging in the LISA mission) *
|
|---|
| 30 | // * *
|
|---|
| 31 | // * Henrique Araujo (h.araujo@imperial.ac.uk) & Peter Wass *
|
|---|
| 32 | // * Imperial College London *
|
|---|
| 33 | // * *
|
|---|
| 34 | // * main program class *
|
|---|
| 35 | // * *
|
|---|
| 36 | // ********************************************************************
|
|---|
| 37 | //
|
|---|
| 38 | // HISTORY
|
|---|
| 39 | // 22/02/2004: migrated from LISA-V04
|
|---|
| 40 | //
|
|---|
| 41 | // ********************************************************************
|
|---|
| 42 |
|
|---|
| 43 | #include "G4RunManager.hh"
|
|---|
| 44 | #include "G4UImanager.hh"
|
|---|
| 45 | #include "G4UIterminal.hh"
|
|---|
| 46 | #include "G4UItcsh.hh"
|
|---|
| 47 |
|
|---|
| 48 | #ifdef G4UI_USE_XM
|
|---|
| 49 | #include "G4UIXm.hh"
|
|---|
| 50 | #endif
|
|---|
| 51 |
|
|---|
| 52 | #include "Randomize.hh"
|
|---|
| 53 |
|
|---|
| 54 | #ifdef G4VIS_USE
|
|---|
| 55 | #include "G4VisExecutive.hh"
|
|---|
| 56 | #endif
|
|---|
| 57 |
|
|---|
| 58 | #include "LISADetectorConstruction.hh"
|
|---|
| 59 | #include "LISAPhysicsList.hh"
|
|---|
| 60 | #include "LISAPrimaryGeneratorAction.hh"
|
|---|
| 61 | #include "LISARunAction.hh"
|
|---|
| 62 | #include "LISAEventAction.hh"
|
|---|
| 63 | #include "LISASteppingAction.hh"
|
|---|
| 64 | #include "LISAStackingAction.hh"
|
|---|
| 65 |
|
|---|
| 66 | #include <vector>
|
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 | int main(int argc,char** argv) {
|
|---|
| 70 |
|
|---|
| 71 | // choose the Random engine
|
|---|
| 72 | CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
|
|---|
| 73 |
|
|---|
| 74 | // Construct the default run manager
|
|---|
| 75 | G4RunManager* runManager = new G4RunManager;
|
|---|
| 76 |
|
|---|
| 77 | // set mandatory initialization classes
|
|---|
| 78 | LISADetectorConstruction* detector = new LISADetectorConstruction;
|
|---|
| 79 | runManager->SetUserInitialization(detector);
|
|---|
| 80 | runManager->SetUserInitialization(new LISAPhysicsList);
|
|---|
| 81 | LISAPrimaryGeneratorAction* generatorAction = new LISAPrimaryGeneratorAction;
|
|---|
| 82 | runManager->SetUserAction(generatorAction);
|
|---|
| 83 |
|
|---|
| 84 | // set user action classes
|
|---|
| 85 | LISASteppingAction* steppingAction = new LISASteppingAction;
|
|---|
| 86 | runManager->SetUserAction(steppingAction);
|
|---|
| 87 | runManager->SetUserAction(new LISAStackingAction);
|
|---|
| 88 | runManager->SetUserAction(
|
|---|
| 89 | new LISAEventAction(generatorAction,steppingAction));
|
|---|
| 90 | runManager->SetUserAction(new LISARunAction);
|
|---|
| 91 |
|
|---|
| 92 |
|
|---|
| 93 | G4UIsession* session=0;
|
|---|
| 94 | if (argc==1) { // Define UI session for interactive mode.
|
|---|
| 95 | // G4UIterminal is a (dumb) terminal.
|
|---|
| 96 | #ifdef G4UI_USE_XM
|
|---|
| 97 | session = new G4UIXm(argc,argv);
|
|---|
| 98 | #else
|
|---|
| 99 | #ifdef G4UI_USE_TCSH
|
|---|
| 100 | session = new G4UIterminal(new G4UItcsh);
|
|---|
| 101 | #else
|
|---|
| 102 | session = new G4UIterminal();
|
|---|
| 103 | #endif
|
|---|
| 104 | #endif
|
|---|
| 105 | }
|
|---|
| 106 |
|
|---|
| 107 | #ifdef G4VIS_USE
|
|---|
| 108 | // visualization manager
|
|---|
| 109 | G4VisManager* visManager = new G4VisExecutive;
|
|---|
| 110 | visManager->Initialize();
|
|---|
| 111 | #endif
|
|---|
| 112 |
|
|---|
| 113 |
|
|---|
| 114 | //Initialize G4 kernel
|
|---|
| 115 | runManager->Initialize();
|
|---|
| 116 |
|
|---|
| 117 | // get the pointer to the User Interface manager
|
|---|
| 118 | G4UImanager* UI = G4UImanager::GetUIpointer();
|
|---|
| 119 |
|
|---|
| 120 | // Define UI session for interactive mode.
|
|---|
| 121 | if(session) {
|
|---|
| 122 | // G4UIterminal is a (dumb) terminal.
|
|---|
| 123 | UI->ApplyCommand("/control/execute init.mac");
|
|---|
| 124 | session->SessionStart();
|
|---|
| 125 | delete session;
|
|---|
| 126 | }
|
|---|
| 127 | // Batch mode
|
|---|
| 128 | else {
|
|---|
| 129 | G4String command = "/control/execute ";
|
|---|
| 130 | G4String fileName = argv[1];
|
|---|
| 131 | UI->ApplyCommand(command+fileName);
|
|---|
| 132 | }
|
|---|
| 133 |
|
|---|
| 134 | // job termination
|
|---|
| 135 | #ifdef G4VIS_USE
|
|---|
| 136 | delete visManager;
|
|---|
| 137 | #endif
|
|---|
| 138 | delete runManager;
|
|---|
| 139 |
|
|---|
| 140 | return 0;
|
|---|
| 141 | }
|
|---|
| 142 |
|
|---|