Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 08:29:15

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 RunAction.hh
0027 /// \brief Definition of the RunAction class
0028 
0029 // This example is provided by the Geant4-DNA collaboration
0030 // Any report or published results obtained using the Geant4-DNA software
0031 // shall cite the following Geant4-DNA collaboration publication:
0032 // Med. Phys. 37 (2010) 4692-4708
0033 // and papers
0034 // M. Batmunkh et al. J Radiat Res Appl Sci 8 (2015) 498-507
0035 // O. Belov et al. Physica Medica 32 (2016) 1510-1520
0036 // The Geant4-DNA web site is available at http://geant4-dna.org
0037 //
0038 // -------------------------------------------------------------------
0039 // November 2016
0040 // -------------------------------------------------------------------
0041 //
0042 
0043 #ifndef RunAction_h
0044 #define RunAction_h 1
0045 
0046 #include "DetectorConstruction.hh"
0047 
0048 #include "G4ThreeVector.hh"
0049 #include "G4UserRunAction.hh"
0050 #include "globals.hh"
0051 
0052 #include <iostream>
0053 
0054 class PrimaryGeneratorAction;
0055 class Run;
0056 class G4Run;
0057 class TrackingAction;
0058 
0059 class RunAction : public G4UserRunAction
0060 {
0061   public:
0062     RunAction(DetectorConstruction*, PrimaryGeneratorAction*);
0063     ~RunAction() override = default;
0064 
0065     void BeginOfRunAction(const G4Run*) override;
0066     void EndOfRunAction(const G4Run*) override;
0067 
0068     void SetRndmFreq(G4int val) { fSaveRndm = val; }
0069     G4int GetRndmFreq() const { return fSaveRndm; }
0070     G4Run* GenerateRun() override;
0071 
0072     // Edep in all volume
0073     G4double GetEdepALL() const { return fEdepAll; }
0074     void SetEdepALL(G4double vall) { fEdepAll = vall; }
0075     void AddEdepALL(G4double vall)
0076     {
0077       fEdepAll += vall;
0078       fEdepAll_err += vall * vall;
0079     }
0080     // 0. Edep in homogeneous Medium
0081     G4double GetEdepMedium() const { return fEdepMedium; }
0082     void SetEdepMedium(G4double vall) { fEdepMedium = vall; }
0083     void AddEdepMedium(G4double vall)
0084     {
0085       fEdepMedium += vall;
0086       fEdepMedium_err += vall * vall;
0087     }
0088     // 1. Edep in Bounding Slice Volume
0089     G4double GetEdepSlice() const { return fEdepSlice; }
0090     void SetEdepSlice(G4double vall) { fEdepSlice = vall; }
0091     void AddEdepSlice(G4double vall)
0092     {
0093       fEdepSlice += vall;
0094       fEdepSlice_err += vall * vall;
0095     }
0096     // 2. Edep in Soma volume
0097     G4double GetEdepSoma() const { return fEdepSoma; }
0098     void SetEdepSoma(G4double vall) { fEdepSoma = vall; }
0099     void AddEdepSoma(G4double vall)
0100     {
0101       fEdepSoma += vall;
0102       fEdepSoma_err += vall * vall;
0103     }
0104 
0105     // 3. Edep in Dendrites volume
0106     G4double GetEdepDend() const { return fEdepDend; }
0107     void SetEdepDend(G4double vall) { fEdepDend = vall; }
0108     void AddEdepDend(G4double vall)
0109     {
0110       fEdepDend += vall;
0111       fEdepDend_err += vall * vall;
0112     }
0113 
0114     // 4. Edep in Axon volume
0115     G4double GetEdepAxon() const { return fEdepAxon; }
0116     void SetEdepAxon(G4double vall) { fEdepAxon = vall; }
0117     void AddEdepAxon(G4double vall)
0118     {
0119       fEdepAxon += vall;
0120       fEdepAxon_err += vall * vall;
0121     }
0122 
0123     // 5. Edep in whole Neuron volume
0124     G4double GetEdepNeuron() const { return fEdepNeuron; }
0125     void SetEdepNeuron(G4double vall) { fEdepNeuron = vall; }
0126     void AddEdepNeuron(G4double vall)
0127     {
0128       fEdepNeuron += vall;
0129       fEdepNeuron_err += vall * vall;
0130     }
0131 
0132     G4int GetNumEvent() const { return fNumEvent; }
0133     void SetNumEvent(G4int i) { fNumEvent = i; }
0134 
0135   private:
0136     /////////////////
0137     // Histogramming
0138     //
0139     void CreateHistogram();
0140     void WriteHistogram();
0141 
0142     /////////////////
0143     // Print Info
0144     //
0145     void PrintRunInfo(const G4Run* run);
0146 
0147     G4bool fDebug{false};
0148 
0149     DetectorConstruction* fDetector;
0150     PrimaryGeneratorAction* fPrimary;
0151     Run* fRun{nullptr};
0152 
0153     //
0154     // phys
0155     G4double fEdepAll{0.0};
0156     G4double fEdepAll_err{0.0};
0157     G4double fEdepMedium{0.0};
0158     G4double fEdepMedium_err{0.0};
0159     G4double fEdepSlice{0.0};
0160     G4double fEdepSlice_err{0.0};
0161     G4double fEdepSoma{0.0};
0162     G4double fEdepSoma_err{0.0};
0163     G4double fEdepDend{0.0};
0164     G4double fEdepDend_err{0.0};
0165     G4double fEdepAxon{0.0};
0166     G4double fEdepAxon_err{0.0};
0167     G4double fEdepNeuron{0.0};
0168     G4double fEdepNeuron_err{0.0};
0169     G4int fNumEvent{0};
0170     G4int fSaveRndm{0};
0171 };
0172 
0173 #endif