Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4VUserActionInitialization
0027 //
0028 // Class description:
0029 //
0030 // This is the abstract base class for instantiating all user action classes.
0031 // It has a pure virtual method Build() which is invoked by G4RunManager for
0032 // sequential execution, and G4WorkerRunManager for multi-threaded execution.
0033 // The additional virtual method BuildForMaster() will be invoked from
0034 // G4MTRunManager for multi-threaded execution.
0035 //
0036 // Note that these virtual methods are const. It means the user may construct
0037 // user action objects, but should not store the pointers of these objects as
0038 // data members of the derived class.
0039 //
0040 // Note for multi-threaded mode: the only action class the user may set to
0041 // G4MTRunManager is a run action. It is then used at the beginning and the
0042 // end of a run. It may be the same class or a dedicated class different from
0043 // the run action instantiated for G4WorkerRunManager.
0044 
0045 // Author: M.Asai (SLAC), 17 April 2013
0046 // --------------------------------------------------------------------
0047 #ifndef G4VUserActionInitialization_hh
0048 #define G4VUserActionInitialization_hh 1
0049 
0050 class G4VUserPrimaryGeneratorAction;
0051 class G4UserRunAction;
0052 class G4UserEventAction;
0053 class G4UserStackingAction;
0054 class G4UserTrackingAction;
0055 class G4UserSteppingAction;
0056 class G4VSteppingVerbose;
0057 
0058 class G4VUserActionInitialization
0059 {
0060   public:
0061     G4VUserActionInitialization() = default;
0062     virtual ~G4VUserActionInitialization() = default;
0063 
0064     // Virtual method to be implemented by the user to instantiate
0065     // user action class objects.
0066     virtual void Build() const = 0;
0067 
0068     // Virtual method to be implemented by the user to instantiate user
0069     // run action class object to be used by G4MTRunManager. This method
0070     // is not invoked in the sequential mode. The user should not use
0071     // this method to instantiate user action classes except for user
0072     // run action.
0073     virtual void BuildForMaster() const {}
0074 
0075     // Virtual method to be implemented by the user if having a concrete
0076     // SteppingVerbose class to be used by the worker thread. In this case
0077     // one should instantiate a SteppingVerbose in the concrete
0078     // implementation of this method and return its pointer. If this method
0079     // is not implemented, the default G4SteppingVerbose will be used.
0080     // Please note that this method affects only for the worker thread.
0081     virtual G4VSteppingVerbose* InitializeSteppingVerbose() const { return nullptr; }
0082 
0083   protected:
0084     // These methods should be used to define user's action classes.
0085     void SetUserAction(G4VUserPrimaryGeneratorAction*) const;
0086     void SetUserAction(G4UserRunAction*) const;
0087     void SetUserAction(G4UserEventAction*) const;
0088     void SetUserAction(G4UserStackingAction*) const;
0089     void SetUserAction(G4UserTrackingAction*) const;
0090     void SetUserAction(G4UserSteppingAction*) const;
0091 };
0092 
0093 #endif