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 // G4UserWorkerInitialization
0027 //
0028 // Class description:
0029 //
0030 // This class is used for multi-threading.
0031 // The object of this class can be set to G4MTRunManager, but not to
0032 // G4RunManager. G4UserWorkerInitialization class has five virtual methods
0033 // as the user hooks which are invoked at several occasions in the life
0034 // cycle of each thread.
0035 //
0036 // - virtual void WorkerInitialize() const
0037 //     This method is called after the tread is created but before the
0038 //     G4WorkerRunManager is instantiated.
0039 // - virtual void WorkerStart() const
0040 //     This method is called once at the beginning of simulation job when
0041 //     kernel classes and user action classes have already instantiated but
0042 //     geometry and physics have not been yet initialised. This situation is
0043 //     identical to the 'PreInit' state in the sequential mode.
0044 // - virtual void WorkerRunStart() const
0045 //     This method is called before an event loop. Geometry and physics have
0046 //     already been set up for the thread. All threads are synchronised and
0047 //     ready to start the local event loop. This situation is identical to
0048 //     'Idle' state in the sequential mode.
0049 // - virtual void WorkerRunEnd() const
0050 //     This method is called for each thread when the local event loop is
0051 //     done, but before the synchronisation over threads.
0052 // - virtual void WorkerStop() const
0053 //     This method is called once at the end of the simulation job.
0054 //
0055 // Note: this object should be instantiated only once and set to
0056 //       G4MTRunManager, while the five methods above are invoked for each
0057 //       worker thread. Thus, to store thread-local objects, use the
0058 //       G4ThreadLocal keyword.
0059 
0060 // Author: A.Dotti (SLAC), 25 February 2013
0061 // --------------------------------------------------------------------
0062 #ifndef G4UserWorkerInitialization_hh
0063 #define G4UserWorkerInitialization_hh 1
0064 
0065 class G4UserWorkerInitialization
0066 {
0067   public:
0068     G4UserWorkerInitialization() = default;
0069     virtual ~G4UserWorkerInitialization() = default;
0070 
0071     // This method is called after the tread is created but before the
0072     // G4WorkerRunManager is instantiated.
0073     virtual void WorkerInitialize() const {}
0074 
0075     // This method is called once at the beginning of simulation job
0076     // when kernel classes and user action classes have already instantiated
0077     // but geometry and physics have not been yet initialised. This situation
0078     // is identical to 'PreInit' state in the sequential mode.
0079     virtual void WorkerStart() const {}
0080 
0081     // This method is called before an event loop. Geometry and physics have
0082     // already been set up for the thread. All threads are synchronised and
0083     // ready to start the local event loop. This situation is identical to
0084     // 'Idle' state in the sequential mode.
0085     virtual void WorkerRunStart() const {}
0086 
0087     // This method is called for each thread, when the local event loop has
0088     // finished but before the synchronisation over threads.
0089     virtual void WorkerRunEnd() const {}
0090 
0091     // This method is called once at the end of simulation job.
0092     // Implement here a clean up action.
0093     virtual void WorkerStop() const {}
0094 };
0095 
0096 #endif