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