Back to home page

EIC code displayed by LXR

 
 

    


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