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