Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/extended/eventgenerator/pythia/py8decayer/pythia8_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 pythia8_decayer.cc
0027 /// \brief Main program of the pythia/py8decayer example
0028 
0029 #include "ActionInitialization.hh"
0030 #include "DetConstruction.hh"
0031 #include "FTFP_BERT.hh"
0032 #include "Py8DecayerPhysics.hh"
0033 #include "SingleParticleGun.hh"
0034 
0035 #include "G4GeometryManager.hh"
0036 #include "G4PhysListFactoryAlt.hh"
0037 #include "G4PhysListRegistry.hh"
0038 #include "G4RunManagerFactory.hh"
0039 #include "G4SystemOfUnits.hh"
0040 #include "Randomize.hh"
0041 
0042 // allow ourselves to extend the short names for physics ctor addition/replace
0043 // along the same lines as EMX, EMY, etc
0044 #include "G4PhysListRegistry.hh"
0045 
0046 // allow ourselves to give the user extra info about available physics ctors
0047 #include "G4PhysicsConstructorFactory.hh"
0048 
0049 // forward declaration
0050 void PrintAvailable(G4int verb = 1);
0051 
0052 int main(int argc, char** argv)
0053 {
0054   // pick physics list
0055   std::string physListName = "FTFP_BERT+PY8DK";
0056 
0057   for (G4int i = 1; i < argc; i = i + 2) {
0058     G4String g4argv(argv[i]);  // convert only once
0059     if (g4argv == "-p") physListName = argv[i + 1];
0060   }
0061 
0062   // Choose the Random engine
0063   //
0064   G4Random::setTheEngine(new CLHEP::RanecuEngine);
0065 
0066   // Construct the default run manager;
0067   // it'll operate in the Tasking mode, and will use 5 thread
0068   //
0069   // If one wishes to operate in the so called serial (sequential) mode,
0070   // one can use G4RunManagerType::SerialOnly
0071   //
0072   auto runManager = G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default, 5);
0073 
0074   // Set mandatory initialization classes
0075   //
0076   // Geometry
0077   //
0078   runManager->SetUserInitialization(new DetConstruction);
0079   //
0080   // Physics
0081   //
0082   // G4VModularPhysicsList* physicsList = new FTFP_BERT();
0083   // physicsList->RegisterPhysics(new Py8DecayerPhysics());
0084 
0085   g4alt::G4PhysListFactory plFactory;
0086   G4VModularPhysicsList* physicsList = nullptr;
0087   plFactory.SetDefaultReferencePhysList("NO_DEFAULT_PHYSLIST");
0088 
0089   // set a short name for the plugin
0090   G4PhysListRegistry* plReg = G4PhysListRegistry::Instance();
0091   plReg->AddPhysicsExtension("PY8DK", "Py8DecayerPhysics");
0092 
0093   physicsList = plFactory.GetReferencePhysList(physListName);
0094 
0095   if (!physicsList) {
0096     PrintAvailable(1);
0097 
0098     // if we can't get what the user asked for...
0099     //    don't go on to use something else, that's confusing
0100     G4ExceptionDescription ed;
0101     ed << "The factory for the physicslist [" << physListName << "] does not exist!" << G4endl;
0102     G4Exception("extensibleFactory", "extensibleFactory001", FatalException, ed);
0103     exit(42);
0104   }
0105 
0106   runManager->SetUserInitialization(physicsList);
0107   //
0108   // Set user action classes, e.g. prim.generator (tau- gun), etc.
0109   // NOTE: setting particle gun (prim. generator) is done in
0110   //       ActionInit class (see src/ActionInitialization.cc)
0111   //
0112   runManager->SetUserInitialization(new ActionInitialization());
0113   //
0114   // General initialization for the run
0115   //
0116   runManager->Initialize();
0117 
0118   //
0119   // Run 5 events
0120   // NOTE: they will run on 5 different threads, as indicated earlier in the code
0121   //
0122   runManager->BeamOn(5);
0123 
0124   // Job termination
0125   // Free the store: user actions, physics_list and detector_description are
0126   //                 owned and deleted by the run manager, so they should not
0127   //                 be deleted in the main() program !
0128   delete runManager;
0129 
0130   return 0;
0131 }
0132 
0133 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0134 
0135 void PrintAvailable(G4int verbosity)
0136 {
0137   G4cout << G4endl;
0138   G4cout << "extensibleFactory: here are the available physics lists:" << G4endl;
0139   g4alt::G4PhysListFactory factory;
0140   factory.PrintAvailablePhysLists();
0141 
0142   // if user asked for extra verbosity then print physics ctors as well
0143   if (verbosity > 1) {
0144     G4cout << G4endl;
0145     G4cout << "extensibleFactory: "
0146            << "here are the available physics ctors that can be added:" << G4endl;
0147     G4PhysicsConstructorRegistry* g4pctorFactory = G4PhysicsConstructorRegistry::Instance();
0148     g4pctorFactory->PrintAvailablePhysicsConstructors();
0149   }
0150 }
0151 
0152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......