| [968] | 1 | //
|
|---|
| 2 | // ********************************************************************
|
|---|
| 3 | // * License and Disclaimer *
|
|---|
| 4 | // * *
|
|---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of *
|
|---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and *
|
|---|
| 7 | // * conditions of the Geant4 Software License, included in the file *
|
|---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These *
|
|---|
| 9 | // * include a list of copyright holders. *
|
|---|
| 10 | // * *
|
|---|
| 11 | // * Neither the authors of this software system, nor their employing *
|
|---|
| 12 | // * institutes,nor the agencies providing financial support for this *
|
|---|
| 13 | // * work make any representation or warranty, express or implied, *
|
|---|
| 14 | // * regarding this software system or assume any liability for its *
|
|---|
| 15 | // * use. Please see the license in the file LICENSE and URL above *
|
|---|
| 16 | // * for the full disclaimer and the limitation of liability. *
|
|---|
| 17 | // * *
|
|---|
| 18 | // * This code implementation is the result of the scientific and *
|
|---|
| 19 | // * technical work of the GEANT4 collaboration. *
|
|---|
| 20 | // * By using, copying, modifying or distributing the software (or *
|
|---|
| 21 | // * any work based on the software) you agree to acknowledge its *
|
|---|
| 22 | // * use in resulting scientific publications, and indicate your *
|
|---|
| 23 | // * acceptance of all terms of the Geant4 Software license. *
|
|---|
| 24 | // ********************************************************************
|
|---|
| 25 | //
|
|---|
| [1055] | 26 | // $Id: G4HadronicProcessStore.cc,v 1.12 2009/02/25 16:29:03 vnivanch Exp $
|
|---|
| [1196] | 27 | // GEANT4 tag $Name: geant4-09-03-cand-01 $
|
|---|
| [968] | 28 | //
|
|---|
| 29 | // -------------------------------------------------------------------
|
|---|
| 30 | //
|
|---|
| 31 | // GEANT4 Class file
|
|---|
| 32 | //
|
|---|
| 33 | //
|
|---|
| 34 | // File name: G4HadronicProcessStore
|
|---|
| 35 | //
|
|---|
| 36 | // Author: Vladimir Ivanchenko
|
|---|
| 37 | //
|
|---|
| 38 | // Creation date: 09.05.2008
|
|---|
| 39 | //
|
|---|
| 40 | // Modifications:
|
|---|
| [1055] | 41 | // 23.01.2009 V.Ivanchenko add destruction of processes
|
|---|
| [968] | 42 | //
|
|---|
| 43 | // Class Description:
|
|---|
| [1055] | 44 | // Singleton to store hadronic processes, to provide access to processes
|
|---|
| 45 | // and to printout information about processes
|
|---|
| [968] | 46 | //
|
|---|
| 47 | // -------------------------------------------------------------------
|
|---|
| 48 | //
|
|---|
| 49 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 50 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
|---|
| 51 |
|
|---|
| 52 | #include "G4HadronicProcessStore.hh"
|
|---|
| 53 | #include "G4Element.hh"
|
|---|
| 54 | #include "G4ProcessManager.hh"
|
|---|
| 55 | #include "G4Electron.hh"
|
|---|
| 56 | #include "G4Proton.hh"
|
|---|
| [1055] | 57 | #include "G4HadronicInteractionRegistry.hh"
|
|---|
| 58 | #include "G4CrossSectionDataSetRegistry.hh"
|
|---|
| [968] | 59 |
|
|---|
| 60 | G4HadronicProcessStore* G4HadronicProcessStore::theInstance = 0;
|
|---|
| 61 |
|
|---|
| 62 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 63 |
|
|---|
| 64 | G4HadronicProcessStore* G4HadronicProcessStore::Instance()
|
|---|
| 65 | {
|
|---|
| 66 | if(0 == theInstance) {
|
|---|
| 67 | static G4HadronicProcessStore manager;
|
|---|
| 68 | theInstance = &manager;
|
|---|
| 69 | }
|
|---|
| 70 | return theInstance;
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 74 |
|
|---|
| 75 | G4HadronicProcessStore::~G4HadronicProcessStore()
|
|---|
| 76 | {
|
|---|
| [1055] | 77 | Clean();
|
|---|
| 78 | G4HadronicInteractionRegistry::Instance()->Clean();
|
|---|
| 79 | G4CrossSectionDataSetRegistry::Instance()->Clean();
|
|---|
| 80 | }
|
|---|
| 81 |
|
|---|
| 82 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 83 |
|
|---|
| 84 | void G4HadronicProcessStore::Clean()
|
|---|
| 85 | {
|
|---|
| 86 | G4int i;
|
|---|
| 87 | //G4cout << "G4HadronicProcessStore::Clean() Nproc= " << n_proc
|
|---|
| 88 | // << " Nextra= " << n_extra << G4endl;
|
|---|
| 89 | if(n_proc > 0) {
|
|---|
| 90 | for (i=0; i<n_proc; i++) {
|
|---|
| 91 | if( process[i] ) {
|
|---|
| 92 | //G4cout << "G4HadronicProcessStore::Clean() delete hadronic " << i << G4endl;
|
|---|
| 93 | //G4cout << process[i]->GetProcessName() << G4endl;
|
|---|
| 94 | delete process[i];
|
|---|
| 95 | process[i] = 0;
|
|---|
| 96 | }
|
|---|
| 97 | }
|
|---|
| [968] | 98 | }
|
|---|
| [1055] | 99 | if(n_extra > 0) {
|
|---|
| 100 | for(i=0; i<n_extra; i++) {
|
|---|
| 101 | if(extraProcess[i]) {
|
|---|
| 102 | //G4cout << "G4HadronicProcessStore::Clean() delete extra "
|
|---|
| 103 | // << i << G4endl;
|
|---|
| 104 | //G4cout << extraProcess[i]->GetProcessName() << G4endl;
|
|---|
| 105 | delete extraProcess[i];
|
|---|
| 106 | extraProcess[i] = 0;
|
|---|
| 107 | }
|
|---|
| 108 | }
|
|---|
| 109 | }
|
|---|
| 110 | //G4cout << "G4HadronicProcessStore::Clean() done" << G4endl;
|
|---|
| 111 | n_extra = 0;
|
|---|
| 112 | n_proc = 0;
|
|---|
| [968] | 113 | }
|
|---|
| 114 |
|
|---|
| 115 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 116 |
|
|---|
| 117 | G4HadronicProcessStore::G4HadronicProcessStore()
|
|---|
| 118 | {
|
|---|
| 119 | n_proc = 0;
|
|---|
| 120 | n_part = 0;
|
|---|
| 121 | n_model= 0;
|
|---|
| 122 | n_extra= 0;
|
|---|
| 123 | currentProcess = 0;
|
|---|
| 124 | currentParticle = 0;
|
|---|
| 125 | verbose = 1;
|
|---|
| 126 | buildTableStart = true;
|
|---|
| 127 | }
|
|---|
| 128 |
|
|---|
| 129 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 130 |
|
|---|
| 131 | G4double G4HadronicProcessStore::GetElasticCrossSectionPerVolume(
|
|---|
| 132 | const G4ParticleDefinition *aParticle,
|
|---|
| 133 | G4double kineticEnergy,
|
|---|
| 134 | const G4Material *material)
|
|---|
| 135 | {
|
|---|
| 136 | G4double cross = 0.0;
|
|---|
| 137 | const G4ElementVector* theElementVector = material->GetElementVector();
|
|---|
| 138 | const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
|
|---|
| 139 | size_t nelm = material->GetNumberOfElements();
|
|---|
| 140 | for (size_t i=0; i<nelm; i++) {
|
|---|
| 141 | const G4Element* elm = (*theElementVector)[i];
|
|---|
| 142 | cross += theAtomNumDensityVector[i]*
|
|---|
| 143 | GetElasticCrossSectionPerAtom(aParticle,kineticEnergy,elm);
|
|---|
| 144 | }
|
|---|
| 145 | return cross;
|
|---|
| 146 | }
|
|---|
| 147 |
|
|---|
| 148 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 149 |
|
|---|
| 150 | G4double G4HadronicProcessStore::GetElasticCrossSectionPerAtom(
|
|---|
| 151 | const G4ParticleDefinition *aParticle,
|
|---|
| 152 | G4double kineticEnergy,
|
|---|
| 153 | const G4Element *anElement)
|
|---|
| 154 | {
|
|---|
| 155 | G4HadronicProcess* hp = FindProcess(aParticle, fHadronElastic);
|
|---|
| 156 | localDP.SetKineticEnergy(kineticEnergy);
|
|---|
| 157 | G4double cross = 0.0;
|
|---|
| 158 | if(hp) cross = hp->GetMicroscopicCrossSection(&localDP,
|
|---|
| 159 | anElement,
|
|---|
| 160 | STP_Temperature);
|
|---|
| 161 | return cross;
|
|---|
| 162 | }
|
|---|
| 163 |
|
|---|
| 164 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 165 |
|
|---|
| 166 | G4double G4HadronicProcessStore::GetElasticCrossSectionPerIsotope(
|
|---|
| 167 | const G4ParticleDefinition*,
|
|---|
| 168 | G4double,
|
|---|
| 169 | G4int, G4int)
|
|---|
| 170 | {
|
|---|
| 171 | return 0.0;
|
|---|
| 172 | }
|
|---|
| 173 |
|
|---|
| 174 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 175 |
|
|---|
| 176 | G4double G4HadronicProcessStore::GetInelasticCrossSectionPerVolume(
|
|---|
| 177 | const G4ParticleDefinition *aParticle,
|
|---|
| 178 | G4double kineticEnergy,
|
|---|
| 179 | const G4Material *material)
|
|---|
| 180 | {
|
|---|
| 181 | G4double cross = 0.0;
|
|---|
| 182 | const G4ElementVector* theElementVector = material->GetElementVector();
|
|---|
| 183 | const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
|
|---|
| 184 | size_t nelm = material->GetNumberOfElements();
|
|---|
| 185 | for (size_t i=0; i<nelm; i++) {
|
|---|
| 186 | const G4Element* elm = (*theElementVector)[i];
|
|---|
| 187 | cross += theAtomNumDensityVector[i]*
|
|---|
| 188 | GetInelasticCrossSectionPerAtom(aParticle,kineticEnergy,elm);
|
|---|
| 189 | }
|
|---|
| 190 | return cross;
|
|---|
| 191 | }
|
|---|
| 192 |
|
|---|
| 193 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 194 |
|
|---|
| 195 | G4double G4HadronicProcessStore::GetInelasticCrossSectionPerAtom(
|
|---|
| 196 | const G4ParticleDefinition *aParticle,
|
|---|
| 197 | G4double kineticEnergy,
|
|---|
| 198 | const G4Element *anElement)
|
|---|
| 199 | {
|
|---|
| 200 | G4HadronicProcess* hp = FindProcess(aParticle, fHadronInelastic);
|
|---|
| 201 | localDP.SetDefinition(const_cast<G4ParticleDefinition*>(aParticle));
|
|---|
| 202 | localDP.SetKineticEnergy(kineticEnergy);
|
|---|
| 203 | G4double cross = 0.0;
|
|---|
| 204 | if(hp) cross = hp->GetMicroscopicCrossSection(&localDP,
|
|---|
| 205 | anElement,
|
|---|
| 206 | STP_Temperature);
|
|---|
| 207 | return cross;
|
|---|
| 208 | }
|
|---|
| 209 |
|
|---|
| 210 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 211 |
|
|---|
| 212 | G4double G4HadronicProcessStore::GetInelasticCrossSectionPerIsotope(
|
|---|
| 213 | const G4ParticleDefinition *,
|
|---|
| 214 | G4double,
|
|---|
| 215 | G4int, G4int)
|
|---|
| 216 | {
|
|---|
| 217 | return 0.0;
|
|---|
| 218 | }
|
|---|
| 219 |
|
|---|
| 220 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 221 |
|
|---|
| 222 | G4double G4HadronicProcessStore::GetCaptureCrossSectionPerVolume(
|
|---|
| 223 | const G4ParticleDefinition *aParticle,
|
|---|
| 224 | G4double kineticEnergy,
|
|---|
| 225 | const G4Material *material)
|
|---|
| 226 | {
|
|---|
| 227 | G4double cross = 0.0;
|
|---|
| 228 | const G4ElementVector* theElementVector = material->GetElementVector();
|
|---|
| 229 | const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
|
|---|
| 230 | size_t nelm = material->GetNumberOfElements();
|
|---|
| 231 | for (size_t i=0; i<nelm; i++) {
|
|---|
| 232 | const G4Element* elm = (*theElementVector)[i];
|
|---|
| 233 | cross += theAtomNumDensityVector[i]*
|
|---|
| 234 | GetCaptureCrossSectionPerAtom(aParticle,kineticEnergy,elm);
|
|---|
| 235 | }
|
|---|
| 236 | return cross;
|
|---|
| 237 | }
|
|---|
| 238 |
|
|---|
| 239 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 240 |
|
|---|
| 241 | G4double G4HadronicProcessStore::GetCaptureCrossSectionPerAtom(
|
|---|
| 242 | const G4ParticleDefinition *aParticle,
|
|---|
| 243 | G4double kineticEnergy,
|
|---|
| 244 | const G4Element *anElement)
|
|---|
| 245 | {
|
|---|
| 246 | G4HadronicProcess* hp = FindProcess(aParticle, fCapture);
|
|---|
| 247 | localDP.SetDefinition(const_cast<G4ParticleDefinition*>(aParticle));
|
|---|
| 248 | localDP.SetKineticEnergy(kineticEnergy);
|
|---|
| 249 | G4double cross = 0.0;
|
|---|
| 250 | if(hp) cross = hp->GetMicroscopicCrossSection(&localDP,
|
|---|
| 251 | anElement,
|
|---|
| 252 | STP_Temperature);
|
|---|
| 253 | return cross;
|
|---|
| 254 | }
|
|---|
| 255 |
|
|---|
| 256 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 257 |
|
|---|
| 258 | G4double G4HadronicProcessStore::GetCaptureCrossSectionPerIsotope(
|
|---|
| 259 | const G4ParticleDefinition *,
|
|---|
| 260 | G4double,
|
|---|
| 261 | G4int, G4int)
|
|---|
| 262 | {
|
|---|
| 263 | return 0.0;
|
|---|
| 264 | }
|
|---|
| 265 |
|
|---|
| 266 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 267 |
|
|---|
| 268 | G4double G4HadronicProcessStore::GetFissionCrossSectionPerVolume(
|
|---|
| 269 | const G4ParticleDefinition *aParticle,
|
|---|
| 270 | G4double kineticEnergy,
|
|---|
| 271 | const G4Material *material)
|
|---|
| 272 | {
|
|---|
| 273 | G4double cross = 0.0;
|
|---|
| 274 | const G4ElementVector* theElementVector = material->GetElementVector();
|
|---|
| 275 | const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
|
|---|
| 276 | size_t nelm = material->GetNumberOfElements();
|
|---|
| 277 | for (size_t i=0; i<nelm; i++) {
|
|---|
| 278 | const G4Element* elm = (*theElementVector)[i];
|
|---|
| 279 | cross += theAtomNumDensityVector[i]*
|
|---|
| 280 | GetFissionCrossSectionPerAtom(aParticle,kineticEnergy,elm);
|
|---|
| 281 | }
|
|---|
| 282 | return cross;
|
|---|
| 283 | }
|
|---|
| 284 |
|
|---|
| 285 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 286 |
|
|---|
| 287 | G4double G4HadronicProcessStore::GetFissionCrossSectionPerAtom(
|
|---|
| 288 | const G4ParticleDefinition *aParticle,
|
|---|
| 289 | G4double kineticEnergy,
|
|---|
| 290 | const G4Element *anElement)
|
|---|
| 291 | {
|
|---|
| 292 | G4HadronicProcess* hp = FindProcess(aParticle, fFission);
|
|---|
| 293 | localDP.SetDefinition(const_cast<G4ParticleDefinition*>(aParticle));
|
|---|
| 294 | localDP.SetKineticEnergy(kineticEnergy);
|
|---|
| 295 | G4double cross = 0.0;
|
|---|
| 296 | if(hp) cross = hp->GetMicroscopicCrossSection(&localDP,
|
|---|
| 297 | anElement,
|
|---|
| 298 | STP_Temperature);
|
|---|
| 299 | return cross;
|
|---|
| 300 | }
|
|---|
| 301 |
|
|---|
| 302 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 303 |
|
|---|
| 304 | G4double G4HadronicProcessStore::GetFissionCrossSectionPerIsotope(
|
|---|
| 305 | const G4ParticleDefinition *,
|
|---|
| 306 | G4double,
|
|---|
| 307 | G4int, G4int)
|
|---|
| 308 | {
|
|---|
| 309 | return 0.0;
|
|---|
| 310 | }
|
|---|
| 311 |
|
|---|
| 312 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 313 |
|
|---|
| 314 | G4double G4HadronicProcessStore::GetChargeExchangeCrossSectionPerVolume(
|
|---|
| 315 | const G4ParticleDefinition *aParticle,
|
|---|
| 316 | G4double kineticEnergy,
|
|---|
| 317 | const G4Material *material)
|
|---|
| 318 | {
|
|---|
| 319 | G4double cross = 0.0;
|
|---|
| 320 | const G4ElementVector* theElementVector = material->GetElementVector();
|
|---|
| 321 | const G4double* theAtomNumDensityVector = material->GetVecNbOfAtomsPerVolume();
|
|---|
| 322 | size_t nelm = material->GetNumberOfElements();
|
|---|
| 323 | for (size_t i=0; i<nelm; i++) {
|
|---|
| 324 | const G4Element* elm = (*theElementVector)[i];
|
|---|
| 325 | cross += theAtomNumDensityVector[i]*
|
|---|
| 326 | GetChargeExchangeCrossSectionPerAtom(aParticle,kineticEnergy,elm);
|
|---|
| 327 | }
|
|---|
| 328 | return cross;
|
|---|
| 329 | }
|
|---|
| 330 |
|
|---|
| 331 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 332 |
|
|---|
| 333 | G4double G4HadronicProcessStore::GetChargeExchangeCrossSectionPerAtom(
|
|---|
| 334 | const G4ParticleDefinition *aParticle,
|
|---|
| 335 | G4double kineticEnergy,
|
|---|
| 336 | const G4Element *anElement)
|
|---|
| 337 | {
|
|---|
| 338 | G4HadronicProcess* hp = FindProcess(aParticle, fChargeExchange);
|
|---|
| 339 | localDP.SetDefinition(const_cast<G4ParticleDefinition*>(aParticle));
|
|---|
| 340 | localDP.SetKineticEnergy(kineticEnergy);
|
|---|
| 341 | G4double cross = 0.0;
|
|---|
| 342 | if(hp) cross = hp->GetMicroscopicCrossSection(&localDP,
|
|---|
| 343 | anElement,
|
|---|
| 344 | STP_Temperature);
|
|---|
| 345 | return cross;
|
|---|
| 346 | }
|
|---|
| 347 |
|
|---|
| 348 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 349 |
|
|---|
| 350 | G4double G4HadronicProcessStore::GetChargeExchangeCrossSectionPerIsotope(
|
|---|
| 351 | const G4ParticleDefinition *,
|
|---|
| 352 | G4double,
|
|---|
| 353 | G4int, G4int)
|
|---|
| 354 | {
|
|---|
| 355 | return 0.0;
|
|---|
| 356 | }
|
|---|
| 357 |
|
|---|
| 358 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 359 |
|
|---|
| 360 | void G4HadronicProcessStore::Register(G4HadronicProcess* proc)
|
|---|
| 361 | {
|
|---|
| [1055] | 362 | if(0 < n_proc) {
|
|---|
| 363 | for(G4int i=0; i<n_proc; i++) {
|
|---|
| 364 | if(process[i] == proc) return;
|
|---|
| 365 | }
|
|---|
| 366 | }
|
|---|
| 367 | //G4cout << "G4HadronicProcessStore::Register hadronic " << n_proc
|
|---|
| 368 | // << " " << proc->GetProcessName() << G4endl;
|
|---|
| [968] | 369 | n_proc++;
|
|---|
| 370 | process.push_back(proc);
|
|---|
| 371 | }
|
|---|
| 372 |
|
|---|
| 373 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 374 |
|
|---|
| 375 | void G4HadronicProcessStore::RegisterParticle(G4HadronicProcess* proc,
|
|---|
| 376 | const G4ParticleDefinition* part)
|
|---|
| 377 | {
|
|---|
| 378 | G4int i=0;
|
|---|
| 379 | for(; i<n_proc; i++) {if(process[i] == proc) break;}
|
|---|
| 380 | G4int j=0;
|
|---|
| 381 | for(; j<n_part; j++) {if(particle[j] == part) break;}
|
|---|
| 382 |
|
|---|
| 383 | if(j == n_part) {
|
|---|
| 384 | n_part++;
|
|---|
| 385 | particle.push_back(part);
|
|---|
| 386 | wasPrinted.push_back(0);
|
|---|
| 387 | }
|
|---|
| 388 |
|
|---|
| 389 | // the pair should be added?
|
|---|
| 390 | if(i < n_proc) {
|
|---|
| 391 | std::multimap<PD,HP,std::less<PD> >::iterator it;
|
|---|
| 392 | for(it=p_map.lower_bound(part); it!=p_map.upper_bound(part); ++it) {
|
|---|
| 393 | if(it->first == part) {
|
|---|
| 394 | HP process = (it->second);
|
|---|
| 395 | if(proc == process) return;
|
|---|
| 396 | }
|
|---|
| 397 | }
|
|---|
| 398 | }
|
|---|
| 399 |
|
|---|
| 400 | p_map.insert(std::multimap<PD,HP>::value_type(part,proc));
|
|---|
| 401 | }
|
|---|
| 402 |
|
|---|
| 403 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 404 |
|
|---|
| 405 | void G4HadronicProcessStore::RegisterInteraction(G4HadronicProcess* proc,
|
|---|
| 406 | G4HadronicInteraction* mod)
|
|---|
| 407 | {
|
|---|
| 408 | G4int i=0;
|
|---|
| 409 | for(; i<n_proc; i++) {if(process[i] == proc) break;}
|
|---|
| 410 | G4int k=0;
|
|---|
| 411 | for(; k<n_model; k++) {if(model[k] == mod) break;}
|
|---|
| 412 |
|
|---|
| 413 | m_map.insert(std::multimap<HP,HI>::value_type(proc,mod));
|
|---|
| 414 |
|
|---|
| 415 | if(k == n_model) {
|
|---|
| 416 | n_model++;
|
|---|
| 417 | model.push_back(mod);
|
|---|
| 418 | modelName.push_back(mod->GetModelName());
|
|---|
| 419 | }
|
|---|
| 420 | }
|
|---|
| 421 |
|
|---|
| 422 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 423 |
|
|---|
| 424 | void G4HadronicProcessStore::DeRegister(G4HadronicProcess* proc)
|
|---|
| 425 | {
|
|---|
| [1055] | 426 | if(0 == n_proc) return;
|
|---|
| [968] | 427 | for(G4int i=0; i<n_proc; i++) {
|
|---|
| 428 | if(process[i] == proc) {
|
|---|
| 429 | process[i] = 0;
|
|---|
| [1055] | 430 | return;
|
|---|
| [968] | 431 | }
|
|---|
| 432 | }
|
|---|
| 433 | }
|
|---|
| 434 |
|
|---|
| 435 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 436 |
|
|---|
| 437 | void G4HadronicProcessStore::RegisterExtraProcess(G4VProcess* proc)
|
|---|
| 438 | {
|
|---|
| [1055] | 439 | if(0 < n_extra) {
|
|---|
| 440 | for(G4int i=0; i<n_extra; i++) {
|
|---|
| 441 | if(extraProcess[i] == proc) return;
|
|---|
| 442 | }
|
|---|
| 443 | }
|
|---|
| 444 | //G4cout << "Extra Process: " << n_extra << " " << proc->GetProcessName()
|
|---|
| 445 | // << " " << proc << G4endl;
|
|---|
| [968] | 446 |
|
|---|
| 447 | n_extra++;
|
|---|
| 448 | extraProcess.push_back(proc);
|
|---|
| 449 | }
|
|---|
| 450 |
|
|---|
| 451 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 452 |
|
|---|
| 453 | void G4HadronicProcessStore::RegisterParticleForExtraProcess(
|
|---|
| 454 | G4VProcess* proc,
|
|---|
| 455 | const G4ParticleDefinition* part)
|
|---|
| 456 | {
|
|---|
| 457 | G4int i=0;
|
|---|
| 458 | for(; i<n_extra; i++) {if(extraProcess[i] == proc) break;}
|
|---|
| 459 | G4int j=0;
|
|---|
| 460 | for(; j<n_part; j++) {if(particle[j] == part) break;}
|
|---|
| 461 |
|
|---|
| 462 | if(j == n_part) {
|
|---|
| 463 | n_part++;
|
|---|
| 464 | particle.push_back(part);
|
|---|
| 465 | wasPrinted.push_back(0);
|
|---|
| 466 | }
|
|---|
| 467 |
|
|---|
| 468 | // the pair should be added?
|
|---|
| 469 | if(i < n_extra) {
|
|---|
| 470 | std::multimap<PD,G4VProcess*,std::less<PD> >::iterator it;
|
|---|
| 471 | for(it=ep_map.lower_bound(part); it!=ep_map.upper_bound(part); ++it) {
|
|---|
| 472 | if(it->first == part) {
|
|---|
| 473 | G4VProcess* process = (it->second);
|
|---|
| 474 | if(proc == process) return;
|
|---|
| 475 | }
|
|---|
| 476 | }
|
|---|
| 477 | }
|
|---|
| 478 |
|
|---|
| 479 | ep_map.insert(std::multimap<PD,G4VProcess*>::value_type(part,proc));
|
|---|
| 480 | }
|
|---|
| 481 |
|
|---|
| 482 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 483 |
|
|---|
| 484 | void G4HadronicProcessStore::DeRegisterExtraProcess(G4VProcess* proc)
|
|---|
| 485 | {
|
|---|
| [1055] | 486 | //G4cout << "Deregister Extra Process: " << proc << " " << proc->GetProcessName() << G4endl;
|
|---|
| 487 | if(0 == n_extra) return;
|
|---|
| [968] | 488 | for(G4int i=0; i<n_extra; i++) {
|
|---|
| 489 | if(extraProcess[i] == proc) {
|
|---|
| 490 | extraProcess[i] = 0;
|
|---|
| [1055] | 491 | //G4cout << "Extra Process: " << i << " is deregisted " << G4endl;
|
|---|
| 492 | return;
|
|---|
| [968] | 493 | }
|
|---|
| 494 | }
|
|---|
| 495 | }
|
|---|
| 496 |
|
|---|
| 497 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 498 |
|
|---|
| 499 | void G4HadronicProcessStore::PrintInfo(const G4ParticleDefinition* part)
|
|---|
| 500 | {
|
|---|
| 501 | if(buildTableStart && part == particle[n_part - 1]) {
|
|---|
| 502 | buildTableStart = false;
|
|---|
| 503 | Dump(verbose);
|
|---|
| 504 | }
|
|---|
| 505 | }
|
|---|
| 506 |
|
|---|
| 507 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 508 |
|
|---|
| 509 | void G4HadronicProcessStore::Dump(G4int level)
|
|---|
| 510 | {
|
|---|
| 511 | if(level > 0) {
|
|---|
| 512 | G4cout << "=============================================================="
|
|---|
| 513 | << "=============================="
|
|---|
| 514 | << G4endl;
|
|---|
| 515 | G4cout << " HADRONIC PROCESSES SUMMARY (verbose level " << level
|
|---|
| 516 | << ")" << G4endl;
|
|---|
| 517 | }
|
|---|
| 518 | for(G4int i=0; i<n_part; i++) {
|
|---|
| 519 | PD part = particle[i];
|
|---|
| 520 | G4String pname = part->GetParticleName();
|
|---|
| 521 | G4bool yes = false;
|
|---|
| 522 | if(level >= 2) yes = true;
|
|---|
| 523 | else if(level == 1 && (pname == "proton" ||
|
|---|
| 524 | pname == "neutron" ||
|
|---|
| 525 | pname == "pi+" ||
|
|---|
| 526 | pname == "pi-" ||
|
|---|
| 527 | pname == "gamma" ||
|
|---|
| 528 | pname == "e-" ||
|
|---|
| 529 | pname == "mu-" ||
|
|---|
| 530 | pname == "kaon+" ||
|
|---|
| 531 | pname == "kaon-" ||
|
|---|
| 532 | pname == "lambda" ||
|
|---|
| 533 | pname == "anti_neutron" ||
|
|---|
| 534 | pname == "anti_proton")) yes = true;
|
|---|
| 535 | if(yes) {
|
|---|
| 536 | // main processes
|
|---|
| 537 | std::multimap<PD,HP,std::less<PD> >::iterator it;
|
|---|
| 538 | for(it=p_map.lower_bound(part); it!=p_map.upper_bound(part); ++it) {
|
|---|
| 539 | if(it->first == part) {
|
|---|
| 540 | HP proc = (it->second);
|
|---|
| 541 | G4int j=0;
|
|---|
| 542 | for(; j<n_proc; j++) {
|
|---|
| 543 | if(process[j] == proc) {
|
|---|
| 544 | Print(j, i);
|
|---|
| 545 | }
|
|---|
| 546 | }
|
|---|
| 547 | }
|
|---|
| 548 | }
|
|---|
| 549 | // extra processes
|
|---|
| 550 | std::multimap<PD,G4VProcess*,std::less<PD> >::iterator itp;
|
|---|
| 551 | for(itp=ep_map.lower_bound(part); itp!=ep_map.upper_bound(part); ++itp) {
|
|---|
| 552 | if(itp->first == part) {
|
|---|
| 553 | G4VProcess* proc = (itp->second);
|
|---|
| 554 | if(wasPrinted[i] == 0) {
|
|---|
| 555 | wasPrinted[i] = 1;
|
|---|
| 556 | G4cout<<G4endl;
|
|---|
| 557 | G4cout << " Hadronic Processes for <"
|
|---|
| 558 | <<part->GetParticleName() << ">" << G4endl;
|
|---|
| 559 | }
|
|---|
| 560 | G4cout << " " << proc->GetProcessName() << G4endl;
|
|---|
| 561 | }
|
|---|
| 562 | }
|
|---|
| 563 | }
|
|---|
| 564 | }
|
|---|
| 565 | if(level > 0) {
|
|---|
| 566 | G4cout << "=============================================================="
|
|---|
| 567 | << "=============================="
|
|---|
| 568 | << G4endl;
|
|---|
| 569 | }
|
|---|
| 570 | }
|
|---|
| 571 |
|
|---|
| 572 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 573 |
|
|---|
| 574 | void G4HadronicProcessStore::Print(G4int idxProc, G4int idxPart)
|
|---|
| 575 | {
|
|---|
| 576 | G4HadronicProcess* proc = process[idxProc];
|
|---|
| 577 | const G4ParticleDefinition* part = particle[idxPart];
|
|---|
| 578 | if(wasPrinted[idxPart] == 0) {
|
|---|
| 579 | wasPrinted[idxPart] = 1;
|
|---|
| 580 | G4cout<<G4endl;
|
|---|
| 581 | G4cout << " Hadronic Processes for <"
|
|---|
| 582 | <<part->GetParticleName() << ">" << G4endl;
|
|---|
| 583 | }
|
|---|
| 584 | HI hi = 0;
|
|---|
| 585 | G4bool first;
|
|---|
| 586 | std::multimap<HP,HI,std::less<HP> >::iterator ih;
|
|---|
| 587 | G4cout << std::setw(20) << proc->GetProcessName()
|
|---|
| 588 | << " Models: ";
|
|---|
| 589 | first = true;
|
|---|
| 590 | for(ih=m_map.lower_bound(proc); ih!=m_map.upper_bound(proc); ++ih) {
|
|---|
| 591 | if(ih->first == proc) {
|
|---|
| 592 | hi = ih->second;
|
|---|
| 593 | G4int i=0;
|
|---|
| 594 | for(; i<n_model; i++) {
|
|---|
| 595 | if(model[i] == hi) break;
|
|---|
| 596 | }
|
|---|
| 597 | if(!first) G4cout << " ";
|
|---|
| 598 | first = false;
|
|---|
| 599 | G4cout << std::setw(25) << modelName[i]
|
|---|
| 600 | << ": Emin(GeV)= "
|
|---|
| 601 | << std::setw(5) << hi->GetMinEnergy()/GeV
|
|---|
| 602 | << " Emax(GeV)= "
|
|---|
| 603 | << hi->GetMaxEnergy()/GeV
|
|---|
| 604 | << G4endl;
|
|---|
| 605 | }
|
|---|
| 606 | }
|
|---|
| 607 | }
|
|---|
| 608 |
|
|---|
| 609 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 610 |
|
|---|
| 611 | void G4HadronicProcessStore::SetVerbose(G4int val)
|
|---|
| 612 | {
|
|---|
| 613 | verbose = val;
|
|---|
| 614 | G4int i;
|
|---|
| 615 | for(i=0; i<n_proc; i++) {
|
|---|
| 616 | if(process[i]) process[i]->SetVerboseLevel(val);
|
|---|
| 617 | }
|
|---|
| 618 | for(i=0; i<n_model; i++) {
|
|---|
| 619 | if(model[i]) model[i]->SetVerboseLevel(val);
|
|---|
| 620 | }
|
|---|
| 621 | }
|
|---|
| 622 |
|
|---|
| 623 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 624 |
|
|---|
| 625 | G4int G4HadronicProcessStore::GetVerbose()
|
|---|
| 626 | {
|
|---|
| 627 | return verbose;
|
|---|
| 628 | }
|
|---|
| 629 |
|
|---|
| 630 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|
| 631 |
|
|---|
| 632 | G4HadronicProcess* G4HadronicProcessStore::FindProcess(
|
|---|
| 633 | const G4ParticleDefinition* part, G4HadronicProcessType subType)
|
|---|
| 634 | {
|
|---|
| 635 | bool isNew = false;
|
|---|
| 636 | G4HadronicProcess* hp = 0;
|
|---|
| 637 |
|
|---|
| 638 | if(part != currentParticle) {
|
|---|
| 639 | isNew = true;
|
|---|
| 640 | currentParticle = part;
|
|---|
| 641 | localDP.SetDefinition(const_cast<G4ParticleDefinition*>(part));
|
|---|
| 642 | } else if(!currentProcess) {
|
|---|
| 643 | isNew = true;
|
|---|
| 644 | } else if(subType == currentProcess->GetProcessSubType()) {
|
|---|
| 645 | hp = currentProcess;
|
|---|
| 646 | } else {
|
|---|
| 647 | isNew = true;
|
|---|
| 648 | }
|
|---|
| 649 |
|
|---|
| 650 | if(isNew) {
|
|---|
| 651 | std::multimap<PD,HP,std::less<PD> >::iterator it;
|
|---|
| 652 | for(it=p_map.lower_bound(part); it!=p_map.upper_bound(part); ++it) {
|
|---|
| 653 | if(it->first == part && subType == (it->second)->GetProcessSubType()) {
|
|---|
| 654 | hp = it->second;
|
|---|
| 655 | break;
|
|---|
| 656 | }
|
|---|
| 657 | }
|
|---|
| 658 | currentProcess = hp;
|
|---|
| 659 | }
|
|---|
| 660 |
|
|---|
| 661 | return hp;
|
|---|
| 662 | }
|
|---|
| 663 |
|
|---|
| 664 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
|
|---|