!The slave functions must provide cross-sections in millibarns (mb) !! (not in IU)
101{
105 static std::vector <G4int> colPDG;
106 static std::vector <G4int> colN;
107 static std::vector <G4int> colZ;
108 static std::vector <G4double> colP;
109 static std::vector <G4double> colTH;
110 static std::vector <G4double> colCS;
111
112 G4double pEn=std::sqrt(pMom*pMom+mtu2)-mtu;
113#ifdef pdebug
114 G4cout<<
"G4QTNCS::GetCS:>>> f="<<fCS<<
", p="<<pMom<<
", Z="<<tgZ<<
"("<<lastZ<<
") ,N="<<tgN
115 <<"("<<lastN<<"),PDG="<<pPDG<<"("<<lastPDG<<"), T="<<pEn<<"("<<lastTH<<")"<<",Sz="
117
118#endif
119 if(std::abs(pPDG)!=15)
120 {
121#ifdef pdebug
122 G4cout<<
"G4QTNCS::GetCS: *** Found pPDG="<<pPDG<<
" =--=> CS=0"<<
G4endl;
123
124#endif
125 return 0.;
126 }
128 if(tgN!=lastN || tgZ!=lastZ || pPDG!=lastPDG)
129 {
130 in = false;
131 lastP = 0.;
132 lastPDG = pPDG;
133 lastN = tgN;
134 lastZ = tgZ;
135 lastI = colN.size();
136 j = 0;
137 if(lastI)
for(
G4int i=0; i<lastI; i++)
if(colPDG[i]==pPDG)
138 {
139 if(colN[i]==tgN && colZ[i]==tgZ)
140 {
141 lastI=i;
142 lastTH =colTH[i];
143#ifdef pdebug
144 G4cout<<
"G4QTNCS::GetCS:*Found* P="<<pMom<<
",Threshold="<<lastTH<<
",j="<<j<<
G4endl;
145
146#endif
147 if(pEn<=lastTH)
148 {
149#ifdef pdebug
150 G4cout<<
"G4QTNCS::GetCS:Found T="<<pEn<<
" < Threshold="<<lastTH<<
",CS=0"<<
G4endl;
151
152#endif
153 return 0.;
154 }
155 lastP =colP [i];
156 lastCS =colCS[i];
158 {
159#ifdef pdebug
160 G4cout<<
"G4QTNCS::GetCS:P="<<pMom<<
",CS="<<lastCS*millibarn<<
G4endl;
161#endif
163 return lastCS*millibarn;
164 }
165 in = true;
166
167#ifdef pdebug
168 G4cout<<
"G4QTNCS::G:UpdatDB P="<<pMom<<
",f="<<fCS<<
",lI="<<lastI<<
",j="<<j<<
G4endl;
169#endif
171#ifdef pdebug
172 G4cout<<
"G4QTNCS::GetCrosSec: *****> New (inDB) Calculated CS="<<lastCS<<
G4endl;
173
174#endif
175 if(lastCS<=0. && pEn>lastTH)
176 {
177#ifdef pdebug
178 G4cout<<
"G4QTNCS::GetCS: New T="<<pEn<<
"(CS=0) > Threshold="<<lastTH<<
G4endl;
179#endif
180 lastTH=pEn;
181 }
182 break;
183 }
184#ifdef pdebug
185 G4cout<<
"---G4QTNCrossSec::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<<
"G4QTNCS::GetCrosSec:CalcNew P="<<pMom<<
",f="<<fCS<<
",lastI="<<lastI<<
G4endl;
195#endif
196
198 if(lastCS<=0.)
199 {
201#ifdef pdebug
202 G4cout<<
"G4QTNCrossSection::GetCrossSect: NewThresh="<<lastTH<<
", T="<<pEn<<
G4endl;
203#endif
204 if(pEn>lastTH)
205 {
206#ifdef pdebug
207 G4cout<<
"G4QTNCS::GetCS: First T="<<pEn<<
"(CS=0) > Threshold="<<lastTH<<
G4endl;
208#endif
209 lastTH=pEn;
210 }
211 }
212#ifdef pdebug
213 G4cout<<
"G4QTNCS::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<<
"G4QTNCS::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<<
"G4QTNCS::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<<
"G4QTNCS::GetCS: Current T="<<pEn<<
" < Threshold="<<lastTH<<
", CS=0"<<
G4endl;
242
243#endif
244 return 0.;
245 }
246 else if(std::fabs(lastP/pMom-1.)<
tolerance)
247 {
248#ifdef pdebug
249 G4cout<<
"G4QTNCS::GetCS:OldCur P="<<pMom<<
"="<<pMom<<
", CS="<<lastCS*millibarn<<
G4endl;
250
251#endif
252 return lastCS*millibarn;
253 }
254 else
255 {
256#ifdef pdebug
257 G4cout<<
"G4QTNCS::GetCS:UpdatCur P="<<pMom<<
",f="<<fCS<<
",I="<<lastI<<
",j="<<j<<
G4endl;
258#endif
260 lastP=pMom;
261 }
262#ifdef pdebug
263 G4cout<<
"G4QTNCS::GetCroSec:End,P="<<pMom<<
"(MeV),CS="<<lastCS*millibarn<<
"(mb)"<<
G4endl;
264
265#endif
266 return lastCS*millibarn;
267}
G4double CalculateCrossSection(G4bool CS, G4int F, G4int I, G4int PDG, G4int Z, G4int N, G4double Momentum)
G4double ThresholdEnergy(G4int Z, G4int N, G4int PDG=15)
static G4double tolerance