Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 27 28 // Created by Z. Francis 28 // Created by Z. Francis 29 29 30 #include "G4DNAMeltonAttachmentModel.hh" 30 #include "G4DNAMeltonAttachmentModel.hh" 31 #include "G4SystemOfUnits.hh" 31 #include "G4SystemOfUnits.hh" 32 #include "G4DNAChemistryManager.hh" 32 #include "G4DNAChemistryManager.hh" 33 #include "G4DNAMolecularMaterial.hh" 33 #include "G4DNAMolecularMaterial.hh" 34 34 35 //....oooOO0OOooo........oooOO0OOooo........oo 35 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 36 36 37 using namespace std; 37 using namespace std; 38 38 39 //#define MELTON_VERBOSE // prevent checking c 39 //#define MELTON_VERBOSE // prevent checking conditions at run time 40 40 41 //....oooOO0OOooo........oooOO0OOooo........oo 41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 42 42 43 G4DNAMeltonAttachmentModel::G4DNAMeltonAttachm 43 G4DNAMeltonAttachmentModel::G4DNAMeltonAttachmentModel(const G4ParticleDefinition*, 44 44 const G4String& nam) : 45 G4VEmModel(nam) << 45 G4VEmModel(nam), isInitialised(false) 46 { 46 { 47 fpWaterDensity = nullptr; << 47 fpWaterDensity = 0; 48 48 49 SetLowEnergyLimit(4.*eV); 49 SetLowEnergyLimit(4.*eV); 50 SetHighEnergyLimit(13.*eV); 50 SetHighEnergyLimit(13.*eV); 51 51 52 verboseLevel = 0; 52 verboseLevel = 0; 53 // Verbosity scale: 53 // Verbosity scale: 54 // 0 = nothing 54 // 0 = nothing 55 // 1 = warning for energy non-conservation 55 // 1 = warning for energy non-conservation 56 // 2 = details of energy budget 56 // 2 = details of energy budget 57 // 3 = calculation of cross sections, file o 57 // 3 = calculation of cross sections, file openings, sampling of atoms 58 // 4 = entering in methods 58 // 4 = entering in methods 59 59 60 #ifdef MELTON_VERBOSE 60 #ifdef MELTON_VERBOSE 61 if (verboseLevel > 0) 61 if (verboseLevel > 0) 62 { 62 { 63 G4cout << "Melton Attachment model is cons 63 G4cout << "Melton Attachment model is constructed " 64 << G4endl 64 << G4endl 65 << "Energy range: " 65 << "Energy range: " 66 << LowEnergyLimit() / eV << " eV - 66 << LowEnergyLimit() / eV << " eV - " 67 << HighEnergyLimit() / eV << " eV" 67 << HighEnergyLimit() / eV << " eV" 68 << G4endl; 68 << G4endl; 69 } 69 } 70 #endif 70 #endif 71 71 72 fParticleChangeForGamma = nullptr; << 72 fParticleChangeForGamma = 0; 73 fDissociationFlag = true; 73 fDissociationFlag = true; 74 fData = nullptr; << 74 fData = 0; 75 75 76 // Selection of stationary mode 76 // Selection of stationary mode 77 77 78 statCode = false; 78 statCode = false; 79 } 79 } 80 80 81 //....oooOO0OOooo........oooOO0OOooo........oo 81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 82 82 83 G4DNAMeltonAttachmentModel::~G4DNAMeltonAttach 83 G4DNAMeltonAttachmentModel::~G4DNAMeltonAttachmentModel() 84 { 84 { 85 delete fData; << 85 if(fData) delete fData; 86 } 86 } 87 87 88 //....oooOO0OOooo........oooOO0OOooo........oo 88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 89 89 90 void G4DNAMeltonAttachmentModel::Initialise(co 90 void G4DNAMeltonAttachmentModel::Initialise(const G4ParticleDefinition* particle, 91 co 91 const G4DataVector& /*cuts*/) 92 { 92 { 93 #ifdef MELTON_VERBOSE 93 #ifdef MELTON_VERBOSE 94 if (verboseLevel > 3) 94 if (verboseLevel > 3) 95 G4cout 95 G4cout 96 << "Calling G4DNAMeltonAttachmentModel:: 96 << "Calling G4DNAMeltonAttachmentModel::Initialise()" << G4endl; 97 #endif 97 #endif 98 98 99 // Only electron 99 // Only electron 100 100 101 if(particle->GetParticleName() != "e-") 101 if(particle->GetParticleName() != "e-") 102 { 102 { 103 G4Exception("G4DNAMeltonAttachmentModel::I 103 G4Exception("G4DNAMeltonAttachmentModel::Initialise", 104 "em0002", 104 "em0002", 105 FatalException, 105 FatalException, 106 "Model not applicable to parti 106 "Model not applicable to particle type."); 107 } 107 } 108 108 109 // Energy limits 109 // Energy limits 110 110 111 if (LowEnergyLimit() < 4.*eV) 111 if (LowEnergyLimit() < 4.*eV) 112 { 112 { 113 G4ExceptionDescription errMsg; 113 G4ExceptionDescription errMsg; 114 errMsg << "G4DNAMeltonAttachmentModel: low 114 errMsg << "G4DNAMeltonAttachmentModel: low energy limit increased from " << 115 LowEnergyLimit()/eV << " eV to " << 4. << 115 LowEnergyLimit()/eV << " eV to " << 4. << " eV" << G4endl; 116 116 117 G4Exception("G4DNAMeltonAttachmentModel::I 117 G4Exception("G4DNAMeltonAttachmentModel::Initialise", 118 "Melton_LowerEBoundary", 118 "Melton_LowerEBoundary", 119 JustWarning, 119 JustWarning, 120 errMsg); 120 errMsg); 121 121 122 SetLowEnergyLimit(4*eV); 122 SetLowEnergyLimit(4*eV); 123 } 123 } 124 124 125 if (HighEnergyLimit() > 13.*eV) 125 if (HighEnergyLimit() > 13.*eV) 126 { 126 { 127 G4ExceptionDescription errMsg; 127 G4ExceptionDescription errMsg; 128 errMsg << "G4DNAMeltonAttachmentModel: hig 128 errMsg << "G4DNAMeltonAttachmentModel: high energy limit decreased from " << 129 HighEnergyLimit()/eV << " eV to " << 13. < 129 HighEnergyLimit()/eV << " eV to " << 13. << " eV" << G4endl; 130 130 131 G4Exception("G4DNAMeltonAttachmentModel::I 131 G4Exception("G4DNAMeltonAttachmentModel::Initialise", 132 "Melton_HigherEBoundary", 132 "Melton_HigherEBoundary", 133 JustWarning, 133 JustWarning, 134 errMsg); 134 errMsg); 135 135 136 SetHighEnergyLimit(13.*eV); 136 SetHighEnergyLimit(13.*eV); 137 } 137 } 138 138 139 // Reading of data files 139 // Reading of data files 140 140 141 G4double scaleFactor = 1e-18*cm2; 141 G4double scaleFactor = 1e-18*cm2; 142 142 143 // For total cross section 143 // For total cross section 144 G4String fileElectron("dna/sigma_attachment_ 144 G4String fileElectron("dna/sigma_attachment_e_melton"); 145 145 146 fData = new G4DNACrossSectionDataSet(new G4L 146 fData = new G4DNACrossSectionDataSet(new G4LogLogInterpolation(), 147 eV, sc 147 eV, scaleFactor); 148 fData->LoadData(fileElectron); 148 fData->LoadData(fileElectron); 149 149 150 150 151 #ifdef MELTON_VERBOSE 151 #ifdef MELTON_VERBOSE 152 if( verboseLevel >0) 152 if( verboseLevel >0) 153 { 153 { 154 if (verboseLevel > 2) 154 if (verboseLevel > 2) 155 { 155 { 156 G4cout << "Loaded cross section data for 156 G4cout << "Loaded cross section data for Melton Attachment model" << G4endl; 157 } 157 } 158 158 159 G4cout << "Melton Attachment model is init 159 G4cout << "Melton Attachment model is initialized " << G4endl 160 << "Energy range: " 160 << "Energy range: " 161 << LowEnergyLimit() / eV << " eV - " 161 << LowEnergyLimit() / eV << " eV - " 162 << HighEnergyLimit() / eV << " eV" 162 << HighEnergyLimit() / eV << " eV" 163 << G4endl; 163 << G4endl; 164 } 164 } 165 #endif 165 #endif 166 166 167 // Initialize water density pointer 167 // Initialize water density pointer 168 fpWaterDensity = G4DNAMolecularMaterial::Ins 168 fpWaterDensity = G4DNAMolecularMaterial::Instance()-> 169 GetNumMolPerVolTableFor(G4Material::GetM 169 GetNumMolPerVolTableFor(G4Material::GetMaterial("G4_WATER")); 170 170 171 if (isInitialised) return; 171 if (isInitialised) return; 172 172 173 fParticleChangeForGamma = GetParticleChangeF 173 fParticleChangeForGamma = GetParticleChangeForGamma(); 174 isInitialised = true; 174 isInitialised = true; 175 } 175 } 176 176 177 //....oooOO0OOooo........oooOO0OOooo........oo 177 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 178 178 179 G4double 179 G4double 180 G4DNAMeltonAttachmentModel::CrossSectionPerVol 180 G4DNAMeltonAttachmentModel::CrossSectionPerVolume(const G4Material* material, 181 181 const G4ParticleDefinition*, 182 182 G4double ekin, 183 183 G4double, 184 184 G4double) 185 { 185 { 186 #ifdef MELTON_VERBOSE 186 #ifdef MELTON_VERBOSE 187 if (verboseLevel > 3) 187 if (verboseLevel > 3) 188 G4cout 188 G4cout 189 << "Calling CrossSectionPerVolume() of G 189 << "Calling CrossSectionPerVolume() of G4DNAMeltonAttachmentModel" 190 << G4endl; 190 << G4endl; 191 #endif 191 #endif 192 192 193 // Calculate total cross section for model 193 // Calculate total cross section for model 194 194 195 G4double sigma = 0.; 195 G4double sigma = 0.; 196 196 197 G4double waterDensity = (*fpWaterDensity)[ma 197 G4double waterDensity = (*fpWaterDensity)[material->GetIndex()]; 198 198 199 if (ekin >= LowEnergyLimit() && ekin <= High 199 if (ekin >= LowEnergyLimit() && ekin <= HighEnergyLimit()) 200 sigma = fData->FindValue(ekin); 200 sigma = fData->FindValue(ekin); 201 201 202 #ifdef MELTON_VERBOSE 202 #ifdef MELTON_VERBOSE 203 if (verboseLevel > 2) 203 if (verboseLevel > 2) 204 { 204 { 205 G4cout << "_______________________________ 205 G4cout << "__________________________________" << G4endl; 206 G4cout << "=== G4DNAMeltonAttachmentModel 206 G4cout << "=== G4DNAMeltonAttachmentModel - XS INFO START" << G4endl; 207 G4cout << "--- Kinetic energy(eV)=" << eki 207 G4cout << "--- Kinetic energy(eV)=" << ekin/eV 208 << " particle : " << particleDefini 208 << " particle : " << particleDefinition->GetParticleName() 209 << G4endl; 209 << G4endl; 210 G4cout << "--- Cross section per water mol 210 G4cout << "--- Cross section per water molecule (cm^2)=" 211 << sigma/cm/cm << G4endl; 211 << sigma/cm/cm << G4endl; 212 G4cout << "--- Cross section per water mol 212 G4cout << "--- Cross section per water molecule (cm^-1)=" 213 << sigma*waterDensity/(1./cm) << G4 213 << sigma*waterDensity/(1./cm) << G4endl; 214 G4cout << "--- G4DNAMeltonAttachmentModel 214 G4cout << "--- G4DNAMeltonAttachmentModel - XS INFO END" << G4endl; 215 } 215 } 216 #endif 216 #endif 217 217 218 return sigma*waterDensity; 218 return sigma*waterDensity; 219 } 219 } 220 220 221 //....oooOO0OOooo........oooOO0OOooo........oo 221 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 222 222 223 void 223 void 224 G4DNAMeltonAttachmentModel:: 224 G4DNAMeltonAttachmentModel:: 225 SampleSecondaries(std::vector<G4DynamicParticl 225 SampleSecondaries(std::vector<G4DynamicParticle*>* /*fvect*/, 226 const G4MaterialCutsCouple* 226 const G4MaterialCutsCouple* /*couple*/, 227 const G4DynamicParticle* aDy 227 const G4DynamicParticle* aDynamicElectron, 228 G4double, 228 G4double, 229 G4double) 229 G4double) 230 { 230 { 231 231 232 #ifdef MELTON_VERBOSE 232 #ifdef MELTON_VERBOSE 233 if (verboseLevel > 3) 233 if (verboseLevel > 3) 234 G4cout 234 G4cout 235 << "Calling SampleSecondaries() of G4DNAMe 235 << "Calling SampleSecondaries() of G4DNAMeltonAttachmentModel" << G4endl; 236 #endif 236 #endif 237 237 238 // Electron is killed 238 // Electron is killed 239 239 240 G4double electronEnergy0 = aDynamicElectron- 240 G4double electronEnergy0 = aDynamicElectron->GetKineticEnergy(); 241 241 242 if (!statCode) 242 if (!statCode) 243 { 243 { 244 fParticleChangeForGamma->SetProposedKine 244 fParticleChangeForGamma->SetProposedKineticEnergy(0.); 245 fParticleChangeForGamma->ProposeTrackSta 245 fParticleChangeForGamma->ProposeTrackStatus(fStopAndKill); 246 fParticleChangeForGamma->ProposeLocalEne 246 fParticleChangeForGamma->ProposeLocalEnergyDeposit(electronEnergy0); 247 } 247 } 248 248 249 else 249 else 250 { 250 { 251 fParticleChangeForGamma->SetProposedKine 251 fParticleChangeForGamma->SetProposedKineticEnergy(electronEnergy0); 252 fParticleChangeForGamma->ProposeLocalEne 252 fParticleChangeForGamma->ProposeLocalEnergyDeposit(electronEnergy0); 253 } 253 } 254 254 255 if(fDissociationFlag) 255 if(fDissociationFlag) 256 { 256 { 257 G4DNAChemistryManager::Instance()-> 257 G4DNAChemistryManager::Instance()-> 258 CreateWaterMolecule(eDissociativeAttachm 258 CreateWaterMolecule(eDissociativeAttachment, 259 -1, 259 -1, 260 fParticleChangeForGa 260 fParticleChangeForGamma->GetCurrentTrack()); 261 } 261 } 262 return; 262 return; 263 } 263 } 264 264