Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-25 07:40:23

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 /// \file Run.hh
0027 /// \brief Definition of the Run class
0028 
0029 #ifndef Run_h
0030 #define Run_h 1
0031 
0032 #include "SteppingAction.hh"
0033 #include "TrackingAction.hh"
0034 
0035 #include "G4Run.hh"
0036 #include "G4ThreeVector.hh"
0037 
0038 #include <array>
0039 
0040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0041 
0042 class Run : public G4Run
0043 {
0044     // This class accumulates relevant quantities related to particle fluence collected during
0045     // the run.
0046     // ( Note: these information are provided via calls of accessor methods of this Run class
0047     //         made by SteppingAction::UserSteppingAction
0048     //         and     TrackingAction::PreUserTrackingAction. )
0049     // At the end of a run, the  PrintInfo  method is called by the run-action to print out
0050     // some summary information about these quantities.
0051     // In multithreaded (MT) mode, an object of this class is filled up for each working thread,
0052     // and then merged (automatically by the Geant4 kernel) into another object (of this class)
0053     // owned by the master class; the  PrintInfo  method is then called only for the latter run
0054     // object.
0055     // Note that, for simplicity and brevity, we avoid histograms and print-out instead some
0056     // statistics (compute by ourself) at the end of the run.
0057   public:
0058     Run();
0059     ~Run() override = default;
0060 
0061     void RecordEvent(const G4Event* anEvent) override;
0062     // This method is called automatically by the Geant4 kernel (not by the user!) at the end
0063     // of each event. In the case of multithreaded mode, it is called only for the working thread
0064     // that handled that event.
0065 
0066     void Merge(const G4Run* aRun) override;
0067     // This method is called automatically by the Geant4 kernel (not by the user!) only in the
0068     // case of multithreaded mode and only for working threads.
0069 
0070     void PrintInfo() const;
0071     // This method is called by RunAction::EndOfRunAction : in the case of multithreaded mode,
0072     // only the master thread calls it.
0073 
0074     void SetPrimaryParticleId(const G4int inputValue) { fPrimaryParticleId = inputValue; }
0075     void SetPrimaryParticleEnergy(const G4double inputValue)
0076     {
0077       fPrimaryParticleEnergy = inputValue;
0078     }
0079     void SetPrimaryParticleDirection(const G4ThreeVector& inputValue)
0080     {
0081       fPrimaryParticleDirection = inputValue;
0082     }
0083     void SetTargetMaterialName(const G4String& inputValue) { fTargetMaterialName = inputValue; }
0084     void SetCubicVolumeScoringShell(const G4double inputValue)
0085     {
0086       fCubicVolumeScoringShell = inputValue;
0087     }
0088     G4int GetPrimaryParticleId() const { return fPrimaryParticleId; }
0089     G4double GetPrimaryParticleEnergy() const { return fPrimaryParticleEnergy; }
0090     G4ThreeVector GetPrimaryParticleDirection() const { return fPrimaryParticleDirection; }
0091     G4String GetTargetMaterialName() const { return fTargetMaterialName; }
0092     G4double GetCubicVolumeScoringShell() const { return fCubicVolumeScoringShell; }
0093 
0094     void
0095     SetSteppingArray(const std::array<G4double, SteppingAction::fkNumberCombinations>& inputArray);
0096     std::array<G4double, SteppingAction::fkNumberCombinations> GetSteppingArray() const
0097     {
0098       return fSteppingArray;
0099     }
0100     // Accessor methods useful to transfer information collected by the stepping-action
0101     // into this Run class
0102 
0103     void
0104     SetTrackingArray1(const std::array<G4long, TrackingAction::fkNumberCombinations>& inputArray);
0105     std::array<G4long, TrackingAction::fkNumberCombinations> GetTrackingArray1() const
0106     {
0107       return fTrackingArray1;
0108     }
0109     void
0110     SetTrackingArray2(const std::array<G4double, TrackingAction::fkNumberCombinations>& inputArray);
0111     std::array<G4double, TrackingAction::fkNumberCombinations> GetTrackingArray2() const
0112     {
0113       return fTrackingArray2;
0114     }
0115     // Accessor methods useful to transfer information collected by the tracking-action
0116     // into this Run class
0117 
0118   private:
0119     G4int fNumEvents;
0120     G4int fPrimaryParticleId;
0121     G4double fPrimaryParticleEnergy;
0122     G4ThreeVector fPrimaryParticleDirection;
0123     G4String fTargetMaterialName;
0124     G4double fCubicVolumeScoringShell;
0125     std::array<G4double, SteppingAction::fkNumberCombinations> fSteppingArray;
0126     std::array<G4long, TrackingAction::fkNumberCombinations> fTrackingArray1;
0127     std::array<G4double, TrackingAction::fkNumberCombinations> fTrackingArray2;
0128 };
0129 
0130 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0131 
0132 #endif