Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 /// \file eventgenerator/pythia/decayer6/pythi << 27 // $Id: pythia6_decayer.cc,v 1.2 2010-05-12 13:30:38 allison Exp $ 28 /// \brief Main program of the pythia6Decayer << 28 // GEANT4 tag $Name: not supported by cvs2svn $ >> 29 // >> 30 // >> 31 // ---------------------------------------------------------------------------- 29 32 30 #include "DetectorConstruction.hh" << 33 #include "G4RunManager.hh" 31 #include "GunPrimaryGeneratorAction.hh" << 32 #include "P6DExtDecayerPhysics.hh" << 33 #include "QGSP_BERT.hh" << 34 << 35 #include "G4RunManagerFactory.hh" << 36 #include "G4SystemOfUnits.hh" << 37 #include "G4ThreeVector.hh" << 38 #include "G4UIExecutive.hh" << 39 #include "G4UImanager.hh" 34 #include "G4UImanager.hh" 40 #include "G4VisExecutive.hh" << 35 41 #include "Randomize.hh" 36 #include "Randomize.hh" 42 37 43 int main(int argc, char** argv) << 38 #include "DetectorConstruction.hh" 44 { << 39 #include "PhysicsList.hh" 45 // Detect interactive mode (if no arguments) << 40 #include "PrimaryGeneratorAction.hh" 46 // << 41 #include "RunAction.hh" 47 G4UIExecutive* ui = 0; << 42 #include "EventAction.hh" 48 if (argc == 1) { << 43 #include "SteppingAction.hh" 49 ui = new G4UIExecutive(argc, argv); << 44 #include "SteppingVerbose.hh" 50 } << 45 >> 46 #ifdef G4VIS_USE >> 47 #include "G4VisExecutive.hh" >> 48 #endif >> 49 >> 50 #ifdef G4UI_USE >> 51 #include "G4UIExecutive.hh" >> 52 #endif 51 53 >> 54 // ---------------------------------------------------------------------------- >> 55 >> 56 int main(int argc,char** argv) >> 57 { 52 // Choose the Random engine 58 // Choose the Random engine 53 // 59 // 54 G4Random::setTheEngine(new CLHEP::RanecuEngi << 60 CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine); 55 << 61 56 // Construct a serial run manager << 62 // User Verbose output class >> 63 // >> 64 G4VSteppingVerbose::SetInstance(new SteppingVerbose); >> 65 >> 66 // Construct the default run manager 57 // 67 // 58 auto* runManager = G4RunManagerFactory::Crea << 68 G4RunManager * runManager = new G4RunManager; 59 69 60 // Set mandatory initialization classes 70 // Set mandatory initialization classes 61 // 71 // 62 runManager->SetUserInitialization(new Common << 72 DetectorConstruction* detector = new DetectorConstruction; 63 << 73 runManager->SetUserInitialization(detector); 64 // 74 // 65 G4VModularPhysicsList* physicsList = new QGS << 75 G4VUserPhysicsList* physics = new PhysicsList; 66 physicsList->RegisterPhysics(new P6DExtDecay << 76 runManager->SetUserInitialization(physics); 67 runManager->SetUserInitialization(physicsLis << 77 68 << 69 // Set user action classes 78 // Set user action classes 70 // 79 // 71 runManager->SetUserAction(new Common::GunPri << 80 G4VUserPrimaryGeneratorAction* gen_action = 72 // B- meson has not defined decay in Geant4 << 81 new PrimaryGeneratorAction(detector); 73 << 82 runManager->SetUserAction(gen_action); 74 // Initialize visualization << 83 // >> 84 RunAction* run_action = new RunAction; >> 85 runManager->SetUserAction(run_action); >> 86 // >> 87 EventAction* event_action = new EventAction(run_action); >> 88 runManager->SetUserAction(event_action); >> 89 // >> 90 G4UserSteppingAction* stepping_action = >> 91 new SteppingAction(detector, event_action); >> 92 runManager->SetUserAction(stepping_action); >> 93 >> 94 // Initialize G4 kernel 75 // 95 // 76 G4VisManager* visManager = new G4VisExecutiv << 96 runManager->Initialize(); 77 // G4VisExecutive can take a verbosity argum << 97 78 // G4VisManager* visManager = new G4VisExecu << 79 visManager->Initialize(); << 80 << 81 // Get the pointer to the User Interface man 98 // Get the pointer to the User Interface manager 82 G4UImanager* UImanager = G4UImanager::GetUIp << 83 << 84 // Process macro or start UI session << 85 // 99 // 86 if (!ui) { << 100 G4UImanager* UImanager = G4UImanager::GetUIpointer(); 87 // batch mode << 101 88 G4String command = "/control/execute "; << 102 if (argc!=1) // batch mode 89 G4String fileName = argv[1]; << 103 { 90 UImanager->ApplyCommand(command + fileName << 104 G4String command = "/control/execute "; 91 } << 105 G4String fileName = argv[1]; 92 else { << 106 UImanager->ApplyCommand(command+fileName); 93 // interactive mode << 107 } 94 UImanager->ApplyCommand("/control/execute << 108 else 95 ui->SessionStart(); << 109 { // interactive mode : define UI session 96 delete ui; << 110 #ifdef G4UI_USE 97 } << 111 #ifdef G4VIS_USE >> 112 G4VisManager* visManager = new G4VisExecutive; >> 113 visManager->Initialize(); >> 114 #endif >> 115 UImanager->ApplyCommand("/control/execute vis.mac"); >> 116 G4UIExecutive* ui = new G4UIExecutive(argc, argv); >> 117 ui->SessionStart(); >> 118 delete ui; >> 119 #ifdef G4VIS_USE >> 120 delete visManager; >> 121 #endif >> 122 #endif >> 123 } 98 124 99 // Job termination 125 // Job termination 100 // Free the store: user actions, physics_lis 126 // Free the store: user actions, physics_list and detector_description are 101 // owned and deleted by the 127 // owned and deleted by the run manager, so they should not 102 // be deleted in the main() 128 // be deleted in the main() program ! 103 delete visManager; << 104 delete runManager; 129 delete runManager; >> 130 >> 131 return 0; 105 } 132 } >> 133 >> 134 // ---------------------------------------------------------------------------- 106 135