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