Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-18 07:41:16

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 // -------------------------------------------------------------------
0028 //    
0029 //   history :
0030 //      21/10/2021 : DLa update in order to manage G4MicroElecSiPhysics (previous model) 
0031 //                                 and G4MicroElecPhysics (new model)
0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0033 
0034 #include "G4Types.hh"
0035 #include "G4RunManagerFactory.hh"
0036 #include "G4UImanager.hh"
0037 #include "G4UIExecutive.hh"
0038 #include "G4VisExecutive.hh"
0039 #include "ActionInitialization.hh"
0040 #include "DetectorConstruction.hh"
0041 #include "G4GenericPhysicsList.hh"
0042 #include "G4EmStandardPhysics.hh"
0043 //#include "MicroElecSiPhysics.hh"
0044 #include "MicroElecPhysics.hh"
0045 
0046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0047 
0048 int main(int argc,char** argv)
0049 {
0050   G4UIExecutive* session = nullptr;
0051   if (argc==1)   // Define UI session for interactive mode.
0052   {
0053       session = new G4UIExecutive(argc, argv);
0054   }
0055 
0056 
0057   auto* runManager = G4RunManagerFactory::CreateRunManager();
0058   G4int nThreads = 4;    // the new MicroElec works better with only one thread
0059   runManager->SetNumberOfThreads(nThreads);
0060   
0061   // Set mandatory user initialization classes
0062   DetectorConstruction* detector = new DetectorConstruction;
0063   runManager->SetUserInitialization(detector);
0064 
0065   // Management of the MicroElec only Si 
0066   //              and the new MicroElec
0067   G4String fileName;
0068   fileName = "microelec-SEY.mac";
0069   
0070 
0071   if (argc > 1)
0072   {
0073       fileName = argv[1];
0074       if (argc > 2)
0075       {
0076           fileName = argv[2];
0077       }
0078   }
0079 
0080 
0081   runManager->SetUserInitialization(new MicroElecPhysics());
0082 
0083   // User action initialization
0084   runManager->SetUserInitialization(new ActionInitialization(detector));
0085 
0086   // Initialize G4 kernel
0087   runManager->Initialize();
0088 
0089   G4VisManager* visManager = new G4VisExecutive;
0090   visManager->Initialize();
0091 
0092   // Get the pointer to the User Interface manager
0093   G4UImanager* UImanager = G4UImanager::GetUIpointer();
0094 
0095   if (argc==1)   // Define UI session for interactive mode.
0096   {
0097     UImanager->ApplyCommand("/control/execute microelec-SEY.mac");
0098     session->SessionStart();
0099     delete session;
0100   }
0101   else           // Batch mode
0102   {
0103     G4String command = "/control/execute ";
0104     UImanager->ApplyCommand(command+fileName);
0105   }
0106 
0107   delete visManager;
0108 
0109   delete runManager;
0110 
0111   return 0;
0112 }
0113