Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-19 08:38:44

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 /// \file geotest.cc
0027 /// \brief Main program of the gdml/G02 example
0028 
0029 // --------------------------------------------------------------
0030 //      GEANT 4 - geotest
0031 //
0032 // --------------------------------------------------------------
0033 
0034 // Geant4 includes
0035 //
0036 #include "G4RunManagerFactory.hh"
0037 #include "G4UImanager.hh"
0038 #include "globals.hh"
0039 
0040 // A pre-built physics list
0041 //
0042 #include "QGSP_BERT.hh"
0043 
0044 // Example includes
0045 //
0046 #include "G02DetectorConstruction.hh"
0047 #include "G02PrimaryGeneratorAction.hh"
0048 #include "G02RunAction.hh"
0049 
0050 #include "G4UIExecutive.hh"
0051 #include "G4VisExecutive.hh"
0052 
0053 // --------------------------------------------------------------
0054 
0055 int main(int argc, char** argv)
0056 {
0057   // Construct a serial run manager
0058   //
0059   auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::SerialOnly);
0060 
0061   // Set mandatory initialization and user action classes
0062   //
0063   G02DetectorConstruction* detector = new G02DetectorConstruction;
0064   runManager->SetUserInitialization(detector);
0065   runManager->SetUserInitialization(new QGSP_BERT);
0066   runManager->SetUserAction(new G02PrimaryGeneratorAction);
0067   G02RunAction* runAction = new G02RunAction;
0068   runManager->SetUserAction(runAction);
0069 
0070   // Initialisation of runManager via macro for the interactive mode
0071   // This gives possibility to give different names for GDML file to READ
0072 
0073   // Initialize visualization
0074   //
0075   G4VisManager* visManager = new G4VisExecutive;
0076   visManager->Initialize();
0077 
0078   // Open a UI session: will stay there until the user types "exit"
0079   //
0080   G4UImanager* UImanager = G4UImanager::GetUIpointer();
0081 
0082   if (argc == 1)  // Automatically run default macro for writing...
0083   {
0084     G4UIExecutive* ui = new G4UIExecutive(argc, argv);
0085     UImanager->ApplyCommand("/control/execute vis.mac");
0086     ui->SessionStart();
0087     delete ui;
0088   }
0089   else  // Interactive, provides macro in input
0090   {
0091     G4UIExecutive* ui = new G4UIExecutive(argc, argv);
0092     G4String command = "/control/execute ";
0093     G4String fileName = argv[1];
0094     UImanager->ApplyCommand(command + fileName);
0095     ui->SessionStart();
0096     delete ui;
0097   }
0098 
0099   // Job termination
0100   //
0101   delete visManager;
0102   delete runManager;
0103 
0104   return 0;
0105 }