Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 09:41: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 // -------------------------------------------------------------------
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   // Construct the default run manager
0057 
0058   auto* runManager = G4RunManagerFactory::CreateRunManager();
0059   G4int nThreads = 1;    // the new MicroElec works better with only one thread
0060   runManager->SetNumberOfThreads(nThreads);
0061   
0062   // Set mandatory user initialization classes
0063   DetectorConstruction* detector = new DetectorConstruction;
0064   runManager->SetUserInitialization(detector);
0065 
0066   // Management of the MicroElec only Si 
0067   //              and the new MicroElec
0068   G4String fileName;
0069   fileName = "microelectronics.mac";
0070   G4bool microElecSiPhysics;
0071   microElecSiPhysics=false;
0072   if(argc>1)
0073     {
0074       if (G4String(argv[1])== "-onlySi") {microElecSiPhysics=true;}
0075       else {fileName=argv[1]; }
0076       if( argc>2)
0077       {
0078         if (G4String(argv[2])== "-onlySi"){ microElecSiPhysics=true;}
0079         else{ fileName=argv[2];}
0080       } 
0081     }
0082 
0083   if (microElecSiPhysics)
0084   {   G4cout << "Physic list : MicroElecSiPhysics (only Silicium)" << G4endl;
0085       runManager->SetUserInitialization(new MicroElecSiPhysics());
0086   }
0087   else
0088   {   G4cout << "Physic list : MicroElecPhysics" << G4endl;
0089       runManager->SetUserInitialization(new MicroElecPhysics());
0090   }
0091 
0092   // User action initialization
0093   runManager->SetUserInitialization(new ActionInitialization(detector));
0094 
0095   // Initialize G4 kernel
0096   runManager->Initialize();
0097 
0098   G4VisManager* visManager = new G4VisExecutive;
0099   visManager->Initialize();
0100 
0101   // Get the pointer to the User Interface manager
0102   G4UImanager* UImanager = G4UImanager::GetUIpointer();
0103 
0104   if (argc==1)   // Define UI session for interactive mode.
0105   {
0106     UImanager->ApplyCommand("/control/execute microelectronics.mac");
0107     session->SessionStart();
0108     delete session;
0109   }
0110   else           // Batch mode
0111   {
0112     G4String command = "/control/execute ";
0113     UImanager->ApplyCommand(command+fileName);
0114   }
0115 
0116   delete visManager;
0117 
0118   delete runManager;
0119 
0120   return 0;
0121 }
0122