Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:20:56

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 electromagnetic/TestEm18/include/RunAction.hh
0027 /// \brief Definition of the RunAction class
0028 //
0029 //
0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 
0033 #ifndef RunAction_h
0034 #define RunAction_h 1
0035 
0036 #include "G4UserRunAction.hh"
0037 #include "G4VProcess.hh"
0038 #include "globals.hh"
0039 
0040 #include <map>
0041 
0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0043 
0044 class G4Run;
0045 class G4ParticleDefinition;
0046 class G4Material;
0047 
0048 class DetectorConstruction;
0049 class PrimaryGeneratorAction;
0050 class HistoManager;
0051 
0052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0053 
0054 class RunAction : public G4UserRunAction
0055 {
0056   public:
0057     RunAction(DetectorConstruction*, PrimaryGeneratorAction*);
0058     ~RunAction() override;
0059 
0060   public:
0061     void BeginOfRunAction(const G4Run*) override;
0062     void EndOfRunAction(const G4Run*) override;
0063 
0064     void CountProcesses(G4String procName);
0065 
0066     void TrackLength(G4double step);
0067 
0068     void EnergyDeposited(G4double edepPrim, G4double edepSecond);
0069 
0070     void EnergyTransferedByProcess(G4String procName, G4double energy);
0071 
0072     void EnergyTransfered(G4double energy);
0073 
0074     void TotalEnergyLost(G4double energy);
0075 
0076     void EnergyBalance(G4double energy);
0077 
0078     void TotalEnergyDeposit(G4double energy);
0079 
0080     void EnergySpectrumOfSecondaries(G4String particleName, G4double ekin);
0081 
0082   public:
0083     G4double GetEnergyFromRestrictedRange(G4double, G4ParticleDefinition*, G4Material*, G4double);
0084 
0085     G4double GetEnergyFromCSDARange(G4double, G4ParticleDefinition*, G4Material*, G4double);
0086 
0087   private:
0088     struct MinMaxData
0089     {
0090         MinMaxData() : fCount(0), fVsum(0.), fVmin(0.), fVmax(0.) {}
0091         MinMaxData(G4int count, G4double vsum, G4double vmin, G4double vmax)
0092           : fCount(count), fVsum(vsum), fVmin(vmin), fVmax(vmax)
0093         {}
0094         G4int fCount;
0095         G4double fVsum;
0096         G4double fVmin;
0097         G4double fVmax;
0098     };
0099 
0100   private:
0101     DetectorConstruction* fDetector = nullptr;
0102     PrimaryGeneratorAction* fPrimary = nullptr;
0103     HistoManager* fHistoManager = nullptr;
0104 
0105     std::map<G4String, G4int> fProcCounter;
0106 
0107     G4long fNbSteps = 0;
0108     G4double fTrackLength = 0., fStepMin = DBL_MAX, fStepMax = 0.;
0109 
0110     G4double fEdepPrimary = 0., fEdepPrimMin = DBL_MAX, fEdepPrimMax = 0.;
0111     std::map<G4String, MinMaxData> fEtransfByProcess;
0112     G4double fEnergyTransfered = 0., fEtransfMin = DBL_MAX, fEtransfMax = 0.;
0113     G4double fEnergyLost = 0., fElostMin = DBL_MAX, fElostMax = 0.;
0114     G4double fEnergyBalance = 0., fEbalMin = DBL_MAX, fEbalMax = 0.;
0115 
0116     G4double fEdepSecondary = 0., fEdepSecMin = DBL_MAX, fEdepSecMax = 0.;
0117     G4double fEdepTotal = 0., fEdepTotMin = DBL_MAX, fEdepTotMax = 0.;
0118 
0119     std::map<G4String, MinMaxData> fEkinOfSecondaries;
0120 };
0121 
0122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0123 
0124 #endif