[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 | // |
---|
[1337] | 26 | // $Id: monopole.cc,v 1.6 2010/06/06 04:53:49 perl Exp $ |
---|
| 27 | // GEANT4 tag $Name: geant4-09-04-beta-01 $ |
---|
[807] | 28 | // |
---|
| 29 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 30 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 31 | |
---|
| 32 | #include "G4RunManager.hh" |
---|
| 33 | #include "G4UImanager.hh" |
---|
| 34 | #include "Randomize.hh" |
---|
[1230] | 35 | #include "globals.hh" |
---|
[807] | 36 | |
---|
| 37 | #include "DetectorConstruction.hh" |
---|
| 38 | #include "G4MonopolePhysics.hh" |
---|
[1337] | 39 | #include "QGSP_BERT.hh" |
---|
[807] | 40 | #include "PrimaryGeneratorAction.hh" |
---|
| 41 | |
---|
| 42 | #include "RunAction.hh" |
---|
| 43 | #include "EventAction.hh" |
---|
| 44 | #include "TrackingAction.hh" |
---|
| 45 | #include "SteppingAction.hh" |
---|
| 46 | |
---|
| 47 | #ifdef G4VIS_USE |
---|
| 48 | #include "G4VisExecutive.hh" |
---|
| 49 | #endif |
---|
| 50 | |
---|
[1337] | 51 | #ifdef G4UI_USE |
---|
| 52 | #include "G4UIExecutive.hh" |
---|
| 53 | #endif |
---|
| 54 | |
---|
[807] | 55 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
| 56 | |
---|
| 57 | int main(int argc,char** argv) { |
---|
| 58 | |
---|
| 59 | //choose the Random engine |
---|
| 60 | CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine); |
---|
| 61 | |
---|
| 62 | //Construct the default run manager |
---|
| 63 | G4RunManager * runManager = new G4RunManager; |
---|
| 64 | |
---|
[1230] | 65 | //create physicsList |
---|
[1337] | 66 | QGSP_BERT* phys = new QGSP_BERT(); |
---|
[1230] | 67 | G4MonopolePhysics * theMonopole = new G4MonopolePhysics(); |
---|
[807] | 68 | phys->RegisterPhysics(theMonopole); |
---|
[1337] | 69 | |
---|
| 70 | // visualization manager |
---|
| 71 | #ifdef G4VIS_USE |
---|
| 72 | G4VisManager* visManager = new G4VisExecutive; |
---|
| 73 | visManager->Initialize(); |
---|
| 74 | #endif |
---|
| 75 | |
---|
[1230] | 76 | //get the pointer to the User Interface manager |
---|
[1337] | 77 | G4UImanager* UImanager = G4UImanager::GetUIpointer(); |
---|
[807] | 78 | |
---|
[1230] | 79 | // Setup monopole |
---|
| 80 | G4String s = ""; |
---|
[1337] | 81 | if(argc > 2) { s = argv[2]; } |
---|
| 82 | UImanager->ApplyCommand("/control/verbose 1"); |
---|
| 83 | UImanager->ApplyCommand("/monopole/setup "+s); |
---|
[1230] | 84 | |
---|
| 85 | // mandator user classes |
---|
| 86 | DetectorConstruction* det = new DetectorConstruction(); |
---|
| 87 | |
---|
| 88 | runManager->SetUserInitialization(det); |
---|
| 89 | runManager->SetUserInitialization(phys); |
---|
| 90 | |
---|
| 91 | PrimaryGeneratorAction* kin = new PrimaryGeneratorAction(det); |
---|
| 92 | runManager->SetUserAction(kin); |
---|
| 93 | |
---|
| 94 | //user action classes |
---|
[807] | 95 | RunAction* run; |
---|
| 96 | |
---|
| 97 | runManager->SetUserAction(run = new RunAction(det, kin)); |
---|
| 98 | runManager->SetUserAction(new EventAction); |
---|
| 99 | runManager->SetUserAction(new TrackingAction(run)); |
---|
| 100 | runManager->SetUserAction(new SteppingAction(det, run)); |
---|
| 101 | |
---|
[1337] | 102 | if (argc!=1) // batch mode |
---|
[807] | 103 | { |
---|
[1230] | 104 | G4String command = "/control/execute "; |
---|
| 105 | G4String fileName = argv[1]; |
---|
[1337] | 106 | UImanager->ApplyCommand(command+fileName); |
---|
[807] | 107 | } |
---|
[1337] | 108 | else |
---|
| 109 | { // interactive mode : define UI session |
---|
| 110 | #ifdef G4UI_USE |
---|
| 111 | G4UIExecutive* ui = new G4UIExecutive(argc, argv); |
---|
| 112 | ui->SessionStart(); |
---|
| 113 | delete ui; |
---|
| 114 | #endif |
---|
| 115 | } |
---|
[807] | 116 | |
---|
| 117 | //job termination |
---|
| 118 | #ifdef G4VIS_USE |
---|
| 119 | delete visManager; |
---|
| 120 | #endif |
---|
| 121 | |
---|
| 122 | delete runManager; |
---|
| 123 | |
---|
| 124 | return 0; |
---|
| 125 | } |
---|
| 126 | |
---|
| 127 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|