Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-13 07:41:29

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 // 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 Run_h
0044 #define Run_h 1
0045 
0046 #include "G4Molecule.hh"
0047 #include "G4Run.hh"
0048 #include "G4VProcess.hh"
0049 #include "globals.hh"
0050 
0051 #include <map>
0052 
0053 class DetectorConstruction;
0054 class G4ParticleDefinition;
0055 class G4Molecule;
0056 
0057 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0058 
0059 class Run : public G4Run
0060 {
0061   public:
0062     Run(DetectorConstruction*);
0063     ~Run() override;
0064 
0065     void SetPrimary(G4ParticleDefinition* particle, G4double energy);
0066     void AddPrimaryLET(G4double let);
0067     void SetTrackLength(G4double tracklen);
0068     void CountProcesses(const G4VProcess* process);
0069     void ParticleCount(G4String, G4double);
0070     void ParticleCountNeuron(G4String, G4double);
0071     void MoleculeCount(G4String, G4double);
0072     void MoleculeCountNeuron(G4Molecule* molecule);
0073     void AddEdep(G4double edep);
0074     void AddEflow(G4double eflow);
0075     void ParticleFlux(G4String, G4double);
0076 
0077     void Merge(const G4Run*) override;
0078     void EndOfRun();
0079 
0080     // Edep in all volume
0081     G4double GetEdepALL() { return fEdepAll; }
0082     void SetEdepALL(G4double vall) { fEdepAll = vall; }
0083     void AddEdepALL(G4double vall)
0084     {
0085       fEdepAll += vall;
0086       fEdepAll_err += vall * vall;
0087     }
0088     // 0. Edep in homogeneous Medium
0089     G4double GetEdepMedium() { return fEdepMedium; }
0090     void SetEdepMedium(G4double vall) { fEdepMedium = vall; }
0091     void AddEdepMedium(G4double vall)
0092     {
0093       fEdepMedium += vall;
0094       fEdepMedium_err += vall * vall;
0095     }
0096     // 1. Edep in Bounding Slice Volume
0097     G4double GetEdepSlice() { return fEdepSlice; }
0098     void SetEdepSlice(G4double vall) { fEdepSlice = vall; }
0099     void AddEdepSlice(G4double vall)
0100     {
0101       fEdepSlice += vall;
0102       fEdepSlice_err += vall * vall;
0103     }
0104     // 2. Edep in Soma volume
0105     G4double GetEdepSoma() { return fEdepSoma; }
0106     void SetEdepSoma(G4double vall) { fEdepSoma = vall; }
0107     void AddEdepSoma(G4double vall)
0108     {
0109       fEdepSoma += vall;
0110       fEdepSoma_err += vall * vall;
0111     }
0112 
0113     void AddSomaCompart(G4int i, G4double x) { fSoma3DEdep[i] += x; }
0114     G4double GetSomaCompart(G4int i) { return fSoma3DEdep[i]; }
0115 
0116     // 3. Edep in Dendrites volume
0117     G4double GetEdepDend() { return fEdepDend; }
0118     void SetEdepDend(G4double vall) { fEdepDend = vall; }
0119     void AddEdepDend(G4double vall)
0120     {
0121       fEdepDend += vall;
0122       fEdepDend_err += vall * vall;
0123     }
0124 
0125     void AddDendCompart(G4int i, G4double x) { fDend3DEdep[i] += x; }
0126     G4double GetDendCompart(G4int i) { return fDend3DEdep[i]; }
0127 
0128     // 4. Edep in Axon volume
0129     G4double GetEdepAxon() { return fEdepAxon; }
0130     void SetEdepAxon(G4double vall) { fEdepAxon = vall; }
0131     void AddEdepAxon(G4double vall)
0132     {
0133       fEdepAxon += vall;
0134       fEdepAxon_err += vall * vall;
0135     }
0136 
0137     void AddAxonCompart(G4int i, G4double x) { fAxon3DEdep[i] += x; }
0138     G4double GetAxonCompart(G4int i) { return fAxon3DEdep[i]; }
0139 
0140     // 5. Edep in whole Neuron volume
0141     G4double GetEdepNeuron() { return fEdepNeuron; }
0142     void SetEdepNeuron(G4double vall) { fEdepNeuron = vall; }
0143     void AddEdepNeuron(G4double vall)
0144     {
0145       fEdepNeuron += vall;
0146       fEdepNeuron_err += vall * vall;
0147     }
0148 
0149   private:
0150     struct ParticleData
0151     {
0152         ParticleData() : fCount(0), fEmean(0.), fEmin(0.), fEmax(0.) {}
0153         ParticleData(G4int count, G4double ekin, G4double emin, G4double emax)
0154           : fCount(count), fEmean(ekin), fEmin(emin), fEmax(emax)
0155         {}
0156         G4int fCount;
0157         G4double fEmean;
0158         G4double fEmin;
0159         G4double fEmax;
0160     };
0161 
0162     DetectorConstruction* fDetector;
0163     G4ParticleDefinition* fParticle;
0164     G4double fEkin{0.0};
0165     G4double fLET{0.0};
0166     G4double fLET2{0.0};
0167     G4double ftrackLength{0.0};
0168     G4double fTrackLen{0.0};
0169     G4double fTrackLen2{0.0};
0170     G4int fNParticle{0};
0171 
0172     G4double* fSoma3DEdep;
0173     G4double* fDend3DEdep;
0174     G4double* fAxon3DEdep;
0175     G4double* fNeuron3DEdep;
0176     G4double fEdepAll, fEdepAll_err, fEdepMedium, fEdepMedium_err, fEdepSlice, fEdepSlice_err,
0177       fEdepSoma, fEdepSoma_err, fEdepDend, fEdepDend_err, fEdepAxon, fEdepAxon_err, fEdepNeuron,
0178       fEdepNeuron_err;
0179 
0180     G4int fmolNum{0};
0181     G4int fmolNum2{0};
0182     G4double fEnergyFlow{0.0};
0183     G4double fEnergyFlow2{0.0};
0184     std::map<G4String, G4int> fMoleculeNumber;
0185     std::map<G4String, G4int> fProcCounter;
0186     std::map<G4String, ParticleData> fParticleDataMap1;
0187     std::map<G4String, ParticleData> fParticleDataMap2;
0188 };
0189 
0190 #endif