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: G4CHIPSElasticXS.cc,v 1.2 2010/09/24 13:56:00 vnivanch Exp $ |
---|
27 | // GEANT4 tag $Name: geant4-09-03-ref-09 $ |
---|
28 | // |
---|
29 | // ------------------------------------------------------------------- |
---|
30 | // |
---|
31 | // GEANT4 Class file |
---|
32 | // |
---|
33 | // |
---|
34 | // File name: G4CHIPSElasticXS |
---|
35 | // |
---|
36 | // Author Ivantchenko, Geant4, 3-Aug-09 |
---|
37 | // |
---|
38 | // Modifications: |
---|
39 | // |
---|
40 | |
---|
41 | #include "G4CHIPSElasticXS.hh" |
---|
42 | #include "G4DynamicParticle.hh" |
---|
43 | #include "G4ParticleDefinition.hh" |
---|
44 | #include "G4Element.hh" |
---|
45 | #include "G4Proton.hh" |
---|
46 | #include "G4Neutron.hh" |
---|
47 | #include "G4VQCrossSection.hh" |
---|
48 | #include "G4QProtonElasticCrossSection.hh" |
---|
49 | #include "G4QNeutronElasticCrossSection.hh" |
---|
50 | |
---|
51 | G4CHIPSElasticXS::G4CHIPSElasticXS() |
---|
52 | : G4VCrossSectionDataSet("CHIPSElasticXS"), |
---|
53 | theProton(G4Proton::Proton()), |
---|
54 | theNeutron(G4Neutron::Neutron()), |
---|
55 | thEnergy(19*CLHEP::MeV), |
---|
56 | isInitialized(false) |
---|
57 | { |
---|
58 | // verboseLevel = 0; |
---|
59 | pCManager = G4QProtonElasticCrossSection::GetPointer(); |
---|
60 | nCManager = G4QNeutronElasticCrossSection::GetPointer(); |
---|
61 | } |
---|
62 | |
---|
63 | G4CHIPSElasticXS::~G4CHIPSElasticXS() |
---|
64 | {} |
---|
65 | |
---|
66 | G4bool |
---|
67 | G4CHIPSElasticXS::IsApplicable(const G4DynamicParticle* dyn, |
---|
68 | const G4Element* elm) |
---|
69 | { |
---|
70 | return (elm->GetZ() < 2.5 && dyn->GetKineticEnergy() > thEnergy); |
---|
71 | } |
---|
72 | |
---|
73 | G4bool |
---|
74 | G4CHIPSElasticXS::IsZAApplicable(const G4DynamicParticle* dyn, |
---|
75 | G4double ZZ, G4double /*AA*/) |
---|
76 | { |
---|
77 | return (ZZ < 2.5 && dyn->GetKineticEnergy() > thEnergy); |
---|
78 | } |
---|
79 | |
---|
80 | G4bool |
---|
81 | G4CHIPSElasticXS::IsIsoApplicable(const G4DynamicParticle* dyn, |
---|
82 | G4int Z, G4int /*N*/) |
---|
83 | { |
---|
84 | return (Z <= 2 && dyn->GetKineticEnergy() > thEnergy); |
---|
85 | } |
---|
86 | |
---|
87 | G4double |
---|
88 | G4CHIPSElasticXS::GetCrossSection(const G4DynamicParticle* aParticle, |
---|
89 | const G4Element* elm, |
---|
90 | G4double) |
---|
91 | { |
---|
92 | G4double xs = 0.0; |
---|
93 | G4int Z = G4int(elm->GetZ()); |
---|
94 | G4IsotopeVector* isv = elm->GetIsotopeVector(); |
---|
95 | G4int ni = 0; |
---|
96 | if(isv) { ni = isv->size(); } |
---|
97 | |
---|
98 | if(ni <= 1) { |
---|
99 | G4int A = G4int(elm->GetN()+0.5); |
---|
100 | xs = GetZandACrossSection(aParticle, Z, A); |
---|
101 | } else { |
---|
102 | G4double* ab = elm->GetRelativeAbundanceVector(); |
---|
103 | for(G4int j=0; j<ni; ++j) { |
---|
104 | G4int A = (*isv)[j]->GetN(); |
---|
105 | xs += ab[j]*GetZandACrossSection(aParticle, Z, A); |
---|
106 | } |
---|
107 | } |
---|
108 | |
---|
109 | if(verboseLevel > 1) { |
---|
110 | G4cout << "G4CHIPSElasticXS::GetCrossSection for " |
---|
111 | << theParticle->GetParticleName() |
---|
112 | << " on " << elm->GetName() |
---|
113 | << " ekin(MeV)= " << aParticle->GetKineticEnergy()/CLHEP::MeV |
---|
114 | << ", XSel(bn)= " << xs/CLHEP::barn << G4endl; |
---|
115 | } |
---|
116 | return xs; |
---|
117 | } |
---|
118 | |
---|
119 | G4double |
---|
120 | G4CHIPSElasticXS::GetIsoCrossSection(const G4DynamicParticle* p, |
---|
121 | const G4Isotope* iso, |
---|
122 | G4double) |
---|
123 | { |
---|
124 | return GetZandACrossSection(p, iso->GetZ(), iso->GetN()); |
---|
125 | } |
---|
126 | |
---|
127 | G4double |
---|
128 | G4CHIPSElasticXS::GetIsoZACrossSection(const G4DynamicParticle* p, |
---|
129 | G4double ZZ, |
---|
130 | G4double AA, |
---|
131 | G4double) |
---|
132 | { |
---|
133 | return GetZandACrossSection(p, G4int(ZZ), G4int(AA)); |
---|
134 | } |
---|
135 | |
---|
136 | G4double |
---|
137 | G4CHIPSElasticXS::GetZandACrossSection(const G4DynamicParticle* dyn, |
---|
138 | G4int Z, G4int A, G4double) |
---|
139 | { |
---|
140 | G4double momentum = dyn->GetTotalMomentum(); |
---|
141 | |
---|
142 | // only proton, deuteron and He4 x-sections |
---|
143 | G4int N = A - Z; |
---|
144 | if(Z == 1) { |
---|
145 | if(N > 1) { N = 1; } |
---|
146 | } else if(Z == 2) { N = 2; } |
---|
147 | |
---|
148 | G4double x = 0.0; |
---|
149 | if(theParticle == theProton) { |
---|
150 | x = pCManager->GetCrossSection(false,momentum,Z,N,pPDG); |
---|
151 | } else { |
---|
152 | x = nCManager->GetCrossSection(false,momentum,Z,N,pPDG); |
---|
153 | } |
---|
154 | return x; |
---|
155 | } |
---|
156 | |
---|
157 | void |
---|
158 | G4CHIPSElasticXS::BuildPhysicsTable(const G4ParticleDefinition& p) |
---|
159 | { |
---|
160 | if(isInitialized) { return; } |
---|
161 | if(verboseLevel > 0){ |
---|
162 | G4cout << "G4CHIPSElasticXS::BuildPhysicsTable for " |
---|
163 | << p.GetParticleName() |
---|
164 | << " Elow(MeV)= " << thEnergy/MeV |
---|
165 | << G4endl; |
---|
166 | } |
---|
167 | isInitialized = true; |
---|
168 | theParticle = &p; |
---|
169 | if(theParticle != theProton && theParticle != theNeutron) { |
---|
170 | G4cout << "G4CHIPSElasticXS::BuildPhysicsTable ERROR for " |
---|
171 | << p.GetParticleName() |
---|
172 | << G4endl; |
---|
173 | G4Exception("G4CHIPSElasticXS", "", FatalException,"Not applicable"); |
---|
174 | } |
---|
175 | pPDG = theParticle->GetPDGEncoding(); |
---|
176 | } |
---|
177 | |
---|
178 | void |
---|
179 | G4CHIPSElasticXS::DumpPhysicsTable(const G4ParticleDefinition&) |
---|
180 | {} |
---|
181 | |
---|