Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:20:01

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 // ------------------------------------------------------------
0028 //      GEANT 4 main program
0029 //      CERN Geneva Switzerland
0030 //
0031 //
0032 //      ------------ GammaRayTel example main program ------
0033 //           by F.Longo, R.Giannitrapani & G.Santin (29 nov 2000)
0034 //           See README file for details on this example
0035 //  20.11.01 G.Santin: new analysis management, and some modification in the
0036 //                     construction of some Action's
0037 // ************************************************************
0038 
0039 #include "G4Types.hh"
0040 #include "G4RunManagerFactory.hh"
0041 #include "G4UImanager.hh"
0042 #include "G4VisExecutive.hh"
0043 #include "G4UIExecutive.hh"
0044 
0045 #include "GammaRayTelActionInitializer.hh"
0046 #include "GammaRayTelAnalysis.hh"
0047 #include "GammaRayTelDetectorConstruction.hh"
0048 #include "GammaRayTelPhysicsList.hh"
0049 
0050 // #include "QGSP_BIC.hh"
0051 #include "FTFP_BERT.hh"
0052 
0053 // This is the main function
0054 auto main(int argc, char **argv) -> int {
0055     // Construct the default run manager
0056     auto *runManager = G4RunManagerFactory::CreateRunManager();
0057     constexpr auto NUMBER_OF_THREADS{4};
0058     runManager->SetNumberOfThreads(NUMBER_OF_THREADS);
0059 
0060     // Set mandatory user initialization classes
0061     auto *detector = new GammaRayTelDetectorConstruction;
0062     runManager->SetUserInitialization(detector);
0063     runManager->SetUserInitialization(new GammaRayTelPhysicsList);
0064     // runManager->SetUserInitialization(new QGSP_BIC);
0065     // runManager->SetUserInitialization(new FTFP_BERT);
0066 
0067     // Initialize actions
0068     runManager->SetUserInitialization(new GammaRayTelActionInitializer());
0069 
0070     // Creation of the analysis manager
0071     auto *analysis = GammaRayTelAnalysis::getInstance();
0072 
0073     // Set visualization and user interface
0074     // Visualization manager
0075     G4VisManager *visManager = new G4VisExecutive;
0076     visManager->Initialize();
0077 
0078     // Initialize G4 kernel
0079     //  runManager->Initialize();
0080 
0081     // Get the pointer to the UI manager
0082     auto *uiManager = G4UImanager::GetUIpointer();
0083 
0084     if (argc == 1) { // Define UI session for interactive mode.
0085         auto *ui = new G4UIExecutive(argc, argv);
0086         G4cout << " UI session starts ..." << G4endl;
0087         uiManager->ApplyCommand("/control/execute prerunGammaRayTel.mac");
0088         ui->SessionStart();
0089         delete ui;
0090     } else { // batch mode
0091         G4String command = "/control/execute ";
0092         G4String fileName = argv[1];
0093         uiManager->ApplyCommand(command + fileName);
0094     }
0095 
0096     // Job termination
0097     delete visManager;
0098     delete analysis;
0099     delete runManager;
0100 
0101     return 0;
0102 }