[1206] | 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 | // |
---|
| 26 | // $Id: G4VHadronPhysics.cc,v 1.3 2009/11/25 19:33:18 vnivanch Exp $ |
---|
[1228] | 27 | // GEANT4 tag $Name: geant4-09-03 $ |
---|
[1206] | 28 | // |
---|
| 29 | //--------------------------------------------------------------------------- |
---|
| 30 | // |
---|
| 31 | // ClassName: G4VHadronPhysics |
---|
| 32 | // |
---|
| 33 | // Author: 28 June 2009 V.Ivanchenko |
---|
| 34 | // |
---|
| 35 | // Modified: |
---|
| 36 | // |
---|
| 37 | //---------------------------------------------------------------------------- |
---|
| 38 | // |
---|
| 39 | |
---|
| 40 | #include "G4VHadronPhysics.hh" |
---|
| 41 | #include "G4ParticleDefinition.hh" |
---|
| 42 | #include "G4VCrossSectionDataSet.hh" |
---|
| 43 | #include "G4HadronicProcessType.hh" |
---|
| 44 | #include "G4HadronicProcessStore.hh" |
---|
| 45 | #include "G4HadronInelasticProcess.hh" |
---|
| 46 | #include "G4HadronElasticProcess.hh" |
---|
| 47 | #include "G4HadronCaptureProcess.hh" |
---|
| 48 | #include "G4HadronFissionProcess.hh" |
---|
| 49 | #include "G4Neutron.hh" |
---|
| 50 | #include "G4MesonConstructor.hh" |
---|
| 51 | #include "G4BaryonConstructor.hh" |
---|
| 52 | #include "G4IonConstructor.hh" |
---|
| 53 | #include "G4ShortLivedConstructor.hh" |
---|
| 54 | #include "G4ProcessVector.hh" |
---|
| 55 | #include "G4ProcessManager.hh" |
---|
| 56 | |
---|
| 57 | G4VHadronPhysics::G4VHadronPhysics(const G4String& aName, G4int verb) |
---|
| 58 | : G4VPhysicsConstructor(aName) |
---|
| 59 | { |
---|
| 60 | SetVerboseLevel(verb); |
---|
| 61 | if (verboseLevel>1) { |
---|
| 62 | G4cout << "### G4VHadronPhysics: <" << aName << "> is created " |
---|
| 63 | << G4endl; |
---|
| 64 | } |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | G4VHadronPhysics::~G4VHadronPhysics() |
---|
| 68 | { |
---|
| 69 | G4int n = builders.size(); |
---|
| 70 | if(n > 0) { |
---|
| 71 | for(G4int i=0; i<n; i++) {delete builders[i];} |
---|
| 72 | } |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | void G4VHadronPhysics::ConstructParticle() |
---|
| 76 | { |
---|
| 77 | G4MesonConstructor pMesonConstructor; |
---|
| 78 | pMesonConstructor.ConstructParticle(); |
---|
| 79 | |
---|
| 80 | G4BaryonConstructor pBaryonConstructor; |
---|
| 81 | pBaryonConstructor.ConstructParticle(); |
---|
| 82 | |
---|
| 83 | G4IonConstructor pIonConstructor; |
---|
| 84 | pIonConstructor.ConstructParticle(); |
---|
| 85 | |
---|
| 86 | G4ShortLivedConstructor pShortLivedConstructor; |
---|
| 87 | pShortLivedConstructor.ConstructParticle(); |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | G4HadronicInteraction* |
---|
| 91 | G4VHadronPhysics::BuildModel(G4VHadronModelBuilder* mBuilder, |
---|
| 92 | G4double emin, |
---|
| 93 | G4double emax) |
---|
| 94 | { |
---|
| 95 | builders.push_back(mBuilder); |
---|
| 96 | G4HadronicInteraction* model = mBuilder->GetModel(); |
---|
| 97 | model->SetMinEnergy(emin); |
---|
| 98 | model->SetMaxEnergy(emax); |
---|
| 99 | if (verboseLevel>1) { |
---|
| 100 | G4cout << "### G4VHadronPhysics <" |
---|
| 101 | << model->GetModelName() << " Emin(GeV)= " |
---|
| 102 | << emin/GeV << " Emax(GeV)= " << emax/GeV |
---|
| 103 | << G4endl; |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | return model; |
---|
| 107 | } |
---|
| 108 | |
---|
| 109 | G4HadronicInteraction* |
---|
| 110 | G4VHadronPhysics::NewModel(G4HadronicInteraction* model, |
---|
| 111 | G4double emin, |
---|
| 112 | G4double emax) |
---|
| 113 | { |
---|
| 114 | if(!model) return model; |
---|
| 115 | model->SetMinEnergy(emin); |
---|
| 116 | model->SetMaxEnergy(emax); |
---|
| 117 | if (verboseLevel>1) { |
---|
| 118 | G4cout << "### G4VHadronPhysics <" |
---|
| 119 | << model->GetModelName() << " Emin(GeV)= " |
---|
| 120 | << emin/GeV << " Emax(GeV)= " << emax/GeV |
---|
| 121 | << G4endl; |
---|
| 122 | } |
---|
| 123 | return model; |
---|
| 124 | } |
---|
| 125 | |
---|
| 126 | void |
---|
| 127 | G4VHadronPhysics::AddInelasticCrossSection(const G4String& pname, |
---|
| 128 | G4VCrossSectionDataSet* xsec) |
---|
| 129 | { |
---|
| 130 | const G4ParticleDefinition* p = |
---|
| 131 | G4ParticleTable::GetParticleTable()->FindParticle(pname); |
---|
| 132 | if(!p) { |
---|
| 133 | G4cout << "### G4VHadronPhysics WARNING: fails to find particle " |
---|
| 134 | << pname << G4endl; |
---|
| 135 | } else { |
---|
| 136 | AddInelasticCrossSection(p, xsec); |
---|
| 137 | } |
---|
| 138 | } |
---|
| 139 | |
---|
| 140 | void |
---|
| 141 | G4VHadronPhysics::AddInelasticCrossSection(const G4ParticleDefinition* p, |
---|
| 142 | G4VCrossSectionDataSet* xsec) |
---|
| 143 | { |
---|
| 144 | if(!p) return; |
---|
| 145 | G4HadronicProcess* had = FindInelasticProcess(p); |
---|
| 146 | if(!had) return; |
---|
| 147 | had->AddDataSet(xsec); |
---|
| 148 | if (verboseLevel>1) { |
---|
| 149 | G4cout << "### G4VHadronPhysics: the inelastic cross section " |
---|
| 150 | << " is added for " << p->GetParticleName() |
---|
| 151 | << G4endl; |
---|
| 152 | } |
---|
| 153 | } |
---|
| 154 | |
---|
| 155 | void |
---|
| 156 | G4VHadronPhysics::AddElasticCrossSection(const G4String& pname, |
---|
| 157 | G4VCrossSectionDataSet* xsec) |
---|
| 158 | { |
---|
| 159 | const G4ParticleDefinition* p = |
---|
| 160 | G4ParticleTable::GetParticleTable()->FindParticle(pname); |
---|
| 161 | if(!p) { |
---|
| 162 | G4cout << "### G4VHadronPhysics WARNING: fails to find particle " |
---|
| 163 | << pname << G4endl; |
---|
| 164 | } else { |
---|
| 165 | AddElasticCrossSection(p, xsec); |
---|
| 166 | } |
---|
| 167 | } |
---|
| 168 | |
---|
| 169 | void |
---|
| 170 | G4VHadronPhysics::AddElasticCrossSection(const G4ParticleDefinition* p, |
---|
| 171 | G4VCrossSectionDataSet* xsec) |
---|
| 172 | { |
---|
| 173 | if(!p) return; |
---|
| 174 | G4HadronicProcess* had = FindElasticProcess(p); |
---|
| 175 | if(!had) return; |
---|
| 176 | had->AddDataSet(xsec); |
---|
| 177 | if (verboseLevel>1) { |
---|
| 178 | G4cout << "### G4VHadronPhysics: the inelastic cross section " |
---|
| 179 | << " is added for " << p->GetParticleName() |
---|
| 180 | << G4endl; |
---|
| 181 | } |
---|
| 182 | } |
---|
| 183 | |
---|
| 184 | void |
---|
| 185 | G4VHadronPhysics::AddCaptureCrossSection(G4VCrossSectionDataSet* xsec) |
---|
| 186 | { |
---|
| 187 | G4HadronicProcess* had = FindCaptureProcess(); |
---|
| 188 | if(!had) return; |
---|
| 189 | had->AddDataSet(xsec); |
---|
| 190 | if (verboseLevel>1) { |
---|
| 191 | G4cout << "### G4VHadronPhysics: the capture cross section " |
---|
| 192 | << " is added for neutron" |
---|
| 193 | << G4endl; |
---|
| 194 | } |
---|
| 195 | } |
---|
| 196 | |
---|
| 197 | void |
---|
| 198 | G4VHadronPhysics::AddFissionCrossSection(G4VCrossSectionDataSet* xsec) |
---|
| 199 | { |
---|
| 200 | G4HadronicProcess* had = FindFissionProcess(); |
---|
| 201 | if(!had) return; |
---|
| 202 | had->AddDataSet(xsec); |
---|
| 203 | if (verboseLevel>1) { |
---|
| 204 | G4cout << "### G4VHadronPhysics: the fission cross section " |
---|
| 205 | << " is added for neutron" |
---|
| 206 | << G4endl; |
---|
| 207 | } |
---|
| 208 | } |
---|
| 209 | |
---|
| 210 | G4HadronicProcess* |
---|
| 211 | G4VHadronPhysics::FindInelasticProcess(const G4String& pname) |
---|
| 212 | { |
---|
| 213 | G4HadronicProcess* had = 0; |
---|
| 214 | const G4ParticleDefinition* p = |
---|
| 215 | G4ParticleTable::GetParticleTable()->FindParticle(pname); |
---|
| 216 | if(!p) { |
---|
| 217 | G4cout << "### G4VHadronPhysics WARNING: fails to find particle " |
---|
| 218 | << pname << G4endl; |
---|
| 219 | return had; |
---|
| 220 | } |
---|
| 221 | return FindInelasticProcess(p); |
---|
| 222 | } |
---|
| 223 | |
---|
| 224 | G4HadronicProcess* |
---|
| 225 | G4VHadronPhysics::FindInelasticProcess(const G4ParticleDefinition* p) |
---|
| 226 | { |
---|
| 227 | G4HadronicProcess* had = 0; |
---|
| 228 | if(!p) return had; |
---|
| 229 | G4ProcessManager* pmanager = p->GetProcessManager(); |
---|
| 230 | G4ProcessVector* pv = pmanager->GetProcessList(); |
---|
| 231 | size_t n = pv->size(); |
---|
| 232 | if(0 < n) { |
---|
| 233 | for(size_t i=0; i<n; ++i) { |
---|
| 234 | if(fHadronInelastic == ((*pv)[i])->GetProcessSubType()) { |
---|
| 235 | had = static_cast<G4HadronicProcess*>((*pv)[i]); |
---|
| 236 | return had; |
---|
| 237 | } |
---|
| 238 | } |
---|
| 239 | } |
---|
| 240 | G4ParticleDefinition* part = const_cast<G4ParticleDefinition*>(p); |
---|
| 241 | had = new G4HadronInelasticProcess("hInelastic",part); |
---|
| 242 | pmanager->AddDiscreteProcess(had); |
---|
| 243 | return had; |
---|
| 244 | } |
---|
| 245 | |
---|
| 246 | G4HadronicProcess* |
---|
| 247 | G4VHadronPhysics::FindElasticProcess(const G4String& pname) |
---|
| 248 | { |
---|
| 249 | G4HadronicProcess* had = 0; |
---|
| 250 | const G4ParticleDefinition* p = |
---|
| 251 | G4ParticleTable::GetParticleTable()->FindParticle(pname); |
---|
| 252 | if(!p) { |
---|
| 253 | G4cout << "### G4VHadronPhysics WARNING: fails to find particle " |
---|
| 254 | << pname << G4endl; |
---|
| 255 | return had; |
---|
| 256 | } |
---|
| 257 | return FindElasticProcess(p); |
---|
| 258 | } |
---|
| 259 | |
---|
| 260 | G4HadronicProcess* |
---|
| 261 | G4VHadronPhysics::FindElasticProcess(const G4ParticleDefinition* p) |
---|
| 262 | { |
---|
| 263 | G4HadronicProcess* had = 0; |
---|
| 264 | if(!p) return had; |
---|
| 265 | G4ProcessManager* pmanager = p->GetProcessManager(); |
---|
| 266 | G4ProcessVector* pv = pmanager->GetProcessList(); |
---|
| 267 | size_t n = pv->size(); |
---|
| 268 | if(0 < n) { |
---|
| 269 | for(size_t i=0; i<n; ++i) { |
---|
| 270 | if(fHadronElastic == ((*pv)[i])->GetProcessSubType()) { |
---|
| 271 | had = static_cast<G4HadronicProcess*>((*pv)[i]); |
---|
| 272 | return had; |
---|
| 273 | } |
---|
| 274 | } |
---|
| 275 | } |
---|
| 276 | had = new G4HadronElasticProcess("hElastic"); |
---|
| 277 | pmanager->AddDiscreteProcess(had); |
---|
| 278 | return had; |
---|
| 279 | } |
---|
| 280 | |
---|
| 281 | G4HadronicProcess* G4VHadronPhysics::FindCaptureProcess() |
---|
| 282 | { |
---|
| 283 | G4HadronicProcess* had = 0; |
---|
| 284 | G4ProcessManager* pmanager = |
---|
| 285 | G4Neutron::Neutron()->GetProcessManager(); |
---|
| 286 | G4ProcessVector* pv = pmanager->GetProcessList(); |
---|
| 287 | size_t n = pv->size(); |
---|
| 288 | if(0 < n) { |
---|
| 289 | for(size_t i=0; i<n; ++i) { |
---|
| 290 | if(fCapture == ((*pv)[i])->GetProcessSubType()) { |
---|
| 291 | had = static_cast<G4HadronicProcess*>((*pv)[i]); |
---|
| 292 | return had; |
---|
| 293 | } |
---|
| 294 | } |
---|
| 295 | } |
---|
| 296 | had = new G4HadronCaptureProcess("nCapture"); |
---|
| 297 | pmanager->AddDiscreteProcess(had); |
---|
| 298 | return had; |
---|
| 299 | } |
---|
| 300 | |
---|
| 301 | G4HadronicProcess* G4VHadronPhysics::FindFissionProcess() |
---|
| 302 | { |
---|
| 303 | G4HadronicProcess* had = 0; |
---|
| 304 | G4ProcessManager* pmanager = |
---|
| 305 | G4Neutron::Neutron()->GetProcessManager(); |
---|
| 306 | G4ProcessVector* pv = pmanager->GetProcessList(); |
---|
| 307 | size_t n = pv->size(); |
---|
| 308 | if(0 < n) { |
---|
| 309 | for(size_t i=0; i<n; ++i) { |
---|
| 310 | if(fFission == ((*pv)[i])->GetProcessSubType()) { |
---|
| 311 | had = static_cast<G4HadronicProcess*>((*pv)[i]); |
---|
| 312 | return had; |
---|
| 313 | } |
---|
| 314 | } |
---|
| 315 | } |
---|
| 316 | had = new G4HadronFissionProcess("nFission"); |
---|
| 317 | pmanager->AddDiscreteProcess(had); |
---|
| 318 | return had; |
---|
| 319 | } |
---|
| 320 | |
---|