149#include "TGraphErrors.h"
151#include "TPostScript.h"
153#include "TMultiGraph.h"
156int EvtConExc::nconexcdecays=0;
158int EvtConExc::ntable=0;
160int EvtConExc::ncommand=0;
161int EvtConExc::lcommand=0;
162std::string* EvtConExc::commands=0;
163double EvtConExc::AF[600];
164double EvtConExc::AA[600];
165double EvtConExc::MH[600];
171 extern double dgauss_(
double (*fun)(
double*),
double *,
double *,
double *);
175 extern double divdif_(
float*,
float *,
int *,
float *,
int*);
179 extern void polint_(
float*,
float *,
int *,
float *,
float*);
183 extern void hadr5n12_(
float*,
float *,
float *,
float *,
float *,
float *);
195double EvtConExc::_xs0=0;
196double EvtConExc::_xs1=0;
197double EvtConExc::_er0=0;
198double EvtConExc::_er1=0;
199int EvtConExc::_nevt=0;
205std::vector<std::vector <double> > EvtConExc::VXS;
222 if (nconexcdecays==0) {
228 for(i=0;i<nconexcdecays;i++){
229 if (conexcdecays[i]==
this){
230 conexcdecays[i]=conexcdecays[nconexcdecays-1];
232 if (nconexcdecays==0) {
261 for(
int i=0;i<120;i++){
265 for(
int i=0;i<97;i++){
266 if(53<=i && i<=58)
continue;
267 if(86<=i && i<=89)
continue;
268 if(_mode==74110 ||_mode==-100) vmode.push_back(i);
270 if(_mode==74110||_mode==-100){
271 vmode.push_back(74100);
272 vmode.push_back(74101);
273 vmode.push_back(74102);
274 vmode.push_back(74103);
275 vmode.push_back(74104);
276 vmode.push_back(74105);
277 vmode.push_back(74110);
280 std::cout<<
"==== Parameters set by users====="<<std::endl;
281 for(
int i=0;i<ncommand;i++){
282 std::cout<<commands[i]<<std::endl;
284 std::cout<<
"==================================="<<std::endl;
286 std::cout<<threshold<<
" "<<beamEnergySpread<<std::endl;
294 }
else if(
getNDaug()>2){std::cout<<
"Bad daughter specified"<<std::endl;abort();
307 std::cout<<
"The decay daughters are "<<std::endl;
309 std::cout<<std::endl;
311 radflag=0;mydbg=
false;
315 }
else if(
getArg(0)==-100){
320 std::cout<<
" multi-exclusive mode "<<std::endl;
322 std::cout<<std::endl;
323 if(vmd[vmd.size()-1]==74110){std::cout<<
"74110 is not allowd for multimode simulation"<<std::endl;abort();}
324 }
else if(
getNArg()==1){ _mode =
getArg(0); radflag=0;mydbg=
false;
327 }
else{std::cout<<
"ConExc:number of parameter should be 1,2 or 3, but you set "<<
getNArg()<<std::endl;::abort(); }
337 myfile =
new TFile(
"mydbg.root",
"RECREATE");
338 xs=
new TTree (
"xs",
"momentum of rad. gamma and hadrons");
339 xs->Branch(
"imode",&imode,
"imode/I");
340 xs->Branch(
"pgam",pgam,
"pgam[4]/D");
341 xs->Branch(
"phds",phds,
"phds[4]/D");
342 xs->Branch(
"ph1",ph1,
"ph1[4]/D");
343 xs->Branch(
"ph2",ph2,
"ph2[4]/D");
344 xs->Branch(
"mhds",&mhds,
"mhds/D");
345 xs->Branch(
"mass1",&mass1,
"mass1/D");
346 xs->Branch(
"mass2",&mass2,
"mass2/D");
347 xs->Branch(
"costheta",&costheta,
"costheta/D");
348 xs->Branch(
"cosp",&cosp,
"cosp/D");
349 xs->Branch(
"cosk",&cosk,
"cosk/D");
350 xs->Branch(
"sumxs",&sumxs,
"sumxs/D");
351 xs->Branch(
"selectmode",&selectmode,
"selectmode/D");
357 std::cout<<
"parent mass = "<<parentMass<<std::endl;
377 if(mx<mth){std::cout<<
"The CMS energy is lower than the threshold of the final states"<<std::endl;abort();}
378 }
else if(_mode == -2){
384 std::cout<<
"The specified mode is "<<_mode<<std::endl;
389 double Esig = 0.0001;
390 double x = 2*Egamcut/
_cms;
392 double mhscut = sqrt(
s*(1-
x));
395 float fe,fst2,fder,ferrder,fdeg,ferrdeg;
399 if(3.0943<
_cms &&
_cms<3.102) vph=1;
400 std::cout<<
"sum of leptonic, hadronic contributions(u,d,s,c,b) to vacuum polarization: "<<vph<<
" @"<<fe<<
"GeV"<<std::endl;
406 for(
int jj=1;jj<_ndaugs;jj++){
410 ISRXS.clear();ISRM.clear();ISRFLAG.clear();
411 for(
int ii=0;ii<3;ii++){
413 if(mx<mR || _mode !=74110)
continue;
414 double narRxs=
Ros_xs(mx,BR_ee[ii],ResId[ii]);
415 std::cout<<
"The corss section for gamma "<<
EvtPDL::name(ResId[ii]).c_str()<<
" is: "<< narRxs<<
"*Br (nb)."<<std::endl;
416 ISRXS.push_back(narRxs);
418 ISRFLAG.push_back(1.);
419 ISRID.push_back(ResId[ii]);
422 std::cout<<
"==========================================================================="<<std::endl;
427std::cout<<
"SetMthr= "<<
SetMthr<<std::endl;
428 EgamH = (
s-mhdL*mhdL)/2/sqrt(
s);
432 std::cout<<
"_er0= "<<_er0<<std::endl;
434 std::cout<<
"_xs1= "<<_xs0<<std::endl;
435 double xs1_err = _er1;
439 double xb= 2*Esig/
_cms;
442 std::cout<<
"_xs0= "<<_xs0<<std::endl;
447 double stp=(EgamH - Egamcut)/Nstp;
448 for(
int i=0;i<Nstp;i++){
449 double Eg0=EgamH - i*stp;
450 double Eg1=EgamH - (i+1)*stp;
458 double binwidth = mh2-mhi;
461 if(i>=1) AF[i]=AF[i-1]+xsi;
465 AA[598]=Egamcut; AA[599]=0;
467 AF[599]=AF[598]+ _xs0;
472 std::cout<<
"mhdL = "<<mhdL<<
", SetMthr= "<<
SetMthr<<
", EgamH = "<<EgamH<<std::endl;
473 for(
int i=0;i<vmode.size();i++){
474 if(_mode==74110||_mode==-100)
mk_VXS(Esig,Egamcut,EgamH,i);
495 for(
int i=0;i<vmode.size();i++){
497 if(md<74100 || md>74106)
continue;
498 std::string partname=
"";
499 if(md==74100) {partname=
"J/psi";}
500 else if(md==74101) {partname=
"psi(2S)";}
501 else if(md==74102) {partname=
"psi(3770)";}
502 else if(md==74103) {partname=
"phi";}
503 else if(md==74104) {partname=
"omega";}
504 else if(md==74105) {partname=
"rho0";}
505 else if(md==74106) {partname=
"rho(3S)0";}
507 std::cout<<
"The observed cross section for gamma "<<partname<<
": "<<VXS[i][599]<<
" nb"<<std::endl;
511 for(
int i=0;i<600;i++){
518 std::cout<<
"EgamH = "<<EgamH<<
", obsvXS = "<<_xs0+_xs1<<
", _xs1 = "<<_xs1 <<
", _xs0 = "<<_xs0<<std::endl;
519 std::cout<<
"EgamH = "<<EgamH<<
", AF[599] = "<< AF[599]<<
", AF[598] = "<<AF[598]<<
", _xs0 = "<<_xs0<<std::endl;
526 double obsvXS = _xs0 + _xs1;
527 double obsvXS_er= _er0 + xs1_err;
528 double corr = obsvXS/bornXS;
529 double corr_er =corr*sqrt(bornXS_er*bornXS_er/bornXS/bornXS + obsvXS_er*obsvXS_er/obsvXS/obsvXS);
532 if(bornXS==0){std::cout<<
"EvtConExc::init : The Born cross section at this point is zero!"<<std::endl;abort();}
533 if(obsvXS==0){std::cout<<
"EvtConExc::init : The observed cross section at this point is zero!"<<std::endl;abort();}
538 std::cout<<
""<<std::endl;
539 std::cout<<
"========= Generation using cross section (Egamcut="<<Egamcut<<
" GeV) =============="<<std::endl;
540 std::cout<<
" sqrt(s)= "<<mx<<
" GeV "<<std::endl;
541 if(_mode>=0 || _mode ==-2 || _mode ==-100){
542 std::cout<<
"The generated born cross section (sigma_b): "<<_xs0<<
"+/-"<<_er0<<
" in Unit "<<_unit.c_str()<<std::endl;
543 std::cout<<
"The generated radiative correction cross section (sigma_isr): "<<_xs1<<
"+/-"<<xs1_err<<
" in Unit "<<_unit.c_str()<<std::endl;
544 std::cout<<
"The Born process is sampled according to the ratio sigma_b/(sigma_b+sigma_isr)"<<std::endl;
545 std::cout<<
"The radiative correction factor f_ISR*f_vacuum= sigma_obs/sigma_born(s) = "<<corr<<
"+/-"<< fabs(corr_er)<<
","<<std::endl;
546 std::cout<<
"which is calcualted with these quantities:"<<std::endl;
547 std::cout<<
"the observed cross section is "<<obsvXS<<
"+/-"<< obsvXS_er<<_unit.c_str()<<std::endl;
548 std::cout<<
"and the Born cross section (s) is "<<bornXS<<
"+/-"<<bornXS_er<<_unit.c_str()<<std::endl;
549 std::cout<<
"and the vaccum polarziation factor (lep. + hadr.) 1/|1-Pi|^2= "<<vph<<std::endl;
551 std::cout<<
"==========================================================================="<<std::endl;
553 std::cout<<
"The generated born cross section (sigma_b): "<<_xs0<<
" *Br_ee"<<
" in Unit "<<_unit.c_str()<<std::endl;
554 std::cout<<
"The generated radiative correction cross section (sigma_isr): "<<_xs1<<
"*Br_ee in Unit "<<_unit.c_str()<<std::endl;
555 std::cout<<
"The Born process is sampled according to the ratio sigma_b/(sigma_b+sigma_isr)"<<std::endl;
556 std::cout<<
"The radiative correction factor sigma_obs/sigma_born(s) = (1+delta) = "<<corr<<
"+/-"<< fabs(corr_er)<<std::endl;
557 std::cout<<
"==========================================================================="<<std::endl;
559 std::cout<<std::endl;
560 std::cout<<std::endl;
564 std::cout<<
" Summary of Born cross section for each exclusive mode"<<std::endl;
565 std::cout<<
"Mode index "<<
" Born cross section at "<<mx<<
" GeV "<<
" final states"<<std::endl;
567 std::cout<<
"End of summary Born cross section"<<std::endl;
575 if(_xs0 == 0 && _xs1==0){std::cout<<
"EvtConExc::ini() has zero cross section"<<std::endl;abort();}
577 std::cout<<std::endl;
578 std::cout<<std::endl;
582 if(mydbg && _mode!=74110){
584 double xx[10000],yy[10000],xer[10000],yer[10000];
585 for(
int i=0;i<nd;i++){
592 myth=
new TH1F(
"myth",
"Exp.data",200,xx[0],xx[nd]);
593 for(
int i=0;i<nd;i++){
594 myth->Fill(xx[i],yy[i]);
600 }
else if(mydbg && _mode==74110){
602 double xx[10000],yy[10000],xer[10000],yer[10000],ysum[10000],yysum[10000];
603 for(
int i=0;i<nd;i++){
608 std::cout<<
"yy "<<yy[i]<<std::endl;
614 TGraphErrors *Gdt =
new TGraphErrors(nd,xx,yy,xer,yer);
616 myth=
new TH1F(
"myth",
"Exp.data",600,
xlow,xhigh);
617 Xsum=
new TH1F(
"sumxs",
"sum of exclusive xs",600,
xlow,xhigh);
619 for(
int i=0;i<600;i++){
627 for(
int i=0;i<600;i++){
630 if(ysum[i]==0)
continue;
631 Xsum->Fill(mx,ysum[i]);
635 for(
int i=0;i<nd;i++){
643 TGraphErrors *Gsum =
new TGraphErrors(nd,xx,yysum,xer,yer);
645 double ex[600]={600*0};
646 double ey[600],ta[600];
647 double exz[600]={600*0};
648 double eyz[600]={600*0};
649 for(
int i=0;i<600;i++){
652 TGraphErrors *gr0 =
new TGraphErrors(600,MH,AF,ex,ey);
653 TGraphErrors *gr1 =
new TGraphErrors(600,MH,RadXS,exz,eyz);
654 TPostScript *ps =
new TPostScript(
"xsobs.ps",111);
655 TCanvas *c1 =
new TCanvas(
"c1",
"TGraphs for data",200,10,600,400);
658 gStyle->SetCanvasColor(0);
659 gStyle->SetStatBorderSize(1);
667 gr0->SetMarkerStyle(10);
669 gr0->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
670 gr0->GetYaxis()->SetTitle(
"observed cross section (nb)");
678 gr1->SetMarkerStyle(10);
680 gr1->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
681 gr1->GetYaxis()->SetTitle(
"Rad*BornXS");
685 TMultiGraph *mg =
new TMultiGraph();
686 mg->SetTitle(
"Exclusion graphs");
687 Gdt->SetMarkerStyle(2);
688 Gdt->SetMarkerSize(1);
689 Gsum->SetLineColor(2);
690 Gsum->SetLineWidth(1);
700 mg->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
701 mg->GetYaxis()->SetTitle(
"observed cross section (nb)");
709 Gdt->SetMarkerStyle(2);
711 Gdt->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
712 Gdt->GetYaxis()->SetTitle(
"observed cross section (nb)");
719 Gsum->SetMarkerStyle(2);
720 Gsum->SetMarkerSize(1);
722 Gsum->SetLineWidth(0);
723 Gsum->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
724 Gsum->GetYaxis()->SetTitle(
"observed cross section (nb)");
732 Gdt->SetMarkerStyle(2);
733 Gdt->SetMarkerSize(1);
734 Gdt->SetMaximum(8000.0);
735 Gsum->SetLineColor(2);
736 Gsum->SetLineWidth(1.5);
739 Gsum->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
740 Gsum->GetYaxis()->SetTitle(
"cross section (nb)");
1178 }
else if(mode==111){
1182 }
else if(mode==112){
1186 }
else if(mode==74100){
1189 }
else if(mode==74101){
1192 }
else if(mode==74102){
1195 }
else if(mode==74103){
1198 }
else if(mode==74104){
1201 }
else if(mode==74105){
1204 }
else if(mode==74106){
1207 }
else if(mode==74107){
1210 }
else if(mode==74110){
1216 _modeFlag.push_back(74110);
1217 _modeFlag.push_back(0);
1220 for(
int i=0;i<nson;i++){ daugs[i]=son[i]; }
1221 std::cout<<
"The paraent particle: "<<
EvtPDL::name(pid)<<std::endl;
1224 for(
int i=0;i<nson;i++){ daugs[i]=son[i]; }
1225 }
else if(mode==-100){
1229 _modeFlag.push_back(-100);
1230 _modeFlag.push_back(0);
1232 }
else if(mode==10000){
1237 std::cout<<
"Bad mode_index number " <<mode<<
", please refer to the manual."<<std::endl;
1249 for(
int i=0;i<_ndaugs;i++){
1255 if(!(_mode==74110 || _mode==-100)){
1256 if(Mthr<fmth) {std::cout<<
"Low end of cross section: ("<<Mthr<<
" < (mass of final state)"<<fmth<<
") GeV."<< std::endl; abort();}
1690 }
else if(mode==111){
1694 }
else if(mode==112){
1698 }
else if(mode==74100){
1702 }
else if(mode==74101){
1706 }
else if(mode==74102){
1710 }
else if(mode==74103){
1714 }
else if(mode==74104){
1718 }
else if(mode==74105){
1722 }
else if(mode==74106){
1726 }
else if(mode==74107){
1730 }
else if(mode==74110){
1737 _modeFlag.push_back(74110);
1738 _modeFlag.push_back(0);
1741 for(
int i=0;i<nson;i++){ daugs[i]=son[i]; }
1742 std::cout<<
"The paraent particle: "<<
EvtPDL::name(pid)<<std::endl;
1745 for(
int i=0;i<nson;i++){ daugs[i]=son[i]; }
1746 }
else if(mode==-100){
1750 _modeFlag.push_back(-100);
1751 _modeFlag.push_back(0);
1753 }
else if(mode==10000){
1758 std::cout<<
"Bad mode_index number " <<mode<<
", please refer to the manual."<<std::endl;
1769 std::vector<EvtId> theDaugs;
1770 for(
int i=0;i<_ndaugs;i++){
1771 theDaugs.push_back(daugs[i]);
1773 if(theDaugs.size()) {
return theDaugs;}
else {std::cout<<
"EvtConExc::get_mode: zero size"<<std::endl;abort();}
1786 if(myvpho != p->
getId()){
1787 std::cout<<
"Parent needs to be vpho, but found "<<
EvtPDL::name(p->
getId())<<std::endl;
1820 std::vector<int> vmod; vmod.clear();
1821 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,
1823 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,
1824 90,91,92,93,94,95,96,
1825 74100,74101,74102,74103,74104,74105,74110};
1826 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,
1828 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,
1829 90,91,92,93,94,95,96,
1830 74100,74101,74102,74103,74104,74105,74110};
1831 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,
1833 68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,
1834 90,91,92,93,94,95,96,
1835 74100,74101,74102,74110};
1839 for(
int i=0;i<83;i++){vmod.push_back(mn[i]);}
1841 for(
int i=0;i<84;i++){vmod.push_back(mn2[i]);}
1852 if(pm <_xs0/(_xs0 + _xs1)){
1856 _selectedMode = mymode;
1857 std::cout<<
"A selected mode is "<<mymode<<
" with Mhds= "<<mhds<<std::endl;
1867 for(
int i=0;i< _ndaugs;i++){
1873 if(totMass>p->
mass())
goto checkA;
1881 mydaugs[0]=daugs[0];
1888 for(
int i=0;i< 2;i++){
1895 if(totMass>p->
mass())
goto checkB;
1907 if(mhds<
SetMthr)
goto Sampling_mhds;
1908 double xeng=1-mhds*mhds/(
_cms*
_cms);
1911 if(mydbg) mass2=mhds;
1917 if(mymode==-10)
goto Sampling_mhds;
1919 if(mhds<2.3 && mymode==74110) {
goto ModeSelection;}
1920 std::cout<<
"A selected mode is "<<mymode<<
" with Mhds= "<<mhds<<std::endl;
1921 _selectedMode = mymode;
1939 mydaugs[0]=daugs[0];
1946 ISRphotonAng_sampling:
1949 for(
int i=0;i< 2;i++){
1955 if(totMass>p->
mass())
goto ISRphotonAng_sampling;
1958 if(!
checkdecay(p))
goto ISRphotonAng_sampling;
1962 if(maxflag==0) {
findMaxXS(mhds); maxflag=1;}
1965 double gx=vgam.
get(1);
1966 double gy=vgam.
get(2);
1967 double sintheta= sqrt(gx*gx+gy*gy)/vgam.
d3mag();
1975 pgam[0]=vgam.
get(0);
1976 pgam[1]=vgam.
get(1);
1977 pgam[2]=vgam.
get(2);
1978 pgam[3]=vgam.
get(3);
1980 phds[0]=vhds.
get(0);
1981 phds[1]=vhds.
get(1);
1982 phds[2]=vhds.
get(2);
1983 phds[3]=vhds.
get(3);
1984 costheta = vgam.
get(3)/vgam.
d3mag();
1985 selectmode = mymode;
1989 _modeFlag[1]= _selectedMode;
2004 if(pm <_xs0/(_xs0 + _xs1)){
2008 _selectedMode = mymode;
2009 std::cout<<
"A selected mode is "<<mymode<<
" with Mhds= "<<mhds<<std::endl;
2019 for(
int i=0;i< _ndaugs;i++){
2025 if(totMass>p->
mass())
goto checkAA;
2035 if(!byn_ang)
goto checkAA;
2040 mydaugs[0]=daugs[0];
2047 for(
int i=0;i< 2;i++){
2054 if(totMass>p->
mass())
goto checkBA;
2066 if(mhds<
SetMthr)
goto Sampling_mhds_A;
2067 double xeng=1-mhds*mhds/(
_cms*
_cms);
2070 if(mydbg) mass2=mhds;
2075 if(mymode==-10)
goto Sampling_mhds_A;
2077 std::cout<<
"A selected mode is "<<mymode<<
" with Mhds= "<<mhds<<std::endl;
2078 _selectedMode = mymode;
2096 mydaugs[0]=daugs[0];
2103 ISRphotonAng_sampling_A:
2106 for(
int i=0;i< 2;i++){
2112 if(totMass>p->
mass())
goto ISRphotonAng_sampling_A;
2115 if(!
checkdecay(p))
goto ISRphotonAng_sampling_A;
2122 if(maxflag==0) {
findMaxXS(mhds); maxflag=1;}
2125 double gx=vgam.
get(1);
2126 double gy=vgam.
get(2);
2127 double sintheta= sqrt(gx*gx+gy*gy)/vgam.
d3mag();
2133 _modeFlag[1]= _selectedMode;
2138 pgam[0]=vgam.
get(0);
2139 pgam[1]=vgam.
get(1);
2140 pgam[2]=vgam.
get(2);
2141 pgam[3]=vgam.
get(3);
2143 phds[0]=vhds.
get(0);
2144 phds[1]=vhds.
get(1);
2145 phds[2]=vhds.
get(2);
2146 phds[3]=vhds.
get(3);
2147 costheta = vgam.
get(3)/vgam.
d3mag();
2148 selectmode = mymode;
2162 if(pm <_xs0/(_xs0 + _xs1)){
2171 double xeng=1-mhds*mhds/(
_cms*
_cms);
2174 for(
int i=0;i< 2;i++){
2181 SetP4(p,mhds,xeng,theta);
2190 if((_xs0 + _xs1)==0) {std::cout<<
"EvtConExc::zero total xsection"<<std::endl;::abort();}
2192 double xsratio = _xs0/(_xs0 + _xs1);
2195 if(
getNArg()==3 && radflag==1){iflag=1;xsratio=0;}
2196 else if(
getNArg()==3 && radflag==0) {iflag=0;xsratio=1;}
2205 for(
int i=0;i< _ndaugs;i++){
2212 if(summassx>p->
mass())
goto masscheck;
2220 if(!byn_ang)
goto angular_hadron;
2231 double xeng=1-mhdr*mhdr/(
_cms*
_cms);
2242 costheta =
cos(theta);
2246 for(
int i=0;i< 2;i++){
2253 SetP4(p,mhdr,xeng,theta);
2265 std::cout<<
"The decay chain: "<<std::endl;
2282 if((_mode>=0 && _mode<=5) || _mode==44 || _mode==96){
2285 }
else if(_mode==6 || _mode==45 || _mode==46 || _mode==70 || _mode==71|| _mode==93){
2288 }
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){
2291 }
else if(_mode==-2){
2315 for(
int ii=0;ii<nmc;ii++){
2317 int gamdaugs = _ndaugs+1;
2320 for(
int i=0;i<_ndaugs;i++){
2321 theDaugs[i] = daugs[i];
2323 theDaugs[_ndaugs]=gamId;
2327 for(
int i=0;i<gamdaugs;i++){
2336 double pmag = pgam.
d3mag();
2337 double pz = pgam.
get(3);
2338 double sintheta = sqrt( pmag*pmag - pz*pz)/pmag;
2339 double onedegree = 1./180.*3.1415926;
2341 if(pmag <El || pmag >Eh) {
goto loop;}
2347 if(thexs>maxXS) {maxXS=thexs;}
2348 double s = p_init.
mass2();
2349 double x = 2*pgam.
get(0)/sqrt(
s);
2376 double xL=2*El/sqrt(
s);
2377 double xH=2*Eh/sqrt(
s);
2378 for(
int i=0;i<nmc;i++){
2380 double x= xL+ (xH-xL)*rdm;
2389 double thexs= Rad2Xs*(xH-xL);
2398 std::cout<<
" "<<std::endl;
2408 if(!Rad2Xs)
return Rad2Xs;
2416 std::cout<<
" "<<std::endl;
2426 if(!Rad2Xs)
return Rad2Xs;
2434 std::cout<<
" "<<std::endl;
2444 if(!Rad2Xs)
return Rad2Xs;;
2461 for(
int ii=0;ii<nmc;ii++){
2463 int gamdaugs = _ndaugs+1;
2466 for(
int i=0;i<_ndaugs;i++){
2467 theDaugs[i] = daugs[i];
2469 theDaugs[_ndaugs]=gamId;
2474 for(
int i=0;i<gamdaugs;i++){
2482 if(totm >= p_init.
get(0) )
goto loop;
2487 double costheta = p4gam.
get(3)/p4gam.
d3mag();
2489 bool acut=(sintheta>0.04) && (sintheta<0.96);
2490 if(thexs>maxXS && acut ) {maxXS=thexs;}
2499 for(
int i=1;i<_ndaugs;i++){
2503 double mhs = p0.
mass();
2504 double egam = pgam.
get(0);
2505 double sin2theta = pgam.
get(3)/pgam.
d3mag();
2506 sin2theta = 1-sin2theta*sin2theta;
2509 double alpha = 1./137.;
2510 double pi = 3.1415926;
2511 double x = 2*egam/cms;
2516 double difxs = 2*mhs/cms/cms * wsx *xs;
2526 double xsratio = xs/maxXS;
2527 if(pm<xsratio){
return true;}
else{
return false;}
2532 double xs =
difgamXs( mhds,sintheta );
2533 double xsratio = xs/maxXS;
2534 if(pm<xsratio){
return true;}
else{
return false;}
2540 if(pm <xs/
XS_max) {
return true;}
else {
return false;}
2546 if(pm <xs/(xs0*1.1)) {
return true;}
else {
return false;}
2553 double costheta=
cos(theta);
2558 if(_mode ==96){
alpha=-0.34;}
2563 if(pm< ang/myang) {
return true;}
else{
return false;}
2570 double costheta=
cos(theta);
2574 if(pm< ang/1.) {
return true;}
else{
return false;}
2581 double costheta=
cos(theta);
2585 if(pm< ang/2.) {
return true;}
else{
return false;}
2591 double alpha = 1./137.;
2592 double pi=3.1415926;
2593 double me = 0.5*0.001;
2594 double sme = sqrt(
s)/
me;
2595 double L = 2*log(sme);
2603 double alpha = 1./137.;
2604 double pi=3.1415926;
2605 double me = 0.5*0.001;
2606 double xi2 = 1.64493407;
2607 double xi3=1.2020569;
2608 double sme = sqrt(
s)/
me;
2609 double L = 2*log(sme);
2610 double beta = 2*
alpha/
pi*(L-1);
2611 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.;
2613 double Delta = 1 + ap *(1.5*L + 1./3.*
pi*
pi-2) + ap*ap *delta2;
2614 double wsx = Delta * beta * pow(
x,beta-1)-0.5*beta*(2-
x);
2615 double wsx2 = (2-
x)*( 3*log(1-
x)-4*log(
x) ) -4*log(1-
x)/
x-6+
x;
2616 wsx = wsx + beta*beta/8. *wsx2;
2617 double mymx = sqrt(
s*(1-
x));
2619 return wsx*
getVP(mymx);
2628 for(
int i=1;i<_ndaugs;i++){
2635 double mrg = cms - summass;
2637 double mhs = pm*mrg + summass;
2639 double s = cms * cms;
2640 double x = 2*Egam/cms;
2648 double difxs = 2*mhs/cms/cms * wsx *xs;
2657 double mhs = sqrt(
s*(1-
x));
2661 double difxs = wsx *xs;
2668 double mhs = sqrt(
s*(1-
x));
2672 double difxs = wsx *xs;
2681 for(
int i=1;i<_ndaugs;i++){
2686 double mrg = cms - summass;
2688 double mhs = pm*mrg + summass;
2690 double s = cms * cms;
2691 double x = 1 - mhs*mhs/
s;
2698 double difxs = 2*mhs/cms/cms * wsx *xs;
2708 double psip_ee =7.73E-03;
2709 double jsi_ee =5.94*0.01;
2710 double phi_ee =2.954E-04;
2724 BR_ee.push_back(phi_ee);
2725 BR_ee.push_back(jsi_ee);
2726 BR_ee.push_back(psip_ee);
2731 ResId.push_back(phiId);
2732 ResId.push_back(jsiId);
2733 ResId.push_back(pspId);
2739 double pi=3.1415926;
2746 double nbar = 3.89379304*100000;
2753 double s = cms * cms;
2754 double x = 1 - (*mhs)*(*mhs)/
s;
2761 double difxs = 2*dhs/cms/cms * wsx *xs;
2762 std::ofstream
oa;
oa<<
x<<std::endl;
2767 double s = cms * cms;
2768 double x = 1 - (*mhs)*(*mhs)/
s;
2773 double differ2 = 2*(*mhs)/cms/cms * wsx *xs;
2774 std::ofstream
oa;
oa<<
x<<std::endl;
2780 double s = cms * cms;
2781 double x = 1 - (*mhs)*(*mhs)/
s;
2788 double difxs = 2*dhs/cms/cms * wsx *xs;
2795 double s = cms * cms;
2796 double x = 1 - (*mhs)*(*mhs)/
s;
2801 double differ2 = 2*(*mhs)/cms/cms * wsx *xs;
2808 double alpha = 1./137.;
2809 double pi=3.1415926;
2810 double me = 0.5*0.001;
2811 double xi2 = 1.64493407;
2812 double xi3=1.2020569;
2813 double sme = sqrt(
s)/
me;
2814 double L = 2*log(sme);
2815 double beta = 2*
alpha/
pi*(L-1);
2816 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.;
2818 double Delta = 1 + ap *(1.5*L + 1./3.*
pi*
pi-2) + ap*ap *delta2;
2820 double beta2 = beta*beta;
2823 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 -
2824 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) +
2825 16*pow(beta,2)*
Li2(
b))/32. ;
2826 double mymx = sqrt(
s*(1-
b));
2828 return xs*
getVP(mymx);
2834 double li2= +
x +
x*
x/4. +
x*
x*
x/9;
2842 for(
int i=0;i<
n-1;i++){
2843 if(
x[i]>=
t &&
t>
x[i+1]) {n0=i;
break;}
2845 if(n0==-1) {
return 0.0;}
else{
2846 double k=(
y[n0]-
y[n0+1])/(
x[n0]-
x[n0+1]);
2847 z=
y[n0+1]+k*(
t-
x[n0+1]);
2857 for(
int i=0;i<
n-1;i++){
2858 if(
x[i]>=
t &&
t>
x[i+1]) {n0=i;
break;}
2860 double xstotal=
y[599];
2861 if(n0==-1) {
return 0;}
else{
2862 double p1=
y[n0]/xstotal;
2863 double p2=
y[n0+1]/xstotal;
2865 if(p1<pm && pm<=
p2) {
return 1;}
else{
return 0;}
2872 if(
t==
x[
n-1] )
return y[
n-1];
2873 for(
int i=0;i<
n-1;i++){
2874 if(
x[i]<=
t &&
t<
x[i+1]) {n0=i;
break;}
2876 if(n0==-1) {
return 0.0;}
else{
2877 double k=(
y[n0]-
y[n0+1])/(
x[n0]-
x[n0+1]);
2878 z=
y[n0+1]+k*(
t-
x[n0+1]);
2894 for(
int i=0;i<
n;i++){
2895 if((
y[i]/xst)<pm && pm<=(
y[i+1]/xst)){
2901 if(pm>1){std::cout<<
"random larger than 1: "<<pm<<std::endl;}
2902 double mhd=
x[mybin-1]+(
x[mybin]-
x[mybin-1])*pm;
2904 if((mhd -
_cms)>0){std::cout<<
"selected mhd larger than Ecms: "<<mhd<<
" > "<<
x[mybin] <<std::endl;abort();}
2906 std::cout<<
"the sample mhassrons is less than the low end of XS"<<mhd<<
" <"<<_mhdL<<std::endl;
2907 for(
int i=0;i<598;i++){std::cout<<i<<
" "<<
x[i]<<
" "<<
y[i]<<std::endl;}
2915 double costheta=
cos(theta);
2919 double me=0.51*0.001;
2921 double meE2=
me*
me/eb/eb;
2923 double hq1= meE2/2*
costheta/(sin2+meE2*cos2);
2925 double hq3=
x*
x*
costheta/2/(
x*
x-2*
x+2)*(1-meE2/(sin2+meE2*cos2));
2926 double hq=(L-1)/2.+hq1+hq2+hq3;
2932 double xx[180],yy[180];
2933 double dgr2rad=1./180.*3.1415926;
2937 for(
int i=6;i<=175;i++){
2942 for(
int j=0;j<=
nc;j++){
2947 for(
int j=1;j<=
nc;j++){
2948 if(yy[j-1]<pm && pm<=yy[j]){mypt=j;
break;}
2951 double mytheta= xx[mypt-1]+ (xx[mypt]-xx[mypt-1])*pm;
2957 double phi=2*3.1415926*pm;
2958 double gamE =
_cms/2*xeng;
2959 double hdrE = sqrt(mhdr*mhdr+gamE*gamE);
2960 double px = gamE*
sin(theta)*
cos(phi);
2961 double py = gamE*
sin(theta)*
sin(phi);
2962 double pz = gamE*
cos(theta);
2964 p4[0].set(gamE,px,py,pz);
2965 p4[1].set(hdrE,-px,-py,-pz);
2967 for(
int i=0;i<2;i++){
2971 if( (
_cms-mhdr)<0.002){
2981 double phi=2*3.1415926*pm;
2982 double gamE =
_cms/2*xeng;
2983 double hdrE = sqrt(mhdr*mhdr+gamE*gamE);
2984 double px = gamE*
sin(theta)*
cos(phi);
2985 double py = gamE*
sin(theta)*
sin(phi);
2986 double pz = gamE*
cos(theta);
2988 p4[0].set(hdrE,px,py,pz);
2989 p4[1].set(gamE,-px,-py,-pz);
2990 for(
int i=0;i<2;i++){
2999 for(
int i=0;i<90000;i++){
3002 double sin2theta =sqrt(1-
cos*
cos);
3003 double alpha = 1./137.;
3004 double pi = 3.1415926;
3007 double difxs = 2*mhds/
_cms/
_cms * wsx *xs;
3008 if(difxs>maxXS)maxXS=difxs;
3014 double sin2theta = sintheta*sintheta;
3015 double alpha = 1./137.;
3016 double pi = 3.1415926;
3019 double difxs = 2*mhds/
_cms/
_cms * wsx *xs;
3026 std::vector<int>excmod;
3027 excmod.push_back(0);
3028 excmod.push_back(1);
3029 excmod.push_back(2);
3030 excmod.push_back(6);
3031 excmod.push_back(7);
3032 excmod.push_back(12);
3033 excmod.push_back(13);
3034 excmod.push_back(45);
3035 excmod.push_back(46);
3037 std::vector<double> vxs;vxs.clear();
3038 for (
int i=0;i<vmod.size();i++){
3047 if(i==0) {vxs.push_back(myxs);}
3048 else if(imod==74110){
3049 double xcon = myxs - vxs[i-1];
3050 if(xcon<0) {xcon=vxs[i-1];}
else{xcon=myxs;}
3051 if(mhds<2.0) xcon=vxs[i-1];
3052 vxs.push_back(xcon);
3054 vxs.push_back(myxs+vxs[i-1]);
3061 double totxs = vxs[vxs.size()-1];
3067 if(pm <= vxs[0]/totxs) {
3069 std::vector<EvtId> theDaug=
get_mode(themode);
3071 for(
int i=0;i<theDaug.size();i++){daugs[i]=theDaug[i];}
3073 if(_mode!=74110){
return themode;}
3074 else if(exmode==-1){
return themode;}
else{
goto mycount;}
3077 for(
int j=1;j<vxs.size();j++){
3078 double x0 = vxs[j-1]/totxs;
3079 double x1 = vxs[j]/totxs;
3080 if(x0<pm && pm<=x1){
3082 std::vector<EvtId> theDaug=
get_mode(themode);
3084 for(
int i=0;i<theDaug.size();i++){daugs[i]=theDaug[i];}
3086 if(_mode!=74110){
return themode;}
3087 else if(exmode==-1){
return themode;}
else{
break;}
3093 if(icount<20000 )
goto mode_iter;
3096 std::cout<<
"EvtConExc::selectMode can not find a mode with 20000 iteration for Mhadrons="<<mhds<<std::endl;
3175 std::cout<<
"J/psi: "<<mjsi<<
" "<<wjsi<<std::endl;
3176 std::cout<<
"psipr: "<<mpsip<<
" "<<wpsip<<std::endl;
3177 std::cout<<
"psipp: "<<mpsipp<<
" "<<wpsipp<<std::endl;
3178 std::cout<<
"phi : "<<mphi<<
" "<<wphi<<std::endl;
3179 std::cout<<
"omega: "<<momega<<
" "<<womega<<std::endl;
3180 std::cout<<
"rho0 : "<<mrho0<<
" "<<wrho0<<std::endl;
3181 std::cout<<
"rho(3S)0: "<<mrho3s<<
" "<<wrho3s<<std::endl;
3182 std::cout<<
"omega(2S): "<<momega2s<<
" "<<womega2s<<std::endl;
3188 for(
int i=0;i<nson;i++){
3193 std::cout<<
"Zero mass!"<<std::endl;
3200 std::vector<int> vmod; vmod.clear();
3201 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,
3203 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,
3204 90,91,92,93,94,95,96,
3205 74100,74101,74102,74103,74104,74105,74110};
3206 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,
3208 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,
3209 90,91,92,93,94,95,96,
3210 74100,74101,74102,74103,74104,74105,74110};
3213 for(
int i=0;i<83;i++){vmod.push_back(mn[i]);}
3215 for(
int i=0;i<84;i++){vmod.push_back(mn2[i]);}
3222 for(
int i=0;i<vmod.size();i++){
3223 int mymode = vmod[i];
3224 if(mymode ==74110)
continue;
3237 std::vector<int> vmod; vmod.clear();
3238 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,
3240 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,
3241 90,91,92,93,94,95,96,
3242 74100,74101,74102,74103,74104,74105,74110};
3243 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,
3245 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,
3246 90,91,92,93,94,95,96,
3247 74100,74101,74102,74103,74104,74105,74110};
3250 for(
int i=0;i<83;i++){vmod.push_back(mn[i]);}
3252 for(
int i=0;i<84;i++){vmod.push_back(mn2[i]);}
3260 for(
int i=0;i<vmod.size();i++){
3261 int mymode = vmod[i];
3267 if(mymode ==74110){ hxs=mixs;
continue;}
3270 std::cout<<setw(5)<<mymode<<
" : ";
3271 std::cout<<setw(10)<<mixs<<
" nb ";
3272 for(
int ii=0;ii<_ndaugs;ii++){std::cout<<setw(10)<<
EvtPDL::name(daugs[ii])<<
" ";}
3273 std::cout<<std::endl;
3275 std::cout<<setw(6)<<
"LUARLW "<<setw(10)<<hxs-xsum<<
" nb "<<setw(10)<<
" anything "<<std::endl;
3276 std::cout<<
"Total hadron cross section here is "<<hxs<<
" nb"<<std::endl;
3285 for(
int i=0;i<par->
getNDaug();i++){
3301 double angmax = 1+
alpha;
3302 double costheta =
cos(p4i.
theta());
3304 double xratio = ang/angmax;
3308 if(xi>xratio)
return false;
3318 double u = 0.938/mx;
3320 double u2 = (1+u)*(1+u);
3321 double uu = u*(1+6*u);
3322 double alpha = (u2-uu)/(u2+uu);
3331 for(
int i=0;i<par->
getNDaug();i++){
3337 if(pdgcode==111 ||pdgcode==221 || pdgcode==331){
3341 double angmax = 1+
alpha;
3342 double costheta =
cos(p4i.
theta());
3344 double xratio = ang/angmax;
3348 if(xi>xratio)
return false;
3359 double psippee,psipee,jsiee,
phiee,omegaee,
rhoee;
3360 double kev2Gev=0.000001;
3361 psippee=0.262*kev2Gev;
3362 psipee =2.36*kev2Gev;
3363 jsiee =5.55*kev2Gev;
3364 phiee=4.266*0.001*2.954*0.0001;
3365 omegaee=0.6*kev2Gev;
3371 double xpi=12*3.1415926*3.1415926;
3372 if(mxL<=3.0957 && 3.0957<=mxH || mxL<=3.0983 && 3.0983<=mxH) {
3375 }
else if(mxL<=3.6847 && 3.6847<=mxH || mxL<=3.6873 && 3.6873<=mxH){
3378 }
else if(mxL<=1.01906 && 1.01906<=mxH || mxL<= 1.01986 && 1.01986<=mxH){
3383 if(
_cms<=mv)
return -1.;
3384 double xv = 1-mv*mv/
s;
3385 sigv += xpi*widee/mv/
s*
Rad2(
s,xv);
3386 double unic = 3.89379304*100000;
3393 for(
int i=0;i<ISRXS.size();i++){
3394 if( (ISRM[i]-mhi)<binwidth && ISRFLAG[i]){ISRFLAG[i]=0; myxs = ISRXS[i];}
3401 double pm,mhdL,mhds;
3404 mhds = pm*(
_cms - mhdL)+mhdL;
3405 std::vector<double> sxs;
3406 for(
int i=0;i<ISRID.size();i++){
3407 double ri=ISRXS[i]/AF[598];
3410 for(
int j=0;j<sxs.size();j++){
3411 if(j>0) sxs[j] += sxs[j-1];
3417 for(
int j=1;j<sxs.size();j++){
3418 double x0 = sxs[j-1];
3430 for(
int i=0;i<4001;i++){
3434 if(xx<=mx && mx <x1){xx=x1; r1=y1; i1=y2; mytag=0;
break;}
3435 xx=x1; r1=y1; i1=y2;
3437 if(mytag==1){std::cout<<
"No vacuum polarization value found"<<std::endl;abort();}
3439 double thevp=
abs(1./(1-cvp));
3440 if(3.0933<mx && mx<3.1035)
return 1.;
3441 if(3.6810<mx && mx<3.6913)
return 1.;
3447 vpx.clear();vpr.clear();vpi.clear();
3452 std::string locvp=getenv(
"BESEVTGENROOT");
3453 locvp +=
"/share/vp.dat";
3454 ifstream m_inputFile;
3455 m_inputFile.open(locvp.c_str());
3460 for(
int i=0;i<4001;i++){
3461 m_inputFile>>vpx[i]>>vpr[i]>>vpi[i];
3470 int mode=vmode[midx];
3478 for(
int i=0;i<600;i++){VXS[midx][i]=0;}
3486 double xb= 2*Esig/
_cms;
3491 double stp=(EgamH - Egamcut)/Nstp;
3492 for(
int i=0;i<Nstp;i++){
3493 double Eg0=EgamH - i*stp;
3494 double Eg1=EgamH - (i+1)*stp;
3497 if(i==0) VXS[midx][0]=xsi;
3498 if(i>=1) VXS[midx][i]=VXS[midx][i-1]+xsi;
3500 VXS[midx][598]=VXS[midx][597];
3501 VXS[midx][599]=VXS[midx][598]+ myxs0;
3507 for(
int j=0;i<vmode.size();j++){
3508 if(mode==vmode[j])
return j;
3510 std::cout<<
" EvtConExc::get_mode_index: no index is found in vmode"<<std::endl;
3515 double hwid=(AA[0]-AA[1])/2.;
3518 double Egam=(
s-mhds*mhds)/2/
_cms;
3519 for(
int i=0;i<600;i++){
3520 if( (AA[i]-hwid)<=Egam && Egam<(AA[i]+hwid) )
return VXS[idx][i];
3523 std:cout<<
"EvtConExc::getObsXsection : no observed xs is found "<<endl;
3529 double mhds = sqrt(
s - 2*Egam*
_cms);
3535 oa.open(
"_pkhr.dec");
3536 ob.open(
"obsxs.dat");
3540 double xscon=VXS[im][599];
3542 std::vector<int> Vmode;
3544 Vmode.push_back(13);
3545 Vmode.push_back(12);
3548 Vmode.push_back(45);
3549 Vmode.push_back(46);
3552 Vmode.push_back(37);
3553 std::vector<std::string> vmdl;
3554 vmdl.push_back(
"PHOKHARA_pipi");
3555 vmdl.push_back(
"PHOKHARA_pi0pi0pipi");
3556 vmdl.push_back(
"PHOKHARA_4pi");
3557 vmdl.push_back(
"PHOKHARA_ppbar");
3558 vmdl.push_back(
"PHOKHARA_nnbar");
3559 vmdl.push_back(
"PHOKHARA_KK");
3560 vmdl.push_back(
"PHOKHARA_K0K0");
3561 vmdl.push_back(
"PHOKHARA_pipipi0");
3562 vmdl.push_back(
"PHOKHARA_LLB");
3563 vmdl.push_back(
"PHOKHARA_pipieta");
3565 ob<<
"mode_index observed cross /nb"<<std::endl;
3566 for(
int i=0;i<vmode.size();i++){
3567 ob<<vmode[i]<<
" "<<VXS[
getModeIndex(vmode[i])][599]<<std::endl;
3571 for(
int i=0;i<Vmode.size();i++){
3576 for(
int i=0;i<Vmode.size();i++){
3580 oa<<
"LundaPar PARJ(11)=0.611798"<<std::endl;
3581 oa<<
"LundaPar PARJ(12)=7.92527E-12"<<std::endl;
3582 oa<<
"LundaPar PARJ(14)=0.244495"<<std::endl;
3583 oa<<
"LundaPar PARJ(15)=1.16573E-15"<<std::endl;
3584 oa<<
"LundaPar PARJ(16)=0.436516"<<std::endl;
3585 oa<<
"LundaPar PARJ(17)=0.530517"<<std::endl;
3586 oa<<
"LundaPar PARJ(1)=0.0651577"<<std::endl;
3587 oa<<
"LundaPar PARJ(2)=0.260378"<<std::endl;
3588 oa<<
"LundaPar PARJ(21)=0.0664835"<<std::endl;
3589 oa<<
"LundaPar RALPA(15)=0.576687"<<std::endl;
3590 oa<<
"LundaPar RALPA(16)=0.364796"<<std::endl;
3591 oa<<
"LundaPar RALPA(17)=3.19486E-06"<<std::endl;
3592 oa<<
"noPhotos"<<std::endl;
3593 oa<<
"Particle vpho "<<
_cms<<
" 0"<<std::endl;
3594 oa<<
"Decay vpho"<<std::endl;
3595 oa<<
"0 pi+ pi- PHSP ;"<<std::endl;
3596 oa<<
"0 pi0 pi0 pi- pi+ PHSP ;"<<std::endl;
3597 oa<<
"0 pi+ pi- pi- pi+ PHSP ;"<<std::endl;
3598 oa<<
"0 anti-p- p+ PHSP ;"<<std::endl;
3599 oa<<
"0 anti-n0 n0 PHSP ;"<<std::endl;
3600 oa<<
"0 K+ K- PHSP ;"<<std::endl;
3601 oa<<
"0 K_S0 K_L0 PHSP ;"<<std::endl;
3602 oa<<
"0 pi+ pi- pi0 PHSP ;"<<std::endl;
3603 oa<<
"0 Lambda0 anti-Lambda0 PHSP ;"<<std::endl;
3604 oa<<
"0 pi+ pi- eta PHSP ;"<<std::endl;
3605 oa<<
"0 gamma phi PHSP;"<<std::endl;
3606 oa<<
"0 gamma rho0 PHSP;"<<std::endl;
3607 oa<<
"0 gamma omega PHSP;"<<std::endl;
3608 oa<<xscon<<
" ConExc 74110;"<<std::endl;
3609 for(
int i=0;i<Vmode.size();i++){
3610 oa<<VXS[
getModeIndex(Vmode[i]) ][599]<<
" "<<vmdl[i]<<
" ;"<<std::endl;
3612 oa<<
"Enddecay"<<std::endl;
3613 oa<<
"End"<<std::endl;
3620 oa.open(
"_evtR.dat");
3623 double xscon=VXS[im][599];
3624 double xscon0=xscon;
3625 oa<<
"Ecms= "<<
_cms<<
" GeV"<<std::endl;
3626 oa<<
"The total observed xs: "<<xscon<<
" nb"<<std::endl;
3627 oa<<
"=== mode =========== ratio ==========="<<std::endl;
3628 for(
int i=0;i<vmode.size();i++){
3631 if(vmode[i]==74110)
continue;
3632 xscon -= VXS[themode ][599];
3634 if(xscon<0) xscon=0;
3636 for(
int i=0;i<vmode.size();i++){
3638 if(vmode[i]==74110)
continue;
3639 oa<<vmode[i]<<
"-th mode: "<<100*VXS[themode][599]/xscon0<<
" % "<<std::endl;
3641 oa<<
"74110-th mode: "<<100*xscon/xscon0<<
" % "<<std::endl;
3647 for (
int i=0;i<vmode.size();i++){
3648 if(m==vmode[i])
return i;
3650 std::cout<<
"EvtConExc::getModeIndex: no index in vmode found "<<std::endl;
3656 return std::string(
"ConExcPar");
3661 if (ncommand==lcommand){
3662 lcommand=10+2*lcommand;
3663 std::string* newcommands=
new std::string[lcommand];
3665 for(i=0;i<ncommand;i++){
3666 newcommands[i]=commands[i];
3669 commands=newcommands;
3671 commands[ncommand]=cmd;
3678 if (nconexcdecays==ntable){
3682 for(i=0;i<ntable;i++){
3683 newconexcdecays[i]=conexcdecays[i];
3686 delete [] conexcdecays;
3687 conexcdecays=newconexcdecays;
3690 conexcdecays[nconexcdecays++]=jsdecay;
3697 std::string::size_type pos;
3698 std::vector<std::string> result;
3700 int size=str.size();
3702 for(
int i=0; i<size; i++)
3704 pos=str.find(pattern,i);
3707 std::string
s=str.substr(i,pos-i);
3708 result.push_back(
s);
3709 i=pos+pattern.size()-1;
3719 std::string pattern=
"=";
3720 for(
int i=0;i<ncommand;i++){
3721 std::vector<std::string> result=
split(commands[i],pattern);
3722 if(result[0]==
"threshold") { threshold=atof(result[1].c_str());}
else
3723 if(result[0]==
"beamEnergySpread"){ beamEnergySpread=atof(result[1].c_str());}
3725 std::cout<<
"Your parameter in decay card \""<<result[0]<<
"\" incorect"<<std::endl;
3726 std::cout<<
"Possible words: threshold, beamEnergySpread"<<std::endl;
3740 for(
int i=0;i<
n;i++){
3744 double eta=sqrt(
n*12.0)*(ri/12-0.5);
3745 double xsig=
sigma*eta+mu;
3748 if(xsig<mx0 || xsig>mx1)
goto rloop;
3756 double Esig = 0.0001;
3757 double x = 2*Egamcut/
_cms;
3761 double EgamH = (
s-mhdL*mhdL)/2/sqrt(
s);
3767 double xb= 2*Esig/
_cms;
3772 double stp=(EgamH - Egamcut)/Nstp;
3773 for(
int i=0;i<Nstp;i++){
3774 double Eg0=EgamH - i*stp;
3775 double Eg1=EgamH - (i+1)*stp;
3781 double binwidth = mh2-mhi;
3783 if(i>=1) AF[i]=AF[i-1]+xsi;
3787 AA[598]=Egamcut; AA[599]=0;
3789 AF[599]=AF[598]+ _xs0;
3791 for(
int i=0;i<600;i++){
3796 if(bornXS==0){std::cout<<
"EvtConExc::calAF: bad BornXS at "<<
_cms<<
" GeV"<<std::endl;abort();}
3797 double fisr=AF[599]/bornXS;
3798 myFisr.push_back(fisr);
3804 int ntot=myFisr.size();
3806 for(
int i=0;i<ntot;i++){mymu += myFisr[i];}
3809 for(
int i=0;i<ntot;i++){ mysig += (myFisr[i]-mymu)*(myFisr[i]-mymu);}
3811 mysig = sqrt(mysig);
3812 std::cout<<
"========= Iteration times over ISR factor: "<<ntot<<std::endl;
3813 std::cout<<
" ISR factor * VP factor= observedXS/BornXS: "<<mymu<<
" + "<<mysig<<std::endl;
3819 double xL=2*El/sqrt(
s);
3820 double xH=2*Eh/sqrt(
s);
3822 double gaps = (xH-xL)/
double(
n);
3823 for (
int i = 0; i <
n; i++)
3832 double xL=2*El/sqrt(
s);
3833 double xH=2*Eh/sqrt(
s);
3835 double gaps = (xH-xL)/
double(
n);
3836 for (
int i = 0; i <
n; i++)
double sin(const BesAngle a)
double cos(const BesAngle a)
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)
*********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()
double double double * p4