Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-01 07:50:22

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 PhysicsList.cc
0027 /// \brief Implementation of the PhysicsList class
0028 
0029 #include "PhysicsList.hh"
0030 
0031 #include "PhysicsListMessenger.hh"
0032 
0033 #include "G4ComptonScattering.hh"
0034 #include "G4DecayPhysics.hh"
0035 #include "G4GammaConversion.hh"
0036 #include "G4MuBremsstrahlung.hh"
0037 #include "G4MuIonisation.hh"
0038 #include "G4MuMultipleScattering.hh"
0039 #include "G4MuPairProduction.hh"
0040 #include "G4ParticleDefinition.hh"
0041 #include "G4ParticleTable.hh"
0042 #include "G4ParticleTypes.hh"
0043 #include "G4PhotoElectricEffect.hh"
0044 #include "G4ProcessManager.hh"
0045 #include "G4ProcessTable.hh"
0046 #include "G4RayleighScattering.hh"
0047 #include "G4StepLimiter.hh"
0048 #include "G4SynchrotronRadiation.hh"
0049 #include "G4SynchrotronRadiationInMat.hh"
0050 #include "G4SystemOfUnits.hh"
0051 #include "G4XrayReflection.hh"
0052 #include "G4eBremsstrahlung.hh"
0053 #include "G4eIonisation.hh"
0054 #include "G4eMultipleScattering.hh"
0055 #include "G4eplusAnnihilation.hh"
0056 #include "G4hBremsstrahlung.hh"
0057 #include "G4hIonisation.hh"
0058 #include "G4hMultipleScattering.hh"
0059 #include "G4hPairProduction.hh"
0060 
0061 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0062 
0063 PhysicsList::PhysicsList() : G4VUserPhysicsList(), fMess(0)
0064 {
0065   SetDefaultCutValue(1. * km);
0066 
0067   fSRType = true;
0068   fMess = new PhysicsListMessenger(this);
0069   fDecayPhysics = new G4DecayPhysics();
0070 }
0071 
0072 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0073 
0074 void PhysicsList::ConstructParticle()
0075 {
0076   fDecayPhysics->ConstructParticle();
0077 }
0078 
0079 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0080 
0081 void PhysicsList::ConstructProcess()
0082 {
0083   AddTransportation();
0084   ConstructEM();
0085   fDecayPhysics->ConstructProcess();
0086 }
0087 
0088 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0089 
0090 void PhysicsList::ConstructEM()
0091 {
0092   auto particleIterator = GetParticleIterator();
0093   particleIterator->reset();
0094   auto fSync = new G4SynchrotronRadiation();
0095   while ((*particleIterator)()) {
0096     G4ParticleDefinition* particle = particleIterator->value();
0097     G4ProcessManager* pmanager = particle->GetProcessManager();
0098     G4String particleName = particle->GetParticleName();
0099 
0100     if (particleName == "gamma") {
0101       // gamma
0102       pmanager->AddDiscreteProcess(new G4PhotoElectricEffect);
0103       pmanager->AddDiscreteProcess(new G4ComptonScattering);
0104       pmanager->AddDiscreteProcess(new G4GammaConversion);
0105       pmanager->AddDiscreteProcess(new G4RayleighScattering);
0106       pmanager->AddDiscreteProcess(new G4XrayReflection);
0107     }
0108     else if (particleName == "e-") {
0109       // electron
0110       pmanager->AddProcess(new G4eMultipleScattering, -1, 1, -1);
0111       pmanager->AddProcess(new G4eIonisation, -1, 2, 1);
0112       pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 2);
0113       if (fSRType) {
0114         pmanager->AddProcess(fSync, -1, -1, 3);
0115       }
0116       else {
0117         pmanager->AddProcess(new G4SynchrotronRadiationInMat, -1, -1, 3);
0118       }
0119       pmanager->AddProcess(new G4StepLimiter, -1, -1, 4);
0120     }
0121     else if (particleName == "e+") {
0122       // positron
0123       pmanager->AddProcess(new G4eMultipleScattering, -1, 1, -1);
0124       pmanager->AddProcess(new G4eIonisation, -1, 2, 1);
0125       pmanager->AddProcess(new G4eBremsstrahlung, -1, 3, 2);
0126       pmanager->AddProcess(new G4eplusAnnihilation, 0, -1, 3);
0127       if (fSRType) {
0128         pmanager->AddProcess(fSync, -1, -1, 4);
0129       }
0130       else {
0131         pmanager->AddProcess(new G4SynchrotronRadiationInMat, -1, -1, 4);
0132       }
0133       pmanager->AddProcess(new G4StepLimiter, -1, -1, 5);
0134     }
0135     else if (particleName == "mu+" || particleName == "mu-") {
0136       // muon
0137       pmanager->AddProcess(new G4MuMultipleScattering, -1, 1, -1);
0138       pmanager->AddProcess(new G4MuIonisation, -1, 2, 1);
0139       pmanager->AddProcess(new G4MuBremsstrahlung, -1, 3, 2);
0140       pmanager->AddProcess(new G4MuPairProduction, -1, 4, 3);
0141       pmanager->AddProcess(fSync, -1, -1, 4);
0142       pmanager->AddProcess(new G4StepLimiter, -1, -1, 5);
0143     }
0144     else if (particleName == "proton") {
0145       // proton
0146       pmanager->AddProcess(new G4hMultipleScattering, -1, 1, -1);
0147       pmanager->AddProcess(new G4hIonisation, -1, 2, 1);
0148       pmanager->AddProcess(new G4hBremsstrahlung, -1, 3, 2);
0149       pmanager->AddProcess(new G4hPairProduction, -1, 4, 3);
0150       pmanager->AddProcess(fSync, -1, -1, 4);
0151       pmanager->AddProcess(new G4StepLimiter, -1, -1, 5);
0152     }
0153     else if (particle->GetPDGCharge() != 0.0 && !particle->IsShortLived()) {
0154       pmanager->AddProcess(fSync, -1, -1, 1);
0155     }
0156   }
0157 }
0158 
0159 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0160 
0161 void PhysicsList::SetXrayReflectionRoughness(G4double SurfaceRoughness)
0162 {
0163   G4ProcessTable* theProcessTable = G4ProcessTable::GetProcessTable();
0164   G4XrayReflection* XrayReflectionProcess =
0165     (G4XrayReflection*)theProcessTable->FindProcess("XrayReflection", "gamma");
0166   if (XrayReflectionProcess)
0167     XrayReflectionProcess->SetSurfaceRoughness(SurfaceRoughness);
0168   else
0169     G4cout << "Warning. No process XrayReflection found, "
0170               "SetXrayReflectionRoughness ignored"
0171            << G4endl;
0172 }
0173 
0174 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......