Back to home page

EIC code displayed by LXR

 
 

    


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