Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 27 #include "PhysicsList.hh" 28 #include "G4SystemOfUnits.hh" 29 #include "G4EmDNAPhysics.hh" 30 #include "G4EmDNAPhysics_option1.hh" 31 #include "G4EmDNAPhysics_option2.hh" 32 #include "G4EmDNAPhysics_option3.hh" 33 #include "G4EmDNAPhysics_option4.hh" 34 #include "G4EmDNAPhysics_option5.hh" 35 #include "G4EmDNAPhysics_option6.hh" 36 #include "G4EmDNAPhysics_option7.hh" 37 #include "G4EmDNAPhysics_option8.hh" 38 #include "G4PhysicsConstructorRegistry.hh" 39 #include "G4ProcessTable.hh" 40 #include "G4ProcessManager.hh" 41 #include "G4DNAChampionElasticModel.hh" 42 #include "G4DNAScreenedRutherfordElasticModel.hh" 43 #include "G4DNAElastic.hh" 44 #include "G4PhysicsListHelper.hh" 45 #include "G4DNAVibExcitation.hh" 46 #include "G4DNASancheExcitationModel.hh" 47 #include "G4DNAElectronSolvation.hh" 48 #include "G4DNAChemistryManager.hh" 49 #include "G4LeptonConstructor.hh" 50 #include "G4BosonConstructor.hh" 51 #include "G4MesonConstructor.hh" 52 #include "G4BaryonConstructor.hh" 53 #include "G4ShortLivedConstructor.hh" 54 #include "G4DNAMolecule.hh" 55 #include "UserChoosingDNASolvationModel.hh" 56 #include "DetectorConstruction.hh" 57 #include "DetectorConstruction.hh" 58 59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 60 61 PhysicsList::PhysicsList() 62 : G4VModularPhysicsList() 63 { 64 DefineCommands(); 65 SetDefaultCutValue(1.0*nanometer); 66 SetVerboseLevel(1); 67 RegisterPhysicsList("G4EmDNAPhysics_option2"); 68 G4ProductionCutsTable::GetProductionCutsTable()->SetEnergyRange(100*eV, 1*GeV); 69 if (gRunMode == RunningMode::Phys){ 70 G4DNAChemistryManager::Instance()->SetChemistryActivation(false); 71 } 72 } 73 74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 75 76 void PhysicsList::ConstructParticle() 77 { 78 if(fDNAPhysicsList != nullptr) 79 { 80 fDNAPhysicsList->ConstructParticle(); 81 //dna molecules to get rid of warning 82 G4Deoxyribose::Definition(); 83 G4Phosphate::Definition(); 84 G4Adenine::Definition(); 85 G4Guanine::Definition(); 86 G4Thymine::Definition(); 87 G4Cytosine::Definition(); 88 G4Histone::Definition(); 89 } 90 if(fEmDNAChemistryList != nullptr) 91 { 92 fEmDNAChemistryList->ConstructParticle(); 93 } 94 // construct following pqrticles to get rid of warning 95 96 G4LeptonConstructor lConstructor; 97 lConstructor.ConstructParticle(); 98 G4BosonConstructor pBosonConstructor; 99 pBosonConstructor.ConstructParticle(); 100 G4MesonConstructor pMesonConstructor; 101 pMesonConstructor.ConstructParticle(); 102 G4BaryonConstructor pBaryonConstructor; 103 pBaryonConstructor.ConstructParticle(); 104 G4ShortLivedConstructor pShortLivedConstructor; 105 pShortLivedConstructor.ConstructParticle(); 106 107 } 108 109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 110 111 void PhysicsList::ConstructProcess() 112 { 113 AddTransportation(); 114 115 if(fDNAPhysicsList != nullptr) 116 { 117 fDNAPhysicsList->ConstructProcess(); 118 } 119 120 if (gRunMode == RunningMode::Chem) { 121 if(fEmDNAChemistryList != nullptr) 122 { 123 fEmDNAChemistryList->ConstructProcess(); 124 } 125 } else { 126 G4VProcess* process = G4ProcessTable::GetProcessTable()->FindProcess( 127 "e-_G4DNAVibExcitation", "e-"); 128 129 if (process) 130 { 131 G4DNAVibExcitation* vibExcitation = (G4DNAVibExcitation*) process; 132 G4VEmModel* model = vibExcitation->EmModel(); 133 G4DNASancheExcitationModel* sancheExcitationMod = 134 dynamic_cast<G4DNASancheExcitationModel*>(model); 135 if(sancheExcitationMod) 136 { 137 sancheExcitationMod->ExtendLowEnergyLimit(0.025 * eV); 138 } 139 } 140 141 // Modify elastic scattering models to avoid killing electrons 142 // at low energy 143 // 144 process = G4ProcessTable::GetProcessTable()->FindProcess("e-_G4DNAElastic", "e-"); 145 146 if (process) 147 { 148 G4DNAElastic* vibExcitation = (G4DNAElastic*) process; 149 G4VEmModel* model = vibExcitation->EmModel(); 150 151 if(G4DNAChampionElasticModel* championMod = 152 dynamic_cast<G4DNAChampionElasticModel*>(model)) 153 { 154 championMod->SetKillBelowThreshold(-1); 155 } 156 else if(G4DNAScreenedRutherfordElasticModel* screenRutherfordMod = 157 dynamic_cast<G4DNAScreenedRutherfordElasticModel*>(model)) 158 { 159 screenRutherfordMod->SetKillBelowThreshold(-1); 160 } 161 } 162 163 // force to use UserChoosingDNASolvationModel to 164 //invoke G4EmDNAChemistryManager::CreateSovaltedElectron() 165 // when G4DNAChemistryManager is disable 166 if (!G4DNAChemistryManager::IsActivated()) { 167 process = G4ProcessTable::GetProcessTable()->FindProcess("e-_G4DNAElectronSolvation", "e-"); 168 if (!process){ 169 auto pPhysicsListHelper = G4PhysicsListHelper::GetPhysicsListHelper(); 170 pPhysicsListHelper->RegisterProcess(new G4DNAElectronSolvation("e-_G4DNAElectronSolvation"), 171 G4Electron::Definition()); 172 } 173 G4DNAElectronSolvation* solvation = dynamic_cast<G4DNAElectronSolvation*>(process); 174 G4double hLimitE= 0; 175 G4VEmModel* therm = solvation->GetModelByIndex(0,1); 176 if (therm) { 177 178 hLimitE = therm->HighEnergyLimit(); 179 therm->SetHighEnergyLimit(0*keV); 180 } 181 auto thermz = UserChoosingDNASolvationModel::UserGetMacroDefinedModel(); 182 thermz->SetHighEnergyLimit(hLimitE); 183 solvation->AddEmModel(-1,thermz); 184 } 185 186 } 187 } 188 189 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 190 191 void PhysicsList::RegisterPhysicsList(const G4String& name) 192 { 193 if(name == fPhysDNAName) 194 { 195 return; 196 } 197 if(verboseLevel > 0) 198 { 199 G4cout << "===== Register constructor ==== " << name << G4endl; 200 } 201 202 if(name == "G4EmDNAPhysics") 203 { 204 fDNAPhysicsList.reset(new G4EmDNAPhysics(verboseLevel)); 205 fPhysDNAName = name; 206 } 207 else if(name == "G4EmDNAPhysics_option1") 208 { 209 fDNAPhysicsList.reset(new G4EmDNAPhysics_option1(verboseLevel)); 210 fPhysDNAName = name; 211 } 212 else if(name == "G4EmDNAPhysics_option2") 213 { 214 fDNAPhysicsList.reset(new G4EmDNAPhysics_option2(verboseLevel)); 215 fPhysDNAName = name; 216 } 217 else if(name == "G4EmDNAPhysics_option3") 218 { 219 fDNAPhysicsList.reset(new G4EmDNAPhysics_option3(verboseLevel)); 220 fPhysDNAName = name; 221 } 222 else if(name == "G4EmDNAPhysics_option4") 223 { 224 fDNAPhysicsList.reset(new G4EmDNAPhysics_option4(verboseLevel)); 225 fPhysDNAName = name; 226 } 227 else if(name == "G4EmDNAPhysics_option5") 228 { 229 fDNAPhysicsList.reset(new G4EmDNAPhysics_option5(verboseLevel)); 230 fPhysDNAName = name; 231 } 232 else if(name == "G4EmDNAPhysics_option6") 233 { 234 fDNAPhysicsList.reset(new G4EmDNAPhysics_option6(verboseLevel)); 235 fPhysDNAName = name; 236 } 237 else if(name == "G4EmDNAPhysics_option7") 238 { 239 fDNAPhysicsList.reset(new G4EmDNAPhysics_option7(verboseLevel)); 240 fPhysDNAName = name; 241 } 242 else if(name == "G4EmDNAPhysics_option8") 243 { 244 fDNAPhysicsList.reset(new G4EmDNAPhysics_option8(verboseLevel)); 245 fPhysDNAName = name; 246 } 247 else 248 { 249 G4cout << "PhysicsList::RegisterConstructor: <" << name << ">" 250 << " fails - name is not defined" 251 << G4endl; 252 } 253 } 254 255 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 256 257 void PhysicsList::RegisterChemListConstructor(const G4String& name) 258 { 259 if(verboseLevel > 0) 260 { 261 G4cout << "===== Register constructor for Chemitry ==== " << name << G4endl; 262 } 263 264 if(name == "G4EmDNAChemistry_option2") 265 { 266 if ( fEmDNAChemistryList != nullptr) return; 267 fEmDNAChemistryList.reset(new G4EmDNAChemistry_option2()); 268 fEmDNAChemistryList->SetVerboseLevel(verboseLevel); 269 G4EmParameters::Instance()->SetTimeStepModel(G4ChemTimeStepModel::SBS); 270 fChemListName = name; 271 } 272 else if(name == "G4EmDNAChemistry_option3") 273 { 274 if ( fEmDNAChemistryList != nullptr) return; 275 fEmDNAChemistryList.reset(new G4EmDNAChemistry_option3_Extended()); 276 fEmDNAChemistryList->SetVerboseLevel(verboseLevel); 277 G4EmParameters::Instance()->SetTimeStepModel(G4ChemTimeStepModel::IRT_syn); 278 fChemListName = name; 279 } 280 else 281 { 282 G4ExceptionDescription msg; 283 msg <<"ChemPhysicsList::RegisterChemListConstructor: <" << name << ">" 284 <<" fails - name is not defined"; 285 G4Exception("ChemPhysicsList::RegisterChemListConstructor", "Phys_WrongName", 286 JustWarning, msg); 287 } 288 } 289 290 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 291 292 void PhysicsList::DefineCommands() 293 { 294 fMessenger = std::make_unique<G4GenericMessenger>(this, 295 "/dsbandrepair/phys/", 296 "cmd control"); 297 auto & fPhysListCmd = fMessenger->DeclareMethod("physicsList", 298 &PhysicsList::RegisterPhysicsList); 299 fPhysListCmd.SetParameterName("physList",true); 300 fPhysListCmd.SetDefaultValue("G4EmDNAPhysics_option2"); 301 302 auto & fChemListCmd = fMessenger->DeclareMethod("chemList", 303 &PhysicsList::RegisterChemListConstructor); 304 fChemListCmd.SetParameterName("chemList",true); 305 fChemListCmd.SetDefaultValue("G4EmDNAChemistry_option2"); 306 } 307 308 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......