Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4Run
0027 //
0028 // Class description:
0029 //
0030 // This class represents a run. An object of this class is constructed
0031 // and deleted by G4RunManager. Basically the user should use only the
0032 // accessors (get methods). All properties are set by G4RunManager.
0033 
0034 // Author: M.Asai, 1996
0035 // --------------------------------------------------------------------
0036 #ifndef G4Run_hh
0037 #define G4Run_hh 1
0038 
0039 #include "G4Profiler.hh"
0040 #include "globals.hh"
0041 
0042 #include <vector>
0043 
0044 class G4Event;
0045 class G4HCtable;
0046 class G4DCtable;
0047 
0048 class G4Run
0049 {
0050   public:
0051     using ProfilerConfig = G4ProfilerConfig<G4ProfileType::Run>;
0052 
0053   public:
0054     G4Run();
0055     virtual ~G4Run();
0056     G4Run(const G4Run&) = delete;
0057     G4Run& operator=(const G4Run&) = delete;
0058 
0059     // Method to be overwritten by the user for recording events in this run.
0060     // In such a case, it is the user's responsibility to increment
0061     // numberOfEvent. Also, user's run class object must be instantiated in
0062     // user's runAction.
0063     virtual void RecordEvent(const G4Event*);
0064 
0065     // Method to be overwritten by the user for merging local G4Run object
0066     // to the global G4Run object.
0067     virtual void Merge(const G4Run*);
0068 
0069     // Method to be overwritten by the user for merging sub-event results
0070     // (e.g. hits) into the master G4Event.
0071     // [N.B.] Trajectories are merged in the base-class method. So, the user
0072     // should invoke the base-class method at the end of his/her overwriting
0073     // method.
0074     virtual void MergeSubEvent(G4Event* masterEv, const G4Event* subEv);
0075 
0076     // Store a G4Event object until this run object is deleted.
0077     // Given the potential large memory size of G4Event and its data-member
0078     // objects stored in G4Event, the user must be careful and responsible
0079     // for not storing too many G4Event objects. This method is invoked by
0080     // G4RunManager if the user invokes G4EventManager::KeepTheCurrentEvent()
0081     // or "/event/keepCurrentEvent" UI command while the particular event is
0082     // in being processed (typically in EndOfEventAction).
0083     void StoreEvent(G4Event* evt);
0084 
0085     // Returns the run ID. Run ID is set by G4RunManager.
0086     inline G4int GetRunID() const { return runID; }
0087 
0088     // Returns number of events processed in this run. The number is
0089     // incremented at the end of each event processing.
0090     inline G4int GetNumberOfEvent() const { return numberOfEvent; }
0091 
0092     inline G4int GetNumberOfEventToBeProcessed() const { return numberOfEventToBeProcessed; }
0093 
0094     // Returns hits collection.
0095     inline const G4HCtable* GetHCtable() const { return HCtable; }
0096 
0097     // Returns digi collection.
0098     inline const G4DCtable* GetDCtable() const { return DCtable; }
0099 
0100     // Returns random number status at the beginning of this run.
0101     inline const G4String& GetRandomNumberStatus() const { return randomNumberStatus; }
0102 
0103     // Returns the event vector.
0104     inline std::vector<const G4Event*>* GetEventVector() const { return eventVector; }
0105 
0106     inline void SetRunID(G4int id) { runID = id; }
0107     inline void SetNumberOfEventToBeProcessed(G4int n_ev) { numberOfEventToBeProcessed = n_ev; }
0108     inline void SetHCtable(G4HCtable* HCtbl) { HCtable = HCtbl; }
0109     inline void SetDCtable(G4DCtable* DCtbl) { DCtable = DCtbl; }
0110     inline void SetRandomNumberStatus(G4String& st) { randomNumberStatus = st; }
0111 
0112   protected:
0113     G4int runID = 0;
0114     G4int numberOfEvent = 0;
0115     G4int numberOfEventToBeProcessed = 0;
0116     G4HCtable* HCtable = nullptr;
0117     G4DCtable* DCtable = nullptr;
0118     G4String randomNumberStatus = "";
0119     std::vector<const G4Event*>* eventVector = nullptr;
0120 };
0121 
0122 #endif