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