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 // 28 // 29 // GEANT4 Class file 29 // GEANT4 Class file 30 // 30 // 31 // 31 // 32 // File name: G4HadronicProcessStore 32 // File name: G4HadronicProcessStore 33 // 33 // 34 // Author: Vladimir Ivanchenko 34 // Author: Vladimir Ivanchenko 35 // 35 // 36 // Creation date: 09.05.2008 36 // Creation date: 09.05.2008 37 // 37 // 38 // Modifications: 38 // Modifications: 39 // 23.01.2009 V.Ivanchenko add destruction of 39 // 23.01.2009 V.Ivanchenko add destruction of processes 40 // 12.05.2020 A.Ribon introduced general verbo 40 // 12.05.2020 A.Ribon introduced general verbose level in hadronics 41 // 41 // 42 // Class Description: 42 // Class Description: 43 // Singleton to store hadronic processes, to p 43 // Singleton to store hadronic processes, to provide access to processes 44 // and to printout information about processes 44 // and to printout information about processes 45 // 45 // 46 // ------------------------------------------- 46 // ------------------------------------------------------------------- 47 // 47 // 48 //....oooOO0OOooo........oooOO0OOooo........oo 48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 49 //....oooOO0OOooo........oooOO0OOooo........oo 49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 50 50 51 #include "G4HadronicProcessStore.hh" 51 #include "G4HadronicProcessStore.hh" 52 #include "G4SystemOfUnits.hh" 52 #include "G4SystemOfUnits.hh" 53 #include "G4UnitsTable.hh" 53 #include "G4UnitsTable.hh" 54 #include "G4Element.hh" 54 #include "G4Element.hh" 55 #include "G4ProcessManager.hh" 55 #include "G4ProcessManager.hh" 56 #include "G4Electron.hh" 56 #include "G4Electron.hh" 57 #include "G4Proton.hh" 57 #include "G4Proton.hh" 58 #include "G4ParticleTable.hh" 58 #include "G4ParticleTable.hh" 59 #include "G4HadronicInteractionRegistry.hh" 59 #include "G4HadronicInteractionRegistry.hh" 60 #include "G4CrossSectionDataSetRegistry.hh" 60 #include "G4CrossSectionDataSetRegistry.hh" 61 #include "G4HadronicEPTestMessenger.hh" 61 #include "G4HadronicEPTestMessenger.hh" 62 #include "G4HadronicParameters.hh" 62 #include "G4HadronicParameters.hh" 63 #include "G4HadronicProcessType.hh" 63 #include "G4HadronicProcessType.hh" 64 #include <algorithm> 64 #include <algorithm> 65 65 66 //....oooOO0OOooo........oooOO0OOooo........oo 66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 67 67 68 G4ThreadLocal G4HadronicProcessStore* G4Hadron << 69 << 70 G4HadronicProcessStore* G4HadronicProcessStore 68 G4HadronicProcessStore* G4HadronicProcessStore::Instance() 71 { 69 { 72 if (nullptr == instance) { << 70 static thread_local auto* _instance = new G4HadronicProcessStore{}; 73 static G4ThreadLocalSingleton<G4HadronicPr << 71 return _instance; 74 instance = inst.Instance(); << 75 } << 76 return instance; << 77 } 72 } 78 73 79 //....oooOO0OOooo........oooOO0OOooo........oo 74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 80 75 81 G4HadronicProcessStore::~G4HadronicProcessStor 76 G4HadronicProcessStore::~G4HadronicProcessStore() 82 { 77 { >> 78 Clean(); 83 delete theEPTestMessenger; 79 delete theEPTestMessenger; 84 if (!process.empty()) { << 80 } 85 for (auto const& itr : process) { << 81 86 delete itr; << 82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 87 } << 83 88 process.clear(); << 84 void G4HadronicProcessStore::Clean() 89 } << 85 { 90 ep_map.clear(); << 86 for (auto const& itr : process) >> 87 delete itr; >> 88 process.clear(); >> 89 >> 90 for (auto const& itr : extraProcess) >> 91 delete itr; >> 92 extraProcess.clear(); >> 93 >> 94 for (auto const& it : ep_map) >> 95 delete it.second; >> 96 91 m_map.clear(); 97 m_map.clear(); 92 p_map.clear(); 98 p_map.clear(); 93 99 94 n_extra = 0; 100 n_extra = 0; 95 n_proc = 0; 101 n_proc = 0; 96 } 102 } 97 103 98 //....oooOO0OOooo........oooOO0OOooo........oo 104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 99 105 100 G4HadronicProcessStore::G4HadronicProcessStore 106 G4HadronicProcessStore::G4HadronicProcessStore() 101 { 107 { 102 theGenericIon = 108 theGenericIon = 103 G4ParticleTable::GetParticleTable()->FindP 109 G4ParticleTable::GetParticleTable()->FindParticle("GenericIon"); 104 param = G4HadronicParameters::Instance(); 110 param = G4HadronicParameters::Instance(); 105 theEPTestMessenger = new G4HadronicEPTestMes 111 theEPTestMessenger = new G4HadronicEPTestMessenger(this); 106 } 112 } 107 113 108 //....oooOO0OOooo........oooOO0OOooo........oo 114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 109 115 110 G4double G4HadronicProcessStore::GetCrossSecti 116 G4double G4HadronicProcessStore::GetCrossSectionPerAtom( 111 const G4Parti 117 const G4ParticleDefinition* part, 112 G4double ener 118 G4double energy, 113 const G4VProc 119 const G4VProcess* proc, 114 const G4Eleme 120 const G4Element* element, 115 const G4Material* material) 121 const G4Material* material) 116 { 122 { 117 G4double cross = 0.; 123 G4double cross = 0.; 118 G4int subType = proc->GetProcessSubType(); 124 G4int subType = proc->GetProcessSubType(); 119 if (subType == fHadronElastic) 125 if (subType == fHadronElastic) 120 cross = GetElasticCrossSectionPerAtom(part 126 cross = GetElasticCrossSectionPerAtom(part,energy,element,material); 121 else if (subType == fHadronInelastic) 127 else if (subType == fHadronInelastic) 122 cross = GetInelasticCrossSectionPerAtom(pa 128 cross = GetInelasticCrossSectionPerAtom(part,energy,element,material); 123 else if (subType == fCapture) 129 else if (subType == fCapture) 124 cross = GetCaptureCrossSectionPerAtom(part 130 cross = GetCaptureCrossSectionPerAtom(part,energy,element,material); 125 else if (subType == fFission) 131 else if (subType == fFission) 126 cross = GetFissionCrossSectionPerAtom(part 132 cross = GetFissionCrossSectionPerAtom(part,energy,element,material); 127 else if (subType == fChargeExchange) 133 else if (subType == fChargeExchange) 128 cross = GetChargeExchangeCrossSectionPerAt 134 cross = GetChargeExchangeCrossSectionPerAtom(part,energy,element,material); 129 return cross; 135 return cross; 130 } 136 } 131 137 132 //....oooOO0OOooo........oooOO0OOooo........oo 138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 133 139 134 G4double G4HadronicProcessStore::GetCrossSecti 140 G4double G4HadronicProcessStore::GetCrossSectionPerVolume( 135 const G4Parti 141 const G4ParticleDefinition* part, 136 G4double ener 142 G4double energy, 137 const G4VProc 143 const G4VProcess* proc, 138 const G4Mater 144 const G4Material* material) 139 { 145 { 140 G4double cross = 0.; 146 G4double cross = 0.; 141 G4int subType = proc->GetProcessSubType(); 147 G4int subType = proc->GetProcessSubType(); 142 if (subType == fHadronElastic) 148 if (subType == fHadronElastic) 143 cross = GetElasticCrossSectionPerVolume(pa 149 cross = GetElasticCrossSectionPerVolume(part,energy,material); 144 else if (subType == fHadronInelastic) 150 else if (subType == fHadronInelastic) 145 cross = GetInelasticCrossSectionPerVolume( 151 cross = GetInelasticCrossSectionPerVolume(part,energy,material); 146 else if (subType == fCapture) 152 else if (subType == fCapture) 147 cross = GetCaptureCrossSectionPerVolume(pa 153 cross = GetCaptureCrossSectionPerVolume(part,energy,material); 148 else if (subType == fFission) 154 else if (subType == fFission) 149 cross = GetFissionCrossSectionPerVolume(pa 155 cross = GetFissionCrossSectionPerVolume(part,energy,material); 150 else if (subType == fChargeExchange) 156 else if (subType == fChargeExchange) 151 cross = GetChargeExchangeCrossSectionPerVo 157 cross = GetChargeExchangeCrossSectionPerVolume(part,energy,material); 152 return cross; 158 return cross; 153 } 159 } 154 160 155 //....oooOO0OOooo........oooOO0OOooo........oo 161 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 156 162 157 G4double G4HadronicProcessStore::GetElasticCro 163 G4double G4HadronicProcessStore::GetElasticCrossSectionPerVolume( 158 const G4ParticleDefinition *aParticle, 164 const G4ParticleDefinition *aParticle, 159 G4double kineticEnergy, 165 G4double kineticEnergy, 160 const G4Material *material) 166 const G4Material *material) 161 { 167 { 162 G4double cross = 0.0; 168 G4double cross = 0.0; 163 const G4ElementVector* theElementVector = ma 169 const G4ElementVector* theElementVector = material->GetElementVector(); 164 const G4double* theAtomNumDensityVector = 170 const G4double* theAtomNumDensityVector = 165 material->GetVecNbOfAtomsPerVolume(); 171 material->GetVecNbOfAtomsPerVolume(); 166 size_t nelm = material->GetNumberOfElements( 172 size_t nelm = material->GetNumberOfElements(); 167 for (size_t i=0; i<nelm; ++i) { 173 for (size_t i=0; i<nelm; ++i) { 168 const G4Element* elm = (*theElementVector) 174 const G4Element* elm = (*theElementVector)[i]; 169 cross += theAtomNumDensityVector[i]* 175 cross += theAtomNumDensityVector[i]* 170 GetElasticCrossSectionPerAtom(aParticle, 176 GetElasticCrossSectionPerAtom(aParticle,kineticEnergy,elm,material); 171 } 177 } 172 return cross; 178 return cross; 173 } 179 } 174 180 175 //....oooOO0OOooo........oooOO0OOooo........oo 181 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 176 182 177 G4double G4HadronicProcessStore::GetElasticCro 183 G4double G4HadronicProcessStore::GetElasticCrossSectionPerAtom( 178 const G4ParticleDefinition *aParticle, 184 const G4ParticleDefinition *aParticle, 179 G4double kineticEnergy, 185 G4double kineticEnergy, 180 const G4Element *anElement, const G4Materi 186 const G4Element *anElement, const G4Material* mat) 181 { 187 { 182 G4HadronicProcess* hp = FindProcess(aParticl 188 G4HadronicProcess* hp = FindProcess(aParticle, fHadronElastic); 183 G4double cross = 0.0; 189 G4double cross = 0.0; 184 localDP.SetKineticEnergy(kineticEnergy); 190 localDP.SetKineticEnergy(kineticEnergy); 185 if(hp) { 191 if(hp) { 186 cross = hp->GetElementCrossSection(&localD 192 cross = hp->GetElementCrossSection(&localDP,anElement,mat); 187 } 193 } 188 return cross; 194 return cross; 189 } 195 } 190 196 191 //....oooOO0OOooo........oooOO0OOooo........oo 197 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 192 198 193 G4double G4HadronicProcessStore::GetElasticCro 199 G4double G4HadronicProcessStore::GetElasticCrossSectionPerIsotope( 194 const G4ParticleDefinition*, 200 const G4ParticleDefinition*, 195 G4double, 201 G4double, 196 G4int, G4int) 202 G4int, G4int) 197 { 203 { 198 return 0.0; 204 return 0.0; 199 } 205 } 200 206 201 //....oooOO0OOooo........oooOO0OOooo........oo 207 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 202 208 203 G4double G4HadronicProcessStore::GetInelasticC 209 G4double G4HadronicProcessStore::GetInelasticCrossSectionPerVolume( 204 const G4ParticleDefinition *aParticle, 210 const G4ParticleDefinition *aParticle, 205 G4double kineticEnergy, 211 G4double kineticEnergy, 206 const G4Material *material) 212 const G4Material *material) 207 { 213 { 208 G4double cross = 0.0; 214 G4double cross = 0.0; 209 const G4ElementVector* theElementVector = ma 215 const G4ElementVector* theElementVector = material->GetElementVector(); 210 const G4double* theAtomNumDensityVector = 216 const G4double* theAtomNumDensityVector = 211 material->GetVecNbOfAtomsPerVolume(); 217 material->GetVecNbOfAtomsPerVolume(); 212 size_t nelm = material->GetNumberOfElements( 218 size_t nelm = material->GetNumberOfElements(); 213 for (size_t i=0; i<nelm; ++i) { 219 for (size_t i=0; i<nelm; ++i) { 214 const G4Element* elm = (*theElementVector) 220 const G4Element* elm = (*theElementVector)[i]; 215 cross += theAtomNumDensityVector[i]* 221 cross += theAtomNumDensityVector[i]* 216 GetInelasticCrossSectionPerAtom(aParticl 222 GetInelasticCrossSectionPerAtom(aParticle,kineticEnergy,elm,material); 217 } 223 } 218 return cross; 224 return cross; 219 } 225 } 220 226 221 //....oooOO0OOooo........oooOO0OOooo........oo 227 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 222 228 223 G4double G4HadronicProcessStore::GetInelasticC 229 G4double G4HadronicProcessStore::GetInelasticCrossSectionPerAtom( 224 const G4ParticleDefinition *aParticle, 230 const G4ParticleDefinition *aParticle, 225 G4double kineticEnergy, 231 G4double kineticEnergy, 226 const G4Element *anElement, const G4Materi 232 const G4Element *anElement, const G4Material* mat) 227 { 233 { 228 G4HadronicProcess* hp = FindProcess(aParticl 234 G4HadronicProcess* hp = FindProcess(aParticle, fHadronInelastic); 229 localDP.SetKineticEnergy(kineticEnergy); 235 localDP.SetKineticEnergy(kineticEnergy); 230 G4double cross = 0.0; 236 G4double cross = 0.0; 231 if(hp) { 237 if(hp) { 232 cross = hp->GetElementCrossSection(&localD 238 cross = hp->GetElementCrossSection(&localDP,anElement,mat); 233 } 239 } 234 return cross; 240 return cross; 235 } 241 } 236 242 237 //....oooOO0OOooo........oooOO0OOooo........oo 243 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 238 244 239 G4double G4HadronicProcessStore::GetInelasticC 245 G4double G4HadronicProcessStore::GetInelasticCrossSectionPerIsotope( 240 const G4ParticleDefinition *, 246 const G4ParticleDefinition *, 241 G4double, 247 G4double, 242 G4int, G4int) 248 G4int, G4int) 243 { 249 { 244 return 0.0; 250 return 0.0; 245 } 251 } 246 252 247 //....oooOO0OOooo........oooOO0OOooo........oo 253 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 248 254 249 G4double G4HadronicProcessStore::GetCaptureCro 255 G4double G4HadronicProcessStore::GetCaptureCrossSectionPerVolume( 250 const G4ParticleDefinition *aParticle, 256 const G4ParticleDefinition *aParticle, 251 G4double kineticEnergy, 257 G4double kineticEnergy, 252 const G4Material *material) 258 const G4Material *material) 253 { 259 { 254 G4double cross = 0.0; 260 G4double cross = 0.0; 255 const G4ElementVector* theElementVector = ma 261 const G4ElementVector* theElementVector = material->GetElementVector(); 256 const G4double* theAtomNumDensityVector = 262 const G4double* theAtomNumDensityVector = 257 material->GetVecNbOfAtomsPerVolume(); 263 material->GetVecNbOfAtomsPerVolume(); 258 size_t nelm = material->GetNumberOfElements( 264 size_t nelm = material->GetNumberOfElements(); 259 for (size_t i=0; i<nelm; ++i) { 265 for (size_t i=0; i<nelm; ++i) { 260 const G4Element* elm = (*theElementVector) 266 const G4Element* elm = (*theElementVector)[i]; 261 cross += theAtomNumDensityVector[i]* 267 cross += theAtomNumDensityVector[i]* 262 GetCaptureCrossSectionPerAtom(aParticle, 268 GetCaptureCrossSectionPerAtom(aParticle,kineticEnergy,elm,material); 263 } 269 } 264 return cross; 270 return cross; 265 } 271 } 266 272 267 //....oooOO0OOooo........oooOO0OOooo........oo 273 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 268 274 269 G4double G4HadronicProcessStore::GetCaptureCro 275 G4double G4HadronicProcessStore::GetCaptureCrossSectionPerAtom( 270 const G4ParticleDefinition *aParticle, 276 const G4ParticleDefinition *aParticle, 271 G4double kineticEnergy, 277 G4double kineticEnergy, 272 const G4Element *anElement, const G4Materi 278 const G4Element *anElement, const G4Material* mat) 273 { 279 { 274 G4HadronicProcess* hp = FindProcess(aParticl 280 G4HadronicProcess* hp = FindProcess(aParticle, fCapture); 275 localDP.SetKineticEnergy(kineticEnergy); 281 localDP.SetKineticEnergy(kineticEnergy); 276 G4double cross = 0.0; 282 G4double cross = 0.0; 277 if(hp) { 283 if(hp) { 278 cross = hp->GetElementCrossSection(&localD 284 cross = hp->GetElementCrossSection(&localDP,anElement,mat); 279 } 285 } 280 return cross; 286 return cross; 281 } 287 } 282 288 283 //....oooOO0OOooo........oooOO0OOooo........oo 289 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 284 290 285 G4double G4HadronicProcessStore::GetCaptureCro 291 G4double G4HadronicProcessStore::GetCaptureCrossSectionPerIsotope( 286 const G4ParticleDefinition *, 292 const G4ParticleDefinition *, 287 G4double, 293 G4double, 288 G4int, G4int) 294 G4int, G4int) 289 { 295 { 290 return 0.0; 296 return 0.0; 291 } 297 } 292 298 293 //....oooOO0OOooo........oooOO0OOooo........oo 299 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 294 300 295 G4double G4HadronicProcessStore::GetFissionCro 301 G4double G4HadronicProcessStore::GetFissionCrossSectionPerVolume( 296 const G4ParticleDefinition *aParticle, 302 const G4ParticleDefinition *aParticle, 297 G4double kineticEnergy, 303 G4double kineticEnergy, 298 const G4Material *material) 304 const G4Material *material) 299 { 305 { 300 G4double cross = 0.0; 306 G4double cross = 0.0; 301 const G4ElementVector* theElementVector = ma 307 const G4ElementVector* theElementVector = material->GetElementVector(); 302 const G4double* theAtomNumDensityVector = 308 const G4double* theAtomNumDensityVector = 303 material->GetVecNbOfAtomsPerVolume(); 309 material->GetVecNbOfAtomsPerVolume(); 304 size_t nelm = material->GetNumberOfElements( 310 size_t nelm = material->GetNumberOfElements(); 305 for (size_t i=0; i<nelm; i++) { 311 for (size_t i=0; i<nelm; i++) { 306 const G4Element* elm = (*theElementVector) 312 const G4Element* elm = (*theElementVector)[i]; 307 cross += theAtomNumDensityVector[i]* 313 cross += theAtomNumDensityVector[i]* 308 GetFissionCrossSectionPerAtom(aParticle, 314 GetFissionCrossSectionPerAtom(aParticle,kineticEnergy,elm,material); 309 } 315 } 310 return cross; 316 return cross; 311 } 317 } 312 318 313 //....oooOO0OOooo........oooOO0OOooo........oo 319 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 314 320 315 G4double G4HadronicProcessStore::GetFissionCro 321 G4double G4HadronicProcessStore::GetFissionCrossSectionPerAtom( 316 const G4ParticleDefinition *aParticle, 322 const G4ParticleDefinition *aParticle, 317 G4double kineticEnergy, 323 G4double kineticEnergy, 318 const G4Element *anElement, const G4Materi 324 const G4Element *anElement, const G4Material* mat) 319 { 325 { 320 G4HadronicProcess* hp = FindProcess(aParticl 326 G4HadronicProcess* hp = FindProcess(aParticle, fFission); 321 localDP.SetKineticEnergy(kineticEnergy); 327 localDP.SetKineticEnergy(kineticEnergy); 322 G4double cross = 0.0; 328 G4double cross = 0.0; 323 if(hp) { 329 if(hp) { 324 cross = hp->GetElementCrossSection(&localD 330 cross = hp->GetElementCrossSection(&localDP,anElement,mat); 325 } 331 } 326 return cross; 332 return cross; 327 } 333 } 328 334 329 //....oooOO0OOooo........oooOO0OOooo........oo 335 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 330 336 331 G4double G4HadronicProcessStore::GetFissionCro 337 G4double G4HadronicProcessStore::GetFissionCrossSectionPerIsotope( 332 const G4ParticleDefinition *, 338 const G4ParticleDefinition *, 333 G4double, 339 G4double, 334 G4int, G4int) 340 G4int, G4int) 335 { 341 { 336 return 0.0; 342 return 0.0; 337 } 343 } 338 344 339 //....oooOO0OOooo........oooOO0OOooo........oo 345 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 340 346 341 G4double G4HadronicProcessStore::GetChargeExch 347 G4double G4HadronicProcessStore::GetChargeExchangeCrossSectionPerVolume( 342 const G4ParticleDefinition *aParticle, 348 const G4ParticleDefinition *aParticle, 343 G4double kineticEnergy, 349 G4double kineticEnergy, 344 const G4Material *material) 350 const G4Material *material) 345 { 351 { 346 G4double cross = 0.0; 352 G4double cross = 0.0; 347 const G4ElementVector* theElementVector = ma 353 const G4ElementVector* theElementVector = material->GetElementVector(); 348 const G4double* theAtomNumDensityVector = 354 const G4double* theAtomNumDensityVector = 349 material->GetVecNbOfAtomsPerVolume(); 355 material->GetVecNbOfAtomsPerVolume(); 350 size_t nelm = material->GetNumberOfElements( 356 size_t nelm = material->GetNumberOfElements(); 351 for (size_t i=0; i<nelm; ++i) { 357 for (size_t i=0; i<nelm; ++i) { 352 const G4Element* elm = (*theElementVector) 358 const G4Element* elm = (*theElementVector)[i]; 353 cross += theAtomNumDensityVector[i]* 359 cross += theAtomNumDensityVector[i]* 354 GetChargeExchangeCrossSectionPerAtom(aPart 360 GetChargeExchangeCrossSectionPerAtom(aParticle,kineticEnergy,elm,material); 355 } 361 } 356 return cross; 362 return cross; 357 } 363 } 358 364 359 //....oooOO0OOooo........oooOO0OOooo........oo 365 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 360 366 361 G4double G4HadronicProcessStore::GetChargeExch 367 G4double G4HadronicProcessStore::GetChargeExchangeCrossSectionPerAtom( 362 const G4ParticleDefinition *aParticle, 368 const G4ParticleDefinition *aParticle, 363 G4double kineticEnergy, 369 G4double kineticEnergy, 364 const G4Element *anElement, const G4Materi 370 const G4Element *anElement, const G4Material* mat) 365 { 371 { 366 G4HadronicProcess* hp = FindProcess(aParticl 372 G4HadronicProcess* hp = FindProcess(aParticle, fChargeExchange); 367 localDP.SetKineticEnergy(kineticEnergy); 373 localDP.SetKineticEnergy(kineticEnergy); 368 G4double cross = 0.0; 374 G4double cross = 0.0; 369 if(hp) { 375 if(hp) { 370 cross = hp->GetElementCrossSection(&localD 376 cross = hp->GetElementCrossSection(&localDP,anElement,mat); 371 } 377 } 372 return cross; 378 return cross; 373 } 379 } 374 380 375 //....oooOO0OOooo........oooOO0OOooo........oo 381 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 376 382 377 G4double G4HadronicProcessStore::GetChargeExch 383 G4double G4HadronicProcessStore::GetChargeExchangeCrossSectionPerIsotope( 378 const G4ParticleDefinition *, 384 const G4ParticleDefinition *, 379 G4double, 385 G4double, 380 G4int, G4int) 386 G4int, G4int) 381 { 387 { 382 return 0.0; 388 return 0.0; 383 } 389 } 384 390 385 //....oooOO0OOooo........oooOO0OOooo........oo 391 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 386 392 387 void G4HadronicProcessStore::Register(G4Hadron 393 void G4HadronicProcessStore::Register(G4HadronicProcess* proc) 388 { 394 { 389 for(G4int i=0; i<n_proc; ++i) { 395 for(G4int i=0; i<n_proc; ++i) { 390 if(process[i] == proc) { return; } 396 if(process[i] == proc) { return; } 391 } 397 } 392 if(1 < param->GetVerboseLevel()) { 398 if(1 < param->GetVerboseLevel()) { 393 G4cout << "G4HadronicProcessStore::Registe 399 G4cout << "G4HadronicProcessStore::Register hadronic " << n_proc 394 << " " << proc->GetProcessName() << G4en 400 << " " << proc->GetProcessName() << G4endl; 395 } 401 } 396 ++n_proc; 402 ++n_proc; 397 process.push_back(proc); 403 process.push_back(proc); 398 } 404 } 399 405 400 //....oooOO0OOooo........oooOO0OOooo........oo 406 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 401 407 402 void G4HadronicProcessStore::RegisterParticle( 408 void G4HadronicProcessStore::RegisterParticle(G4HadronicProcess* proc, 403 const G4ParticleDefinition* pa 409 const G4ParticleDefinition* part) 404 { 410 { 405 G4int i=0; 411 G4int i=0; 406 for(; i<n_proc; ++i) {if(process[i] == proc) 412 for(; i<n_proc; ++i) {if(process[i] == proc) break;} 407 G4int j=0; 413 G4int j=0; 408 for(; j<n_part; ++j) {if(particle[j] == part 414 for(; j<n_part; ++j) {if(particle[j] == part) break;} 409 415 410 if(1 < param->GetVerboseLevel()) { 416 if(1 < param->GetVerboseLevel()) { 411 G4cout << "G4HadronicProcessStore::Registe 417 G4cout << "G4HadronicProcessStore::RegisterParticle " 412 << part->GetParticleName() 418 << part->GetParticleName() 413 << " for " << proc->GetProcessName() << 419 << " for " << proc->GetProcessName() << G4endl; 414 } 420 } 415 if(j == n_part) { 421 if(j == n_part) { 416 ++n_part; 422 ++n_part; 417 particle.push_back(part); 423 particle.push_back(part); 418 wasPrinted.push_back(0); 424 wasPrinted.push_back(0); 419 } 425 } 420 426 421 // the pair should be added? 427 // the pair should be added? 422 if(i < n_proc) { 428 if(i < n_proc) { 423 std::multimap<PD,HP,std::less<PD> >::itera 429 std::multimap<PD,HP,std::less<PD> >::iterator it; 424 for(it=p_map.lower_bound(part); it!=p_map. 430 for(it=p_map.lower_bound(part); it!=p_map.upper_bound(part); ++it) { 425 if(it->first == part) { 431 if(it->first == part) { 426 HP process2 = (it->second); 432 HP process2 = (it->second); 427 if(proc == process2) { return; } 433 if(proc == process2) { return; } 428 } 434 } 429 } 435 } 430 } 436 } 431 437 432 p_map.insert(std::multimap<PD,HP>::value_typ 438 p_map.insert(std::multimap<PD,HP>::value_type(part,proc)); 433 } 439 } 434 440 435 //....oooOO0OOooo........oooOO0OOooo........oo 441 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 436 442 437 void G4HadronicProcessStore::RegisterInteracti 443 void G4HadronicProcessStore::RegisterInteraction(G4HadronicProcess* proc, 438 G4HadronicInteraction* mod) 444 G4HadronicInteraction* mod) 439 { 445 { 440 G4int i=0; 446 G4int i=0; 441 for(; i<n_proc; ++i) {if(process[i] == proc) 447 for(; i<n_proc; ++i) {if(process[i] == proc) { break; }} 442 G4int k=0; 448 G4int k=0; 443 for(; k<n_model; ++k) {if(model[k] == mod) { 449 for(; k<n_model; ++k) {if(model[k] == mod) { break; }} 444 450 445 m_map.insert(std::multimap<HP,HI>::value_typ 451 m_map.insert(std::multimap<HP,HI>::value_type(proc,mod)); 446 452 447 if(k == n_model) { 453 if(k == n_model) { 448 ++n_model; 454 ++n_model; 449 model.push_back(mod); 455 model.push_back(mod); 450 modelName.push_back(mod->GetModelName()); 456 modelName.push_back(mod->GetModelName()); 451 } 457 } 452 } 458 } 453 459 454 //....oooOO0OOooo........oooOO0OOooo........oo 460 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 455 461 456 void G4HadronicProcessStore::DeRegister(G4Hadr 462 void G4HadronicProcessStore::DeRegister(G4HadronicProcess* proc) 457 { 463 { 458 for(G4int i=0; i<n_proc; ++i) { 464 for(G4int i=0; i<n_proc; ++i) { 459 if(process[i] == proc) { 465 if(process[i] == proc) { 460 process[i] = nullptr; 466 process[i] = nullptr; >> 467 DeRegisterExtraProcess((G4VProcess*)proc); 461 return; 468 return; 462 } 469 } 463 } 470 } 464 } 471 } 465 472 466 //....oooOO0OOooo........oooOO0OOooo........oo 473 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 467 474 468 void G4HadronicProcessStore::RegisterExtraProc 475 void G4HadronicProcessStore::RegisterExtraProcess(G4VProcess* proc) 469 { 476 { 470 for(G4int i=0; i<n_extra; ++i) { 477 for(G4int i=0; i<n_extra; ++i) { 471 if(extraProcess[i] == proc) { return; } 478 if(extraProcess[i] == proc) { return; } 472 } 479 } 473 G4HadronicProcess* hproc = dynamic_cast<G4Ha << 480 G4HadronicProcess* hproc = static_cast<G4HadronicProcess*>(proc); 474 if (nullptr != hproc) { << 481 if(hproc) { 475 for(G4int i=0; i<n_proc; ++i) { 482 for(G4int i=0; i<n_proc; ++i) { 476 if(process[i] == hproc) { return; } 483 if(process[i] == hproc) { return; } 477 } 484 } 478 } 485 } 479 if(1 < param->GetVerboseLevel()) { 486 if(1 < param->GetVerboseLevel()) { 480 G4cout << "Extra Process: " << n_extra 487 G4cout << "Extra Process: " << n_extra 481 << " " << proc->GetProcessName() << G4e 488 << " " << proc->GetProcessName() << G4endl; 482 } 489 } 483 ++n_extra; 490 ++n_extra; 484 extraProcess.push_back(proc); 491 extraProcess.push_back(proc); 485 } 492 } 486 493 487 //....oooOO0OOooo........oooOO0OOooo........oo 494 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 488 495 489 void G4HadronicProcessStore::RegisterParticleF 496 void G4HadronicProcessStore::RegisterParticleForExtraProcess( 490 G4VProcess* proc, 497 G4VProcess* proc, 491 const G4ParticleDefinition* part) 498 const G4ParticleDefinition* part) 492 { 499 { 493 G4int i=0; 500 G4int i=0; 494 for(; i<n_extra; ++i) { if(extraProcess[i] = 501 for(; i<n_extra; ++i) { if(extraProcess[i] == proc) { break; } } 495 G4int j=0; 502 G4int j=0; 496 for(; j<n_part; ++j) { if(particle[j] == par 503 for(; j<n_part; ++j) { if(particle[j] == part) { break; } } 497 504 498 if(j == n_part) { 505 if(j == n_part) { 499 ++n_part; 506 ++n_part; 500 particle.push_back(part); 507 particle.push_back(part); 501 wasPrinted.push_back(0); 508 wasPrinted.push_back(0); 502 } 509 } 503 510 504 // the pair should be added? 511 // the pair should be added? 505 if(i < n_extra) { 512 if(i < n_extra) { 506 std::multimap<PD,G4VProcess*,std::less<PD> 513 std::multimap<PD,G4VProcess*,std::less<PD> >::iterator it; 507 for(it=ep_map.lower_bound(part); it!=ep_ma 514 for(it=ep_map.lower_bound(part); it!=ep_map.upper_bound(part); ++it) { 508 if(it->first == part) { 515 if(it->first == part) { 509 G4VProcess* process2 = (it->second); 516 G4VProcess* process2 = (it->second); 510 if(proc == process2) { return; } 517 if(proc == process2) { return; } 511 } 518 } 512 } 519 } 513 } 520 } 514 521 515 ep_map.insert(std::multimap<PD,G4VProcess*>: 522 ep_map.insert(std::multimap<PD,G4VProcess*>::value_type(part,proc)); 516 } 523 } 517 524 518 //....oooOO0OOooo........oooOO0OOooo........oo 525 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 519 526 520 void G4HadronicProcessStore::DeRegisterExtraPr 527 void G4HadronicProcessStore::DeRegisterExtraProcess(G4VProcess* proc) 521 { 528 { 522 for(G4int i=0; i<n_extra; ++i) { 529 for(G4int i=0; i<n_extra; ++i) { 523 if(extraProcess[i] == proc) { 530 if(extraProcess[i] == proc) { 524 extraProcess[i] = nullptr; 531 extraProcess[i] = nullptr; 525 if(1 < param->GetVerboseLevel()) { 532 if(1 < param->GetVerboseLevel()) { 526 G4cout << "Extra Process: " << i << " " 533 G4cout << "Extra Process: " << i << " " 527 <<proc->GetProcessName()<< " is dereg 534 <<proc->GetProcessName()<< " is deregisted " << G4endl; 528 } 535 } 529 return; 536 return; 530 } 537 } 531 } 538 } 532 } 539 } 533 540 534 //....oooOO0OOooo........oooOO0OOooo........oo 541 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 535 542 536 void G4HadronicProcessStore::SetBuildXSTable(G 543 void G4HadronicProcessStore::SetBuildXSTable(G4bool val) 537 { 544 { 538 buildXSTable = val; 545 buildXSTable = val; 539 } 546 } 540 547 541 //....oooOO0OOooo........oooOO0OOooo........oo 548 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 542 549 543 G4bool G4HadronicProcessStore::GetBuildXSTable 550 G4bool G4HadronicProcessStore::GetBuildXSTable() const 544 { 551 { 545 return buildXSTable; 552 return buildXSTable; 546 } 553 } 547 554 548 //....oooOO0OOooo........oooOO0OOooo........oo 555 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 549 556 550 void G4HadronicProcessStore::PrintInfo(const G 557 void G4HadronicProcessStore::PrintInfo(const G4ParticleDefinition* part) 551 { 558 { 552 // Trigger particle/process/model printout o 559 // Trigger particle/process/model printout only when last particle is 553 // registered 560 // registered 554 if(buildTableStart && part == particle[n_par 561 if(buildTableStart && part == particle[n_part - 1]) { 555 buildTableStart = false; 562 buildTableStart = false; 556 Dump(param->GetVerboseLevel()); 563 Dump(param->GetVerboseLevel()); 557 if (!(param->GetPhysListDocDir()).empty()) 564 if (!(param->GetPhysListDocDir()).empty()) DumpHtml(); 558 G4HadronicInteractionRegistry::Instance()- 565 G4HadronicInteractionRegistry::Instance()->InitialiseModels(); 559 } 566 } 560 } 567 } 561 568 562 //....oooOO0OOooo........oooOO0OOooo........oo 569 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 563 570 564 void G4HadronicProcessStore::DumpHtml() 571 void G4HadronicProcessStore::DumpHtml() 565 { 572 { 566 // Automatic generation of html documentatio 573 // Automatic generation of html documentation page for physics lists 567 // List processes, models and cross sections 574 // List processes, models and cross sections for the most important 568 // particles in descending order of importan 575 // particles in descending order of importance 569 576 570 const G4String& dir = param->GetPhysListDocD 577 const G4String& dir = param->GetPhysListDocDir(); 571 const G4String& pl = param->GetPhysListName( 578 const G4String& pl = param->GetPhysListName(); 572 if (!dir.empty() && !pl.empty()) { 579 if (!dir.empty() && !pl.empty()) { 573 580 574 // Open output file with path name 581 // Open output file with path name 575 G4String pathName = dir + "/" + pl + ".htm 582 G4String pathName = dir + "/" + pl + ".html"; 576 std::ofstream outFile; 583 std::ofstream outFile; 577 outFile.open(pathName); 584 outFile.open(pathName); 578 585 579 // Write physics list summary file 586 // Write physics list summary file 580 outFile << "<html>\n"; 587 outFile << "<html>\n"; 581 outFile << "<head>\n"; 588 outFile << "<head>\n"; 582 outFile << "<title>Physics List Summary</t 589 outFile << "<title>Physics List Summary</title>\n"; 583 outFile << "</head>\n"; 590 outFile << "</head>\n"; 584 outFile << "<body>\n"; 591 outFile << "<body>\n"; 585 outFile << "<h2> Summary of Hadronic Proce 592 outFile << "<h2> Summary of Hadronic Processes, Models and Cross Sections" 586 << " for Physics List " << pl << "</h2>\ 593 << " for Physics List " << pl << "</h2>\n"; 587 outFile << "<ul>\n"; 594 outFile << "<ul>\n"; 588 595 589 PrintHtml(G4Proton::Proton(), outFile); 596 PrintHtml(G4Proton::Proton(), outFile); 590 PrintHtml(G4Neutron::Neutron(), outFile); 597 PrintHtml(G4Neutron::Neutron(), outFile); 591 PrintHtml(G4PionPlus::PionPlus(), outFile) 598 PrintHtml(G4PionPlus::PionPlus(), outFile); 592 PrintHtml(G4PionMinus::PionMinus(), outFil 599 PrintHtml(G4PionMinus::PionMinus(), outFile); 593 PrintHtml(G4Gamma::Gamma(), outFile); 600 PrintHtml(G4Gamma::Gamma(), outFile); 594 PrintHtml(G4Electron::Electron(), outFile) 601 PrintHtml(G4Electron::Electron(), outFile); 595 // PrintHtml(G4MuonMinus::MuonMinus(), 602 // PrintHtml(G4MuonMinus::MuonMinus(), outFile); 596 PrintHtml(G4Positron::Positron(), outFile) 603 PrintHtml(G4Positron::Positron(), outFile); 597 PrintHtml(G4KaonPlus::KaonPlus(), outFile) 604 PrintHtml(G4KaonPlus::KaonPlus(), outFile); 598 PrintHtml(G4KaonMinus::KaonMinus(), outFil 605 PrintHtml(G4KaonMinus::KaonMinus(), outFile); 599 PrintHtml(G4Lambda::Lambda(), outFile); 606 PrintHtml(G4Lambda::Lambda(), outFile); 600 PrintHtml(G4Alpha::Alpha(), outFile); 607 PrintHtml(G4Alpha::Alpha(), outFile); 601 PrintHtml(G4GenericIon::GenericIon(), outF 608 PrintHtml(G4GenericIon::GenericIon(), outFile); 602 609 603 outFile << "</ul>\n"; 610 outFile << "</ul>\n"; 604 outFile << "</body>\n"; 611 outFile << "</body>\n"; 605 outFile << "</html>\n"; 612 outFile << "</html>\n"; 606 outFile.close(); 613 outFile.close(); 607 } 614 } 608 } 615 } 609 616 610 //....oooOO0OOooo........oooOO0OOooo........oo 617 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 611 618 612 void G4HadronicProcessStore::PrintHtml(const G 619 void G4HadronicProcessStore::PrintHtml(const G4ParticleDefinition* theParticle, 613 std::of 620 std::ofstream& outFile) 614 { 621 { 615 // Automatic generation of html documentatio 622 // Automatic generation of html documentation page for physics lists 616 // List processes for the most important par 623 // List processes for the most important particles in descending order 617 // of importance 624 // of importance 618 625 619 outFile << "<br> <li><h2><font color=\" ff00 626 outFile << "<br> <li><h2><font color=\" ff0000 \">" 620 << theParticle->GetParticleName() << 627 << theParticle->GetParticleName() << "</font></h2></li>\n"; 621 628 622 typedef std::multimap<PD,HP,std::less<PD> > 629 typedef std::multimap<PD,HP,std::less<PD> > PDHPmap; 623 typedef std::multimap<HP,HI,std::less<HP> > 630 typedef std::multimap<HP,HI,std::less<HP> > HPHImap; 624 631 625 std::pair<PDHPmap::iterator, PDHPmap::iterat 632 std::pair<PDHPmap::iterator, PDHPmap::iterator> itpart = 626 p_map.equal_range(theP 633 p_map.equal_range(theParticle); 627 634 628 const G4String& pl = param->GetPhysListName( 635 const G4String& pl = param->GetPhysListName(); 629 636 630 // Loop over processes assigned to particle 637 // Loop over processes assigned to particle 631 G4HadronicProcess* theProcess; 638 G4HadronicProcess* theProcess; 632 for (PDHPmap::iterator it = itpart.first; it 639 for (PDHPmap::iterator it = itpart.first; it != itpart.second; ++it) { 633 theProcess = (*it).second; 640 theProcess = (*it).second; 634 outFile << "<br> <b><font col 641 outFile << "<br> <b><font color=\" 0000ff \">process : " 635 << theProcess->GetProcessName() << 642 << theProcess->GetProcessName() << "</font></b>\n"; 636 outFile << "<ul>\n"; 643 outFile << "<ul>\n"; 637 outFile << " <li>"; 644 outFile << " <li>"; 638 theProcess->ProcessDescription(outFile); 645 theProcess->ProcessDescription(outFile); 639 outFile << " <li><b><font color=\" 00AA00 646 outFile << " <li><b><font color=\" 00AA00 \">models : </font></b>\n"; 640 // Loop over models assigned to process 647 // Loop over models assigned to process 641 std::pair<HPHImap::iterator, HPHImap::iter 648 std::pair<HPHImap::iterator, HPHImap::iterator> itmod = 642 m_map.equal_range(theP 649 m_map.equal_range(theProcess); 643 650 644 outFile << " <ul>\n"; 651 outFile << " <ul>\n"; 645 652 646 for (HPHImap::iterator jt = itmod.first; j 653 for (HPHImap::iterator jt = itmod.first; jt != itmod.second; ++jt) { 647 outFile << " <li><b><a href=\"" << pl 654 outFile << " <li><b><a href=\"" << pl << "_" 648 << HtmlFileName((*jt).second->GetM 655 << HtmlFileName((*jt).second->GetModelName()) << "\"> " 649 << (*jt).second->GetModelName() 656 << (*jt).second->GetModelName() << "</a>" 650 << " from " << (*jt).second->Get 657 << " from " << (*jt).second->GetMinEnergy()/GeV 651 << " GeV to " << (*jt).second->G 658 << " GeV to " << (*jt).second->GetMaxEnergy()/GeV 652 << " GeV </b></li>\n"; 659 << " GeV </b></li>\n"; 653 660 654 // Print ModelDescription, ignore that w 661 // Print ModelDescription, ignore that we overwrite files n-times. 655 PrintModelHtml((*jt).second); 662 PrintModelHtml((*jt).second); 656 663 657 } 664 } 658 outFile << " </ul>\n"; 665 outFile << " </ul>\n"; 659 outFile << " </li>\n"; 666 outFile << " </li>\n"; 660 667 661 // List cross sections assigned to process 668 // List cross sections assigned to process 662 outFile << " <li><b><font color=\" 00AA00 669 outFile << " <li><b><font color=\" 00AA00 \">cross sections : </font></b>\n"; 663 outFile << " <ul>\n"; 670 outFile << " <ul>\n"; 664 theProcess->GetCrossSectionDataStore()->Du 671 theProcess->GetCrossSectionDataStore()->DumpHtml(*theParticle, outFile); 665 // << " \n"; 672 // << " \n"; 666 outFile << " </ul>\n"; 673 outFile << " </ul>\n"; 667 674 668 outFile << " </li>\n"; 675 outFile << " </li>\n"; 669 outFile << "</ul>\n"; 676 outFile << "</ul>\n"; 670 677 671 } 678 } 672 679 673 // Loop over extra (G4VProcess) processes 680 // Loop over extra (G4VProcess) processes 674 std::multimap<PD,G4VProcess*,std::less<PD> > 681 std::multimap<PD,G4VProcess*,std::less<PD> >::iterator itp; 675 for (itp=ep_map.lower_bound(theParticle); it 682 for (itp=ep_map.lower_bound(theParticle); itp!=ep_map.upper_bound(theParticle); ++itp) { 676 if (itp->first == theParticle) { 683 if (itp->first == theParticle) { 677 G4VProcess* proc = (itp->second); 684 G4VProcess* proc = (itp->second); 678 outFile << "<br> <b><font c 685 outFile << "<br> <b><font color=\" 0000ff \">process : " 679 << proc->GetProcessName() << "</ 686 << proc->GetProcessName() << "</font></b>\n"; 680 outFile << "<ul>\n"; 687 outFile << "<ul>\n"; 681 outFile << " <li>"; 688 outFile << " <li>"; 682 proc->ProcessDescription(outFile); 689 proc->ProcessDescription(outFile); 683 outFile << " </li>\n"; 690 outFile << " </li>\n"; 684 outFile << "</ul>\n"; 691 outFile << "</ul>\n"; 685 } 692 } 686 } 693 } 687 694 688 } // PrintHtml for particle 695 } // PrintHtml for particle 689 696 690 //....oooOO0OOooo........oooOO0OOooo........oo 697 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 691 698 692 void 699 void 693 G4HadronicProcessStore::PrintModelHtml(const G 700 G4HadronicProcessStore::PrintModelHtml(const G4HadronicInteraction * mod) const 694 { 701 { 695 const G4String& dir = param->GetPhysListDocD 702 const G4String& dir = param->GetPhysListDocDir(); 696 const G4String& pl = param->GetPhysListName( 703 const G4String& pl = param->GetPhysListName(); 697 G4String pathName = dir + "/" + pl + "_" + H 704 G4String pathName = dir + "/" + pl + "_" + HtmlFileName(mod->GetModelName()); 698 std::ofstream outModel; 705 std::ofstream outModel; 699 outModel.open(pathName); 706 outModel.open(pathName); 700 outModel << "<html>\n"; 707 outModel << "<html>\n"; 701 outModel << "<head>\n"; 708 outModel << "<head>\n"; 702 outModel << "<title>Description of " << mod- 709 outModel << "<title>Description of " << mod->GetModelName() 703 << "</title>\n"; 710 << "</title>\n"; 704 outModel << "</head>\n"; 711 outModel << "</head>\n"; 705 outModel << "<body>\n"; 712 outModel << "<body>\n"; 706 713 707 mod->ModelDescription(outModel); 714 mod->ModelDescription(outModel); 708 715 709 outModel << "</body>\n"; 716 outModel << "</body>\n"; 710 outModel << "</html>\n"; 717 outModel << "</html>\n"; 711 } 718 } 712 719 713 //....oooOO0OOooo........oooOO0OOooo........oo 720 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 714 721 715 G4String G4HadronicProcessStore::HtmlFileName( 722 G4String G4HadronicProcessStore::HtmlFileName(const G4String & in) const 716 { 723 { 717 G4String str(in); 724 G4String str(in); 718 725 719 // replace blanks: 726 // replace blanks: 720 std::transform(str.begin(), str.end(), str.b 727 std::transform(str.begin(), str.end(), str.begin(), [](char ch) { 721 return ch == ' ' ? '_' : ch; 728 return ch == ' ' ? '_' : ch; 722 }); 729 }); 723 str=str + ".html"; 730 str=str + ".html"; 724 return str; 731 return str; 725 } 732 } 726 733 727 //....oooOO0OOooo........oooOO0OOooo........oo 734 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 728 735 729 void G4HadronicProcessStore::Dump(G4int verb) 736 void G4HadronicProcessStore::Dump(G4int verb) 730 { 737 { 731 G4int level = std::max(param->GetVerboseLeve 738 G4int level = std::max(param->GetVerboseLevel(), verb); 732 if (0 == level) return; 739 if (0 == level) return; 733 740 734 G4cout 741 G4cout 735 << "\n===================================== 742 << "\n====================================================================\n" 736 << std::setw(60) << "HADRONIC PROCESSES SUM 743 << std::setw(60) << "HADRONIC PROCESSES SUMMARY (verbose level " 737 << level << ")" << G4endl; 744 << level << ")" << G4endl; 738 745 739 for (G4int i=0; i<n_part; ++i) { 746 for (G4int i=0; i<n_part; ++i) { 740 PD part = particle[i]; 747 PD part = particle[i]; 741 G4String pname = part->GetParticleName(); 748 G4String pname = part->GetParticleName(); 742 G4bool yes = false; 749 G4bool yes = false; 743 750 744 if (level == 1 && (pname == "proton" || 751 if (level == 1 && (pname == "proton" || 745 pname == "neutron" || 752 pname == "neutron" || 746 pname == "deuteron" || 753 pname == "deuteron" || 747 pname == "triton" || 754 pname == "triton" || 748 pname == "He3" || 755 pname == "He3" || 749 pname == "alpha" || 756 pname == "alpha" || 750 pname == "pi+" || 757 pname == "pi+" || 751 pname == "pi-" || 758 pname == "pi-" || 752 pname == "gamma" || 759 pname == "gamma" || 753 pname == "e+" || 760 pname == "e+" || 754 pname == "e-" || 761 pname == "e-" || 755 pname == "nu_e" || 762 pname == "nu_e" || 756 pname == "anti_nu_e" || 763 pname == "anti_nu_e" || 757 pname == "nu_mu" || 764 pname == "nu_mu" || 758 pname == "anti_nu_mu" | 765 pname == "anti_nu_mu" || 759 pname == "mu+" || 766 pname == "mu+" || 760 pname == "mu-" || 767 pname == "mu-" || 761 pname == "kaon+" || 768 pname == "kaon+" || 762 pname == "kaon-" || 769 pname == "kaon-" || 763 pname == "lambda" || 770 pname == "lambda" || 764 pname == "anti_lambda" || 771 pname == "anti_lambda" || 765 pname == "sigma-" || 772 pname == "sigma-" || 766 pname == "D-" || 773 pname == "D-" || 767 pname == "B-" || 774 pname == "B-" || 768 pname == "GenericIon" || 775 pname == "GenericIon" || 769 pname == "hypertriton" || 776 pname == "hypertriton" || 770 pname == "anti_neutron" || 777 pname == "anti_neutron" || 771 pname == "anti_proton" || 778 pname == "anti_proton" || 772 pname == "anti_deuteron 779 pname == "anti_deuteron" || 773 pname == "anti_triton" 780 pname == "anti_triton" || 774 pname == "anti_He3" || 781 pname == "anti_He3" || 775 pname == "anti_alpha" | 782 pname == "anti_alpha" || 776 pname == "anti_hypertri 783 pname == "anti_hypertriton")) yes = true; 777 if (level > 1) yes = true; 784 if (level > 1) yes = true; 778 if (yes) { 785 if (yes) { 779 // main processes 786 // main processes 780 std::multimap<PD,HP,std::less<PD> >::ite 787 std::multimap<PD,HP,std::less<PD> >::iterator it; 781 788 782 for (it=p_map.lower_bound(part); it!=p_m 789 for (it=p_map.lower_bound(part); it!=p_map.upper_bound(part); ++it) { 783 if (it->first == part) { 790 if (it->first == part) { 784 HP proc = (it->second); 791 HP proc = (it->second); 785 G4int j=0; 792 G4int j=0; 786 for (; j<n_proc; ++j) { 793 for (; j<n_proc; ++j) { 787 if (process[j] == proc) { Print(j, i); } 794 if (process[j] == proc) { Print(j, i); } 788 } 795 } 789 } 796 } 790 } 797 } 791 798 792 // extra processes 799 // extra processes 793 std::multimap<PD,G4VProcess*,std::less<P 800 std::multimap<PD,G4VProcess*,std::less<PD> >::iterator itp; 794 for(itp=ep_map.lower_bound(part); itp!=e 801 for(itp=ep_map.lower_bound(part); itp!=ep_map.upper_bound(part); ++itp) { 795 if(itp->first == part) { 802 if(itp->first == part) { 796 G4VProcess* proc = (itp->second); 803 G4VProcess* proc = (itp->second); 797 if (wasPrinted[i] == 0) { 804 if (wasPrinted[i] == 0) { 798 G4cout << "----------------------- 805 G4cout << "-------------------------------------------------------------------------\n" 799 << std::setw(50) << "Hadronic Processes 806 << std::setw(50) << "Hadronic Processes for " 800 << part->GetParticleName() << "\n"; 807 << part->GetParticleName() << "\n"; 801 wasPrinted[i] = 1; 808 wasPrinted[i] = 1; 802 } 809 } 803 G4cout << " Process: " << proc->GetProces 810 G4cout << " Process: " << proc->GetProcessName() << G4endl; 804 } 811 } 805 } 812 } 806 } 813 } 807 } 814 } 808 } 815 } 809 816 810 //....oooOO0OOooo........oooOO0OOooo........oo 817 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 811 818 812 void G4HadronicProcessStore::Print(G4int idxPr 819 void G4HadronicProcessStore::Print(G4int idxProc, G4int idxPart) 813 { 820 { 814 G4HadronicProcess* proc = process[idxProc]; 821 G4HadronicProcess* proc = process[idxProc]; 815 const G4ParticleDefinition* part = particle[ 822 const G4ParticleDefinition* part = particle[idxPart]; 816 if(part == nullptr || proc == nullptr) { ret 823 if(part == nullptr || proc == nullptr) { return; } 817 if (wasPrinted[idxPart] == 0) { 824 if (wasPrinted[idxPart] == 0) { 818 G4cout << "------------------------------- 825 G4cout << "-----------------------------------------------------------------------\n" 819 << std::setw(50) << "Hadronic Proce 826 << std::setw(50) << "Hadronic Processes for " 820 << part->GetParticleName() << "\n"; 827 << part->GetParticleName() << "\n"; 821 wasPrinted[idxPart] = 1; 828 wasPrinted[idxPart] = 1; 822 } 829 } 823 830 824 G4cout << " Process: " << proc->GetProcessN 831 G4cout << " Process: " << proc->GetProcessName(); 825 832 826 // Append the string "/n" (i.e. "per nucleon 833 // Append the string "/n" (i.e. "per nucleon") on the kinetic energy of ions. 827 G4String stringEnergyPerNucleon = ""; 834 G4String stringEnergyPerNucleon = ""; 828 if (part == G4GenericIon::Definition() || 835 if (part == G4GenericIon::Definition() || 829 std::abs( part->GetBaryonNumber() ) > 1) 836 std::abs( part->GetBaryonNumber() ) > 1) { 830 stringEnergyPerNucleon = "/n"; 837 stringEnergyPerNucleon = "/n"; 831 } 838 } 832 // print cross section factor 839 // print cross section factor 833 if(param->ApplyFactorXS()) { 840 if(param->ApplyFactorXS()) { 834 G4int pdg = part->GetPDGEncoding(); 841 G4int pdg = part->GetPDGEncoding(); 835 G4int subType = proc->GetProcessSubType(); 842 G4int subType = proc->GetProcessSubType(); 836 G4double fact = 1.0; 843 G4double fact = 1.0; 837 if(subType == fHadronInelastic) { 844 if(subType == fHadronInelastic) { 838 if(pdg == 2212 || pdg == 2112) { 845 if(pdg == 2212 || pdg == 2112) { 839 fact = param->XSFactorNucleonInelastic 846 fact = param->XSFactorNucleonInelastic(); 840 } else if(std::abs(pdg) == 211) { 847 } else if(std::abs(pdg) == 211) { 841 fact = param->XSFactorPionInelastic(); 848 fact = param->XSFactorPionInelastic(); 842 } else { 849 } else { 843 fact = param->XSFactorHadronInelastic( 850 fact = param->XSFactorHadronInelastic(); 844 } 851 } 845 } else if(subType == fHadronElastic) { 852 } else if(subType == fHadronElastic) { 846 if(pdg == 2212 || pdg == 2112) { 853 if(pdg == 2212 || pdg == 2112) { 847 fact = param->XSFactorNucleonElastic() 854 fact = param->XSFactorNucleonElastic(); 848 } else if(std::abs(pdg) == 211) { 855 } else if(std::abs(pdg) == 211) { 849 fact = param->XSFactorPionElastic(); 856 fact = param->XSFactorPionElastic(); 850 } else { 857 } else { 851 fact = param->XSFactorHadronElastic(); 858 fact = param->XSFactorHadronElastic(); 852 } 859 } 853 } 860 } 854 if(std::abs(fact - 1.0) > 1.e-6) { 861 if(std::abs(fact - 1.0) > 1.e-6) { 855 G4cout << " XSfactor= " << fact; 862 G4cout << " XSfactor= " << fact; 856 } 863 } 857 } 864 } 858 865 859 HI hi = 0; 866 HI hi = 0; 860 std::multimap<HP,HI,std::less<HP> >::iterato 867 std::multimap<HP,HI,std::less<HP> >::iterator ih; 861 for(ih=m_map.lower_bound(proc); ih!=m_map.up 868 for(ih=m_map.lower_bound(proc); ih!=m_map.upper_bound(proc); ++ih) { 862 if(ih->first == proc) { 869 if(ih->first == proc) { 863 hi = ih->second; 870 hi = ih->second; 864 G4int i=0; 871 G4int i=0; 865 for(; i<n_model; ++i) { 872 for(; i<n_model; ++i) { 866 if(model[i] == hi) { break; } 873 if(model[i] == hi) { break; } 867 } 874 } 868 G4cout << "\n Model: " << std::se 875 G4cout << "\n Model: " << std::setw(25) << modelName[i] << ": " 869 << G4BestUnit(hi->GetMinEnergy(), "Ener 876 << G4BestUnit(hi->GetMinEnergy(), "Energy") 870 << stringEnergyPerNucleon << " ---> " 877 << stringEnergyPerNucleon << " ---> " 871 << G4BestUnit(hi->GetMaxEnergy(), "Ener 878 << G4BestUnit(hi->GetMaxEnergy(), "Energy") 872 << stringEnergyPerNucleon; 879 << stringEnergyPerNucleon; 873 } 880 } 874 } 881 } 875 G4cout << G4endl; 882 G4cout << G4endl; 876 883 877 G4CrossSectionDataStore* csds = proc->GetCro 884 G4CrossSectionDataStore* csds = proc->GetCrossSectionDataStore(); 878 csds->DumpPhysicsTable(*part); 885 csds->DumpPhysicsTable(*part); 879 } 886 } 880 887 881 //....oooOO0OOooo........oooOO0OOooo........oo 888 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 882 889 883 void G4HadronicProcessStore::SetVerbose(G4int 890 void G4HadronicProcessStore::SetVerbose(G4int val) 884 // this code is obsolete - not optimal change 891 // this code is obsolete - not optimal change verbose in each thread 885 { 892 { 886 G4int i; 893 G4int i; 887 for(i=0; i<n_proc; ++i) { 894 for(i=0; i<n_proc; ++i) { 888 if(process[i]) { process[i]->SetVerboseLev 895 if(process[i]) { process[i]->SetVerboseLevel(val); } 889 } 896 } 890 for(i=0; i<n_model; ++i) { 897 for(i=0; i<n_model; ++i) { 891 if(model[i]) { model[i]->SetVerboseLevel(v 898 if(model[i]) { model[i]->SetVerboseLevel(val); } 892 } 899 } 893 } 900 } 894 901 895 //....oooOO0OOooo........oooOO0OOooo........oo 902 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 896 903 897 G4int G4HadronicProcessStore::GetVerbose() 904 G4int G4HadronicProcessStore::GetVerbose() 898 { 905 { 899 return param->GetVerboseLevel(); 906 return param->GetVerboseLevel(); 900 } 907 } 901 908 902 //....oooOO0OOooo........oooOO0OOooo........oo 909 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 903 910 904 G4HadronicProcess* G4HadronicProcessStore::Fin 911 G4HadronicProcess* G4HadronicProcessStore::FindProcess( 905 const G4ParticleDefinition* part, G4Hadroni 912 const G4ParticleDefinition* part, G4HadronicProcessType subType) 906 { 913 { 907 bool isNew = false; 914 bool isNew = false; 908 G4HadronicProcess* hp = nullptr; 915 G4HadronicProcess* hp = nullptr; 909 localDP.SetDefinition(part); 916 localDP.SetDefinition(part); 910 917 911 if(part != currentParticle) { 918 if(part != currentParticle) { 912 const G4ParticleDefinition* p = part; 919 const G4ParticleDefinition* p = part; 913 if(p->GetBaryonNumber() > 4 && p->GetParti 920 if(p->GetBaryonNumber() > 4 && p->GetParticleType() == "nucleus") { 914 p = theGenericIon; 921 p = theGenericIon; 915 } 922 } 916 if(p != currentParticle) { 923 if(p != currentParticle) { 917 isNew = true; 924 isNew = true; 918 currentParticle = p; 925 currentParticle = p; 919 } 926 } 920 } 927 } 921 if(!isNew) { 928 if(!isNew) { 922 if(!currentProcess) { 929 if(!currentProcess) { 923 isNew = true; 930 isNew = true; 924 } else if(subType == currentProcess->GetPr 931 } else if(subType == currentProcess->GetProcessSubType()) { 925 hp = currentProcess; 932 hp = currentProcess; 926 } else { 933 } else { 927 isNew = true; 934 isNew = true; 928 } 935 } 929 } 936 } 930 if(isNew) { 937 if(isNew) { 931 std::multimap<PD,HP,std::less<PD> >::itera 938 std::multimap<PD,HP,std::less<PD> >::iterator it; 932 for(it=p_map.lower_bound(currentParticle); 939 for(it=p_map.lower_bound(currentParticle); 933 it!=p_map.upper_bound(currentParticle); ++it 940 it!=p_map.upper_bound(currentParticle); ++it) { 934 if(it->first == currentParticle && 941 if(it->first == currentParticle && 935 subType == (it->second)->GetProcessSubType( 942 subType == (it->second)->GetProcessSubType()) { 936 hp = it->second; 943 hp = it->second; 937 break; 944 break; 938 } 945 } 939 } 946 } 940 currentProcess = hp; 947 currentProcess = hp; 941 } 948 } 942 return hp; 949 return hp; 943 } 950 } 944 951 945 //....oooOO0OOooo........oooOO0OOooo........oo 952 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 946 953 947 void G4HadronicProcessStore::SetEpReportLevel( 954 void G4HadronicProcessStore::SetEpReportLevel(G4int level) 948 { 955 { 949 G4cout << " Setting energy/momentum report l 956 G4cout << " Setting energy/momentum report level to " << level 950 << " for " << process.size() << " had 957 << " for " << process.size() << " hadronic processes " << G4endl; 951 for (auto& theProcess : process) { 958 for (auto& theProcess : process) { 952 theProcess->SetEpReportLevel(level); 959 theProcess->SetEpReportLevel(level); 953 } 960 } 954 } 961 } 955 962 956 //....oooOO0OOooo........oooOO0OOooo........oo 963 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 957 964 958 void G4HadronicProcessStore::SetProcessAbsLeve 965 void G4HadronicProcessStore::SetProcessAbsLevel(G4double abslevel) 959 { 966 { 960 G4cout << " Setting absolute energy/momentum 967 G4cout << " Setting absolute energy/momentum test level to " << abslevel 961 << G4endl; 968 << G4endl; 962 for (auto& theProcess : process) { 969 for (auto& theProcess : process) { 963 G4double rellevel = theProcess->GetEnergyM 970 G4double rellevel = theProcess->GetEnergyMomentumCheckLevels().first; 964 theProcess->SetEnergyMomentumCheckLevels(r 971 theProcess->SetEnergyMomentumCheckLevels(rellevel, abslevel); 965 } 972 } 966 } 973 } 967 974 968 //....oooOO0OOooo........oooOO0OOooo........oo 975 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 969 976 970 void G4HadronicProcessStore::SetProcessRelLeve 977 void G4HadronicProcessStore::SetProcessRelLevel(G4double rellevel) 971 { 978 { 972 G4cout << " Setting relative energy/momentum 979 G4cout << " Setting relative energy/momentum test level to " << rellevel 973 << G4endl; 980 << G4endl; 974 for (auto& theProcess : process) { 981 for (auto& theProcess : process) { 975 G4double abslevel = theProcess->GetEnergyM 982 G4double abslevel = theProcess->GetEnergyMomentumCheckLevels().second; 976 theProcess->SetEnergyMomentumCheckLevels(r 983 theProcess->SetEnergyMomentumCheckLevels(rellevel, abslevel); 977 } 984 } 978 } 985 } 979 986 980 //....oooOO0OOooo........oooOO0OOooo........oo 987 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo..... 981 988