Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 08:59:22

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