Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-02 08:29:39

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: Makoto Asai (JLAB) - 2024
0028 //
0029 // class description:
0030 //
0031 //  This is a class for run control in GEANT4 for multi-threaded runs
0032 //  of worker thread running in sub-event parallel mode.
0033 //  It extends G4RunManager re-implementing multi-threaded behavior in
0034 //  key methods. See documentation for G4RunManager. User should never
0035 //  initialize instances of this class, that are usually handled by
0036 //  G4MTRunManager. There exists one instance of this class for each
0037 //  worker in a MT application.
0038 
0039 #ifndef G4WorkerSubEvtRunManager_h
0040 #define G4WorkerSubEvtRunManager_h 1
0041 
0042 #include "G4WorkerTaskRunManager.hh"
0043 
0044 class G4WorkerThread;
0045 class G4WorkerTaskRunManagerKernel;
0046 
0047 // N.B. G4WorkerTaskRunManagerKernel is still used by this G4WorkerSubEvtRunManager
0048 //  without any modification. -- future work for phase-II developments
0049 using G4WorkerSubEvtRunManagerKernel = G4WorkerTaskRunManagerKernel;
0050 
0051 class G4WorkerSubEvtRunManager : public G4WorkerTaskRunManager 
0052 {
0053   public:
0054     static G4WorkerSubEvtRunManager* GetWorkerRunManager();
0055     static G4WorkerSubEvtRunManagerKernel* GetWorkerRunManagerKernel();
0056     G4WorkerSubEvtRunManager(G4int subEventType = 0);
0057     //G4WorkerSubEvtRunManager() = delete;
0058 
0059     // Modified for worker behavior
0060     void RunInitialization() override;
0061     void DoEventLoop(G4int n_event, const char* macroFile = nullptr, G4int n_select = -1) override;
0062     void ProcessOneEvent(G4int i_event) override;
0063     G4Event* GenerateEvent(G4int i_event) override;
0064     void RunTermination() override;
0065     void TerminateEventLoop() override;
0066     void DoWork() override;
0067     void RestoreRndmEachEvent(G4bool flag) override { readStatusFromFile = flag; }
0068 
0069     void DoCleanup() override;
0070     void ProcessUI() override;
0071 
0072     void SetUserInitialization(G4VUserPhysicsList* userPL) override;
0073     void SetUserInitialization(G4VUserDetectorConstruction* userDC) override;
0074     void SetUserInitialization(G4UserWorkerInitialization* userInit) override;
0075     void SetUserInitialization(G4UserWorkerThreadInitialization* userInit) override;
0076     void SetUserInitialization(G4VUserActionInitialization* userInit) override;
0077     void SetUserAction(G4UserRunAction* userAction) override;
0078     void SetUserAction(G4VUserPrimaryGeneratorAction* userAction) override;
0079     void SetUserAction(G4UserEventAction* userAction) override;
0080     void SetUserAction(G4UserStackingAction* userAction) override;
0081     void SetUserAction(G4UserTrackingAction* userAction) override;
0082     void SetUserAction(G4UserSteppingAction* userAction) override;
0083 
0084   protected:
0085     void StoreRNGStatus(const G4String& filenamePrefix) override;
0086     void SetupDefaultRNGEngine() override;
0087 
0088   private:
0089     G4int fSubEventType = -1;
0090 
0091   public:
0092     G4int GetSubEventType() const override
0093     { return fSubEventType; }
0094     void SetSubEventType(G4int) override;
0095 };
0096 
0097 #endif  // G4WorkerSubEvtRunManager_h