Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:17

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 // G4UserWorkerThreadInitialization
0027 //
0028 // Class description:
0029 //
0030 // This class is used for multi-threading.
0031 // It encapsulates the mechanism of starting/stopping threads.
0032 
0033 // Author: M.Asai, A.Dotti (SLAC), 16 September 2013
0034 // --------------------------------------------------------------------
0035 #ifndef G4UserWorkerThreadInitialization_hh
0036 #define G4UserWorkerThreadInitialization_hh 1
0037 
0038 class G4VUserPrimaryGeneratorAction;
0039 class G4UserRunAction;
0040 class G4UserEventAction;
0041 class G4UserStackingAction;
0042 class G4UserTrackingAction;
0043 class G4UserSteppingAction;
0044 class G4WorkerThread;
0045 class G4WorkerRunManager;
0046 
0047 #include "G4Threading.hh"
0048 #include "Randomize.hh"
0049 
0050 class G4UserWorkerThreadInitialization
0051 {
0052   public:
0053     G4UserWorkerThreadInitialization() = default;
0054     virtual ~G4UserWorkerThreadInitialization() = default;
0055 
0056     // Called by the kernel to create a new thread/worker and start work.
0057     // User should not re-implement this function (in derived class), except
0058     // only if he/she wants to rewrite the default threading model (see
0059     // StartThread() function).
0060     virtual G4Thread* CreateAndStartWorker(G4WorkerThread* workerThreadContext);
0061 
0062     // Called by worker threads to set the Random Number Generator Engine.
0063     // The default implementation "clones" the engine from the master thread
0064     // User needs to re-implement this method if using a non-standard
0065     // RNG Engine (i.e. a different one w.r.t. the one provided in the CLHEP
0066     // version supported by Geant4).
0067     // Important: this method is called by all threads at the same time;
0068     // it is user responsibilitiy to make it thread-safe.
0069     virtual void SetupRNGEngine(const CLHEP::HepRandomEngine* aRNGEngine) const;
0070 
0071     // Called by the kernel when threads need to be terminated. Implements
0072     // logic of joining the "aThread". Calling thread will wait for "aThread"
0073     // to end. Users should not re-implement this function (in derived class),
0074     // except only if he/she wants to rewrite the default threading model (see
0075     // StartThread() function).
0076     virtual void JoinWorker(G4Thread* aThread);
0077 
0078     // Called by StartThread() function to create a run-manager implementing
0079     // worker behvior. User should re-implement this function in a derived
0080     // class to instantiate his/her user-defined WorkerRunManager.
0081     // By default this method instantiates a G4WorkerRunManager object.
0082     virtual G4WorkerRunManager* CreateWorkerRunManager() const;
0083 };
0084 
0085 #endif