Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:32

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