Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:17:13

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 //                 Geant4 - XrayTESdetector example
0028 // ---------------------------------------------------------------------
0029 //
0030 // Authors: P.Dondero (paolo.dondero@cern.ch), R.Stanzani (ronny.stanzani@cern.ch)
0031 //
0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0033 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0034 
0035 #include "XrayTESdetDetectorConstruction.hh"
0036 #include "XrayTESdetPhysicsList.hh"
0037 #include "XrayTESdetActionInitialization.hh"
0038 
0039 #include "G4RunManager.hh"
0040 #include "G4MTRunManager.hh"
0041 #include "G4UImanager.hh"
0042 #include "G4UIterminal.hh"
0043 #include "G4UItcsh.hh"
0044 #include "G4VisExecutive.hh"
0045 #include "G4UIExecutive.hh"
0046 #include "G4RunManagerFactory.hh"
0047 
0048 #include "G4UIExecutive.hh"
0049 
0050 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0051 
0052 int main(int argc,char** argv)
0053 {
0054   G4UIExecutive* ui = nullptr;
0055   if(argc == 1)
0056   {
0057     ui = new G4UIExecutive(argc, argv);
0058   }
0059 
0060   // Run manager
0061   auto runManager = G4RunManagerFactory::CreateRunManager();
0062   runManager->SetNumberOfThreads(8);
0063 
0064   // User Initialization classes (mandatory)
0065   runManager->SetUserInitialization(new XrayTESdetDetectorConstruction);
0066 
0067   auto *phys = new XrayTESdetPhysicsList;
0068   runManager->SetUserInitialization(phys);
0069 
0070   runManager->SetUserInitialization(new XrayTESdetActionInitialization());
0071 
0072   // Visualization manager construction
0073   auto visManager = new G4VisExecutive;
0074   visManager->Initialize();
0075 
0076   // Get the pointer to the User Interface manager
0077   G4UImanager* UImanager = G4UImanager::GetUIpointer();
0078 
0079   // Process macro or start UI session
0080   //
0081   if(!ui)
0082   {
0083     // batch mode
0084     G4String command = "/control/execute ";
0085     G4String fileName = argv[1];
0086     UImanager->ApplyCommand(command+fileName);
0087   }
0088   else
0089   {
0090     // interactive mode
0091     UImanager->ApplyCommand("/control/execute init_vis.mac");
0092     ui->SessionStart();
0093     delete ui;
0094   }
0095 
0096   // Job termination
0097   // Free the store: user actions, physics_list and detector_description are
0098   // owned and deleted by the run manager, so they should not be deleted
0099   // in the main() program!
0100   delete visManager;
0101   delete runManager;
0102 
0103   return 0;
0104 }
0105 
0106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......