Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:45

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 /// \file RE05/exampleRE05.cc
0028 /// \brief Main program of the RE05 example
0029 //
0030 
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0033 
0034 #include "QBBC.hh"
0035 #include "RE05ActionInitialization.hh"
0036 #include "RE05CalorimeterParallelWorld.hh"
0037 #include "RE05DetectorConstruction.hh"
0038 #include "RE05SteppingVerbose.hh"
0039 
0040 #include "G4ParallelWorldPhysics.hh"
0041 #include "G4RunManagerFactory.hh"
0042 #include "G4Types.hh"
0043 #include "G4UIExecutive.hh"
0044 #include "G4UImanager.hh"
0045 #include "G4VisExecutive.hh"
0046 
0047 int main(int argc, char** argv)
0048 {
0049   // Instantiate G4UIExecutive if there are no arguments (interactive mode)
0050   G4UIExecutive* ui = nullptr;
0051   if (argc == 1) {
0052     ui = new G4UIExecutive(argc, argv);
0053   }
0054 
0055   // Setting the application-sepcific SteppingVerbose
0056   auto verbosity = new RE05SteppingVerbose;
0057 
0058   // Creating the run manager
0059   auto runManager = G4RunManagerFactory::CreateRunManager();
0060 
0061   G4String parallelWorldName = "ReadoutWorld";
0062   // User Initialization classes (mandatory)
0063   //
0064   auto detector = new RE05DetectorConstruction();
0065   detector->RegisterParallelWorld(new RE05CalorimeterParallelWorld(parallelWorldName));
0066   runManager->SetUserInitialization(detector);
0067   //
0068   auto physicsList = new QBBC;
0069   physicsList->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName));
0070   runManager->SetUserInitialization(physicsList);
0071   //
0072   auto actions = new RE05ActionInitialization;
0073   runManager->SetUserInitialization(actions);
0074 
0075   runManager->Initialize();
0076 
0077   auto visManager = new G4VisExecutive;
0078   visManager->Initialize();
0079 
0080   // get the pointer to the User Interface manager
0081   auto UImanager = G4UImanager::GetUIpointer();
0082 
0083   if (!ui)  // batch mode
0084   {
0085     G4String command = "/control/execute ";
0086     G4String fileName = argv[1];
0087     UImanager->ApplyCommand(command + fileName);
0088   }
0089   else  // interactive mode : define UI session
0090   {
0091     UImanager->ApplyCommand("/control/execute vis.mac");
0092     ui->SessionStart();
0093     delete ui;
0094   }
0095 
0096   // Job termination
0097   // Free the store: user actions, physics_list and detector_description are
0098   //                 owned and deleted by the run manager, so they should not
0099   //                 be deleted in the main() program !
0100   delete visManager;
0101   delete runManager;
0102   delete verbosity;
0103 
0104   return 0;
0105 }
0106 
0107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......