Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:32:02

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 runAndEvent/RE01/RE01.cc
0027 /// \brief Main program of the runAndEvent/RE01 example
0028 //
0029 //
0030 //
0031 //
0032 // --------------------------------------------------------------
0033 //      GEANT4 - RE01 exsample code
0034 //
0035 // --------------------------------------------------------------
0036 // Comments
0037 //
0038 //
0039 // --------------------------------------------------------------
0040 
0041 #include "QGSP_BERT.hh"
0042 #include "RE01ActionInitialization.hh"
0043 #include "RE01CalorimeterROGeometry.hh"
0044 #include "RE01DetectorConstruction.hh"
0045 
0046 #include "G4ParallelWorldPhysics.hh"
0047 #include "G4RunManagerFactory.hh"
0048 #include "G4Types.hh"
0049 #include "G4UIExecutive.hh"
0050 #include "G4UImanager.hh"
0051 #include "G4UnknownDecayPhysics.hh"
0052 #include "G4VisExecutive.hh"
0053 
0054 int main(int argc, char** argv)
0055 {
0056   // Instantiate G4UIExecutive if there are no arguments (interactive mode)
0057   G4UIExecutive* ui = nullptr;
0058   if (argc == 1) {
0059     ui = new G4UIExecutive(argc, argv);
0060   }
0061 
0062   auto* runManager = G4RunManagerFactory::CreateRunManager();
0063 
0064   // Visualization manager construction
0065   G4VisManager* visManager = new G4VisExecutive;
0066   visManager->Initialize();
0067 
0068   G4String parallelWorldName = "ReadoutWorld";
0069   G4VUserDetectorConstruction* detector = new RE01DetectorConstruction();
0070   detector->RegisterParallelWorld(new RE01CalorimeterROGeometry(parallelWorldName));
0071   runManager->SetUserInitialization(detector);
0072 
0073   G4VModularPhysicsList* physicsList = new QGSP_BERT;
0074   physicsList->RegisterPhysics(new G4UnknownDecayPhysics);
0075   physicsList->RegisterPhysics(new G4ParallelWorldPhysics(parallelWorldName));
0076   runManager->SetUserInitialization(physicsList);
0077 
0078   runManager->SetUserInitialization(new RE01ActionInitialization);
0079 
0080   runManager->Initialize();
0081 
0082   if (ui) {
0083     ui->SessionStart();
0084     delete ui;
0085   }
0086   else {
0087     G4UImanager* UImanager = G4UImanager::GetUIpointer();
0088     G4String command = "/control/execute ";
0089     G4String fileName = argv[1];
0090     UImanager->ApplyCommand(command + fileName);
0091   }
0092 
0093   delete visManager;
0094 
0095   delete runManager;
0096 
0097   return 0;
0098 }