[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 | // GEANT4 ibrem |
---|
| 29 | // |
---|
| 30 | // History: based on object model of |
---|
| 31 | // 2nd December 1995, G.Cosmo |
---|
| 32 | // ---------- ibrem ---------------------------- |
---|
| 33 | // |
---|
| 34 | // Modified: 05.04.01 Vladimir Ivanchenko new design of ibrem |
---|
| 35 | // |
---|
| 36 | // ------------------------------------------------------------- |
---|
| 37 | |
---|
| 38 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 39 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 40 | |
---|
| 41 | #include "G4RunManager.hh" |
---|
| 42 | #include "G4UImanager.hh" |
---|
| 43 | #include "G4UIterminal.hh" |
---|
| 44 | #include "G4UItcsh.hh" |
---|
| 45 | #include "Randomize.hh" |
---|
| 46 | |
---|
| 47 | #include "G4VisExecutive.hh" |
---|
| 48 | |
---|
| 49 | #include "DetectorConstruction.hh" |
---|
| 50 | #include "PhysicsList.hh" |
---|
| 51 | #include "PrimaryGeneratorAction.hh" |
---|
| 52 | #include "EventAction.hh" |
---|
| 53 | #include "TrackingAction.hh" |
---|
| 54 | #include "RunAction.hh" |
---|
| 55 | #include "Histo.hh" |
---|
| 56 | |
---|
| 57 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 58 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... |
---|
| 59 | |
---|
| 60 | int main(int argc,char** argv) { |
---|
| 61 | |
---|
| 62 | G4int verbose = 1; |
---|
| 63 | //choose the Random engine |
---|
| 64 | CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine); |
---|
| 65 | |
---|
| 66 | // G4String fName = argv[1]; |
---|
| 67 | // (Histo::GetInstance)->LoadParameters(fName); |
---|
| 68 | |
---|
| 69 | // Construct the default run manager |
---|
| 70 | G4RunManager * runManager = new G4RunManager(); |
---|
| 71 | |
---|
| 72 | // set mandatory initialization classes |
---|
| 73 | DetectorConstruction* det = new DetectorConstruction(); |
---|
| 74 | runManager->SetUserInitialization(det); |
---|
| 75 | |
---|
| 76 | runManager->SetUserInitialization(new PhysicsList()); |
---|
| 77 | |
---|
| 78 | // visualization manager |
---|
| 79 | G4VisManager* visManager = 0; |
---|
| 80 | |
---|
| 81 | // set user action classes |
---|
| 82 | runManager->SetUserAction(new PrimaryGeneratorAction(det)); |
---|
| 83 | runManager->SetUserAction(new RunAction()); |
---|
| 84 | runManager->SetUserAction(new EventAction()); |
---|
| 85 | runManager->SetUserAction(new TrackingAction()); |
---|
| 86 | |
---|
| 87 | // get the pointer to the User Interface manager |
---|
| 88 | G4UImanager* UI = G4UImanager::GetUIpointer(); |
---|
| 89 | if(1 < verbose) UI->ListCommands("/testem/"); |
---|
| 90 | |
---|
| 91 | if (argc==1) // Define UI terminal for interactive mode |
---|
| 92 | { |
---|
| 93 | visManager = new G4VisExecutive(); |
---|
| 94 | visManager->Initialize(); |
---|
| 95 | G4UIsession * session; |
---|
| 96 | #ifdef G4UI_USE_TCSH |
---|
| 97 | session = new G4UIterminal(new G4UItcsh); |
---|
| 98 | #else |
---|
| 99 | session = new G4UIterminal(); |
---|
| 100 | #endif |
---|
| 101 | session->SessionStart(); |
---|
| 102 | delete session; |
---|
| 103 | } |
---|
| 104 | else if (argc>1) // Batch mode with 1 or more files |
---|
| 105 | { |
---|
| 106 | if(verbose >0) G4cout << "UI interface is started" << G4endl; |
---|
| 107 | G4String command = "/control/execute "; |
---|
| 108 | G4String fileName = argv[1]; |
---|
| 109 | UI->ApplyCommand(command+fileName); |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | // job termination |
---|
| 113 | delete visManager; |
---|
| 114 | delete runManager; |
---|
| 115 | |
---|
| 116 | return 0; |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | |
---|