147#include "TGraphErrors.h"
149#include "TPostScript.h"
151#include "TMultiGraph.h"
154int EvtConExc::nconexcdecays=0;
156int EvtConExc::ntable=0;
158int EvtConExc::ncommand=0;
159int EvtConExc::lcommand=0;
160std::string* EvtConExc::commands=0;
161double EvtConExc::AF[600];
162double EvtConExc::AA[600];
163double EvtConExc::MH[600];
169 extern double dgauss_(
double (*fun)(
double*),
double *,
double *,
double *);
173 extern double divdif_(
float*,
float *,
int *,
float *,
int*);
177 extern void polint_(
float*,
float *,
int *,
float *,
float*);
181 extern void hadr5n12_(
float*,
float *,
float *,
float *,
float *,
float *);
193double EvtConExc::_xs0=0;
194double EvtConExc::_xs1=0;
195double EvtConExc::_er0=0;
196double EvtConExc::_er1=0;
197int EvtConExc::_nevt=0;
203std::vector<std::vector <double> > EvtConExc::VXS;
220 if (nconexcdecays==0) {
226 for(i=0;i<nconexcdecays;i++){
227 if (conexcdecays[i]==
this){
228 conexcdecays[i]=conexcdecays[nconexcdecays-1];
230 if (nconexcdecays==0) {
259 for(
int i=0;i<120;i++){
263 for(
int i=0;i<97;i++){
264 if(53<=i && i<=58)
continue;
265 if(86<=i && i<=89)
continue;
266 if(_mode==74110 ||_mode==-100) vmode.push_back(i);
268 if(_mode==74110||_mode==-100){
269 vmode.push_back(74100);
270 vmode.push_back(74101);
271 vmode.push_back(74102);
272 vmode.push_back(74103);
273 vmode.push_back(74104);
274 vmode.push_back(74105);
275 vmode.push_back(74110);
278 std::cout<<
"==== Parameters set by users====="<<std::endl;
279 for(
int i=0;i<ncommand;i++){
280 std::cout<<commands[i]<<std::endl;
282 std::cout<<
"==================================="<<std::endl;
284 std::cout<<threshold<<
" "<<beamEnergySpread<<std::endl;
292 }
else if(
getNDaug()>2){std::cout<<
"Bad daughter specified"<<std::endl;abort();
305 std::cout<<
"The decay daughters are "<<std::endl;
307 std::cout<<std::endl;
309 radflag=0;mydbg=
false;
313 }
else if(
getArg(0)==-100){
318 std::cout<<
" multi-exclusive mode "<<std::endl;
320 std::cout<<std::endl;
321 if(vmd[vmd.size()-1]==74110){std::cout<<
"74110 is not allowd for multimode simulation"<<std::endl;abort();}
322 }
else if(
getNArg()==1){ _mode =
getArg(0); radflag=0;mydbg=
false;
325 }
else{std::cout<<
"ConExc:number of parameter should be 1,2 or 3, but you set "<<
getNArg()<<std::endl;::abort(); }
335 myfile =
new TFile(
"mydbg.root",
"RECREATE");
336 xs=
new TTree (
"xs",
"momentum of rad. gamma and hadrons");
337 xs->Branch(
"imode",&imode,
"imode/I");
338 xs->Branch(
"pgam",pgam,
"pgam[4]/D");
339 xs->Branch(
"phds",phds,
"phds[4]/D");
340 xs->Branch(
"ph1",ph1,
"ph1[4]/D");
341 xs->Branch(
"ph2",ph2,
"ph2[4]/D");
342 xs->Branch(
"mhds",&mhds,
"mhds/D");
343 xs->Branch(
"mass1",&mass1,
"mass1/D");
344 xs->Branch(
"mass2",&mass2,
"mass2/D");
345 xs->Branch(
"costheta",&costheta,
"costheta/D");
346 xs->Branch(
"cosp",&cosp,
"cosp/D");
347 xs->Branch(
"cosk",&cosk,
"cosk/D");
348 xs->Branch(
"sumxs",&sumxs,
"sumxs/D");
349 xs->Branch(
"selectmode",&selectmode,
"selectmode/D");
355 std::cout<<
"parent mass = "<<parentMass<<std::endl;
375 if(mx<mth){std::cout<<
"The CMS energy is lower than the threshold of the final states"<<std::endl;abort();}
376 }
else if(_mode == -2){
382 std::cout<<
"The specified mode is "<<_mode<<std::endl;
387 double Esig = 0.0001;
388 double x = 2*Egamcut/
_cms;
390 double mhscut = sqrt(
s*(1-
x));
393 float fe,fst2,fder,ferrder,fdeg,ferrdeg;
397 if(3.0943<
_cms &&
_cms<3.102) vph=1;
398 std::cout<<
"sum of leptonic, hadronic contributions(u,d,s,c,b) to vacuum polarization: "<<vph<<
" @"<<fe<<
"GeV"<<std::endl;
404 for(
int jj=1;jj<_ndaugs;jj++){
408 ISRXS.clear();ISRM.clear();ISRFLAG.clear();
409 for(
int ii=0;ii<3;ii++){
411 if(mx<mR || _mode !=74110)
continue;
412 double narRxs=
Ros_xs(mx,BR_ee[ii],ResId[ii]);
413 std::cout<<
"The corss section for gamma "<<
EvtPDL::name(ResId[ii]).c_str()<<
" is: "<< narRxs<<
"*Br (nb)."<<std::endl;
414 ISRXS.push_back(narRxs);
416 ISRFLAG.push_back(1.);
417 ISRID.push_back(ResId[ii]);
420 std::cout<<
"==========================================================================="<<std::endl;
425std::cout<<
"SetMthr= "<<
SetMthr<<std::endl;
426 EgamH = (
s-mhdL*mhdL)/2/sqrt(
s);
430 std::cout<<
"_er0= "<<_er0<<std::endl;
432 std::cout<<
"_xs1= "<<_xs0<<std::endl;
433 double xs1_err = _er1;
437 double xb= 2*Esig/
_cms;
440 std::cout<<
"_xs0= "<<_xs0<<std::endl;
445 double stp=(EgamH - Egamcut)/Nstp;
446 for(
int i=0;i<Nstp;i++){
447 double Eg0=EgamH - i*stp;
448 double Eg1=EgamH - (i+1)*stp;
456 double binwidth = mh2-mhi;
459 if(i>=1) AF[i]=AF[i-1]+xsi;
463 AA[598]=Egamcut; AA[599]=0;
465 AF[599]=AF[598]+ _xs0;
470std::cout<<
"mhdL = "<<mhdL<<
", SetMthr= "<<
SetMthr<<
", EgamH = "<<EgamH<<std::endl;
471 for(
int i=0;i<vmode.size();i++){
472 if(_mode==74110||_mode==-100)
mk_VXS(Esig,Egamcut,EgamH,i);
493 for(
int i=0;i<vmode.size();i++){
495 if(md<74100 || md>74106)
continue;
496 std::string partname=
"";
497 if(md==74100) {partname=
"J/psi";}
498 else if(md==74101) {partname=
"psi(2S)";}
499 else if(md==74102) {partname=
"psi(3770)";}
500 else if(md==74103) {partname=
"phi";}
501 else if(md==74104) {partname=
"omega";}
502 else if(md==74105) {partname=
"rho0";}
503 else if(md==74106) {partname=
"rho(3S)0";}
505 std::cout<<
"The observed cross section for gamma "<<partname<<
": "<<VXS[i][599]<<
" nb"<<std::endl;
509 for(
int i=0;i<600;i++){
516 std::cout<<
"EgamH = "<<EgamH<<
", obsvXS = "<<_xs0+_xs1<<
", _xs1 = "<<_xs1 <<
", _xs0 = "<<_xs0<<std::endl;
517 std::cout<<
"EgamH = "<<EgamH<<
", AF[599] = "<< AF[599]<<
", AF[598] = "<<AF[598]<<
", _xs0 = "<<_xs0<<std::endl;
524 double obsvXS = _xs0 + _xs1;
525 double obsvXS_er= _er0 + xs1_err;
526 double corr = obsvXS/bornXS;
527 double corr_er =corr*sqrt(bornXS_er*bornXS_er/bornXS/bornXS + obsvXS_er*obsvXS_er/obsvXS/obsvXS);
530 if(bornXS==0){std::cout<<
"EvtConExc::init : The Born cross section at this point is zero!"<<std::endl;abort();}
531 if(obsvXS==0){std::cout<<
"EvtConExc::init : The observed cross section at this point is zero!"<<std::endl;abort();}
536 std::cout<<
""<<std::endl;
537 std::cout<<
"========= Generation using cross section (Egamcut="<<Egamcut<<
" GeV) =============="<<std::endl;
538 std::cout<<
" sqrt(s)= "<<mx<<
" GeV "<<std::endl;
539 if(_mode>=0 || _mode ==-2 || _mode ==-100){
540 std::cout<<
"The generated born cross section (sigma_b): "<<_xs0<<
"+/-"<<_er0<<
" in Unit "<<_unit.c_str()<<std::endl;
541 std::cout<<
"The generated radiative correction cross section (sigma_isr): "<<_xs1<<
"+/-"<<xs1_err<<
" in Unit "<<_unit.c_str()<<std::endl;
542 std::cout<<
"The Born process is sampled according to the ratio sigma_b/(sigma_b+sigma_isr)"<<std::endl;
543 std::cout<<
"The radiative correction factor f_ISR*f_vacuum= sigma_obs/sigma_born(s) = "<<corr<<
"+/-"<< fabs(corr_er)<<
","<<std::endl;
544 std::cout<<
"which is calcualted with these quantities:"<<std::endl;
545 std::cout<<
"the observed cross section is "<<obsvXS<<
"+/-"<< obsvXS_er<<_unit.c_str()<<std::endl;
546 std::cout<<
"and the Born cross section (s) is "<<bornXS<<
"+/-"<<bornXS_er<<_unit.c_str()<<std::endl;
547 std::cout<<
"and the vaccum polarziation factor (lep. + hadr.) 1/|1-Pi|^2= "<<vph<<std::endl;
549 std::cout<<
"==========================================================================="<<std::endl;
551 std::cout<<
"The generated born cross section (sigma_b): "<<_xs0<<
" *Br_ee"<<
" in Unit "<<_unit.c_str()<<std::endl;
552 std::cout<<
"The generated radiative correction cross section (sigma_isr): "<<_xs1<<
"*Br_ee in Unit "<<_unit.c_str()<<std::endl;
553 std::cout<<
"The Born process is sampled according to the ratio sigma_b/(sigma_b+sigma_isr)"<<std::endl;
554 std::cout<<
"The radiative correction factor sigma_obs/sigma_born(s) = (1+delta) = "<<corr<<
"+/-"<< fabs(corr_er)<<std::endl;
555 std::cout<<
"==========================================================================="<<std::endl;
557 std::cout<<std::endl;
558 std::cout<<std::endl;
565 if(_xs0 == 0 && _xs1==0){std::cout<<
"EvtConExc::ini() has zero cross section"<<std::endl;abort();}
567 std::cout<<std::endl;
568 std::cout<<std::endl;
572 if(mydbg && _mode!=74110){
574 double xx[10000],yy[10000],xer[10000],yer[10000];
575 for(
int i=0;i<nd;i++){
582 myth=
new TH1F(
"myth",
"Exp.data",200,xx[0],xx[nd]);
583 for(
int i=0;i<nd;i++){
584 myth->Fill(xx[i],yy[i]);
590 }
else if(mydbg && _mode==74110){
592 double xx[10000],yy[10000],xer[10000],yer[10000],ysum[10000],yysum[10000];
593 for(
int i=0;i<nd;i++){
598 std::cout<<
"yy "<<yy[i]<<std::endl;
604 TGraphErrors *Gdt =
new TGraphErrors(nd,xx,yy,xer,yer);
606 myth=
new TH1F(
"myth",
"Exp.data",600,
xlow,xhigh);
607 Xsum=
new TH1F(
"sumxs",
"sum of exclusive xs",600,
xlow,xhigh);
609 for(
int i=0;i<600;i++){
617 for(
int i=0;i<600;i++){
620 if(ysum[i]==0)
continue;
621 Xsum->Fill(mx,ysum[i]);
625 for(
int i=0;i<nd;i++){
633 TGraphErrors *Gsum =
new TGraphErrors(nd,xx,yysum,xer,yer);
635 double ex[600]={600*0};
636 double ey[600],ta[600];
637 double exz[600]={600*0};
638 double eyz[600]={600*0};
639 for(
int i=0;i<600;i++){
642 TGraphErrors *gr0 =
new TGraphErrors(600,MH,AF,ex,ey);
643 TGraphErrors *gr1 =
new TGraphErrors(600,MH,RadXS,exz,eyz);
644 TPostScript *ps =
new TPostScript(
"xsobs.ps",111);
645 TCanvas *c1 =
new TCanvas(
"c1",
"TGraphs for data",200,10,600,400);
648 gStyle->SetCanvasColor(0);
649 gStyle->SetStatBorderSize(1);
657 gr0->SetMarkerStyle(10);
659 gr0->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
660 gr0->GetYaxis()->SetTitle(
"observed cross section (nb)");
668 gr1->SetMarkerStyle(10);
670 gr1->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
671 gr1->GetYaxis()->SetTitle(
"Rad*BornXS");
675 TMultiGraph *mg =
new TMultiGraph();
676 mg->SetTitle(
"Exclusion graphs");
677 Gdt->SetMarkerStyle(2);
678 Gdt->SetMarkerSize(1);
679 Gsum->SetLineColor(2);
680 Gsum->SetLineWidth(1);
690 mg->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
691 mg->GetYaxis()->SetTitle(
"observed cross section (nb)");
699 Gdt->SetMarkerStyle(2);
701 Gdt->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
702 Gdt->GetYaxis()->SetTitle(
"observed cross section (nb)");
709 Gsum->SetMarkerStyle(2);
710 Gsum->SetMarkerSize(1);
712 Gsum->SetLineWidth(0);
713 Gsum->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
714 Gsum->GetYaxis()->SetTitle(
"observed cross section (nb)");
722 Gdt->SetMarkerStyle(2);
723 Gdt->SetMarkerSize(1);
724 Gdt->SetMaximum(8000.0);
725 Gsum->SetLineColor(2);
726 Gsum->SetLineWidth(1.5);
729 Gsum->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
730 Gsum->GetYaxis()->SetTitle(
"cross section (nb)");
1163 }
else if(mode==111){
1167 }
else if(mode==112){
1171 }
else if(mode==74100){
1174 }
else if(mode==74101){
1177 }
else if(mode==74102){
1180 }
else if(mode==74103){
1183 }
else if(mode==74104){
1186 }
else if(mode==74105){
1189 }
else if(mode==74106){
1192 }
else if(mode==74107){
1195 }
else if(mode==74110){
1201 _modeFlag.push_back(74110);
1202 _modeFlag.push_back(0);
1205 for(
int i=0;i<nson;i++){ daugs[i]=son[i]; }
1206 std::cout<<
"The paraent particle: "<<
EvtPDL::name(pid)<<std::endl;
1209 for(
int i=0;i<nson;i++){ daugs[i]=son[i]; }
1210 }
else if(mode==-100){
1214 _modeFlag.push_back(-100);
1215 _modeFlag.push_back(0);
1217 }
else if(mode==10000){
1222 std::cout<<
"Bad mode_index number " <<mode<<
", please refer to the manual."<<std::endl;
1234 for(
int i=0;i<_ndaugs;i++){
1240 if(!(_mode==74110 || _mode==-100)){
1241 if(Mthr<fmth) {std::cout<<
"Low end of cross section: ("<<Mthr<<
" < (mass of final state)"<<fmth<<
") GeV."<< std::endl; abort();}
1670 }
else if(mode==111){
1674 }
else if(mode==112){
1678 }
else if(mode==74100){
1682 }
else if(mode==74101){
1686 }
else if(mode==74102){
1690 }
else if(mode==74103){
1694 }
else if(mode==74104){
1698 }
else if(mode==74105){
1702 }
else if(mode==74106){
1706 }
else if(mode==74107){
1710 }
else if(mode==74110){
1717 _modeFlag.push_back(74110);
1718 _modeFlag.push_back(0);
1721 for(
int i=0;i<nson;i++){ daugs[i]=son[i]; }
1722 std::cout<<
"The paraent particle: "<<
EvtPDL::name(pid)<<std::endl;
1725 for(
int i=0;i<nson;i++){ daugs[i]=son[i]; }
1726 }
else if(mode==-100){
1730 _modeFlag.push_back(-100);
1731 _modeFlag.push_back(0);
1733 }
else if(mode==10000){
1738 std::cout<<
"Bad mode_index number " <<mode<<
", please refer to the manual."<<std::endl;
1749 std::vector<EvtId> theDaugs;
1750 for(
int i=0;i<_ndaugs;i++){
1751 theDaugs.push_back(daugs[i]);
1753 if(theDaugs.size()) {
return theDaugs;}
else {std::cout<<
"EvtConExc::get_mode: zero size"<<std::endl;abort();}
1766 if(myvpho != p->
getId()){
1767 std::cout<<
"Parent needs to be vpho, but found "<<
EvtPDL::name(p->
getId())<<std::endl;
1800 std::vector<int> vmod; vmod.clear();
1801 int mn[83]={0,1,2,3,4,5,6,7,8,9,10,11,13,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,32,33,34,35,36,37,38,40,41,44,45,46,
1803 59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,
1804 90,91,92,93,94,95,96,
1805 74100,74101,74102,74103,74104,74105,74110};
1806 int mn2[84]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,32,33,34,35,36,37,38,40,41,44,45,46,
1808 59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,
1809 90,91,92,93,94,95,96,
1810 74100,74101,74102,74103,74104,74105,74110};
1811 int mn3[77]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,44,45,46,
1813 68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,
1814 90,91,92,93,94,95,96,
1815 74100,74101,74102,74110};
1819 for(
int i=0;i<83;i++){vmod.push_back(mn[i]);}
1821 for(
int i=0;i<84;i++){vmod.push_back(mn2[i]);}
1832 if(pm <_xs0/(_xs0 + _xs1)){
1836 _selectedMode = mymode;
1837 std::cout<<
"A selected mode is "<<mymode<<
" with Mhds= "<<mhds<<std::endl;
1847 for(
int i=0;i< _ndaugs;i++){
1853 if(totMass>p->
mass())
goto checkA;
1861 mydaugs[0]=daugs[0];
1868 for(
int i=0;i< 2;i++){
1875 if(totMass>p->
mass())
goto checkB;
1887 if(mhds<
SetMthr)
goto Sampling_mhds;
1888 double xeng=1-mhds*mhds/(
_cms*
_cms);
1891 if(mydbg) mass2=mhds;
1897 if(mymode==-10)
goto Sampling_mhds;
1899 if(mhds<2.3 && mymode==74110) {
goto ModeSelection;}
1900 std::cout<<
"A selected mode is "<<mymode<<
" with Mhds= "<<mhds<<std::endl;
1901 _selectedMode = mymode;
1919 mydaugs[0]=daugs[0];
1926 ISRphotonAng_sampling:
1929 for(
int i=0;i< 2;i++){
1935 if(totMass>p->
mass())
goto ISRphotonAng_sampling;
1938 if(!
checkdecay(p))
goto ISRphotonAng_sampling;
1942 if(maxflag==0) {
findMaxXS(mhds); maxflag=1;}
1945 double gx=vgam.
get(1);
1946 double gy=vgam.
get(2);
1947 double sintheta= sqrt(gx*gx+gy*gy)/vgam.
d3mag();
1955 pgam[0]=vgam.
get(0);
1956 pgam[1]=vgam.
get(1);
1957 pgam[2]=vgam.
get(2);
1958 pgam[3]=vgam.
get(3);
1960 phds[0]=vhds.
get(0);
1961 phds[1]=vhds.
get(1);
1962 phds[2]=vhds.
get(2);
1963 phds[3]=vhds.
get(3);
1964 costheta = vgam.
get(3)/vgam.
d3mag();
1965 selectmode = mymode;
1969 _modeFlag[1]= _selectedMode;
1984 if(pm <_xs0/(_xs0 + _xs1)){
1988 _selectedMode = mymode;
1989 std::cout<<
"A selected mode is "<<mymode<<
" with Mhds= "<<mhds<<std::endl;
1999 for(
int i=0;i< _ndaugs;i++){
2005 if(totMass>p->
mass())
goto checkAA;
2015 if(!byn_ang)
goto checkAA;
2020 mydaugs[0]=daugs[0];
2027 for(
int i=0;i< 2;i++){
2034 if(totMass>p->
mass())
goto checkBA;
2046 if(mhds<
SetMthr)
goto Sampling_mhds_A;
2047 double xeng=1-mhds*mhds/(
_cms*
_cms);
2050 if(mydbg) mass2=mhds;
2055 if(mymode==-10)
goto Sampling_mhds_A;
2057 std::cout<<
"A selected mode is "<<mymode<<
" with Mhds= "<<mhds<<std::endl;
2058 _selectedMode = mymode;
2076 mydaugs[0]=daugs[0];
2083 ISRphotonAng_sampling_A:
2086 for(
int i=0;i< 2;i++){
2092 if(totMass>p->
mass())
goto ISRphotonAng_sampling_A;
2095 if(!
checkdecay(p))
goto ISRphotonAng_sampling_A;
2102 if(maxflag==0) {
findMaxXS(mhds); maxflag=1;}
2105 double gx=vgam.
get(1);
2106 double gy=vgam.
get(2);
2107 double sintheta= sqrt(gx*gx+gy*gy)/vgam.
d3mag();
2113 _modeFlag[1]= _selectedMode;
2118 pgam[0]=vgam.
get(0);
2119 pgam[1]=vgam.
get(1);
2120 pgam[2]=vgam.
get(2);
2121 pgam[3]=vgam.
get(3);
2123 phds[0]=vhds.
get(0);
2124 phds[1]=vhds.
get(1);
2125 phds[2]=vhds.
get(2);
2126 phds[3]=vhds.
get(3);
2127 costheta = vgam.
get(3)/vgam.
d3mag();
2128 selectmode = mymode;
2142 if(pm <_xs0/(_xs0 + _xs1)){
2151 double xeng=1-mhds*mhds/(
_cms*
_cms);
2154 for(
int i=0;i< 2;i++){
2161 SetP4(p,mhds,xeng,theta);
2170 if((_xs0 + _xs1)==0) {std::cout<<
"EvtConExc::zero total xsection"<<std::endl;::abort();}
2172 double xsratio = _xs0/(_xs0 + _xs1);
2175 if(
getNArg()==3 && radflag==1){iflag=1;xsratio=0;}
2176 else if(
getNArg()==3 && radflag==0) {iflag=0;xsratio=1;}
2185 for(
int i=0;i< _ndaugs;i++){
2192 if(summassx>p->
mass())
goto masscheck;
2200 if(!byn_ang)
goto angular_hadron;
2211 double xeng=1-mhdr*mhdr/(
_cms*
_cms);
2222 costheta =
cos(theta);
2226 for(
int i=0;i< 2;i++){
2233 SetP4(p,mhdr,xeng,theta);
2245 std::cout<<
"The decay chain: "<<std::endl;
2262 if((_mode>=0 && _mode<=5) || _mode==44 || _mode==96){
2265 }
else if(_mode==6 || _mode==45 || _mode==46 || _mode==70 || _mode==71|| _mode==93){
2268 }
else if(_mode==23 || _mode==24 || _mode==25 || _mode==26 || _mode==27 || _mode==36 || _mode==39 || _mode==47 || _mode==48 || _mode==52 || _mode==68 || _mode==69 || _mode==72 || _mode==73 || _mode==80 || _mode==94 || _mode==95){
2271 }
else if(_mode==-2){
2295 for(
int ii=0;ii<nmc;ii++){
2297 int gamdaugs = _ndaugs+1;
2300 for(
int i=0;i<_ndaugs;i++){
2301 theDaugs[i] = daugs[i];
2303 theDaugs[_ndaugs]=gamId;
2307 for(
int i=0;i<gamdaugs;i++){
2316 double pmag = pgam.
d3mag();
2317 double pz = pgam.
get(3);
2318 double sintheta = sqrt( pmag*pmag - pz*pz)/pmag;
2319 double onedegree = 1./180.*3.1415926;
2321 if(pmag <El || pmag >Eh) {
goto loop;}
2327 if(thexs>maxXS) {maxXS=thexs;}
2328 double s = p_init.
mass2();
2329 double x = 2*pgam.
get(0)/sqrt(
s);
2356 double xL=2*El/sqrt(
s);
2357 double xH=2*Eh/sqrt(
s);
2358 for(
int i=0;i<nmc;i++){
2360 double x= xL+ (xH-xL)*rdm;
2369 double thexs= Rad2Xs*(xH-xL);
2378 std::cout<<
" "<<std::endl;
2388 if(!Rad2Xs)
return Rad2Xs;
2396 std::cout<<
" "<<std::endl;
2406 if(!Rad2Xs)
return Rad2Xs;
2414 std::cout<<
" "<<std::endl;
2424 if(!Rad2Xs)
return Rad2Xs;;
2441 for(
int ii=0;ii<nmc;ii++){
2443 int gamdaugs = _ndaugs+1;
2446 for(
int i=0;i<_ndaugs;i++){
2447 theDaugs[i] = daugs[i];
2449 theDaugs[_ndaugs]=gamId;
2454 for(
int i=0;i<gamdaugs;i++){
2462 if(totm >= p_init.
get(0) )
goto loop;
2467 double costheta = p4gam.
get(3)/p4gam.
d3mag();
2468 double sintheta = sqrt(1-costheta*costheta);
2469 bool acut=(sintheta>0.04) && (sintheta<0.96);
2470 if(thexs>maxXS && acut ) {maxXS=thexs;}
2479 for(
int i=1;i<_ndaugs;i++){
2483 double mhs = p0.
mass();
2484 double egam = pgam.
get(0);
2485 double sin2theta = pgam.
get(3)/pgam.
d3mag();
2486 sin2theta = 1-sin2theta*sin2theta;
2489 double alpha = 1./137.;
2490 double pi = 3.1415926;
2491 double x = 2*egam/cms;
2496 double difxs = 2*mhs/cms/cms * wsx *xs;
2506 double xsratio = xs/maxXS;
2507 if(pm<xsratio){
return true;}
else{
return false;}
2512 double xs =
difgamXs( mhds,sintheta );
2513 double xsratio = xs/maxXS;
2514 if(pm<xsratio){
return true;}
else{
return false;}
2520 if(pm <xs/
XS_max) {
return true;}
else {
return false;}
2526 if(pm <xs/(xs0*1.1)) {
return true;}
else {
return false;}
2533 double costheta=
cos(theta);
2538 if(_mode ==96){
alpha=-0.34;}
2540 double ang = 1 +
alpha*costheta*costheta;
2543 if(pm< ang/myang) {
return true;}
else{
return false;}
2550 double costheta=
cos(theta);
2553 double ang = 1 - costheta*costheta;
2554 if(pm< ang/1.) {
return true;}
else{
return false;}
2561 double costheta=
cos(theta);
2564 double ang = 1 + costheta*costheta;
2565 if(pm< ang/2.) {
return true;}
else{
return false;}
2571 double alpha = 1./137.;
2572 double pi=3.1415926;
2573 double me = 0.5*0.001;
2574 double sme = sqrt(
s)/
me;
2575 double L = 2*log(sme);
2583 double alpha = 1./137.;
2584 double pi=3.1415926;
2585 double me = 0.5*0.001;
2586 double xi2 = 1.64493407;
2587 double xi3=1.2020569;
2588 double sme = sqrt(
s)/
me;
2589 double L = 2*log(sme);
2590 double beta = 2*
alpha/
pi*(L-1);
2591 double delta2 = (9./8.-2*xi2)*L*L - (45./16.-5.5*xi2-3*xi3)*L-6./5.*xi2*xi2-4.5*xi3-6*xi2*log(2.)+3./8.*xi2+57./12.;
2593 double Delta = 1 + ap *(1.5*L + 1./3.*
pi*
pi-2) + ap*ap *delta2;
2594 double wsx = Delta * beta * pow(
x,beta-1)-0.5*beta*(2-
x);
2595 double wsx2 = (2-
x)*( 3*log(1-
x)-4*log(
x) ) -4*log(1-
x)/
x-6+
x;
2596 wsx = wsx + beta*beta/8. *wsx2;
2597 double mymx = sqrt(
s*(1-
x));
2599 return wsx*
getVP(mymx);
2608 for(
int i=1;i<_ndaugs;i++){
2615 double mrg = cms - summass;
2617 double mhs = pm*mrg + summass;
2619 double s = cms * cms;
2620 double x = 2*Egam/cms;
2628 double difxs = 2*mhs/cms/cms * wsx *xs;
2637 double mhs = sqrt(
s*(1-
x));
2641 double difxs = wsx *xs;
2648 double mhs = sqrt(
s*(1-
x));
2652 double difxs = wsx *xs;
2661 for(
int i=1;i<_ndaugs;i++){
2666 double mrg = cms - summass;
2668 double mhs = pm*mrg + summass;
2670 double s = cms * cms;
2671 double x = 1 - mhs*mhs/
s;
2678 double difxs = 2*mhs/cms/cms * wsx *xs;
2688 double psip_ee =7.73E-03;
2689 double jsi_ee =5.94*0.01;
2690 double phi_ee =2.954E-04;
2704 BR_ee.push_back(phi_ee);
2705 BR_ee.push_back(jsi_ee);
2706 BR_ee.push_back(psip_ee);
2711 ResId.push_back(phiId);
2712 ResId.push_back(jsiId);
2713 ResId.push_back(pspId);
2719 double pi=3.1415926;
2724 double sigma = 12*
pi*
pi*bree*width/
mass/
s;
2725 sigma *=
Rad2(
s, xv);
2726 double nbar = 3.89379304*100000;
2733 double s = cms * cms;
2734 double x = 1 - (*mhs)*(*mhs)/
s;
2741 double difxs = 2*dhs/cms/cms * wsx *xs;
2742 std::ofstream
oa;
oa<<
x<<std::endl;
2747 double s = cms * cms;
2748 double x = 1 - (*mhs)*(*mhs)/
s;
2753 double differ2 = 2*(*mhs)/cms/cms * wsx *xs;
2754 std::ofstream
oa;
oa<<
x<<std::endl;
2760 double s = cms * cms;
2761 double x = 1 - (*mhs)*(*mhs)/
s;
2768 double difxs = 2*dhs/cms/cms * wsx *xs;
2775 double s = cms * cms;
2776 double x = 1 - (*mhs)*(*mhs)/
s;
2781 double differ2 = 2*(*mhs)/cms/cms * wsx *xs;
2788 double alpha = 1./137.;
2789 double pi=3.1415926;
2790 double me = 0.5*0.001;
2791 double xi2 = 1.64493407;
2792 double xi3=1.2020569;
2793 double sme = sqrt(
s)/
me;
2794 double L = 2*log(sme);
2795 double beta = 2*
alpha/
pi*(L-1);
2796 double delta2 = (9./8.-2*xi2)*L*L - (45./16.-5.5*xi2-3*xi3)*L-6./5.*xi2*xi2-4.5*xi3-6*xi2*log(2.)+3./8.*xi2+57./12.;
2798 double Delta = 1 + ap *(1.5*L + 1./3.*
pi*
pi-2) + ap*ap *delta2;
2800 double beta2 = beta*beta;
2803 double xs=(-32*b*beta + 8*pow(b,2)*beta - 10*b*pow(beta,2) + pow(b,2)*pow(beta,2) + 32*pow(b,beta)*Delta -
2804 6*(3 - 4*b + pow(b,2))*pow(beta,2)*log(1 - b) - 32*b*pow(beta,2)*log(b) + 8*pow(b,2)*pow(beta,2)*log(b) +
2805 16*pow(beta,2)*
Li2(b))/32. ;
2806 double mymx = sqrt(
s*(1-b));
2808 return xs*
getVP(mymx);
2814 double li2= +
x +
x*
x/4. +
x*
x*
x/9;
2822 for(
int i=0;i<
n-1;i++){
2823 if(
x[i]>=
t &&
t>
x[i+1]) {n0=i;
break;}
2825 if(n0==-1) {
return 0.0;}
else{
2826 double k=(y[n0]-y[n0+1])/(
x[n0]-
x[n0+1]);
2827 z= y[n0+1]+k*(
t-
x[n0+1]);
2837 for(
int i=0;i<
n-1;i++){
2838 if(
x[i]>=
t &&
t>
x[i+1]) {n0=i;
break;}
2840 double xstotal=y[599];
2841 if(n0==-1) {
return 0;}
else{
2842 double p1=y[n0]/xstotal;
2843 double p2=y[n0+1]/xstotal;
2845 if(p1<pm && pm<=p2) {
return 1;}
else{
return 0;}
2852 if(
t==
x[
n-1] )
return y[
n-1];
2853 for(
int i=0;i<
n-1;i++){
2854 if(
x[i]<=
t &&
t<
x[i+1]) {n0=i;
break;}
2856 if(n0==-1) {
return 0.0;}
else{
2857 double k=(y[n0]-y[n0+1])/(
x[n0]-
x[n0+1]);
2858 z= y[n0+1]+k*(
t-
x[n0+1]);
2874 for(
int i=0;i<
n;i++){
2875 if((y[i]/xst)<pm && pm<=(y[i+1]/xst)){
2881 if(pm>1){std::cout<<
"random larger than 1: "<<pm<<std::endl;}
2882 double mhd=
x[mybin-1]+(
x[mybin]-
x[mybin-1])*pm;
2884 if((mhd -
_cms)>0){std::cout<<
"selected mhd larger than Ecms: "<<mhd<<
" > "<<
x[mybin] <<std::endl;abort();}
2886 std::cout<<
"the sample mhassrons is less than the low end of XS"<<mhd<<
" <"<<_mhdL<<std::endl;
2887 for(
int i=0;i<598;i++){std::cout<<i<<
" "<<
x[i]<<
" "<<y[i]<<std::endl;}
2895 double costheta=
cos(theta);
2897 double cos2=costheta*costheta;
2899 double me=0.51*0.001;
2901 double meE2=
me*
me/eb/eb;
2903 double hq1= meE2/2*costheta/(sin2+meE2*cos2);
2904 double hq2= -0.5*log((1+sqrt(1-meE2)*costheta)/(1-sqrt(1-meE2)*costheta));
2905 double hq3=
x*
x*costheta/2/(
x*
x-2*
x+2)*(1-meE2/(sin2+meE2*cos2));
2906 double hq=(L-1)/2.+hq1+hq2+hq3;
2912 double xx[180],yy[180];
2913 double dgr2rad=1./180.*3.1415926;
2917 for(
int i=6;i<=175;i++){
2922 for(
int j=0;j<=nc;j++){
2927 for(
int j=1;j<=nc;j++){
2928 if(yy[j-1]<pm && pm<=yy[j]){mypt=j;
break;}
2931 double mytheta= xx[mypt-1]+ (xx[mypt]-xx[mypt-1])*pm;
2937 double phi=2*3.1415926*pm;
2938 double gamE =
_cms/2*xeng;
2939 double hdrE = sqrt(mhdr*mhdr+gamE*gamE);
2940 double px = gamE*
sin(theta)*
cos(phi);
2941 double py = gamE*
sin(theta)*
sin(phi);
2942 double pz = gamE*
cos(theta);
2944 p4[0].
set(gamE,px,py,pz);
2945 p4[1].
set(hdrE,-px,-py,-pz);
2947 for(
int i=0;i<2;i++){
2951 if( (
_cms-mhdr)<0.002){
2961 double phi=2*3.1415926*pm;
2962 double gamE =
_cms/2*xeng;
2963 double hdrE = sqrt(mhdr*mhdr+gamE*gamE);
2964 double px = gamE*
sin(theta)*
cos(phi);
2965 double py = gamE*
sin(theta)*
sin(phi);
2966 double pz = gamE*
cos(theta);
2968 p4[0].
set(hdrE,px,py,pz);
2969 p4[1].
set(gamE,-px,-py,-pz);
2970 for(
int i=0;i<2;i++){
2979 for(
int i=0;i<90000;i++){
2982 double sin2theta =sqrt(1-
cos*
cos);
2983 double alpha = 1./137.;
2984 double pi = 3.1415926;
2987 double difxs = 2*mhds/
_cms/
_cms * wsx *xs;
2988 if(difxs>maxXS)maxXS=difxs;
2994 double sin2theta = sintheta*sintheta;
2995 double alpha = 1./137.;
2996 double pi = 3.1415926;
2999 double difxs = 2*mhds/
_cms/
_cms * wsx *xs;
3006 std::vector<int>excmod;
3007 excmod.push_back(0);
3008 excmod.push_back(1);
3009 excmod.push_back(2);
3010 excmod.push_back(6);
3011 excmod.push_back(7);
3012 excmod.push_back(12);
3013 excmod.push_back(13);
3014 excmod.push_back(45);
3015 excmod.push_back(46);
3017 std::vector<double> vxs;vxs.clear();
3018 for (
int i=0;i<vmod.size();i++){
3027 if(i==0) {vxs.push_back(myxs);}
3028 else if(imod==74110){
3029 double xcon = myxs - vxs[i-1];
3030 if(xcon<0) {xcon=vxs[i-1];}
else{xcon=myxs;}
3031 if(mhds<2.0) xcon=vxs[i-1];
3032 vxs.push_back(xcon);
3034 vxs.push_back(myxs+vxs[i-1]);
3041 double totxs = vxs[vxs.size()-1];
3047 if(pm <= vxs[0]/totxs) {
3049 std::vector<EvtId> theDaug=
get_mode(themode);
3051 for(
int i=0;i<theDaug.size();i++){daugs[i]=theDaug[i];}
3053 if(_mode!=74110){
return themode;}
3054 else if(exmode==-1){
return themode;}
else{
goto mycount;}
3057 for(
int j=1;j<vxs.size();j++){
3058 double x0 = vxs[j-1]/totxs;
3059 double x1 = vxs[j]/totxs;
3060 if(x0<pm && pm<=x1){
3062 std::vector<EvtId> theDaug=
get_mode(themode);
3064 for(
int i=0;i<theDaug.size();i++){daugs[i]=theDaug[i];}
3066 if(_mode!=74110){
return themode;}
3067 else if(exmode==-1){
return themode;}
else{
break;}
3073 if(icount<20000 )
goto mode_iter;
3076 std::cout<<
"EvtConExc::selectMode can not find a mode with 20000 iteration for Mhadrons="<<mhds<<std::endl;
3155 std::cout<<
"J/psi: "<<mjsi<<
" "<<wjsi<<std::endl;
3156 std::cout<<
"psipr: "<<mpsip<<
" "<<wpsip<<std::endl;
3157 std::cout<<
"psipp: "<<mpsipp<<
" "<<wpsipp<<std::endl;
3158 std::cout<<
"phi : "<<mphi<<
" "<<wphi<<std::endl;
3159 std::cout<<
"omega: "<<momega<<
" "<<womega<<std::endl;
3160 std::cout<<
"rho0 : "<<mrho0<<
" "<<wrho0<<std::endl;
3161 std::cout<<
"rho(3S)0: "<<mrho3s<<
" "<<wrho3s<<std::endl;
3162 std::cout<<
"omega(2S): "<<momega2s<<
" "<<womega2s<<std::endl;
3168 for(
int i=0;i<nson;i++){
3173 std::cout<<
"Zero mass!"<<std::endl;
3180 std::vector<int> vmod; vmod.clear();
3181 int mn[83]={0,1,2,3,4,5,6,7,8,9,10,11,13,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,32,33,34,35,36,37,38,40,41,44,45,46,
3183 59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,
3184 90,91,92,93,94,95,96,
3185 74100,74101,74102,74103,74104,74105,74110};
3186 int mn2[84]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,32,33,34,35,36,37,38,40,41,44,45,46,
3188 59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,
3189 90,91,92,93,94,95,96,
3190 74100,74101,74102,74103,74104,74105,74110};
3193 for(
int i=0;i<83;i++){vmod.push_back(mn[i]);}
3195 for(
int i=0;i<84;i++){vmod.push_back(mn2[i]);}
3202 for(
int i=0;i<vmod.size();i++){
3203 int mymode = vmod[i];
3204 if(mymode ==74110)
continue;
3220 for(
int i=0;i<par->
getNDaug();i++){
3236 double angmax = 1+
alpha;
3237 double costheta =
cos(p4i.
theta());
3238 double ang=1+
alpha*costheta*costheta;
3239 double xratio = ang/angmax;
3243 if(xi>xratio)
return false;
3253 double u = 0.938/mx;
3255 double u2 = (1+u)*(1+u);
3256 double uu = u*(1+6*u);
3257 double alpha = (u2-uu)/(u2+uu);
3266 for(
int i=0;i<par->
getNDaug();i++){
3272 if(pdgcode==111 ||pdgcode==221 || pdgcode==331){
3276 double angmax = 1+
alpha;
3277 double costheta =
cos(p4i.
theta());
3278 double ang=1+
alpha*costheta*costheta;
3279 double xratio = ang/angmax;
3283 if(xi>xratio)
return false;
3294 double psippee,psipee,jsiee,
phiee,omegaee,
rhoee;
3295 double kev2Gev=0.000001;
3296 psippee=0.262*kev2Gev;
3297 psipee =2.36*kev2Gev;
3298 jsiee =5.55*kev2Gev;
3299 phiee=4.266*0.001*2.954*0.0001;
3300 omegaee=0.6*kev2Gev;
3306 double xpi=12*3.1415926*3.1415926;
3307 if(mxL<=3.0957 && 3.0957<=mxH || mxL<=3.0983 && 3.0983<=mxH) {
3310 }
else if(mxL<=3.6847 && 3.6847<=mxH || mxL<=3.6873 && 3.6873<=mxH){
3313 }
else if(mxL<=1.01906 && 1.01906<=mxH || mxL<= 1.01986 && 1.01986<=mxH){
3318 if(
_cms<=mv)
return -1.;
3319 double xv = 1-mv*mv/
s;
3320 sigv += xpi*widee/mv/
s*
Rad2(
s,xv);
3321 double unic = 3.89379304*100000;
3328 for(
int i=0;i<ISRXS.size();i++){
3329 if( (ISRM[i]-mhi)<binwidth && ISRFLAG[i]){ISRFLAG[i]=0; myxs = ISRXS[i];}
3336 double pm,mhdL,mhds;
3339 mhds = pm*(
_cms - mhdL)+mhdL;
3340 std::vector<double> sxs;
3341 for(
int i=0;i<ISRID.size();i++){
3342 double ri=ISRXS[i]/AF[598];
3345 for(
int j=0;j<sxs.size();j++){
3346 if(j>0) sxs[j] += sxs[j-1];
3352 for(
int j=1;j<sxs.size();j++){
3353 double x0 = sxs[j-1];
3365 for(
int i=0;i<4001;i++){
3369 if(xx<=mx && mx <x1){xx=x1; r1=y1; i1=y2; mytag=0;
break;}
3370 xx=x1; r1=y1; i1=y2;
3372 if(mytag==1){std::cout<<
"No vacuum polarization value found"<<std::endl;abort();}
3374 double thevp=
abs(1./(1-cvp));
3375 if(3.0933<mx && mx<3.1035)
return 1.;
3376 if(3.6810<mx && mx<3.6913)
return 1.;
3382 vpx.clear();vpr.clear();vpi.clear();
3387 std::string locvp=getenv(
"BESEVTGENROOT");
3388 locvp +=
"/share/vp.dat";
3389 ifstream m_inputFile;
3390 m_inputFile.open(locvp.c_str());
3395 for(
int i=0;i<4001;i++){
3396 m_inputFile>>vpx[i]>>vpr[i]>>vpi[i];
3405 int mode=vmode[midx];
3413 for(
int i=0;i<600;i++){VXS[midx][i]=0;}
3421 double xb= 2*Esig/
_cms;
3426 double stp=(EgamH - Egamcut)/Nstp;
3427 for(
int i=0;i<Nstp;i++){
3428 double Eg0=EgamH - i*stp;
3429 double Eg1=EgamH - (i+1)*stp;
3432 if(i==0) VXS[midx][0]=xsi;
3433 if(i>=1) VXS[midx][i]=VXS[midx][i-1]+xsi;
3435 VXS[midx][598]=VXS[midx][597];
3436 VXS[midx][599]=VXS[midx][598]+ myxs0;
3442 for(
int j=0;i<vmode.size();j++){
3443 if(mode==vmode[j])
return j;
3445 std::cout<<
" EvtConExc::get_mode_index: no index is found in vmode"<<std::endl;
3450 double hwid=(AA[0]-AA[1])/2.;
3453 double Egam=(
s-mhds*mhds)/2/
_cms;
3454 for(
int i=0;i<600;i++){
3455 if( (AA[i]-hwid)<=Egam && Egam<(AA[i]+hwid) )
return VXS[idx][i];
3458 std:cout<<
"EvtConExc::getObsXsection : no observed xs is found "<<endl;
3464 double mhds = sqrt(
s - 2*Egam*
_cms);
3470 oa.open(
"_pkhr.dec");
3471 ob.open(
"obsxs.dat");
3475 double xscon=VXS[im][599];
3477 std::vector<int> Vmode;
3479 Vmode.push_back(13);
3480 Vmode.push_back(12);
3483 Vmode.push_back(45);
3484 Vmode.push_back(46);
3487 Vmode.push_back(37);
3488 std::vector<std::string> vmdl;
3489 vmdl.push_back(
"PHOKHARA_pipi");
3490 vmdl.push_back(
"PHOKHARA_pi0pi0pipi");
3491 vmdl.push_back(
"PHOKHARA_4pi");
3492 vmdl.push_back(
"PHOKHARA_ppbar");
3493 vmdl.push_back(
"PHOKHARA_nnbar");
3494 vmdl.push_back(
"PHOKHARA_KK");
3495 vmdl.push_back(
"PHOKHARA_K0K0");
3496 vmdl.push_back(
"PHOKHARA_pipipi0");
3497 vmdl.push_back(
"PHOKHARA_LLB");
3498 vmdl.push_back(
"PHOKHARA_pipieta");
3500 ob<<
"mode_index observed cross /nb"<<std::endl;
3501 for(
int i=0;i<vmode.size();i++){
3502 ob<<vmode[i]<<
" "<<VXS[
getModeIndex(vmode[i])][599]<<std::endl;
3506 for(
int i=0;i<Vmode.size();i++){
3511 for(
int i=0;i<Vmode.size();i++){
3515 oa<<
"LundaPar PARJ(11)=0.611798"<<std::endl;
3516 oa<<
"LundaPar PARJ(12)=7.92527E-12"<<std::endl;
3517 oa<<
"LundaPar PARJ(14)=0.244495"<<std::endl;
3518 oa<<
"LundaPar PARJ(15)=1.16573E-15"<<std::endl;
3519 oa<<
"LundaPar PARJ(16)=0.436516"<<std::endl;
3520 oa<<
"LundaPar PARJ(17)=0.530517"<<std::endl;
3521 oa<<
"LundaPar PARJ(1)=0.0651577"<<std::endl;
3522 oa<<
"LundaPar PARJ(2)=0.260378"<<std::endl;
3523 oa<<
"LundaPar PARJ(21)=0.0664835"<<std::endl;
3524 oa<<
"LundaPar RALPA(15)=0.576687"<<std::endl;
3525 oa<<
"LundaPar RALPA(16)=0.364796"<<std::endl;
3526 oa<<
"LundaPar RALPA(17)=3.19486E-06"<<std::endl;
3527 oa<<
"noPhotos"<<std::endl;
3528 oa<<
"Particle vpho "<<
_cms<<
" 0"<<std::endl;
3529 oa<<
"Decay vpho"<<std::endl;
3530 oa<<
"0 pi+ pi- PHSP ;"<<std::endl;
3531 oa<<
"0 pi0 pi0 pi- pi+ PHSP ;"<<std::endl;
3532 oa<<
"0 pi+ pi- pi- pi+ PHSP ;"<<std::endl;
3533 oa<<
"0 anti-p- p+ PHSP ;"<<std::endl;
3534 oa<<
"0 anti-n0 n0 PHSP ;"<<std::endl;
3535 oa<<
"0 K+ K- PHSP ;"<<std::endl;
3536 oa<<
"0 K_S0 K_L0 PHSP ;"<<std::endl;
3537 oa<<
"0 pi+ pi- pi0 PHSP ;"<<std::endl;
3538 oa<<
"0 Lambda0 anti-Lambda0 PHSP ;"<<std::endl;
3539 oa<<
"0 pi+ pi- eta PHSP ;"<<std::endl;
3540 oa<<
"0 gamma phi PHSP;"<<std::endl;
3541 oa<<
"0 gamma rho0 PHSP;"<<std::endl;
3542 oa<<
"0 gamma omega PHSP;"<<std::endl;
3543 oa<<xscon<<
" ConExc 74110;"<<std::endl;
3544 for(
int i=0;i<Vmode.size();i++){
3545 oa<<VXS[
getModeIndex(Vmode[i]) ][599]<<
" "<<vmdl[i]<<
" ;"<<std::endl;
3547 oa<<
"Enddecay"<<std::endl;
3548 oa<<
"End"<<std::endl;
3555 oa.open(
"_evtR.dat");
3558 double xscon=VXS[im][599];
3559 double xscon0=xscon;
3560 oa<<
"Ecms= "<<
_cms<<
" GeV"<<std::endl;
3561 oa<<
"The total observed xs: "<<xscon<<
" nb"<<std::endl;
3562 oa<<
"=== mode =========== ratio ==========="<<std::endl;
3563 for(
int i=0;i<vmode.size();i++){
3566 if(vmode[i]==74110)
continue;
3567 xscon -= VXS[themode ][599];
3569 if(xscon<0) xscon=0;
3571 for(
int i=0;i<vmode.size();i++){
3573 if(vmode[i]==74110)
continue;
3574 oa<<vmode[i]<<
"-th mode: "<<100*VXS[themode][599]/xscon0<<
" % "<<std::endl;
3576 oa<<
"74110-th mode: "<<100*xscon/xscon0<<
" % "<<std::endl;
3582 for (
int i=0;i<vmode.size();i++){
3583 if(m==vmode[i])
return i;
3585 std::cout<<
"EvtConExc::getModeIndex: no index in vmode found "<<std::endl;
3591 return std::string(
"ConExcPar");
3596 if (ncommand==lcommand){
3597 lcommand=10+2*lcommand;
3598 std::string* newcommands=
new std::string[lcommand];
3600 for(i=0;i<ncommand;i++){
3601 newcommands[i]=commands[i];
3604 commands=newcommands;
3606 commands[ncommand]=cmd;
3613 if (nconexcdecays==ntable){
3617 for(i=0;i<ntable;i++){
3618 newconexcdecays[i]=conexcdecays[i];
3621 delete [] conexcdecays;
3622 conexcdecays=newconexcdecays;
3625 conexcdecays[nconexcdecays++]=jsdecay;
3632 std::string::size_type pos;
3633 std::vector<std::string> result;
3635 int size=str.size();
3637 for(
int i=0; i<size; i++)
3639 pos=str.find(pattern,i);
3642 std::string
s=str.substr(i,pos-i);
3643 result.push_back(
s);
3644 i=pos+pattern.size()-1;
3654 std::string pattern=
"=";
3655 for(
int i=0;i<ncommand;i++){
3656 std::vector<std::string> result=
split(commands[i],pattern);
3657 if(result[0]==
"threshold") { threshold=atof(result[1].c_str());}
else
3658 if(result[0]==
"beamEnergySpread"){ beamEnergySpread=atof(result[1].c_str());}
3660 std::cout<<
"Your parameter in decay card \""<<result[0]<<
"\" incorect"<<std::endl;
3661 std::cout<<
"Possible words: threshold, beamEnergySpread"<<std::endl;
3675 for(
int i=0;i<
n;i++){
3679 double eta=sqrt(
n*12.0)*(ri/12-0.5);
3680 double xsig= sigma*eta+mu;
3683 if(xsig<mx0 || xsig>mx1)
goto rloop;
3691 double Esig = 0.0001;
3692 double x = 2*Egamcut/
_cms;
3696 double EgamH = (
s-mhdL*mhdL)/2/sqrt(
s);
3702 double xb= 2*Esig/
_cms;
3707 double stp=(EgamH - Egamcut)/Nstp;
3708 for(
int i=0;i<Nstp;i++){
3709 double Eg0=EgamH - i*stp;
3710 double Eg1=EgamH - (i+1)*stp;
3716 double binwidth = mh2-mhi;
3718 if(i>=1) AF[i]=AF[i-1]+xsi;
3722 AA[598]=Egamcut; AA[599]=0;
3724 AF[599]=AF[598]+ _xs0;
3726 for(
int i=0;i<600;i++){
3731 if(bornXS==0){std::cout<<
"EvtConExc::calAF: bad BornXS at "<<
_cms<<
" GeV"<<std::endl;abort();}
3732 double fisr=AF[599]/bornXS;
3733 myFisr.push_back(fisr);
3739 int ntot=myFisr.size();
3741 for(
int i=0;i<ntot;i++){mymu += myFisr[i];}
3744 for(
int i=0;i<ntot;i++){ mysig += (myFisr[i]-mymu)*(myFisr[i]-mymu);}
3746 mysig = sqrt(mysig);
3747 std::cout<<
"========= Iteration times over ISR factor: "<<ntot<<std::endl;
3748 std::cout<<
" ISR factor * VP factor= observedXS/BornXS: "<<mymu<<
" + "<<mysig<<std::endl;
3754 double xL=2*El/sqrt(
s);
3755 double xH=2*Eh/sqrt(
s);
3757 double gaps = (xH-xL)/
double(
n);
3758 for (
int i = 0; i <
n; i++)
3767 double xL=2*El/sqrt(
s);
3768 double xH=2*Eh/sqrt(
s);
3770 double gaps = (xH-xL)/
double(
n);
3771 for (
int i = 0; i <
n; i++)
double Rad2difXs2(double *mhs)
void hadr5n12_(float *, float *, float *, float *, float *, float *)
double divdif_(float *, float *, int *, float *, int *)
double Rad2difXs(double *m)
double Rad2difXs_er2(double *mhs)
double dgauss_(double(*fun)(double *), double *, double *, double *)
double Rad2difXs_er(double *m)
void polint_(float *, float *, int *, float *, float *)
EvtDiracSpinor boostTo(const EvtDiracSpinor &sp, const EvtVector4R p4)
DOUBLE_PRECISION xlow[20]
EvtTensor3C eps(const EvtVector3R &v)
double sin(const BesAngle a)
double cos(const BesAngle a)
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared dimensionless $ !dummy photon IR regulator $ !crude photon multiplicity enhancement factor *EVENT $ !MC crude volume of PhhSpace *Sfactors $ !YFS formfactor IR part only $ !YFS formfactor non IR finite part $ !mass weight
***************************************************************************************Pseudo Class RRes *****************************************************************************************Parameters and physical constants **Maarten sept ************************************************************************DOUBLE PRECISION xsmu **************************************************************************PARTICLE DATA all others are from PDG *Only resonances with known widths into electron pairs are sept ************************************************************************C Declarations xmb DOUBLE PRECISION xcb DOUBLE PRECISION xmDcs DOUBLE PRECISION xmBbc DOUBLE PRECISION rh2ee DOUBLE PRECISION omepi DOUBLE PRECISION om3ee DOUBLE PRECISION phiee
***************************************************************************************Pseudo Class RRes *****************************************************************************************Parameters and physical constants **Maarten sept ************************************************************************DOUBLE PRECISION xsmu **************************************************************************PARTICLE DATA all others are from PDG *Only resonances with known widths into electron pairs are sept ************************************************************************C Declarations xmb DOUBLE PRECISION xcb DOUBLE PRECISION xmDcs DOUBLE PRECISION xmBbc DOUBLE PRECISION rhoee
bool checkdecay(EvtParticle *p)
void findMaxXS(EvtParticle *p)
double addNarrowRXS(double mhi, double binwidth)
double narrowRXS(double mxL, double mxH)
bool VP_sampling(EvtVector4R pcm, EvtVector4R pi)
void command(std::string cmd)
double gamHXSection_er(double El, double Eh)
bool islgr(double *x, double *y, int n, double t)
double lgr(double *x, double *y, int n, double t)
double baryonAng(double mx)
double Ros_xs(double mx, double bree, EvtId pid)
double Rad1(double s, double x)
static EvtXsection * staxsection
static EvtXsection * myxsection
void SetP4Rvalue(EvtParticle *part, double mhdr, double xeng, double theta)
bool meson_sampling(EvtVector4R pcm, EvtVector4R pi)
bool photonSampling(EvtParticle *part)
double ISR_ang_integrate(double x, double theta)
bool xs_sampling(double xs)
int selectMode(std::vector< int > vmod, double mhds)
double gamHXSection(EvtParticle *p, double El, double Eh, int nmc=100000)
double Rad1difXs(EvtParticle *p)
bool baryon_sampling(EvtVector4R pcm, EvtVector4R pi)
int get_mode_index(int mode)
double LLr(double *x, double *y, int n, double t)
double Rad2difXs(EvtParticle *p)
double SoftPhoton_xs(double s, double b)
bool angularSampling(EvtParticle *part)
double difgamXs(EvtParticle *p)
double ISR_ang_sampling(double x)
double Mhad_sampling(double *x, double *y)
double energySpread(double mu, double sigma)
std::vector< EvtId > get_mode(int mode)
double getObsXsection(double mhds, int mode)
void mk_VXS(double Esig, double Egamcut, double EgamH, int midx)
void calAF(double myecms)
bool hadron_angle_sampling(EvtVector4R ppi, EvtVector4R pcm)
bool gam_sampling(EvtParticle *p)
double Rad2(double s, double x)
double trapezoid(double s, double a, double b, int n)
void getName(std::string &name)
void decay(EvtParticle *p)
std::vector< std::string > split(std::string str, std::string pattern)
std::string commandName()
double Egam2Mhds(double Egam)
void SetP4(EvtParticle *part, double mhdr, double xeng, double theta)
static int inChannelList(EvtId parent, int ndaug, EvtId *daugs)
static double getWidth(EvtId i)
static int getStdHep(EvtId id)
static double getMeanMass(EvtId i)
static void reSetWidth(EvtId i, double width)
static void reSetMass(EvtId i, double mass)
static EvtId evtIdFromStdHep(int stdhep)
static std::string name(EvtId i)
static double getMinMass(EvtId i)
static EvtSpinType::spintype getSpinType(EvtId i)
static double getMass(EvtId i)
static EvtId getId(const std::string &name)
static EvtParticle * particleFactory(EvtSpinType::spintype spinType)
void makeDaughters(int ndaug, EvtId *id)
virtual void init(EvtId part_n, const EvtVector4R &p4)=0
void setIntFlag(std::vector< int > vi)
const EvtVector4R & getP4() const
EvtParticle * getDaug(int i)
void deleteDaughters(bool keepChannel=false)
double initializePhaseSpace(int numdaughter, EvtId *daughters, double poleSize=-1., int whichTwo1=0, int whichTwo2=1)
void set(int i, double d)
void setModes(std::vector< int > vmd)
std::vector< double > getEr()
void ini_data_multimode()
double getXsection(double mx)
std::vector< double > getYY()
std::vector< double > getXX()