Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-17 08:31:48

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 // This example is provided by the Geant4-DNA collaboration
0030 // dnadamage3 example is derived from the chem6 example
0031 // chem6 example authors: W. G. Shin and S. Incerti (CENBG, France)
0032 //
0033 // Any report or published results obtained using the Geant4-DNA software
0034 // shall cite the following Geant4-DNA collaboration publication:
0035 // J. Appl. Phys. 125 (2019) 104301
0036 // Med. Phys. 45 (2018) e722-e739
0037 // J. Comput. Phys. 274 (2014) 841-882
0038 // Med. Phys. 37 (2010) 4692-4708
0039 // Int. J. Model. Simul. Sci. Comput. 1 (2010) 157-178
0040 // The Geant4-DNA web site is available at http://geant4-dna.org
0041 //
0042 // Authors: J. Naoki D. Kondo (UCSF, US)
0043 //          J. Ramos-Mendez and B. Faddegon (UCSF, US)
0044 //
0045 
0046 #include "PhysicsList.hh"
0047 
0048 #include "G4EmDNAChemistry.hh"
0049 #include "G4EmDNAChemistryForPlasmids.hh"
0050 #include "G4EmDNAChemistry_option1.hh"
0051 #include "G4EmDNAChemistry_option2.hh"
0052 #include "G4EmDNAChemistry_option3.hh"
0053 #include "G4EmDNAPhysics.hh"
0054 #include "G4EmDNAPhysics_option1.hh"
0055 #include "G4EmDNAPhysics_option2.hh"
0056 #include "G4EmDNAPhysics_option3.hh"
0057 #include "G4EmDNAPhysics_option4.hh"
0058 #include "G4EmDNAPhysics_option5.hh"
0059 #include "G4EmDNAPhysics_option6.hh"
0060 #include "G4EmDNAPhysics_option7.hh"
0061 #include "G4EmDNAPhysics_option8.hh"
0062 #include "G4EmParameters.hh"
0063 #include "G4PhysicsConstructorRegistry.hh"
0064 #include "G4SystemOfUnits.hh"
0065 
0066 #include <memory>
0067 
0068 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0069 
0070 PhysicsList::PhysicsList() : G4VModularPhysicsList()
0071 {
0072   G4double currentDefaultCut = 1. * nanometer;
0073   // fixe lower limit for cut
0074   G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(100 * eV, 1 * GeV);
0075   SetDefaultCutValue(currentDefaultCut);
0076   SetVerboseLevel(1);
0077 
0078   RegisterPhysicsConstructor("G4EmDNAPhysics_option2");
0079   RegisterChemistryConstructor("G4EmDNAChemistryForPlasmids");
0080 
0081   fpPhysicsUI = new G4UIcmdWithAString("/physics/SetPhysics", this);
0082   fpPhysicsUI->AvailableForStates(G4State_PreInit);
0083 
0084   fpChemistryUI = new G4UIcmdWithAString("/physics/SetChemistry", this);
0085   fpChemistryUI->AvailableForStates(G4State_PreInit);
0086 
0087   fpDMSOUI = new G4UIcmdWithADouble("/chem/scavenger/DMSO", this);
0088   fpDMSOUI->AvailableForStates(G4State_PreInit);
0089 
0090   fpOxygenUI = new G4UIcmdWithADouble("/chem/scavenger/Oxygen", this);
0091   fpOxygenUI->AvailableForStates(G4State_PreInit);
0092 }
0093 
0094 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0095 
0096 void PhysicsList::ConstructParticle()
0097 {
0098   if (fEmDNAPhysicsList != nullptr) {
0099     fEmDNAPhysicsList->ConstructParticle();
0100   }
0101   if (fEmDNAChemistryList != nullptr) {
0102     fEmDNAChemistryList->ConstructParticle();
0103   }
0104 }
0105 
0106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0107 
0108 void PhysicsList::ConstructProcess()
0109 {
0110   AddTransportation();
0111   if (fEmDNAPhysicsList != nullptr) {
0112     fEmDNAPhysicsList->ConstructProcess();
0113   }
0114   if (fEmDNAChemistryList != nullptr) {
0115     fEmDNAChemistryList->ConstructProcess();
0116   }
0117 }
0118 
0119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0120 
0121 void PhysicsList::RegisterPhysicsConstructor(const G4String& name)
0122 {
0123   if (name == fPhysDNAName) {
0124     return;
0125   }
0126   if (verboseLevel > 0) {
0127     G4cout << "===== Register Physics constructor   ==== " << name << G4endl;
0128   }
0129   if (name == "G4EmDNAPhysics") {
0130     delete fEmDNAPhysicsList;
0131     fEmDNAPhysicsList = new G4EmDNAPhysics(verboseLevel);
0132     fPhysDNAName = name;
0133   }
0134   else if (name == "G4EmDNAPhysics_option1") {
0135     delete fEmDNAPhysicsList;
0136     fEmDNAPhysicsList = new G4EmDNAPhysics_option1(verboseLevel);
0137     fPhysDNAName = name;
0138   }
0139   else if (name == "G4EmDNAPhysics_option2") {
0140     delete fEmDNAPhysicsList;
0141     fEmDNAPhysicsList = new G4EmDNAPhysics_option2(verboseLevel);
0142     fPhysDNAName = name;
0143   }
0144   else if (name == "G4EmDNAPhysics_option3") {
0145     delete fEmDNAPhysicsList;
0146     fEmDNAPhysicsList = new G4EmDNAPhysics_option3(verboseLevel);
0147     fPhysDNAName = name;
0148   }
0149   else if (name == "G4EmDNAPhysics_option4") {
0150     delete fEmDNAPhysicsList;
0151     fEmDNAPhysicsList = new G4EmDNAPhysics_option4(verboseLevel);
0152     fPhysDNAName = name;
0153   }
0154   else if (name == "G4EmDNAPhysics_option5") {
0155     delete fEmDNAPhysicsList;
0156     fEmDNAPhysicsList = new G4EmDNAPhysics_option5(verboseLevel);
0157     fPhysDNAName = name;
0158   }
0159   else if (name == "G4EmDNAPhysics_option6") {
0160     delete fEmDNAPhysicsList;
0161     fEmDNAPhysicsList = new G4EmDNAPhysics_option6(verboseLevel);
0162     fPhysDNAName = name;
0163   }
0164   else if (name == "G4EmDNAPhysics_option7") {
0165     delete fEmDNAPhysicsList;
0166     fEmDNAPhysicsList = new G4EmDNAPhysics_option7(verboseLevel);
0167     fPhysDNAName = name;
0168   }
0169   else if (name == "G4EmDNAPhysics_option8") {
0170     delete fEmDNAPhysicsList;
0171     fEmDNAPhysicsList = new G4EmDNAPhysics_option8(verboseLevel);
0172     fPhysDNAName = name;
0173   }
0174   else {
0175     G4cout << "PhysicsList::RegisterPhysicsConstructor: <" << name << ">"
0176            << " fails - name is not defined" << G4endl;
0177   }
0178 }
0179 
0180 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0181 
0182 void PhysicsList::RegisterChemistryConstructor(const G4String& name)
0183 {
0184   if (verboseLevel > 0) {
0185     G4cout << "===== Register Chemistry constructor ==== " << name << G4endl;
0186   }
0187   if (name == "G4EmDNAChemistry") {
0188     delete fEmDNAChemistryList;
0189     fEmDNAChemistryList = new G4EmDNAChemistry();
0190     fEmDNAChemistryList->SetVerboseLevel(verboseLevel);
0191     fChemDNAName = name;
0192   }
0193   else if (name == "G4EmDNAChemistry_option1") {
0194     delete fEmDNAChemistryList;
0195     fEmDNAChemistryList = new G4EmDNAChemistry_option1();
0196     fEmDNAChemistryList->SetVerboseLevel(verboseLevel);
0197     fChemDNAName = name;
0198   }
0199   else if (name == "G4EmDNAChemistry_option2") {
0200     delete fEmDNAChemistryList;
0201     fEmDNAChemistryList = new G4EmDNAChemistry_option2();
0202     fEmDNAChemistryList->SetVerboseLevel(verboseLevel);
0203     fChemDNAName = name;
0204   }
0205   else if (name == "G4EmDNAChemistry_option3") {
0206     delete fEmDNAChemistryList;
0207     fEmDNAChemistryList = new G4EmDNAChemistry_option3();
0208     fEmDNAChemistryList->SetVerboseLevel(verboseLevel);
0209     fChemDNAName = name;
0210   }
0211   else if (name == "G4EmDNAChemistryForPlasmids") {
0212     delete fEmDNAChemistryList;
0213     fEmDNAChemistryList = new G4EmDNAChemistryForPlasmids(fDMSO, fOxygen);
0214     fEmDNAChemistryList->SetVerboseLevel(verboseLevel);
0215     fChemDNAName = name;
0216   }
0217   else {
0218     G4cout << "PhysicsList::RegisterChemistryConstructor: <" << name << ">"
0219            << " fails - name is not defined" << G4endl;
0220   }
0221 }
0222 
0223 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0224 
0225 void PhysicsList::SetNewValue(G4UIcommand* command, G4String newValue)
0226 {
0227   if (command == fpPhysicsUI) {
0228     RegisterPhysicsConstructor(newValue);
0229   }
0230 
0231   if (command == fpChemistryUI) {
0232     RegisterChemistryConstructor(newValue);
0233   }
0234 
0235   if (command == fpDMSOUI) {
0236     fDMSO = fpDMSOUI->GetNewDoubleValue(newValue);
0237   }
0238 
0239   else if (command == fpOxygenUI) {
0240     fOxygen = fpOxygenUI->GetNewDoubleValue(newValue);
0241   }
0242 }
0243 
0244 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......