Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-12 08:30: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 ExGflash1.cc
0027 /// \brief Main program of the gflash/gflash1 example
0028 
0029 // Created by Joanna Weng 26.11.2004
0030 
0031 // G4 includes
0032 #include "G4RunManagerFactory.hh"
0033 #include "G4Timer.hh"
0034 #include "G4Types.hh"
0035 #include "G4UImanager.hh"
0036 #include "G4ios.hh"
0037 
0038 // my project
0039 #include "ExGflash1DetectorConstruction.hh"
0040 #include "ExGflashActionInitialization.hh"
0041 #include "FTFP_BERT.hh"
0042 
0043 #include "G4FastSimulationPhysics.hh"
0044 #include "G4UIExecutive.hh"
0045 #include "G4VisExecutive.hh"
0046 
0047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0048 
0049 int main(int argc, char** argv)
0050 {
0051   // Instantiate G4UIExecutive if interactive mode
0052   G4UIExecutive* ui = nullptr;
0053   if (argc == 1) {
0054     ui = new G4UIExecutive(argc, argv);
0055   }
0056 
0057   // timer to see GFlash performance
0058   G4Timer timer;
0059   timer.Start();
0060 
0061   G4cout << "+-------------------------------------------------------+" << G4endl;
0062   G4cout << "|                                                       |" << G4endl;
0063   G4cout << "|          This is an example of Shower                 |" << G4endl;
0064   G4cout << "|          Parameterization with GFLASH                 |" << G4endl;
0065   G4cout << "+-------------------------------------------------------+" << G4endl;
0066 
0067   auto* runManager = G4RunManagerFactory::CreateRunManager();
0068   runManager->SetNumberOfThreads(1);
0069 
0070   // UserInitialization classes (mandatory)
0071   G4cout << "# GFlash Example: Detector Construction" << G4endl;
0072   runManager->SetUserInitialization(new ExGflash1DetectorConstruction);
0073 
0074   // G4cout<<"# GFlash Example: Physics "<<G4endl;
0075   // -- Select a physics list:
0076   G4VModularPhysicsList* physicsList = new FTFP_BERT();
0077   // -- Create a fast simulation physics constructor, used to augment
0078   // -- the above physics list to allow for fast simulation:
0079   auto fastSimulationPhysics = new G4FastSimulationPhysics();
0080   // -- We now configure the fastSimulationPhysics object.
0081   // -- The gflash model (GFlashShowerModel, see ExGflashDetectorConstruction.cc)
0082   // -- is applicable to e+ and e- : we augment the physics list for these
0083   // -- particles (by adding a G4FastSimulationManagerProcess with below's
0084   // -- calls), this will make the fast simulation to be activated:
0085   fastSimulationPhysics->ActivateFastSimulation("e-");
0086   fastSimulationPhysics->ActivateFastSimulation("e+");
0087   // -- Register this fastSimulationPhysics to the physicsList,
0088   // -- when the physics list will be called by the run manager
0089   // -- (will happen at initialization of the run manager)
0090   // -- for physics process construction, the fast simulation
0091   // -- configuration will be applied as well.
0092   physicsList->RegisterPhysics(fastSimulationPhysics);
0093   runManager->SetUserInitialization(physicsList);
0094 
0095   // Action initialization:
0096   runManager->SetUserInitialization(new ExGflashActionInitialization);
0097 
0098   G4VisManager* visManager = new G4VisExecutive;
0099   visManager->Initialize();
0100 
0101   G4UImanager* UImanager = G4UImanager::GetUIpointer();
0102   UImanager->ApplyCommand("/run/verbose 0");
0103   runManager->Initialize();
0104   UImanager->ApplyCommand("/Step/Verbose 0");
0105 
0106   if (ui)  // Define UI terminal for interactive mode
0107   {
0108     UImanager->ApplyCommand("/control/execute vis.mac");
0109     ui->SessionStart();
0110     delete ui;
0111   }
0112   else  // Batch mode
0113   {
0114     G4String s = *(argv + 1);
0115     UImanager->ApplyCommand("/control/execute " + s);
0116   }
0117 
0118   delete visManager;
0119   delete runManager;
0120 
0121   timer.Stop();
0122   G4cout << G4endl;
0123   G4cout << "******************************************";
0124   G4cout << G4endl;
0125   G4cout << "Total Real Elapsed Time is: " << timer.GetRealElapsed();
0126   G4cout << G4endl;
0127   G4cout << "Total System Elapsed Time: " << timer.GetSystemElapsed();
0128   G4cout << G4endl;
0129   G4cout << "Total GetUserElapsed Time: " << timer.GetUserElapsed();
0130   G4cout << G4endl;
0131   G4cout << "******************************************";
0132   G4cout << G4endl;
0133 
0134   return 0;
0135 }
0136 
0137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......