Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:42

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 // G4MTRunManagerKernel
0027 //
0028 // Class description:
0029 //
0030 // This is a class for mandatory control of the Geant4 kernel.
0031 // This class implements Worker behavior in a MT application.
0032 //
0033 // This class is constructed by G4MTRunManager. If a user uses his/her own
0034 // class instead of G4MTRunManager, this class must be instantiated by at the
0035 // very beginning of the application and must be deleted at the very end.
0036 // Also, the following methods must be invoked in the proper order:
0037 //       DefineWorldVolume()
0038 //       InitializePhysics()
0039 //       RunInitialization()
0040 //       RunTermination()
0041 //
0042 // User must provide his/her own classes derived from the following
0043 // abstract class and register it to the RunManagerKernel:
0044 //       G4VUserPhysicsList - Particle types, Processes and Cuts
0045 //
0046 // G4MTRunManagerKernel does not have an event loop. Handling of events
0047 // is managed by G4RunManager.
0048 //
0049 // This class re-implements only the methods that require special treatment
0050 // to implement worker behavior
0051 
0052 // Author: M.Asai - July 2013
0053 // --------------------------------------------------------------------
0054 #ifndef G4MTRunManagerKernel_hh
0055 #define G4MTRunManagerKernel_hh 1
0056 
0057 #include "G4MTRunManager.hh"
0058 #include "G4RunManagerKernel.hh"
0059 #include "G4Threading.hh"
0060 
0061 #include <vector>
0062 
0063 class G4WorkerThread;
0064 class G4WorkerRunManager;
0065 
0066 class G4MTRunManagerKernel : public G4RunManagerKernel
0067 {
0068   public:
0069     G4MTRunManagerKernel();
0070     ~G4MTRunManagerKernel() override;
0071 
0072     // Used to start a worker thread. Virtual methods to be invoked
0073     // from this method are defined in G4UserWorkerInitialization class.
0074     static void StartThread(G4WorkerThread* context);
0075 
0076     static G4WorkerThread* GetWorkerThread();
0077 
0078     // Fill decay tables with particle definition pointers of decay products.
0079     // This method has to be invoked by G4MTRunManager before the event loop
0080     // starts on workers.
0081     void SetUpDecayChannels();
0082 
0083     // This method should be invoked by G4MTRunManager.
0084     void BroadcastAbortRun(G4bool softAbort);
0085 
0086   protected:
0087     void SetupShadowProcess() const override;
0088 
0089   private:
0090     static G4ThreadLocal G4WorkerThread* wThreadContext;
0091 
0092     static std::vector<G4WorkerRunManager*>* workerRMvector;
0093 };
0094 
0095 #endif  // G4MTRunManagerKernel_hh