!The slave functions must provide cross-sections in millibarns (mb) !! (not in IU)
100{
101 static const G4double mmu=105.65839;
104 static std::vector <G4int> colPDG;
105 static std::vector <G4int> colN;
106 static std::vector <G4int> colZ;
107 static std::vector <G4double> colP;
108 static std::vector <G4double> colTH;
109 static std::vector <G4double> colCS;
110
111 G4double pEn=std::sqrt(pMom*pMom+mmu2)-mmu;
112#ifdef pdebug
113 G4cout<<
"G4QMNCS::GetCS:>>> f="<<fCS<<
", p="<<pMom<<
", Z="<<tgZ<<
"("<<lastZ<<
") ,N="<<tgN
114 <<"("<<lastN<<"),PDG="<<pPDG<<"("<<lastPDG<<"), T="<<pEn<<"("<<lastTH<<")"<<",Sz="
116
117#endif
118 if(std::abs(pPDG)!=13)
119 {
120#ifdef pdebug
121 G4cout<<
"G4QMNCS::GetCS: *** Found pPDG="<<pPDG<<
" =--=> CS=0"<<
G4endl;
122
123#endif
124 return 0.;
125 }
127 if(tgN!=lastN || tgZ!=lastZ || pPDG!=lastPDG)
128 {
129 in = false;
130 lastP = 0.;
131 lastPDG = pPDG;
132 lastN = tgN;
133 lastZ = tgZ;
134 lastI = colN.size();
135 j = 0;
136 if(lastI)
for(
G4int i=0; i<lastI; i++)
if(colPDG[i]==pPDG)
137 {
138 if(colN[i]==tgN && colZ[i]==tgZ)
139 {
140 lastI=i;
141 lastTH =colTH[i];
142#ifdef pdebug
143 G4cout<<
"G4QMNCS::GetCS:*Found* P="<<pMom<<
",Threshold="<<lastTH<<
",j="<<j<<
G4endl;
144
145#endif
146 if(pEn<=lastTH)
147 {
148#ifdef pdebug
149 G4cout<<
"G4QMNCS::GetCS:Found T="<<pEn<<
" < Threshold="<<lastTH<<
",CS=0"<<
G4endl;
150
151#endif
152 return 0.;
153 }
154 lastP =colP [i];
155 lastCS =colCS[i];
156
157 if(lastP==pMom)
158 {
159#ifdef pdebug
160 G4cout<<
"G4QMNCS::GetCS:P="<<pMom<<
",CS="<<lastCS*millibarn<<
G4endl;
161#endif
163 return lastCS*millibarn;
164 }
165 in = true;
166
167#ifdef pdebug
168 G4cout<<
"G4QMNCS::G:UpdatDB P="<<pMom<<
",f="<<fCS<<
",lI="<<lastI<<
",j="<<j<<
G4endl;
169#endif
171#ifdef pdebug
172 G4cout<<
"G4QMNCS::GetCrosSec: *****> New (inDB) Calculated CS="<<lastCS<<
G4endl;
173
174#endif
175 if(lastCS<=0. && pEn>lastTH)
176 {
177#ifdef pdebug
178 G4cout<<
"G4QMNCS::GetCS: New T="<<pEn<<
"(CS=0) > Threshold="<<lastTH<<
G4endl;
179#endif
180 lastTH=pEn;
181 }
182 break;
183 }
184#ifdef pdebug
185 G4cout<<
"---G4QMNCrossSec::GetCrosSec:pPDG="<<pPDG<<
",j="<<j<<
",N="<<colN[i]
186 <<
",Z["<<i<<
"]="<<colZ[i]<<
",cPDG="<<colPDG[i]<<
G4endl;
187
188#endif
189 j++;
190 }
191 if(!in)
192 {
193#ifdef pdebug
194 G4cout<<
"G4QMNCS::GetCrosSec:CalcNew P="<<pMom<<
",f="<<fCS<<
",lastI="<<lastI<<
G4endl;
195#endif
196
198 if(lastCS<=0.)
199 {
201#ifdef pdebug
202 G4cout<<
"G4QMNCrossSection::GetCrossSect: NewThresh="<<lastTH<<
",T="<<pEn<<
G4endl;
203#endif
204 if(pEn>lastTH)
205 {
206#ifdef pdebug
207 G4cout<<
"G4QMNCS::GetCS: First T="<<pEn<<
"(CS=0) > Threshold="<<lastTH<<
G4endl;
208#endif
209 lastTH=pEn;
210 }
211 }
212#ifdef pdebug
213 G4cout<<
"G4QMNCS::GetCrosSec: New CS="<<lastCS<<
",lZ="<<lastN<<
",lN="<<lastZ<<
G4endl;
214
215#endif
216 colN.push_back(tgN);
217 colZ.push_back(tgZ);
218 colPDG.push_back(pPDG);
219 colP.push_back(pMom);
220 colTH.push_back(lastTH);
221 colCS.push_back(lastCS);
222#ifdef pdebug
223 G4cout<<
"G4QMNCS::GetCS:1st,P="<<pMom<<
"(MeV),CS="<<lastCS*millibarn<<
"(mb)"<<
G4endl;
224
225#endif
226 return lastCS*millibarn;
227 }
228 else
229 {
230#ifdef pdebug
231 G4cout<<
"G4QMNCS::GetCS: Update lastI="<<lastI<<
",j="<<j<<
G4endl;
232#endif
233 colP[lastI]=pMom;
234 colPDG[lastI]=pPDG;
235 colCS[lastI]=lastCS;
236 }
237 }
238 else if(pEn<=lastTH)
239 {
240#ifdef pdebug
241 G4cout<<
"G4QMNCS::GetCS: Current T="<<pEn<<
" < Threshold="<<lastTH<<
", CS=0"<<
G4endl;
242
243#endif
244 return 0.;
245 }
246
247 else if(lastP==pMom)
248 {
249#ifdef pdebug
250 G4cout<<
"G4QMNCS::GetCS:OldCur P="<<pMom<<
"="<<pMom<<
", CS="<<lastCS*millibarn<<
G4endl;
251
252#endif
253 return lastCS*millibarn;
254 }
255 else
256 {
257#ifdef pdebug
258 G4cout<<
"G4QMNCS::GetCS:UpdatCur P="<<pMom<<
",f="<<fCS<<
",I="<<lastI<<
",j="<<j<<
G4endl;
259#endif
261 lastP=pMom;
262 }
263#ifdef pdebug
264 G4cout<<
"G4QMNCS::GetCroSec:End,P="<<pMom<<
"(MeV),CS="<<lastCS*millibarn<<
"(mb)"<<
G4endl;
265
266#endif
267 return lastCS*millibarn;
268}
G4double CalculateCrossSection(G4bool CS, G4int F, G4int I, G4int PDG, G4int Z, G4int N, G4double Momentum)
G4double ThresholdEnergy(G4int Z, G4int N, G4int PDG=13)