[1316] | 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: AXPETDemonstrator.cc,v 1.1 2008/09/03 13:34:03 gcosmo Exp $ |
---|
[1347] | 28 | // GEANT4 tag $Name: geant4-09-04-ref-00 $ |
---|
[1316] | 29 | // |
---|
| 30 | // |
---|
| 31 | // -------------------------------------------------------------- |
---|
| 32 | // GEANT4 - OpticalEscape |
---|
| 33 | // |
---|
| 34 | // -------------------------------------------------------------- |
---|
| 35 | // Author: Tatiana Nikitina, CERN |
---|
| 36 | // -------------------------------------------------------------- |
---|
| 37 | |
---|
| 38 | #include "G4RunManager.hh" |
---|
| 39 | #include "G4UImanager.hh" |
---|
| 40 | #include "G4UIterminal.hh" |
---|
| 41 | #include "G4UItcsh.hh" |
---|
| 42 | |
---|
| 43 | #include "G4ios.hh" |
---|
| 44 | |
---|
| 45 | #include "AXPETDetectorConstruction.hh" |
---|
| 46 | #include "AXPETPhysicsList.hh" |
---|
| 47 | #include "AXPETPrimaryGeneratorAction.hh" |
---|
| 48 | #include "AXPETRunAction.hh" |
---|
| 49 | #include "AXPETEventAction.hh" |
---|
| 50 | #include "AXPETSteppingAction.hh" |
---|
| 51 | |
---|
| 52 | #ifdef G4VIS_USE |
---|
| 53 | #include "G4VisExecutive.hh" |
---|
| 54 | #endif |
---|
| 55 | |
---|
| 56 | #include "Randomize.hh" |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | int main(int argc,char** argv) |
---|
| 60 | { |
---|
| 61 | // Seed the random number generator manually |
---|
| 62 | // |
---|
| 63 | //G4long myseed = 345354; |
---|
| 64 | //CLHEP::HepRandom::setTheSeed(myseed); |
---|
| 65 | |
---|
| 66 | //choose the Random engine |
---|
| 67 | CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine); |
---|
| 68 | |
---|
| 69 | // Run manager |
---|
| 70 | // |
---|
| 71 | G4RunManager* runManager = new G4RunManager; |
---|
| 72 | |
---|
| 73 | // UserInitialization classes - mandatory |
---|
| 74 | // |
---|
| 75 | AXPETDetectorConstruction* detector = new AXPETDetectorConstruction; |
---|
| 76 | runManager-> SetUserInitialization(detector); |
---|
| 77 | // |
---|
| 78 | AXPETPhysicsList* physics = new AXPETPhysicsList; |
---|
| 79 | runManager-> SetUserInitialization(physics); |
---|
| 80 | // |
---|
| 81 | AXPETPrimaryGeneratorAction* gen_action = new AXPETPrimaryGeneratorAction; |
---|
| 82 | runManager->SetUserAction(gen_action); |
---|
| 83 | |
---|
| 84 | #ifdef G4VIS_USE |
---|
| 85 | // visualization manager |
---|
| 86 | // |
---|
| 87 | G4VisManager* visManager = new G4VisExecutive; |
---|
| 88 | visManager->Initialize(); |
---|
| 89 | #endif |
---|
| 90 | |
---|
| 91 | // UserAction classes |
---|
| 92 | // |
---|
| 93 | AXPETRunAction* run_action = new AXPETRunAction; |
---|
| 94 | runManager->SetUserAction(run_action); |
---|
| 95 | // |
---|
| 96 | AXPETEventAction* event_action = new AXPETEventAction(run_action); |
---|
| 97 | runManager->SetUserAction(event_action); |
---|
| 98 | // |
---|
| 99 | AXPETSteppingAction* step_action = new AXPETSteppingAction(detector,run_action); |
---|
| 100 | runManager->SetUserAction(step_action); |
---|
| 101 | |
---|
| 102 | // Initialize G4 kernel |
---|
| 103 | // |
---|
| 104 | runManager->Initialize(); |
---|
| 105 | |
---|
| 106 | // Get the pointer to the User Interface manager |
---|
| 107 | // |
---|
| 108 | G4UImanager* UI = G4UImanager::GetUIpointer(); |
---|
| 109 | |
---|
| 110 | if (argc==1) // Define UI session for interactive mode |
---|
| 111 | { |
---|
| 112 | G4UIsession* session = 0; |
---|
| 113 | #ifdef G4UI_USE_TCSH |
---|
| 114 | session = new G4UIterminal(new G4UItcsh); |
---|
| 115 | #else |
---|
| 116 | session = new G4UIterminal(); |
---|
| 117 | #endif |
---|
| 118 | UI->ApplyCommand("/control/execute vis.mac"); |
---|
| 119 | session->SessionStart(); |
---|
| 120 | delete session; |
---|
| 121 | } |
---|
| 122 | |
---|
| 123 | else // Batch mode |
---|
| 124 | { |
---|
| 125 | G4String command = "/control/execute "; |
---|
| 126 | G4String fileName = argv[1]; |
---|
| 127 | UI->ApplyCommand(command+fileName); |
---|
| 128 | } |
---|
| 129 | |
---|
| 130 | // Job termination |
---|
| 131 | // Free the store: user actions, physics_list and detector_description are |
---|
| 132 | // owned and deleted by the run manager, so they should not |
---|
| 133 | // be deleted in the main() program ! |
---|
| 134 | |
---|
| 135 | #ifdef G4VIS_USE |
---|
| 136 | delete visManager; |
---|
| 137 | #endif |
---|
| 138 | delete runManager; |
---|
| 139 | |
---|
| 140 | |
---|
| 141 | return 0; |
---|
| 142 | } |
---|
| 143 | |
---|