!The slave functions must provide cross-sections in millibarns (mb) !! (not in IU)
84{
85
87 static std::vector <G4int> colN;
88 static std::vector <G4int> colZ;
89 static std::vector <G4double> colP;
90 static std::vector <G4double> colTH;
91 static std::vector <G4double> colCS;
92
93#ifdef debug
94 G4cout<<
"G4QNeutCS::GetCS:>>> f="<<fCS<<
", p="<<pMom<<
", Z="<<tgZ<<
"("<<lastZ<<
") ,N="
95 <<tgN<<
"("<<lastN<<
"),PDG=2112, thresh="<<lastTH<<
",Sz="<<colN.size()<<
G4endl;
96#endif
97 if(PDG!=2112)
G4cout<<
"-Warning-G4QNeutronCS::GetCS:**Not a neutron**,PDG="<<PDG<<
G4endl;
99 if(tgN!=lastN || tgZ!=lastZ)
100 {
101 in = false;
102 lastP = 0.;
103 lastN = tgN;
104 lastZ = tgZ;
105 lastI = colN.size();
106 j = 0;
107#ifdef debug
108 G4cout<<
"G4QNeutCS::GetCS: the amount of records in the AMDB lastI="<<lastI<<
G4endl;
109#endif
110 if(lastI)
for(
G4int i=0; i<lastI; i++)
111 {
112 if(colN[i]==tgN && colZ[i]==tgZ)
113 {
114 lastI=i;
115 lastTH =colTH[i];
116#ifdef debug
117 G4cout<<
"G4QNCS::GetCS: *Found* P="<<pMom<<
",Threshold="<<lastTH<<
",j="<<j<<
G4endl;
118#endif
119 if(pMom<=lastTH)
120 {
121#ifdef debug
122 G4cout<<
"G4QNCS::GetCS:Found,P="<<pMom<<
" < Threshold="<<lastTH<<
",CS=0"<<
G4endl;
123#endif
124 return 0.;
125 }
126 lastP =colP [i];
127 lastCS =colCS[i];
129
130 {
131#ifdef debug
132 G4cout<<
"...G4QNCS::GetCS:.DoNothing.P="<<pMom<<
",CS="<<lastCS*millibarn<<
G4endl;
133#endif
134
135 return lastCS*millibarn;
136 }
137 in = true;
138
139#ifdef debug
140 G4cout<<
"G4QNCS::GX:UpdatDB P="<<pMom<<
",f="<<fCS<<
",lI="<<lastI<<
",j="<<j<<
G4endl;
141#endif
143#ifdef debug
144 G4cout<<
"G4QNeutCS::GetCrosSec: *****> New (inDB) Calculated CS="<<lastCS<<
G4endl;
145#endif
146 if(lastCS<=0. && pMom>lastTH)
147 {
148#ifdef debug
149 G4cout<<
"G4QNeutCS::GetCS: New P="<<pMom<<
"(CS=0) > Threshold="<<lastTH<<
G4endl;
150#endif
151 lastCS=0.;
152 lastTH=pMom;
153 }
154 break;
155 }
156#ifdef debug
157 G4cout<<
"-->G4QNeutronNuclearCrossSec::GetCrosSec: pPDG=2112, j="<<j<<
", N="<<colN[i]
158 <<
",Z["<<i<<
"]="<<colZ[i]<<
G4endl;
159#endif
160 j++;
161 }
162#ifdef debug
163 G4cout<<
"-?-G4QNeuCS::GetCS:RC Z="<<tgZ<<
",N="<<tgN<<
",in="<<in<<
",j="<<j<<
"?"<<
G4endl;
164#endif
165 if(!in)
166 {
167#ifdef debug
168 G4cout<<
"^^^G4QNeutCS::GetCS:CalcNew P="<<pMom<<
",f="<<fCS<<
",lastI="<<lastI<<
G4endl;
169#endif
170
172
173
174
176#ifdef debug
177 G4cout<<
"G4QPrCrossSection::GetCrossSect: NewThresh="<<lastTH<<
",P="<<pMom<<
G4endl;
178#endif
179 colN.push_back(tgN);
180 colZ.push_back(tgZ);
181 colP.push_back(pMom);
182 colTH.push_back(lastTH);
183 colCS.push_back(lastCS);
184#ifdef debug
185 G4cout<<
"G4QNCS::GetCrosSec: recCS="<<lastCS<<
",lZ="<<lastN<<
",lN="<<lastZ<<
G4endl;
186#endif
187
188#ifdef pdebug
189 G4cout<<
"G4QNCS::GetCS:1st, P="<<pMom<<
"(MeV),CS="<<lastCS*millibarn<<
"(mb)"<<
G4endl;
190#endif
191 return lastCS*millibarn;
192 }
193 else
194 {
195#ifdef debug
196 G4cout<<
"G4QNeutronNuclCrossSections::GetCS: Update lastI="<<lastI<<
",j="<<j<<
G4endl;
197#endif
198 colP[lastI]=pMom;
199 colCS[lastI]=lastCS;
200 }
201 }
202 else if(pMom<=lastTH)
203 {
204#ifdef debug
205 G4cout<<
"G4QNeutCS::GetCS:Current P="<<pMom<<
" < Threshold="<<lastTH<<
", CS=0"<<
G4endl;
206#endif
207 return 0.;
208 }
209 else if(std::fabs(lastP-pMom)<
tolerance*pMom)
210
211 {
212#ifdef debug
213 G4cout<<
"..G4QNCS::GetCS:OldNZ&P="<<lastP<<
"="<<pMom<<
",CS="<<lastCS*millibarn<<
G4endl;
214#endif
215 return lastCS*millibarn;
216 }
217 else
218 {
219#ifdef debug
220 G4cout<<
"-!-G4QNCS::GetCS:UseCur P="<<pMom<<
",f="<<fCS<<
",I="<<lastI<<
",j="<<j<<
G4endl;
221#endif
223 lastP=pMom;
224 }
225#ifdef debug
226 G4cout<<
"==>G4QNCS::GetCroSec: P="<<pMom<<
"(MeV), CS="<<lastCS*millibarn<<
"(mb)"<<
G4endl;
227#endif
228 return lastCS*millibarn;
229}
G4double CalculateCrossSection(G4bool CS, G4int F, G4int I, G4int PDG, G4int Z, G4int N, G4double Momentum)
virtual G4double ThresholdEnergy(G4int Z, G4int N, G4int PDG=0)
static G4double tolerance