Back to home page

EIC code displayed by LXR

 
 

    


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

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 RE02.cc
0027 /// \brief Main program of the runAndEvent/RE02 example
0028 
0029 #include "QGS_BIC.hh"
0030 #include "RE02ActionInitialization.hh"
0031 #include "RE02DetectorConstruction.hh"
0032 
0033 #include "G4RunManagerFactory.hh"
0034 #include "G4SystemOfUnits.hh"
0035 #include "G4UIExecutive.hh"
0036 #include "G4UImanager.hh"
0037 #include "G4VisExecutive.hh"
0038 
0039 //
0040 int main(int argc, char** argv)
0041 {
0042   // Instantiate G4UIExecutive if there are no arguments (interactive mode)
0043   G4UIExecutive* ui = nullptr;
0044   if (argc == 1) {
0045     ui = new G4UIExecutive(argc, argv);
0046   }
0047 
0048   auto* runManager = G4RunManagerFactory::CreateRunManager();
0049 
0050   // UserInitialization classes (mandatory)
0051   //---
0052   //  Create Detector
0053   RE02DetectorConstruction* detector = new RE02DetectorConstruction;
0054   detector->SetPhantomSize(G4ThreeVector(200 * mm, 200 * mm, 400 * mm));  // Default
0055   detector->SetNumberOfSegmentsInPhantom(100, 100, 200);  // Default
0056   //  If your machine does not have enough memory,
0057   //  please try to reduce Number of Segements in phantom.
0058   // detector->SetNumberOfSegmentsInPhantom(1,1,100);  // For small memory size.
0059   //
0060   detector->SetLeadSegment(TRUE);  // Default (Water and Lead)
0061   // Water and Lead segments are placed alternately, by defult.,
0062   //  If you want to simulation homogeneous water phantom, please set it FALSE.
0063   // detector->SetLeadSegment(FALSE); // Homogeneous water phantom
0064   //
0065   runManager->SetUserInitialization(detector);
0066   //
0067   runManager->SetUserInitialization(new QGS_BIC());
0068 
0069   // Visualization, if you choose to have it!
0070   G4VisManager* visManager = new G4VisExecutive;
0071   visManager->Initialize();
0072 
0073   // UserAction classes
0074   runManager->SetUserInitialization(new RE02ActionInitialization);
0075 
0076   // Initialize G4 kernel
0077   runManager->Initialize();
0078 
0079   // get the pointer to the User Interface manager
0080   G4UImanager* pUI = G4UImanager::GetUIpointer();
0081 
0082   if (ui)
0083   // Define (G)UI terminal for interactive mode
0084   {
0085     pUI->ApplyCommand("/control/execute vis.mac");
0086     ui->SessionStart();
0087     delete ui;
0088   }
0089   else
0090   // Batch mode
0091   {
0092     G4String command = "/control/execute ";
0093     G4String fileName = argv[1];
0094     pUI->ApplyCommand(command + fileName);
0095   }
0096 
0097   delete visManager;
0098   delete runManager;
0099 
0100   return 0;
0101 }
0102 
0103 //