BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtXsection.cc
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// Environment:
3// This software is part of models developed at BES collaboration
4// based on the EvtGen framework. If you use all or part
5// of it, please give an appropriate acknowledgement.
6//
7// Copyright Information: See EvtGen/BesCopyright
8// Copyright (A) 2006 Ping Rong-Gang @IHEP, Wang Weiping @USTC
9//
10// Module: EvtXsection.hh
11//
12// Description: To define cross section for the continuum exclusive process
13// Experimental cross section taken from PRD73,012005, PRD76,092006, also
14// see a review: Rev. Mod. Phys. 83,1545
15// Modification history:
16//
17// Ping R.-G. Nov., 2012 Module created
18//
19/*******************--- mode definition: also see EvtXsection.cc
20mode==0: ppbar
21mode==1: nnbar
22mode==2: Lambda0 anti-Lambda0
23mode==3: Sigma0 anti-Sigma0
24mode==4: Lambda0 anti-Sigma0
25mode==5: Sigma0 anti-Lambda0
26mode==6: pi+ pi-
27mode==7: pi+ pi- pi0
28mode==8: K+K- pi0
29mode==9: KsK+pi-
30mode==10: KsK-pi+
31mode==11: K+K-eta
32mode==12: 2(pi+pi-)
33mode==13: pi+pi-2pi0
34mode==14: K+K-pi+pi-
35mode==15: K+K-2pi0
36mode==16: 2(K+K-)
37mode==17: 2(pi+pi-)pi0
38mode==18: 2(pi+pi-)eta
39mode==19: K+K-pi+pi-pi0
40mode==20: K+K-pi+pi-eta
41mode==21: 3(pi+pi-)
42mode==22: 2(pi+pi-pi0)
43mode==23: phi eta
44mode==24: phi pi0
45mode==25: K+K*-
46mode==26: K-K*+
47mode==27: K_SK*0-bar
48mode==28: K*0(892)K+pi-
49mode==29: K*0(892)K-pi+
50mode==30: K*+K-pi0
51mode==31: K*-K+pi0
52mode==32: K_2*(1430)0 K+pi-
53mode==33: K_2*(1430)0 K-pi+
54mode==34: K+K-rho
55mode==35: phi pi+pi-
56mode==36: phi f0(980)
57mode==37: eta pi+pi-
58mode==38: omega pi+ pi-
59mode==39: omega f0(980)
60mode==40: eta' pi+ pi-
61mode==41: f_1(1285)pi+pi-
62mode==42: omega K+K-
63mode==43: omega pi+pi-pi0
64mode==44: Sigma+ Sigma- (Sigma0 Sigma0-bar SU(3) extention )
65mode==45: K+K-
66mode==46: K_S K_L
67mode==47: omega eta
68mode==48: phi eta'
69mode==49: phi K+K-
70mode==50: ppbar pi0
71mode==51: ppbar eta
72mode==52: omega pi0
73
74mode==70: D0 anti-D0
75mode==71: D+D-
76mode==72: D+D*-
77mode==73: D-D*+
78mode==74: D*+D*-
79mode==68: D0 anti-D*0
80mode==69: anti-D0 D*0
81mode==67: D*0 anti-D*0
82
83mode==59: D0 anti-D0 pi0
84mode==63: D+D-pi0
85mode==75: D0D-pi+
86mode==76: anti-D0 D+pi-
87
88mode==77: D0D*-pi+
89mode==78: anti-D0 D*+pi-
90mode==65: D-D*0pi+
91mode==66: D+ anti-D*0pi-
92mode==60: anti-D0 D*0pi0
93mode==61: D0 anti-D*0pi0
94mode==62: D+D*-pi0
95mode==64: D-D*+pi0
96
97mode==90: pi+pi- J/psi
98mode==92: pi0pi0 J/psi
99mode==91: pi+pi- psi(2S)
100mode==79: pi0pi0 psi(2S)
101mode==80: eta J/psi
102mode==81: pi+pi- h_c
103mode==82: pi0pi0 h_c
104mode==83: K+K- J/psi
105mode==84: KsKs J/psi
106
107mode==93: D_s+ D_s-
108mode==94: D_s^{*+}D_s^-
109mode==95: D_s^{*-}D_s^+
110mode==85: D_s^{*+}D_s^{*-}
111
112mode==96: Lambda_c+ anti-Lamba_c-
113*/
114
115//------------------------------------------------------------------------
116//
117#include "EvtXsection.hh"
119struct myclass {
120 bool operator()( int i, int j ) { return ( i < j ); }
122
123#include "EvtFitXsection.dat"
125
126void EvtXsection::ini_data0( int mode ) {
127
128 xx.clear();
129 yy.clear();
130 er.clear();
131 nbins = yy.size();
132}
133
134void EvtXsection::ini_data_diy() { // user provide xs list
135
136 xx.clear();
137 yy.clear();
138 er.clear();
139
140 ifstream file( "xs_user.txt" );
141
142 if ( !file )
143 {
144 cout << "EvtXsection.cc: The input file not found. The default file name should be "
145 "xs_user.txt!"
146 << std::endl;
147 exit( 0 );
148 }
149
150 double xm, xs, xs_er;
151
152 while ( !file.eof() )
153 {
154 file >> xm >> xs >> xs_er;
155 // std::cout<<"read XS: "<<xm<<" "<<xs<<" "<<xs_er<<std::endl;
156 xx.push_back( xm );
157 yy.push_back( xs );
158 er.push_back( xs_er );
159 }
160
161 xx.pop_back();
162 yy.pop_back();
163 er.pop_back();
164 nbins = yy.size();
165 file.close();
166 _unit = "";
167 msg = "";
168}
169
170void EvtXsection::ini_data_multimode() { // multi-exclusive modes
171 xx.clear();
172 yy.clear();
173 er.clear();
174
175 if ( _vmd.size() == 0 )
176 {
177 std::cout << "EvtXsection::ini_data_multimode: No mode indexes are available" << std::endl;
178 abort();
179 }
180
181 double xL = 10.0;
182 double xU = -1.0;
183
184 for ( int i = 0; i < _vmd.size(); i++ )
185 {
186 ini_data( _vmd[i] );
187 double x0 = getXlw();
188 double x1 = getXup();
189 if ( x0 < xL ) xL = x0;
190 if ( x1 > xU ) xU = x1;
191 }
192
193 std::cout << "The low and up end of multimodes: " << xL << " ~ " << xU << std::endl;
194 double stp = 0.0005; // 5 MeV for bin width
195 double xm;
196 double xs = 0; // xsection in nb;
197 double xs_er = 0;
198 double mypb = 1;
199 std::vector<double> uxx, uyy, uer;
200 uxx.clear();
201 uyy.clear();
202 uer.clear();
203 for ( double xxm = xL; xxm < xU; xxm += stp )
204 {
205 xm = xxm;
206 xs = 0;
207 xs_er = 0;
208 for ( int i = 0; i < _vmd.size(); i++ )
209 {
210 ini_data( _vmd[i] );
211 std::string myunit = getUnit();
212 if ( myunit == "pb" ) { mypb = 0.001; }
213 else { mypb = 1; }
214 xs += mypb * getXsection( xxm );
215 xs_er += mypb * getErr( xxm );
216 // std::cout<<_vmd[i]<< ": "<<xm<<" "<<xs<<" "<<xs_er<<std::endl;
217 } // loop over mode
218 uxx.push_back( xm );
219 uyy.push_back( xs );
220 uer.push_back( xs_er );
221 } // loop over mass
222
223 xx.clear();
224 yy.clear();
225 er.clear();
226 for ( int i = 0; i < uxx.size(); i++ )
227 {
228 xx.push_back( uxx[i] );
229 yy.push_back( uyy[i] );
230 er.push_back( uer[i] );
231 }
232 // debugging
233 // for(int i=0;i<yy.size();i++){
234 // std::cout<<xx[i]<<" "<<yy[i]<<std::endl;
235 // }
236 _unit = "nb";
237 nbins = yy.size();
238 msg = "multi-exclusive mode";
239}
240
241int EvtXsection::getMode( std::vector<EvtId> evtdaugs ) {
242 /*******************--- mode definition:
243 0: ppbar
244 1: nnbar
245 2: Lambda0 anti-Lambda0
246 3: Sigma0 anti-Sigma0
247 4: Lambda0 anti-Sigma0
248 5: Sigma0 anti-Lambda0
249 6: pi+ pi-
250 7: pi+ pi- pi0
251 8: K+K- pi0
252 9: KsK+pi-
253 10: KsK-pi+
254 11: K+K-eta
255 *************************************/
256 int pp[2] = { -2212, 2212 };
257 int nn[2] = { -2112, 2112 };
258 int pipi[2] = { -211, 211 };
259 int pi3[3] = { -211, 111, 211 };
260 int kkpi0[3] = { -321, 111, 321 }; // K+K-pi0
261 int kskpi[3] = { -211, 310, 321 }; // KsK+pi-
262
263 std::vector<int> vson;
264 vson.clear();
265 for ( int i = 0; i < evtdaugs.size(); i++ )
266 { vson.push_back( EvtPDL::getStdHep( evtdaugs[i] ) ); }
267 sort( vson.begin(), vson.end(), mysort );
268
269 if ( vson.size() == 2 )
270 {
271 if ( vson[0] == pp[0] && vson[1] == pp[1] ) { return 0; }
272 if ( vson[0] == nn[0] && vson[1] == nn[1] ) { return 1; }
273 if ( vson[0] == pipi[0] && vson[1] == pipi[1] ) { return 2; }
274 }
275 else if ( vson.size() == 3 ) {}
276
277 std::cerr << __FILE__ << ":" << __LINE__ << ": should not reach here" << std::endl;
278 exit( 1 );
279}
280//----
281double EvtXsection::getXsection( double mx ) {
282 if ( _mode == -1 ) { return Xsection_c( mx ); }
283 // else if(_mode == 0 || _mode == 2 || _mode == 3 || _mode == 4 ||_mode == 5){ return
284 // Xsection_a(mx);}
285 else { return Xsection_b( mx ); }
286}
287
288double EvtXsection::getErr( double mx ) {
289 // if(_mode <= 5 && _mode !=1 ){ return Err_a(mx);}
290 // else {return Err_b(mx);}
291 return Err_b( mx );
292}
293//----
294
295double EvtXsection::Xsection_a( double mx ) {
296 if ( mx <= xx[0] ) return 0.;
297 if ( mx > xx[nbins] ) return 0.;
298 int thebin = getXBin_a( mx );
299 //-- debug
300 // std::cout<<"Mode= "<<_mode<<", thebin"<<thebin<<std::endl;
301 return yy[thebin];
302}
303
304double EvtXsection::Xsection_b( double mx ) { // interpolation of the cross section between two
305 // bins
306 if ( mx <= xx[0] ) return 0.;
307 if ( mx > xx[nbins - 1] ) return 0.;
308 int thebin = getXBin_b( mx );
309 double ylow = yy[thebin];
310 double yup = yy[thebin + 1];
311
312 double xlow = xx[thebin];
313 double xup = xx[thebin + 1];
314
315 double yi = ylow + ( yup - ylow ) / ( xup - xlow ) * ( mx - xlow );
316 return yi;
317}
318
319//----
320double EvtXsection::Err_a( double mx ) {
321 if ( _mode == -1 ) return 0.;
322 if ( mx <= xx[0] ) return er[0];
323 if ( mx > xx[nbins] ) return 0.;
324 int thebin = getXBin_a( mx );
325 //-- debug
326 // std::cout<<"Mode= "<<_mode<<", thebin"<<thebin<<std::endl;
327 return er[thebin];
328}
329
330double EvtXsection::Err_b( double mx ) { // interpolation of the cross section error between
331 // two bins
332 if ( mx <= xx[0] ) return er[0];
333 if ( mx > xx[nbins - 1] ) return 0.;
334 int thebin = getXBin_b( mx );
335 double ylow = er[thebin];
336 double yup = er[thebin + 1];
337
338 double xlow = xx[thebin];
339 double xup = xx[thebin + 1];
340
341 double yi = ylow + ( yup - ylow ) / ( xup - xlow ) * ( mx - xlow );
342 return yi;
343}
344
345int EvtXsection::getXBin_a( double mx ) {
346 if ( mx <= xx[0] ) return 0;
347 if ( mx > xx[nbins] ) return nbins;
348 for ( int i = 0; i < nbins; i++ )
349 {
350 if ( mx <= xx[i + 1] && mx > xx[i] ) return i; // mx at i-th bin
351 }
352
353 std::cerr << __FILE__ << ":" << __LINE__ << ": should not reach here" << std::endl;
354 exit( 1 );
355}
356
357int EvtXsection::getXBin_b( double mx ) {
358 if ( mx <= xx[0] ) return 0;
359 if ( mx > xx[nbins - 1] ) return nbins;
360 for ( int i = 0; i < nbins - 1; i++ )
361 {
362 if ( mx <= xx[i + 1] && mx > xx[i] ) return i; // mx at i to i+1 bin
363 }
364
365 std::cerr << __FILE__ << ":" << __LINE__ << ": should not reach here" << std::endl;
366 exit( 1 );
367}
368
369int EvtXsection::getXBin( double mx, std::vector<double> vy ) {
370 double nbins = vy.size();
371 if ( vy[0] < mx || mx < vy[nbins - 1] )
372 {
373 std::cout << "Outside vacuum pol. value" << std::endl;
374 abort();
375 }
376 for ( int i = 0; i < nbins - 1; i++ )
377 {
378 if ( mx <= vy[i + 1] && mx > vy[i] ) return i; // mx at i to i+1 bin
379 }
380
381 std::cerr << __FILE__ << ":" << __LINE__ << ": should not reach here" << std::endl;
382 exit( 1 );
383}
384
385double EvtXsection::Xsection_c( double mx ) { // in unit nb
386 double pi = 3.1415926;
387 double s = mx * mx;
388 EvtId pid = EvtPDL::evtIdFromStdHep( pdgcode );
389 double mass = EvtPDL::getMeanMass( pid );
390 double width = EvtPDL::getWidth( pid );
391 double mass2 = mass * mass;
392 double width2 = width * width;
393 double br = ( s - mass2 ) * ( s - mass2 ) + mass2 * width2;
394 bree = 1; // this value is canceled when calculation the correction factor;
395 double sigma = 12 * pi * bree * width2 / br;
396 double nbar = 4E05; // ! GeV-2 = 4*10^5 nbar
397 double thexs = sigma * nbar;
398 // std::cout<<"EvtXsection::Xsection_c: "<<mass<<" "<<width<<" "<<thexs<<std::endl;
399 // msg = "Calculate the correction factor for " + EvtPDL::name(pid);
400
401 return thexs;
402}
403
404void EvtXsection::setBW( int pdg ) {
405 pdgcode = pdg;
406 EvtId pid = EvtPDL::evtIdFromStdHep( pdgcode );
407 double maxM = EvtPDL::getMaxMass( pid );
408 double minM = EvtPDL::getMinMass( pid );
409 double meanM = EvtPDL::getMeanMass( pid );
410 double width = EvtPDL::getWidth( pid );
411 // std::cout<<minM<<" <=M<= "<<maxM<<std::endl;
412 double xstp = ( maxM - minM ) / 100.;
413 xx.clear();
414 yy.clear();
415 er.clear();
416 for ( int i = 0; i < 100; i++ )
417 {
418 double m = i * xstp;
419 EvtComplex im( 0., 1. );
420 EvtComplex bw = 1. / ( m * m - meanM * meanM + im * m * width );
421 double amps = abs2( bw );
422 xx.push_back( m );
423 yy.push_back( amps );
424 er.push_back( 0. );
425 }
426 nbins = yy.size();
427}
428
429void EvtXsection::setModes( std::vector<int> vmd ) {
430 _vmd.clear();
431 for ( int i = 0; i < vmd.size(); i++ ) { _vmd.push_back( vmd[i] ); }
432}
double mass
char * file
Definition DQA_TO_DB.cxx:16
double abs2(const EvtComplex &c)
double pi
DOUBLE_PRECISION xup[20]
DOUBLE_PRECISION xlow[20]
struct myclass mysort
XmlRpcServer s
Definition EvtId.hh:27
static double getWidth(EvtId i)
Definition EvtPDL.hh:59
static int getStdHep(EvtId id)
Definition EvtPDL.hh:61
static double getMeanMass(EvtId i)
Definition EvtPDL.hh:43
static EvtId evtIdFromStdHep(int stdhep)
Definition EvtPDL.cc:232
static double getMinMass(EvtId i)
Definition EvtPDL.hh:56
static double getMaxMass(EvtId i)
Definition EvtPDL.hh:55
int getXBin(double mx, std::vector< double > vy)
void ini_data(int mode)
void ini_data0(int mode)
double Xsection_b(double mx)
double Err_b(double mx)
virtual ~EvtXsection()
double getXlw()
int getXBin_a(double mx)
double getErr(double mx)
double Xsection_a(double mx)
void setModes(std::vector< int > vmd)
int getMode(std::vector< EvtId > evtdaugs)
void ini_data_diy()
double Err_a(double mx)
void ini_data_multimode()
double getXup()
std::string getUnit()
int getXBin_b(double mx)
double getXsection(double mx)
void setBW(int pdg)
double Xsection_c(double mx)
bool operator()(int i, int j)