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 /// \file runAndEvent/RE01/RE01.cc << 27 /// \brief Main program of the runAndEvent/RE0 << 28 // << 29 // << 30 // 26 // >> 27 // $Id: RE01.cc,v 1.3 2006/06/29 17:42:25 gunter Exp $ >> 28 // GEANT4 tag $Name: geant4-09-03-patch-01 $ 31 // 29 // >> 30 // 32 // ------------------------------------------- 31 // -------------------------------------------------------------- 33 // GEANT4 - RE01 exsample code 32 // GEANT4 - RE01 exsample code 34 // 33 // 35 // ------------------------------------------- 34 // -------------------------------------------------------------- 36 // Comments 35 // Comments 37 // 36 // 38 // << 37 // 39 // ------------------------------------------- 38 // -------------------------------------------------------------- 40 39 41 #include "QGSP_BERT.hh" << 42 #include "RE01ActionInitialization.hh" << 43 #include "RE01CalorimeterROGeometry.hh" << 44 #include "RE01DetectorConstruction.hh" << 45 40 46 #include "G4ParallelWorldPhysics.hh" << 41 #include "G4RunManager.hh" 47 #include "G4RunManagerFactory.hh" << 48 #include "G4Types.hh" << 49 #include "G4UIExecutive.hh" << 50 #include "G4UImanager.hh" 42 #include "G4UImanager.hh" 51 #include "G4UnknownDecayPhysics.hh" << 43 #include "G4UIterminal.hh" >> 44 #include "G4UItcsh.hh" >> 45 >> 46 #include "RE01DetectorConstruction.hh" >> 47 #include "RE01PhysicsList.hh" >> 48 #include "RE01PrimaryGeneratorAction.hh" >> 49 #include "RE01RunAction.hh" >> 50 #include "RE01EventAction.hh" >> 51 #include "RE01StackingAction.hh" >> 52 #include "RE01TrackingAction.hh" >> 53 #include "RE01SteppingAction.hh" >> 54 >> 55 #ifdef G4VIS_USE 52 #include "G4VisExecutive.hh" 56 #include "G4VisExecutive.hh" >> 57 #endif 53 58 54 int main(int argc, char** argv) << 59 int main(int argc,char** argv) 55 { 60 { 56 // Instantiate G4UIExecutive if there are no << 61 G4RunManager* runManager = new G4RunManager; 57 G4UIExecutive* ui = nullptr; << 58 if (argc == 1) { << 59 ui = new G4UIExecutive(argc, argv); << 60 } << 61 << 62 auto* runManager = G4RunManagerFactory::Crea << 63 62 >> 63 #ifdef G4VIS_USE 64 // Visualization manager construction 64 // Visualization manager construction 65 G4VisManager* visManager = new G4VisExecutiv 65 G4VisManager* visManager = new G4VisExecutive; 66 visManager->Initialize(); 66 visManager->Initialize(); >> 67 #endif 67 68 68 G4String parallelWorldName = "ReadoutWorld"; << 69 runManager->SetUserInitialization(new RE01DetectorConstruction); 69 G4VUserDetectorConstruction* detector = new << 70 runManager->SetUserInitialization(new RE01PhysicsList); 70 detector->RegisterParallelWorld(new RE01Calo << 71 71 runManager->SetUserInitialization(detector); << 72 << 73 G4VModularPhysicsList* physicsList = new QGS << 74 physicsList->RegisterPhysics(new G4UnknownDe << 75 physicsList->RegisterPhysics(new G4ParallelW << 76 runManager->SetUserInitialization(physicsLis << 77 << 78 runManager->SetUserInitialization(new RE01Ac << 79 << 80 runManager->Initialize(); 72 runManager->Initialize(); 81 73 82 if (ui) { << 74 runManager->SetUserAction(new RE01PrimaryGeneratorAction); 83 ui->SessionStart(); << 75 runManager->SetUserAction(new RE01RunAction); 84 delete ui; << 76 runManager->SetUserAction(new RE01EventAction); >> 77 runManager->SetUserAction(new RE01StackingAction); >> 78 runManager->SetUserAction(new RE01TrackingAction); >> 79 runManager->SetUserAction(new RE01SteppingAction); >> 80 >> 81 if(argc==1) >> 82 { >> 83 #ifdef G4UI_USE_TCSH >> 84 G4UIsession* session = new G4UIterminal(new G4UItcsh); >> 85 #else >> 86 G4UIsession* session = new G4UIterminal(); >> 87 #endif >> 88 session->SessionStart(); >> 89 delete session; 85 } 90 } 86 else { << 91 else 87 G4UImanager* UImanager = G4UImanager::GetU << 92 { >> 93 G4UImanager* UImanager = G4UImanager::GetUIpointer(); 88 G4String command = "/control/execute "; 94 G4String command = "/control/execute "; 89 G4String fileName = argv[1]; 95 G4String fileName = argv[1]; 90 UImanager->ApplyCommand(command + fileName << 96 UImanager->ApplyCommand(command+fileName); 91 } 97 } 92 98 >> 99 #ifdef G4VIS_USE 93 delete visManager; 100 delete visManager; >> 101 #endif 94 102 95 delete runManager; 103 delete runManager; 96 104 97 return 0; 105 return 0; 98 } 106 } >> 107 99 108