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