Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/extended/eventgenerator/pythia/decayer6/pythia6_decayer.cc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 pythia6_decayer.cc
0027 /// \brief Main program of the pythia/decayer6 example
0028 
0029 #include "DetectorConstruction.hh"
0030 #include "GunPrimaryGeneratorAction.hh"
0031 #include "P6DExtDecayerPhysics.hh"
0032 #include "QGSP_BERT.hh"
0033 
0034 #include "G4RunManagerFactory.hh"
0035 #include "G4SystemOfUnits.hh"
0036 #include "G4ThreeVector.hh"
0037 #include "G4UIExecutive.hh"
0038 #include "G4UImanager.hh"
0039 #include "G4VisExecutive.hh"
0040 #include "Randomize.hh"
0041 
0042 int main(int argc, char** argv)
0043 {
0044   // Detect interactive mode (if no arguments) and define UI session
0045   //
0046   G4UIExecutive* ui = 0;
0047   if (argc == 1) {
0048     ui = new G4UIExecutive(argc, argv);
0049   }
0050 
0051   // Choose the Random engine
0052   //
0053   G4Random::setTheEngine(new CLHEP::RanecuEngine);
0054 
0055   // Construct a serial run manager
0056   //
0057   auto* runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::SerialOnly);
0058 
0059   // Set mandatory initialization classes
0060   //
0061   runManager->SetUserInitialization(new Common::DetectorConstruction);
0062 
0063   //
0064   G4VModularPhysicsList* physicsList = new QGSP_BERT;
0065   physicsList->RegisterPhysics(new P6DExtDecayerPhysics());
0066   runManager->SetUserInitialization(physicsList);
0067 
0068   // Set user action classes
0069   //
0070   runManager->SetUserAction(new Common::GunPrimaryGeneratorAction("B-", 50. * MeV));
0071   // B- meson has not defined decay in Geant4
0072 
0073   // Initialize visualization
0074   //
0075   G4VisManager* visManager = new G4VisExecutive;
0076   // G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
0077   // G4VisManager* visManager = new G4VisExecutive("Quiet");
0078   visManager->Initialize();
0079 
0080   // Get the pointer to the User Interface manager
0081   G4UImanager* UImanager = G4UImanager::GetUIpointer();
0082 
0083   // Process macro or start UI session
0084   //
0085   if (!ui) {
0086     // batch mode
0087     G4String command = "/control/execute ";
0088     G4String fileName = argv[1];
0089     UImanager->ApplyCommand(command + fileName);
0090   }
0091   else {
0092     // interactive mode
0093     UImanager->ApplyCommand("/control/execute init_vis.mac");
0094     ui->SessionStart();
0095     delete ui;
0096   }
0097 
0098   // Job termination
0099   // Free the store: user actions, physics_list and detector_description are
0100   //                 owned and deleted by the run manager, so they should not
0101   //                 be deleted in the main() program !
0102   delete visManager;
0103   delete runManager;
0104 }