125#include "TGraphErrors.h"
127#include "TPostScript.h"
129#include "TMultiGraph.h"
132int EvtConExc::nconexcdecays=0;
134int EvtConExc::ntable=0;
136int EvtConExc::ncommand=0;
137int EvtConExc::lcommand=0;
138std::string* EvtConExc::commands=0;
139double EvtConExc::AF[600];
140double EvtConExc::AA[600];
141double EvtConExc::MH[600];
147 extern double dgauss_(
double (*fun)(
double*),
double *,
double *,
double *);
151 extern double divdif_(
float*,
float *,
int *,
float *,
int*);
155 extern void polint_(
float*,
float *,
int *,
float *,
float*);
159 extern void hadr5n12_(
float*,
float *,
float *,
float *,
float *,
float *);
171double EvtConExc::_xs0=0;
172double EvtConExc::_xs1=0;
173double EvtConExc::_er0=0;
174double EvtConExc::_er1=0;
175int EvtConExc::_nevt=0;
181std::vector<std::vector <double> > EvtConExc::VXS;
196 if (nconexcdecays==0) {
202 for(i=0;i<nconexcdecays;i++){
203 if (conexcdecays[i]==
this){
204 conexcdecays[i]=conexcdecays[nconexcdecays-1];
206 if (nconexcdecays==0) {
234 for(
int i=0;i<120;i++){
238 for(
int i=0;i<97;i++){
239 if(53<=i && i<=58)
continue;
240 if(85<=i && i<=89)
continue;
241 if(_mode==74110 ||_mode==-100) vmode.push_back(i);
243 if(_mode==74110||_mode==-100){
244 vmode.push_back(74100);
245 vmode.push_back(74101);
246 vmode.push_back(74102);
247 vmode.push_back(74103);
248 vmode.push_back(74104);
249 vmode.push_back(74105);
250 vmode.push_back(74110);
253 std::cout<<
"==== Parameters set by users====="<<std::endl;
254 for(
int i=0;i<ncommand;i++){
255 std::cout<<commands[i]<<std::endl;
257 std::cout<<
"==================================="<<std::endl;
259 std::cout<<threshold<<
" "<<beamEnergySpread<<std::endl;
267 }
else if(
getNDaug()>2){std::cout<<
"Bad daughter specified"<<std::endl;abort();}
273 radflag=0;mydbg=
false;
278 std::cout<<
"The decay daughters are "<<std::endl;
280 std::cout<<std::endl;
282 radflag=0;mydbg=
false;
286 }
else if(
getArg(0)==-100){
291 std::cout<<
" multi-exclusive mode "<<std::endl;
293 std::cout<<std::endl;
294 if(vmd[vmd.size()-1]==74110){std::cout<<
"74110 is not allowd for multimode simulation"<<std::endl;abort();}
295 }
else if(
getNArg()==1){ _mode =
getArg(0); radflag=0;mydbg=
false;}
298 else{std::cout<<
"ConExc:number of parameter should be 1,2 or 3, but you set "<<
getNArg()<<std::endl;::abort(); }
307 myfile =
new TFile(
"mydbg.root",
"RECREATE");
308 xs=
new TTree (
"xs",
"momentum of rad. gamma and hadrons");
309 xs->Branch(
"imode",&imode,
"imode/I");
310 xs->Branch(
"pgam",pgam,
"pgam[4]/D");
311 xs->Branch(
"phds",phds,
"phds[4]/D");
312 xs->Branch(
"ph1",ph1,
"ph1[4]/D");
313 xs->Branch(
"ph2",ph2,
"ph2[4]/D");
314 xs->Branch(
"mhds",&mhds,
"mhds/D");
315 xs->Branch(
"mass1",&mass1,
"mass1/D");
316 xs->Branch(
"mass2",&mass2,
"mass2/D");
317 xs->Branch(
"costheta",&costheta,
"costheta/D");
318 xs->Branch(
"cosp",&cosp,
"cosp/D");
319 xs->Branch(
"cosk",&cosk,
"cosk/D");
320 xs->Branch(
"sumxs",&sumxs,
"sumxs/D");
321 xs->Branch(
"selectmode",&selectmode,
"selectmode/D");
327 std::cout<<
"parent mass = "<<parentMass<<std::endl;
347 if(mx<mth){std::cout<<
"The CMS energy is lower than the threshold of the final states"<<std::endl;abort();}
348 }
else if(_mode == -2){
354 std::cout<<
"The specified mode is "<<_mode<<std::endl;
359 double Esig = 0.0001;
360 double x = 2*Egamcut/
_cms;
362 double mhscut = sqrt(
s*(1-
x));
365 float fe,fst2,fder,ferrder,fdeg,ferrdeg;
369 if(3.0943<
_cms &&
_cms<3.102) vph=1;
370 std::cout<<
"sum of leptonic, hadronic contributions(u,d,s,c,b) to vacuum polarization: "<<vph<<
" @"<<fe<<
"GeV"<<std::endl;
376 for(
int jj=1;jj<_ndaugs;jj++){
380 ISRXS.clear();ISRM.clear();ISRFLAG.clear();
381 for(
int ii=0;ii<3;ii++){
383 if(mx<mR || _mode !=74110)
continue;
384 double narRxs=
Ros_xs(mx,BR_ee[ii],ResId[ii]);
385 std::cout<<
"The corss section for gamma "<<
EvtPDL::name(ResId[ii]).c_str()<<
" is: "<< narRxs<<
"*Br (nb)."<<std::endl;
386 ISRXS.push_back(narRxs);
388 ISRFLAG.push_back(1.);
389 ISRID.push_back(ResId[ii]);
392 std::cout<<
"==========================================================================="<<std::endl;
397 EgamH = (
s-mhdL*mhdL)/2/sqrt(
s);
401 std::cout<<
"_er0= "<<_er0<<std::endl;
403 double xs1_err = _er1;
407 double xb= 2*Esig/
_cms;
414 double stp=(EgamH - Egamcut)/Nstp;
415 for(
int i=0;i<Nstp;i++){
416 double Eg0=EgamH - i*stp;
417 double Eg1=EgamH - (i+1)*stp;
425 double binwidth = mh2-mhi;
428 if(i>=1) AF[i]=AF[i-1]+xsi;
432 AA[598]=Egamcut; AA[599]=0;
434 AF[599]=AF[598]+ _xs0;
439 for(
int i=0;i<vmode.size();i++){
441 if(_mode==74110||_mode==-100)
mk_VXS(Esig,Egamcut,EgamH,i);
462 for(
int i=0;i<vmode.size();i++){
464 if(md<74100 || md>74106)
continue;
465 std::string partname=
"";
466 if(md==74100) {partname=
"J/psi";}
467 else if(md==74101) {partname=
"psi(2S)";}
468 else if(md==74102) {partname=
"psi(3770)";}
469 else if(md==74103) {partname=
"phi";}
470 else if(md==74104) {partname=
"omega";}
471 else if(md==74105) {partname=
"rho0";}
472 else if(md==74106) {partname=
"rho(3S)0";}
474 std::cout<<
"The observed cross section for gamma "<<partname<<
": "<<VXS[i][599]<<
" nb"<<std::endl;
478 for(
int i=0;i<600;i++){
484 std::cout<<
"VXS[79][599]: "<<VXS[79][599]<<
" VXS[79][598]= "<<VXS[79][598]<<std::endl;
485 std::cout<<
"EgamH="<<EgamH<<
" "<<_xs0+_xs1<<
" AF[599]="<<AF[599]<<
" AF[598] "<<AF[598]<<std::endl;
492 double obsvXS = _xs0 + _xs1;
493 double obsvXS_er= _er0 + xs1_err;
494 double corr = obsvXS/bornXS;
495 double corr_er =corr*sqrt(bornXS_er*bornXS_er/bornXS/bornXS + obsvXS_er*obsvXS_er/obsvXS/obsvXS);
498 if(bornXS==0){std::cout<<
"EvtConExc::init : The Born cross section at this point is zero!"<<std::endl;abort();}
499 if(obsvXS==0){std::cout<<
"EvtConExc::init : The observed cross section at this point is zero!"<<std::endl;abort();}
504 std::cout<<
""<<std::endl;
505 std::cout<<
"========= Generation using cross section (Egamcut="<<Egamcut<<
" GeV) =============="<<std::endl;
506 std::cout<<
" sqrt(s)= "<<mx<<
" GeV "<<std::endl;
507 if(_mode>=0 || _mode ==-2 || _mode ==-100 ){
508 std::cout<<
"The generated born cross section (sigma_b): "<<_xs0<<
"+/-"<<_er0<<
" in Unit "<<_unit.c_str()<<std::endl;
509 std::cout<<
"The generated radiative correction cross section (sigma_isr): "<<_xs1<<
"+/-"<<xs1_err<<
" in Unit "<<_unit.c_str()<<std::endl;
510 std::cout<<
"The Born process is sampled according to the ratio sigma_b/(sigma_b+sigma_isr)"<<std::endl;
511 std::cout<<
"The radiative correction factor f_ISR*f_vacuum= sigma_obs/sigma_born(s) = "<<corr<<
"+/-"<< fabs(corr_er)<<
","<<std::endl;
512 std::cout<<
"which is calcualted with these quantities:"<<std::endl;
513 std::cout<<
"the observed cross section is "<<obsvXS<<
"+/-"<< obsvXS_er<<_unit.c_str()<<std::endl;
514 std::cout<<
"and the Born cross section (s) is "<<bornXS<<
"+/-"<<bornXS_er<<_unit.c_str()<<std::endl;
515 std::cout<<
"and the vaccum polarziation factor (lep. + hadr.) 1/|1-Pi|^2= "<<vph<<std::endl;
517 std::cout<<
"==========================================================================="<<std::endl;
519 std::cout<<
"The generated born cross section (sigma_b): "<<_xs0<<
" *Br_ee"<<
" in Unit "<<_unit.c_str()<<std::endl;
520 std::cout<<
"The generated radiative correction cross section (sigma_isr): "<<_xs1<<
"*Br_ee in Unit "<<_unit.c_str()<<std::endl;
521 std::cout<<
"The Born process is sampled according to the ratio sigma_b/(sigma_b+sigma_isr)"<<std::endl;
522 std::cout<<
"The radiative correction factor sigma_obs/sigma_born(s) = (1+delta) = "<<corr<<
"+/-"<< fabs(corr_er)<<std::endl;
523 std::cout<<
"==========================================================================="<<std::endl;
525 std::cout<<std::endl;
526 std::cout<<std::endl;
533 if(_xs0 == 0 && _xs1==0){std::cout<<
"EvtConExc::ini() has zero cross section"<<std::endl;abort();}
535 std::cout<<std::endl;
536 std::cout<<std::endl;
540 if(mydbg && _mode!=74110){
542 double xx[10000],yy[10000],xer[10000],yer[10000];
543 for(
int i=0;i<nd;i++){
550 myth=
new TH1F(
"myth",
"Exp.data",200,xx[0],xx[nd]);
551 for(
int i=0;i<nd;i++){
552 myth->Fill(xx[i],yy[i]);
560 if(mydbg && _mode==74110 ){
562 double xx[10000],yy[10000],xer[10000],yer[10000],ysum[10000],yysum[10000];
563 for(
int i=0;i<nd;i++){
573 TGraphErrors *Gdt =
new TGraphErrors(nd,xx,yy,xer,yer);
575 myth=
new TH1F(
"myth",
"Exp.data",600,
xlow,xhigh);
576 Xsum=
new TH1F(
"sumxs",
"sum of exclusive xs",600,
xlow,xhigh);
578 for(
int i=0;i<600;i++){
586 for(
int i=0;i<600;i++){
589 if(ysum[i]==0)
continue;
590 Xsum->Fill(mx,ysum[i]);
594 for(
int i=0;i<nd;i++){
602 TGraphErrors *Gsum =
new TGraphErrors(nd,xx,yysum,xer,yer);
604 double ex[600]={600*0};
605 double ey[600],ta[600];
606 double exz[600]={600*0};
607 double eyz[600]={600*0};
608 for(
int i=0;i<600;i++){
611 TGraphErrors *gr0 =
new TGraphErrors(600,MH,AF,ex,ey);
612 TGraphErrors *gr1 =
new TGraphErrors(600,MH,RadXS,exz,eyz);
613 TPostScript *ps =
new TPostScript(
"xsobs.ps",111);
614 TCanvas *c1 =
new TCanvas(
"c1",
"TGraphs for data",200,10,600,400);
617 gStyle->SetCanvasColor(0);
618 gStyle->SetStatBorderSize(1);
626 gr0->SetMarkerStyle(10);
628 gr0->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
629 gr0->GetYaxis()->SetTitle(
"observed cross section (nb)");
637 gr1->SetMarkerStyle(10);
639 gr1->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
640 gr1->GetYaxis()->SetTitle(
"Rad*BornXS");
644 TMultiGraph *mg =
new TMultiGraph();
645 mg->SetTitle(
"Exclusion graphs");
646 Gdt->SetMarkerStyle(2);
647 Gdt->SetMarkerSize(1);
648 Gsum->SetLineColor(2);
649 Gsum->SetLineWidth(1);
659 mg->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
660 mg->GetYaxis()->SetTitle(
"observed cross section (nb)");
668 Gdt->SetMarkerStyle(2);
670 Gdt->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
671 Gdt->GetYaxis()->SetTitle(
"observed cross section (nb)");
678 Gsum->SetMarkerStyle(2);
679 Gsum->SetMarkerSize(1);
681 Gsum->SetLineWidth(0);
682 Gsum->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
683 Gsum->GetYaxis()->SetTitle(
"observed cross section (nb)");
691 Gdt->SetMarkerStyle(2);
692 Gdt->SetMarkerSize(1);
693 Gdt->SetMaximum(8000.0);
694 Gsum->SetLineColor(2);
695 Gsum->SetLineWidth(1.5);
698 Gsum->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
699 Gsum->GetYaxis()->SetTitle(
"cross section (nb)");
735 }
else if(mode ==6 ){
754 }
else if(mode ==10 ){
759 }
else if(mode ==11 ){
764 }
else if(mode ==12 ){
770 }
else if(mode ==13 ){
776 }
else if(mode ==14 ){
782 }
else if(mode ==15 ){
788 }
else if(mode ==16 ){
794 }
else if(mode ==17 ){
801 }
else if(mode ==18 ){
808 }
else if(mode ==19 ){
815 }
else if(mode ==20 ){
822 }
else if(mode ==21 ){
830 }
else if(mode ==22 ){
838 }
else if(mode == 23){
842 }
else if(mode == 24){
846 }
else if(mode == 25){
850 }
else if(mode == 26){
854 }
else if(mode == 27){
858 }
else if(mode == 28){
863 }
else if(mode == 29){
868 }
else if(mode == 30){
873 }
else if(mode == 31){
878 }
else if(mode == 32){
883 }
else if(mode == 33){
888 }
else if(mode == 34){
893 }
else if(mode == 35){
898 }
else if(mode == 36){
902 }
else if(mode == 37){
907 }
else if(mode == 38){
912 }
else if(mode == 39){
916 }
else if(mode == 40){
921 }
else if(mode == 41){
926 }
else if(mode == 42){
931 }
else if(mode == 43){
937 }
else if(mode == 44){
941 }
else if(mode == 45){
945 }
else if(mode == 46){
949 }
else if(mode == 47){
953 }
else if(mode == 48){
957 }
else if(mode == 49){
962 }
else if(mode == 50){
967 }
else if(mode == 51){
972 }
else if(mode == 52){
977 }
else if(mode == 59){
982 }
else if(mode == 60){
987 }
else if(mode == 61){
992 }
else if(mode == 62){
997 }
else if(mode == 63){
1002 }
else if(mode == 64){
1007 }
else if(mode == 65){
1012 }
else if(mode == 66){
1017 }
else if(mode == 67){
1021 }
else if(mode == 68){
1026 }
else if(mode == 69){
1031 }
else if(mode == 70){
1036}
else if(mode == 71){
1040 }
else if(mode == 72){
1045 }
else if(mode == 73){
1050 }
else if(mode == 74){
1055 }
else if(mode == 75){
1060 }
else if(mode == 76){
1065 }
else if(mode == 77){
1070 }
else if(mode == 78){
1075 }
else if(mode == 79){
1080 }
else if(mode == 80){
1084 }
else if(mode == 81){
1089 }
else if(mode == 82){
1094 }
else if(mode == 83){
1099 }
else if(mode == 84){
1104 }
else if(mode == 90){
1109 }
else if(mode == 91){
1114 }
else if(mode == 92){
1119 }
else if(mode == 93){
1123 }
else if(mode == 94){
1127 }
else if(mode == 95){
1131 }
else if(mode == 96){
1135 }
else if(mode == 74100){
1138 }
else if(mode == 74101){
1141 }
else if(mode == 74102){
1144 }
else if(mode == 74103){
1147 }
else if(mode == 74104){
1150 }
else if(mode == 74105){
1153 }
else if(mode == 74106){
1156 }
else if(mode == 74107){
1159 }
else if(mode == 74110){
1165 _modeFlag.push_back(74110);
1166 _modeFlag.push_back(0);
1167 }
else if(mode == -1){
1169 for(
int i=0;i<nson;i++){ daugs[i]=son[i]; }
1170 std::cout<<
"The paraent particle: "<<
EvtPDL::name(pid)<<std::endl;
1171 }
else if(mode == -2){
1173 for(
int i=0;i<nson;i++){ daugs[i]=son[i]; }
1174 }
else if(mode == -100){
1178 _modeFlag.push_back(-100);
1179 _modeFlag.push_back(0);
1181 }
else if(mode == 10000){
1186 std::cout<<
"Bad mode_index number " <<mode<<
", please refer to the manual."<<std::endl;
1198 for(
int i=0;i<_ndaugs;i++){
1204 if(!(_mode==74110 || _mode==-100) ){
1205 if(Mthr<fmth) {std::cout<<
"Low end of cross section: ("<<Mthr<<
" < (mass of final state)"<<fmth<<
") GeV."<< std::endl; abort();}
1217 }
else if(mode ==1 ){
1221 }
else if(mode ==2 ){
1225 }
else if(mode ==3 ){
1229 }
else if(mode ==4 ){
1233 }
else if(mode ==5 ){
1237 }
else if(mode ==6 ){
1241 }
else if(mode ==7 ){
1246 }
else if(mode ==8 ){
1251 }
else if(mode ==9 ){
1256 }
else if(mode ==10 ){
1261 }
else if(mode ==11 ){
1266 }
else if(mode ==12 ){
1272 }
else if(mode ==13 ){
1278 }
else if(mode ==14 ){
1284 }
else if(mode ==15 ){
1290 }
else if(mode ==16 ){
1296 }
else if(mode ==17 ){
1303 }
else if(mode ==18 ){
1310 }
else if(mode ==19 ){
1317 }
else if(mode ==20 ){
1324 }
else if(mode ==21 ){
1332 }
else if(mode ==22 ){
1340 }
else if(mode == 23){
1344 }
else if(mode == 24){
1348 }
else if(mode == 25){
1352 }
else if(mode == 26){
1356 }
else if(mode == 27){
1360 }
else if(mode == 28){
1365 }
else if(mode == 29){
1370 }
else if(mode == 30){
1375 }
else if(mode == 31){
1380 }
else if(mode == 32){
1385 }
else if(mode == 33){
1390 }
else if(mode == 34){
1395 }
else if(mode == 35){
1400 }
else if(mode == 36){
1404 }
else if(mode == 37){
1409 }
else if(mode == 38){
1414 }
else if(mode == 39){
1418 }
else if(mode == 40){
1423 }
else if(mode == 41){
1428 }
else if(mode == 42){
1433 }
else if(mode == 43){
1439 }
else if(mode == 44){
1443 }
else if(mode == 45){
1447 }
else if(mode == 46){
1451 }
else if(mode == 47){
1455 }
else if(mode == 48){
1459 }
else if(mode == 49){
1464 }
else if(mode == 50){
1469 }
else if(mode == 51){
1474 }
else if(mode == 52){
1479 }
else if(mode == 59){
1484 }
else if(mode == 60){
1489 }
else if(mode == 61){
1494 }
else if(mode == 62){
1499 }
else if(mode == 63){
1504 }
else if(mode == 64){
1509 }
else if(mode == 65){
1514 }
else if(mode == 66){
1519 }
else if(mode == 67){
1523 }
else if(mode == 68){
1528 }
else if(mode == 69){
1533 }
else if(mode == 70){
1538}
else if(mode == 71){
1542 }
else if(mode == 72){
1547 }
else if(mode == 73){
1552 }
else if(mode == 74){
1557 }
else if(mode == 75){
1562 }
else if(mode == 76){
1567 }
else if(mode == 77){
1572 }
else if(mode == 78){
1577 }
else if(mode == 79){
1582 }
else if(mode == 80){
1586 }
else if(mode == 81){
1591 }
else if(mode == 82){
1596 }
else if(mode == 83){
1601 }
else if(mode == 84){
1606 }
else if(mode == 90){
1611 }
else if(mode == 91){
1616 }
else if(mode == 92){
1621 }
else if(mode == 93){
1625 }
else if(mode == 94){
1629 }
else if(mode == 95){
1633 }
else if(mode == 96){
1637 }
else if(mode == 74100){
1641 }
else if(mode == 74101){
1645 }
else if(mode == 74102){
1649 }
else if(mode == 74103){
1653 }
else if(mode == 74104){
1657 }
else if(mode == 74105){
1661 }
else if(mode == 74106){
1665 }
else if(mode == 74107){
1669 }
else if(mode == 74110){
1676 _modeFlag.push_back(74110);
1677 _modeFlag.push_back(0);
1678 }
else if(mode == -1){
1680 for(
int i=0;i<nson;i++){ daugs[i]=son[i]; }
1681 std::cout<<
"The paraent particle: "<<
EvtPDL::name(pid)<<std::endl;
1682 }
else if(mode == -2){
1684 for(
int i=0;i<nson;i++){ daugs[i]=son[i]; }
1685 }
else if(mode == -100){
1689 _modeFlag.push_back(-100);
1690 _modeFlag.push_back(0);
1692 }
else if(mode == 10000){
1697 std::cout<<
"Bad mode_index number " <<mode<<
", please refer to the manual."<<std::endl;
1708 std::vector<EvtId> theDaugs;
1709 for(
int i=0;i<_ndaugs;i++){
1710 theDaugs.push_back(daugs[i]);
1712 if(theDaugs.size()) {
return theDaugs;}
else {std::cout<<
"EvtConExc::get_mode: zero size"<<std::endl;abort();}
1725 if(myvpho != p->
getId()){
1726 std::cout<<
"Parent needs to be vpho, but found "<<
EvtPDL::name(p->
getId())<<std::endl;
1759 std::vector<int> vmod; vmod.clear();
1760 int mn[82]={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,
1762 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,
1763 90,91,92,93,94,95,96,
1764 74100,74101,74102,74103,74104,74105,74110};
1765 int mn2[83]={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,
1767 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,
1768 90,91,92,93,94,95,96,
1769 74100,74101,74102,74103,74104,74105,74110};
1770 int mn3[76]={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,
1772 68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,
1773 90,91,92,93,94,95,96,
1774 74100,74101,74102,74110};
1778 for(
int i=0;i<82;i++){vmod.push_back(mn[i]);}
1780 for(
int i=0;i<83;i++){vmod.push_back(mn2[i]);}
1791 if(pm <_xs0/(_xs0 + _xs1) ){
1795 _selectedMode = mymode;
1796 std::cout<<
"A selected mode is "<<mymode<<
" with Mhds= "<<mhds<<std::endl;
1806 for(
int i=0;i< _ndaugs;i++){
1812 if(totMass>p->
mass())
goto checkA;
1820 mydaugs[0]=daugs[0];
1827 for(
int i=0;i< 2;i++){
1834 if(totMass>p->
mass())
goto checkB;
1846 if(mhds<
SetMthr)
goto Sampling_mhds;
1847 double xeng=1-mhds*mhds/(
_cms*
_cms);
1850 if(mydbg) mass2=mhds;
1856 if(mymode==-10)
goto Sampling_mhds;
1858 if(mhds<2.3 && mymode==74110) {
goto ModeSelection;}
1859 std::cout<<
"A selected mode is "<<mymode<<
" with Mhds= "<<mhds<<std::endl;
1860 _selectedMode = mymode;
1878 mydaugs[0]=daugs[0];
1885 ISRphotonAng_sampling:
1888 for(
int i=0;i< 2;i++){
1894 if(totMass>p->
mass())
goto ISRphotonAng_sampling;
1897 if(!
checkdecay(p))
goto ISRphotonAng_sampling;
1901 if(maxflag==0) {
findMaxXS(mhds); maxflag=1;}
1904 double gx=vgam.
get(1);
1905 double gy=vgam.
get(2);
1906 double sintheta= sqrt(gx*gx+gy*gy)/vgam.
d3mag();
1914 pgam[0]=vgam.
get(0);
1915 pgam[1]=vgam.
get(1);
1916 pgam[2]=vgam.
get(2);
1917 pgam[3]=vgam.
get(3);
1919 phds[0]=vhds.
get(0);
1920 phds[1]=vhds.
get(1);
1921 phds[2]=vhds.
get(2);
1922 phds[3]=vhds.
get(3);
1923 costheta = vgam.
get(3)/vgam.
d3mag();
1924 selectmode = mymode;
1928 _modeFlag[1]= _selectedMode;
1943 if(pm <_xs0/(_xs0 + _xs1) ){
1947 _selectedMode = mymode;
1948 std::cout<<
"A selected mode is "<<mymode<<
" with Mhds= "<<mhds<<std::endl;
1958 for(
int i=0;i< _ndaugs;i++){
1964 if(totMass>p->
mass())
goto checkAA;
1974 if(!byn_ang)
goto checkAA;
1979 mydaugs[0]=daugs[0];
1986 for(
int i=0;i< 2;i++){
1993 if(totMass>p->
mass())
goto checkBA;
2005 if(mhds<
SetMthr)
goto Sampling_mhds_A;
2006 double xeng=1-mhds*mhds/(
_cms*
_cms);
2009 if(mydbg) mass2=mhds;
2014 if(mymode==-10)
goto Sampling_mhds_A;
2016 std::cout<<
"A selected mode is "<<mymode<<
" with Mhds= "<<mhds<<std::endl;
2017 _selectedMode = mymode;
2035 mydaugs[0]=daugs[0];
2042 ISRphotonAng_sampling_A:
2045 for(
int i=0;i< 2;i++){
2051 if(totMass>p->
mass())
goto ISRphotonAng_sampling_A;
2054 if(!
checkdecay(p))
goto ISRphotonAng_sampling_A;
2061 if(maxflag==0) {
findMaxXS(mhds); maxflag=1;}
2064 double gx=vgam.
get(1);
2065 double gy=vgam.
get(2);
2066 double sintheta= sqrt(gx*gx+gy*gy)/vgam.
d3mag();
2072 _modeFlag[1]= _selectedMode;
2077 pgam[0]=vgam.
get(0);
2078 pgam[1]=vgam.
get(1);
2079 pgam[2]=vgam.
get(2);
2080 pgam[3]=vgam.
get(3);
2082 phds[0]=vhds.
get(0);
2083 phds[1]=vhds.
get(1);
2084 phds[2]=vhds.
get(2);
2085 phds[3]=vhds.
get(3);
2086 costheta = vgam.
get(3)/vgam.
d3mag();
2087 selectmode = mymode;
2101 if(pm <_xs0/(_xs0 + _xs1) ){
2110 double xeng=1-mhds*mhds/(
_cms*
_cms);
2113 for(
int i=0;i< 2;i++){
2120 SetP4(p,mhds,xeng,theta);
2129 if((_xs0 + _xs1)==0) {std::cout<<
"EvtConExc::zero total xsection"<<std::endl;::abort();}
2131 double xsratio = _xs0/(_xs0 + _xs1);
2134 if(
getNArg()==3 && radflag==1){iflag=1;xsratio=0;}
2135 else if(
getNArg()==3 && radflag==0) {iflag=0;xsratio=1;}
2144 for(
int i=0;i< _ndaugs;i++){
2151 if(summassx>p->
mass())
goto masscheck;
2159 if(!byn_ang)
goto angular_hadron;
2170 double xeng=1-mhdr*mhdr/(
_cms*
_cms);
2181 costheta =
cos(theta);
2185 for(
int i=0;i< 2;i++){
2192 SetP4(p,mhdr,xeng,theta);
2204 std::cout<<
"The decay chain: "<<std::endl;
2221 if( (_mode>=0 && _mode<=5) || _mode ==44|| _mode ==47|| _mode ==48 ||_mode ==72 ||_mode == 73||_mode==94||_mode==95 ||_mode ==96 || _mode>=23 &&_mode<=27 || _mode==36|| _mode ==39 || _mode == 80 ){
2224 }
else if(_mode ==6||_mode==45 || _mode==46 || _mode==70 || _mode==71|| _mode==93){
2227 }
else if(_mode==23 || _mode==24 || _mode==25 || _mode==26 || _mode==27 || _mode==36||_mode==47||_mode==48|| _mode==52||_mode==68||_mode==69||_mode==72||_mode==73||_mode==80||_mode==94||_mode==95){
2230 }
else if(_mode==-2 ){
2254 for(
int ii=0;ii<nmc;ii++){
2256 int gamdaugs = _ndaugs+1;
2259 for(
int i=0;i<_ndaugs;i++){
2260 theDaugs[i] = daugs[i];
2262 theDaugs[_ndaugs]=gamId;
2266 for(
int i=0;i<gamdaugs;i++){
2275 double pmag = pgam.
d3mag();
2276 double pz = pgam.
get(3);
2277 double sintheta = sqrt( pmag*pmag - pz*pz)/pmag;
2278 double onedegree = 1./180.*3.1415926;
2280 if(pmag <El || pmag >Eh) {
goto loop;}
2286 if(thexs>maxXS) {maxXS=thexs;}
2287 double s = p_init.
mass2();
2288 double x = 2*pgam.
get(0)/sqrt(
s);
2315 double xL=2*El/sqrt(
s);
2316 double xH=2*Eh/sqrt(
s);
2317 for(
int i=0;i<nmc;i++){
2319 double x= xL+ (xH-xL)*rdm;
2328 double thexs= Rad2Xs*(xH-xL);
2337 std::cout<<
" "<<std::endl;
2347 if(!Rad2Xs)
return Rad2Xs;
2355 std::cout<<
" "<<std::endl;
2365 if(!Rad2Xs)
return Rad2Xs;
2373 std::cout<<
" "<<std::endl;
2383 if(!Rad2Xs)
return Rad2Xs;;
2400 for(
int ii=0;ii<nmc;ii++){
2402 int gamdaugs = _ndaugs+1;
2405 for(
int i=0;i<_ndaugs;i++){
2406 theDaugs[i] = daugs[i];
2408 theDaugs[_ndaugs]=gamId;
2413 for(
int i=0;i<gamdaugs;i++){
2421 if(totm >= p_init.
get(0) )
goto loop;
2426 double costheta = p4gam.
get(3)/p4gam.
d3mag();
2427 double sintheta = sqrt(1-costheta*costheta);
2428 bool acut=(sintheta>0.04) && (sintheta<0.96);
2429 if(thexs>maxXS && acut ) {maxXS=thexs;}
2438 for(
int i=1;i<_ndaugs;i++){
2442 double mhs = p0.
mass();
2443 double egam = pgam.
get(0);
2444 double sin2theta = pgam.
get(3)/pgam.
d3mag();
2445 sin2theta = 1-sin2theta*sin2theta;
2448 double alpha = 1./137.;
2449 double pi = 3.1415926;
2450 double x = 2*egam/cms;
2455 double difxs = 2*mhs/cms/cms * wsx *xs;
2465 double xsratio = xs/maxXS;
2466 if(pm<xsratio){
return true;}
else{
return false;}
2471 double xs =
difgamXs( mhds,sintheta );
2472 double xsratio = xs/maxXS;
2473 if(pm<xsratio){
return true;}
else{
return false;}
2479 if(pm <xs/
XS_max) {
return true;}
else {
return false;}
2485 if(pm <xs/(xs0*1.1)) {
return true;}
else {
return false;}
2492 double costheta=
cos(theta);
2497 if(_mode ==96){
alpha=-0.34;}
2499 double ang = 1 +
alpha*costheta*costheta;
2502 if(pm< ang/myang) {
return true;}
else{
return false;}
2509 double costheta=
cos(theta);
2512 double ang = 1 - costheta*costheta;
2513 if(pm< ang/1.) {
return true;}
else{
return false;}
2520 double costheta=
cos(theta);
2523 double ang = 1 + costheta*costheta;
2524 if(pm< ang/2.) {
return true;}
else{
return false;}
2530 double alpha = 1./137.;
2531 double pi=3.1415926;
2532 double me = 0.5*0.001;
2533 double sme = sqrt(
s)/
me;
2534 double L = 2*log(sme);
2542 double alpha = 1./137.;
2543 double pi=3.1415926;
2544 double me = 0.5*0.001;
2545 double xi2 = 1.64493407;
2546 double xi3=1.2020569;
2547 double sme = sqrt(
s)/
me;
2548 double L = 2*log(sme);
2549 double beta = 2*
alpha/
pi*(L-1);
2550 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.;
2552 double Delta = 1 + ap *(1.5*L + 1./3.*
pi*
pi-2) + ap*ap *delta2;
2553 double wsx = Delta * beta * pow(
x,beta-1)-0.5*beta*(2-
x);
2554 double wsx2 = (2-
x)*( 3*log(1-
x)-4*log(
x) ) -4*log(1-
x)/
x-6+
x;
2555 wsx = wsx + beta*beta/8. *wsx2;
2556 double mymx = sqrt(
s*(1-
x));
2558 return wsx*
getVP(mymx);
2567 for(
int i=1;i<_ndaugs;i++){
2574 double mrg = cms - summass;
2576 double mhs = pm*mrg + summass;
2578 double s = cms * cms;
2579 double x = 2*Egam/cms;
2587 double difxs = 2*mhs/cms/cms * wsx *xs;
2596 double mhs = sqrt(
s*(1-
x));
2600 double difxs = wsx *xs;
2607 double mhs = sqrt(
s*(1-
x));
2611 double difxs = wsx *xs;
2620 for(
int i=1;i<_ndaugs;i++){
2625 double mrg = cms - summass;
2627 double mhs = pm*mrg + summass;
2629 double s = cms * cms;
2630 double x = 1 - mhs*mhs/
s;
2637 double difxs = 2*mhs/cms/cms * wsx *xs;
2647 double psip_ee =7.73E-03;
2648 double jsi_ee =5.94*0.01;
2649 double phi_ee =2.954E-04;
2663 BR_ee.push_back(phi_ee);
2664 BR_ee.push_back(jsi_ee);
2665 BR_ee.push_back(psip_ee);
2670 ResId.push_back(phiId);
2671 ResId.push_back(jsiId);
2672 ResId.push_back(pspId);
2678 double pi=3.1415926;
2683 double sigma = 12*
pi*
pi*bree*width/
mass/
s;
2684 sigma *=
Rad2(
s, xv);
2685 double nbar = 3.89379304*100000;
2692 double s = cms * cms;
2693 double x = 1 - (*mhs)*(*mhs)/
s;
2700 double difxs = 2*dhs/cms/cms * wsx *xs;
2701 std::ofstream
oa;
oa<<
x<<std::endl;
2706 double s = cms * cms;
2707 double x = 1 - (*mhs)*(*mhs)/
s;
2712 double differ2 = 2*(*mhs)/cms/cms * wsx *xs;
2713 std::ofstream
oa;
oa<<
x<<std::endl;
2719 double s = cms * cms;
2720 double x = 1 - (*mhs)*(*mhs)/
s;
2727 double difxs = 2*dhs/cms/cms * wsx *xs;
2734 double s = cms * cms;
2735 double x = 1 - (*mhs)*(*mhs)/
s;
2740 double differ2 = 2*(*mhs)/cms/cms * wsx *xs;
2747 double alpha = 1./137.;
2748 double pi=3.1415926;
2749 double me = 0.5*0.001;
2750 double xi2 = 1.64493407;
2751 double xi3=1.2020569;
2752 double sme = sqrt(
s)/
me;
2753 double L = 2*log(sme);
2754 double beta = 2*
alpha/
pi*(L-1);
2755 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.;
2757 double Delta = 1 + ap *(1.5*L + 1./3.*
pi*
pi-2) + ap*ap *delta2;
2759 double beta2 = beta*beta;
2762 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 -
2763 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) +
2764 16*pow(beta,2)*
Li2(b))/32. ;
2765 double mymx = sqrt(
s*(1-b));
2767 return xs*
getVP(mymx);
2772 double li2= -
x +
x*
x/4. -
x*
x*
x/9;
2780 for(
int i=0;i<
n-1;i++){
2781 if(
x[i]>=
t &&
t>
x[i+1]) {n0=i;
break;}
2783 if(n0==-1) {
return 0.0;}
else{
2784 double k=(y[n0]-y[n0+1])/(
x[n0]-
x[n0+1]);
2785 z= y[n0+1]+k*(
t-
x[n0+1]);
2795 for(
int i=0;i<
n-1;i++){
2796 if(
x[i]>=
t &&
t>
x[i+1]) {n0=i;
break;}
2798 double xstotal=y[599];
2799 if(n0==-1) {
return 0;}
else{
2800 double p1=y[n0]/xstotal;
2801 double p2=y[n0+1]/xstotal;
2803 if(p1<pm && pm<=p2) {
return 1;}
else{
return 0;}
2810 if(
t==
x[
n-1] )
return y[
n-1];
2811 for(
int i=0;i<
n-1;i++){
2812 if(
x[i]<=
t &&
t<
x[i+1]) {n0=i;
break;}
2814 if(n0==-1) {
return 0.0;}
else{
2815 double k=(y[n0]-y[n0+1])/(
x[n0]-
x[n0+1]);
2816 z= y[n0+1]+k*(
t-
x[n0+1]);
2832 for(
int i=0;i<
n;i++){
2833 if((y[i]/xst)<pm && pm<=(y[i+1]/xst)){
2839 if(pm>1){std::cout<<
"random larger than 1: "<<pm<<std::endl;}
2840 double mhd=
x[mybin-1]+(
x[mybin]-
x[mybin-1])*pm;
2842 if((mhd -
_cms)>0 ){std::cout<<
"selected mhd larger than Ecms: "<<mhd<<
" > "<<
x[mybin] <<std::endl;abort();}
2844 std::cout<<
"the sample mhassrons is less than the low end of XS"<<mhd<<
" <"<<_mhdL<<std::endl;
2845 for(
int i=0;i<598;i++){std::cout<<i<<
" "<<
x[i]<<
" "<<y[i]<<std::endl;}
2853 double costheta=
cos(theta);
2855 double cos2=costheta*costheta;
2857 double me=0.51*0.001;
2859 double meE2=
me*
me/eb/eb;
2861 double hq1= meE2/2*costheta/(sin2+meE2*cos2);
2862 double hq2= -0.5*log((1+sqrt(1-meE2)*costheta)/(1-sqrt(1-meE2)*costheta));
2863 double hq3=
x*
x*costheta/2/(
x*
x-2*
x+2)*(1-meE2/(sin2+meE2*cos2));
2864 double hq=(L-1)/2.+hq1+hq2+hq3;
2870 double xx[180],yy[180];
2871 double dgr2rad=1./180.*3.1415926;
2875 for(
int i=6;i<=175;i++){
2880 for(
int j=0;j<=nc;j++){
2885 for(
int j=1;j<=nc;j++){
2886 if(yy[j-1]<pm && pm<=yy[j]){mypt=j;
break;}
2889 double mytheta= xx[mypt-1]+ (xx[mypt]-xx[mypt-1])*pm;
2895 double phi=2*3.1415926*pm;
2896 double gamE =
_cms/2*xeng;
2897 double hdrE = sqrt(mhdr*mhdr+gamE*gamE);
2898 double px = gamE*
sin(theta)*
cos(phi);
2899 double py = gamE*
sin(theta)*
sin(phi);
2900 double pz = gamE*
cos(theta);
2902 p4[0].
set(gamE,px,py,pz);
2903 p4[1].
set(hdrE,-px,-py,-pz);
2905 for(
int i=0;i<2;i++){
2909 if( (
_cms-mhdr)<0.002 ){
2919 double phi=2*3.1415926*pm;
2920 double gamE =
_cms/2*xeng;
2921 double hdrE = sqrt(mhdr*mhdr+gamE*gamE);
2922 double px = gamE*
sin(theta)*
cos(phi);
2923 double py = gamE*
sin(theta)*
sin(phi);
2924 double pz = gamE*
cos(theta);
2926 p4[0].
set(hdrE,px,py,pz);
2927 p4[1].
set(gamE,-px,-py,-pz);
2928 for(
int i=0;i<2;i++){
2937 for(
int i=0;i<90000;i++){
2940 double sin2theta =sqrt(1-
cos*
cos);
2941 double alpha = 1./137.;
2942 double pi = 3.1415926;
2945 double difxs = 2*mhds/
_cms/
_cms * wsx *xs;
2946 if(difxs>maxXS)maxXS=difxs;
2952 double sin2theta = sintheta*sintheta;
2953 double alpha = 1./137.;
2954 double pi = 3.1415926;
2957 double difxs = 2*mhds/
_cms/
_cms * wsx *xs;
2964 std::vector<int>excmod;
2965 excmod.push_back(0);
2966 excmod.push_back(1);
2967 excmod.push_back(2);
2968 excmod.push_back(6);
2969 excmod.push_back(7);
2970 excmod.push_back(12);
2971 excmod.push_back(13);
2972 excmod.push_back(45);
2973 excmod.push_back(46);
2975 std::vector<double> vxs;vxs.clear();
2976 for (
int i=0;i<vmod.size();i++){
2985 if(i==0) {vxs.push_back(myxs);}
2986 else if(imod==74110){
2987 double xcon = myxs - vxs[i-1];
2988 if(xcon<0) {xcon=vxs[i-1];}
else{xcon=myxs;}
2989 if(mhds<2.0) xcon=vxs[i-1];
2990 vxs.push_back(xcon);
2992 vxs.push_back(myxs+vxs[i-1]);
2999 double totxs = vxs[vxs.size()-1];
3005 if(pm <= vxs[0]/totxs) {
3007 std::vector<EvtId> theDaug=
get_mode(themode);
3009 for(
int i=0;i<theDaug.size();i++){daugs[i]=theDaug[i];}
3011 if(_mode!=74110){
return themode;}
3012 else if(exmode==-1){
return themode;}
else{
goto mycount;}
3015 for(
int j=1;j<vxs.size();j++){
3016 double x0 = vxs[j-1]/totxs;
3017 double x1 = vxs[j]/totxs;
3018 if(x0<pm && pm<=x1){
3020 std::vector<EvtId> theDaug=
get_mode(themode);
3022 for(
int i=0;i<theDaug.size();i++){daugs[i]=theDaug[i];}
3024 if(_mode!=74110){
return themode;}
3025 else if(exmode==-1){
return themode;}
else{
break;}
3031 if(icount<20000 )
goto mode_iter;
3034 std::cout<<
"EvtConExc::selectMode can not find a mode with 20000 iteration for Mhadrons="<<mhds<<std::endl;
3113 std::cout<<
"J/psi: "<<mjsi<<
" "<<wjsi<<std::endl;
3114 std::cout<<
"psipr: "<<mpsip<<
" "<<wpsip<<std::endl;
3115 std::cout<<
"psipp: "<<mpsipp<<
" "<<wpsipp<<std::endl;
3116 std::cout<<
"phi : "<<mphi<<
" "<<wphi<<std::endl;
3117 std::cout<<
"omega: "<<momega<<
" "<<womega<<std::endl;
3118 std::cout<<
"rho0 : "<<mrho0<<
" "<<wrho0<<std::endl;
3119 std::cout<<
"rho(3S)0: "<<mrho3s<<
" "<<wrho3s<<std::endl;
3120 std::cout<<
"omega(2S): "<<momega2s<<
" "<<womega2s<<std::endl;
3126 for(
int i=0;i<nson;i++){
3131 std::cout<<
"Zero mass!"<<std::endl;
3138 std::vector<int> vmod; vmod.clear();
3139 int mn[82]={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,
3141 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,
3142 90,91,92,93,94,95,96,
3143 74100,74101,74102,74103,74104,74105,74110};
3144 int mn2[83]={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,
3146 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,
3147 90,91,92,93,94,95,96,
3148 74100,74101,74102,74103,74104,74105,74110};
3151 for(
int i=0;i<82;i++){vmod.push_back(mn[i]);}
3153 for(
int i=0;i<83;i++){vmod.push_back(mn2[i]);}
3160 for(
int i=0;i<vmod.size();i++){
3161 int mymode = vmod[i];
3162 if(mymode ==74110)
continue;
3178 for(
int i=0;i<par->
getNDaug();i++){
3194 double angmax = 1+
alpha;
3195 double costheta =
cos(p4i.
theta());
3196 double ang=1+
alpha*costheta*costheta;
3197 double xratio = ang/angmax;
3201 if(xi>xratio)
return false;
3211 double u = 0.938/mx;
3213 double u2 = (1+u)*(1+u);
3214 double uu = u*(1+6*u);
3215 double alpha = (u2-uu)/(u2+uu);
3224 for(
int i=0;i<par->
getNDaug();i++){
3230 if(pdgcode==111 ||pdgcode==221 || pdgcode==331 ){
3234 double angmax = 1+
alpha;
3235 double costheta =
cos(p4i.
theta());
3236 double ang=1+
alpha*costheta*costheta;
3237 double xratio = ang/angmax;
3241 if(xi>xratio)
return false;
3252 double psippee,psipee,jsiee,
phiee,omegaee,
rhoee;
3253 double kev2Gev=0.000001;
3254 psippee=0.262*kev2Gev;
3255 psipee =2.36*kev2Gev;
3256 jsiee =5.55*kev2Gev;
3257 phiee=4.266*0.001*2.954*0.0001;
3258 omegaee=0.6*kev2Gev;
3264 double xpi=12*3.1415926*3.1415926;
3265 if(mxL<=3.0957 && 3.0957<=mxH || mxL<=3.0983 && 3.0983<=mxH) {
3268 }
else if(mxL<=3.6847 && 3.6847<=mxH || mxL<=3.6873 && 3.6873<=mxH){
3271 }
else if(mxL<=1.01906 && 1.01906<=mxH || mxL<= 1.01986 && 1.01986<=mxH){
3276 if(
_cms<=mv)
return -1.;
3277 double xv = 1-mv*mv/
s;
3278 sigv += xpi*widee/mv/
s*
Rad2(
s,xv);
3279 double unic = 3.89379304*100000;
3286 for(
int i=0;i<ISRXS.size();i++){
3287 if( (ISRM[i]-mhi)<binwidth && ISRFLAG[i]){ISRFLAG[i]=0; myxs = ISRXS[i];}
3294 double pm,mhdL,mhds;
3297 mhds = pm*(
_cms - mhdL)+mhdL;
3298 std::vector<double> sxs;
3299 for(
int i=0;i<ISRID.size();i++){
3300 double ri=ISRXS[i]/AF[598];
3303 for(
int j=0;j<sxs.size();j++){
3304 if(j>0) sxs[j] += sxs[j-1];
3310 for(
int j=1;j<sxs.size();j++){
3311 double x0 = sxs[j-1];
3323 for(
int i=0;i<4001;i++){
3327 if(xx<=mx && mx <x1){xx=x1; r1=y1; i1=y2; mytag=0;
break;}
3328 xx=x1; r1=y1; i1=y2;
3330 if(mytag==1){std::cout<<
"No vacuum polarization value found"<<std::endl;abort();}
3332 double thevp=
abs(1./(1-cvp));
3333 if(3.0933<mx && mx<3.1035)
return 1.;
3334 if(3.6810<mx && mx<3.6913)
return 1.;
3340 vpx.clear();vpr.clear();vpi.clear();
3345 std::string locvp=getenv(
"BESEVTGENROOT");
3346 locvp +=
"/share/vp.dat";
3347 ifstream m_inputFile;
3348 m_inputFile.open(locvp.c_str());
3353 for(
int i=0;i<4001;i++){
3354 m_inputFile>>vpx[i]>>vpr[i]>>vpi[i];
3366 int mode=vmode[midx];
3374 for(
int i=0;i<600;i++){VXS[midx][i]=0;}
3382 double xb= 2*Esig/
_cms;
3387 double stp=(EgamH - Egamcut)/Nstp;
3388 for(
int i=0;i<Nstp;i++){
3389 double Eg0=EgamH - i*stp;
3390 double Eg1=EgamH - (i+1)*stp;
3393 if(i==0) VXS[midx][0]=xsi;
3394 if(i>=1) VXS[midx][i]=VXS[midx][i-1]+xsi;
3396 VXS[midx][598]=VXS[midx][597];
3397 VXS[midx][599]=VXS[midx][598]+ myxs0;
3403 for(
int j=0;i<vmode.size();j++){
3404 if(mode==vmode[j])
return j;
3406 std::cout<<
" EvtConExc::get_mode_index: no index is found in vmode"<<std::endl;
3411 double hwid=(AA[0]-AA[1])/2.;
3414 double Egam=(
s-mhds*mhds)/2/
_cms;
3415 for(
int i=0;i<600;i++){
3416 if( (AA[i]-hwid)<=Egam && Egam<(AA[i]+hwid) )
return VXS[idx][i];
3419 std:cout<<
"EvtConExc::getObsXsection : no observed xs is found "<<endl;
3425 double mhds = sqrt(
s - 2*Egam*
_cms);
3431 oa.open(
"_pkhr.dec");
3432 ob.open(
"obsxs.dat");
3436 double xscon=VXS[im][599];
3438 std::vector<int> Vmode;
3440 Vmode.push_back(13);
3441 Vmode.push_back(12);
3444 Vmode.push_back(45);
3445 Vmode.push_back(46);
3448 Vmode.push_back(37);
3449 std::vector<std::string> vmdl;
3450 vmdl.push_back(
"PHOKHARA_pipi");
3451 vmdl.push_back(
"PHOKHARA_pi0pi0pipi");
3452 vmdl.push_back(
"PHOKHARA_4pi");
3453 vmdl.push_back(
"PHOKHARA_ppbar");
3454 vmdl.push_back(
"PHOKHARA_nnbar");
3455 vmdl.push_back(
"PHOKHARA_KK");
3456 vmdl.push_back(
"PHOKHARA_K0K0");
3457 vmdl.push_back(
"PHOKHARA_pipipi0");
3458 vmdl.push_back(
"PHOKHARA_LLB");
3459 vmdl.push_back(
"PHOKHARA_pipieta");
3461 ob<<
"mode_index observed cross /nb"<<std::endl;
3462 for(
int i=0;i<vmode.size();i++){
3463 ob<<vmode[i]<<
" "<<VXS[
getModeIndex(vmode[i])][599]<<std::endl;
3466 for(
int i=0;i<Vmode.size();i++){
3471 for(
int i=0;i<Vmode.size();i++){
3475 oa<<
"LundaPar PARJ(11)=0.611798"<<std::endl;
3476 oa<<
"LundaPar PARJ(12)=7.92527E-12"<<std::endl;
3477 oa<<
"LundaPar PARJ(14)=0.244495"<<std::endl;
3478 oa<<
"LundaPar PARJ(15)=1.16573E-15"<<std::endl;
3479 oa<<
"LundaPar PARJ(16)=0.436516"<<std::endl;
3480 oa<<
"LundaPar PARJ(17)=0.530517"<<std::endl;
3481 oa<<
"LundaPar PARJ(1)=0.0651577"<<std::endl;
3482 oa<<
"LundaPar PARJ(2)=0.260378"<<std::endl;
3483 oa<<
"LundaPar PARJ(21)=0.0664835"<<std::endl;
3484 oa<<
"LundaPar RALPA(15)=0.576687"<<std::endl;
3485 oa<<
"LundaPar RALPA(16)=0.364796"<<std::endl;
3486 oa<<
"LundaPar RALPA(17)=3.19486E-06"<<std::endl;
3487 oa<<
"noPhotos"<<std::endl;
3488 oa<<
"Particle vpho "<<
_cms<<
" 0"<<std::endl;
3489 oa<<
"Decay vpho"<<std::endl;
3490 oa<<
"0 pi+ pi- PHSP ;"<<std::endl;
3491 oa<<
"0 pi0 pi0 pi- pi+ PHSP ;"<<std::endl;
3492 oa<<
"0 pi+ pi- pi- pi+ PHSP ;"<<std::endl;
3493 oa<<
"0 anti-p- p+ PHSP ;"<<std::endl;
3494 oa<<
"0 anti-n0 n0 PHSP ;"<<std::endl;
3495 oa<<
"0 K+ K- PHSP ;"<<std::endl;
3496 oa<<
"0 K_S0 K_L0 PHSP ;"<<std::endl;
3497 oa<<
"0 pi+ pi- pi0 PHSP ;"<<std::endl;
3498 oa<<
"0 Lambda0 anti-Lambda0 PHSP ;"<<std::endl;
3499 oa<<
"0 pi+ pi- eta PHSP ;"<<std::endl;
3500 oa<<
"0 gamma phi PHSP;"<<std::endl;
3501 oa<<
"0 gamma rho0 PHSP;"<<std::endl;
3502 oa<<
"0 gamma omega PHSP;"<<std::endl;
3503 oa<<xscon<<
" ConExc 74110;"<<std::endl;
3504 for(
int i=0;i<Vmode.size();i++){
3505 oa<<VXS[
getModeIndex(Vmode[i]) ][599]<<
" "<<vmdl[i]<<
" ;"<<std::endl;
3507 oa<<
"Enddecay"<<std::endl;
3508 oa<<
"End"<<std::endl;
3515 oa.open(
"_evtR.dat");
3518 double xscon=VXS[im][599];
3519 double xscon0=xscon;
3520 oa<<
"Ecms= "<<
_cms<<
" GeV"<<std::endl;
3521 oa<<
"The total observed xs: "<<xscon<<
" nb"<<std::endl;
3522 oa<<
"=== mode =========== ratio ==========="<<std::endl;
3523 for(
int i=0;i<vmode.size();i++){
3526 if(vmode[i]==74110)
continue;
3527 xscon -= VXS[themode ][599];
3529 if(xscon<0) xscon=0;
3531 for(
int i=0;i<vmode.size();i++){
3533 if(vmode[i]==74110)
continue;
3534 oa<<vmode[i]<<
"-th mode: "<<100*VXS[themode][599]/xscon0<<
" % "<<std::endl;
3536 oa<<
"74110-th mode: "<<100*xscon/xscon0<<
" % "<<std::endl;
3542 for (
int i=0;i<vmode.size();i++){
3543 if(m==vmode[i])
return i;
3545 std::cout<<
"EvtConExc::getModeIndex: no index in vmode found "<<std::endl;
3551 return std::string(
"ConExcPar");
3556 if (ncommand==lcommand){
3557 lcommand=10+2*lcommand;
3558 std::string* newcommands=
new std::string[lcommand];
3560 for(i=0;i<ncommand;i++){
3561 newcommands[i]=commands[i];
3564 commands=newcommands;
3566 commands[ncommand]=cmd;
3573 if (nconexcdecays==ntable){
3577 for(i=0;i<ntable;i++){
3578 newconexcdecays[i]=conexcdecays[i];
3581 delete [] conexcdecays;
3582 conexcdecays=newconexcdecays;
3585 conexcdecays[nconexcdecays++]=jsdecay;
3592 std::string::size_type pos;
3593 std::vector<std::string> result;
3595 int size=str.size();
3597 for(
int i=0; i<size; i++)
3599 pos=str.find(pattern,i);
3602 std::string
s=str.substr(i,pos-i);
3603 result.push_back(
s);
3604 i=pos+pattern.size()-1;
3614 std::string pattern=
"=";
3615 for(
int i=0;i<ncommand;i++){
3616 std::vector<std::string> result=
split(commands[i],pattern);
3617 if(result[0]==
"threshold") { threshold=atof(result[1].c_str());}
else
3618 if(result[0]==
"beamEnergySpread"){ beamEnergySpread=atof(result[1].c_str());}
3620 std::cout<<
"Your parameter in decay card \""<<result[0]<<
"\" incorect"<<std::endl;
3621 std::cout<<
"Possible words: threshold, beamEnergySpread"<<std::endl;
3635 for(
int i=0;i<
n;i++){
3639 double eta=sqrt(
n*12.0)*(ri/12-0.5);
3640 double xsig= sigma*eta+mu;
3643 if(xsig<mx0 || xsig>mx1)
goto rloop;
3651 double Esig = 0.0001;
3652 double x = 2*Egamcut/
_cms;
3656 double EgamH = (
s-mhdL*mhdL)/2/sqrt(
s);
3662 double xb= 2*Esig/
_cms;
3667 double stp=(EgamH - Egamcut)/Nstp;
3668 for(
int i=0;i<Nstp;i++){
3669 double Eg0=EgamH - i*stp;
3670 double Eg1=EgamH - (i+1)*stp;
3676 double binwidth = mh2-mhi;
3678 if(i>=1) AF[i]=AF[i-1]+xsi;
3682 AA[598]=Egamcut; AA[599]=0;
3684 AF[599]=AF[598]+ _xs0;
3686 for(
int i=0;i<600;i++){
3691 if(bornXS==0){std::cout<<
"EvtConExc::calAF: bad BornXS at "<<
_cms<<
" GeV"<<std::endl;abort();}
3692 double fisr=AF[599]/bornXS;
3693 myFisr.push_back(fisr);
3699 int ntot=myFisr.size();
3701 for(
int i=0;i<ntot;i++){mymu += myFisr[i];}
3704 for(
int i=0;i<ntot;i++){ mysig += (myFisr[i]-mymu)*(myFisr[i]-mymu);}
3706 mysig = sqrt(mysig);
3707 std::cout<<
"========= Iteration times over ISR factor: "<<ntot<<std::endl;
3708 std::cout<<
" ISR factor * VP factor= observedXS/BornXS: "<<mymu<<
" + "<<mysig<<std::endl;
3714 double xL=2*El/sqrt(
s);
3715 double xH=2*Eh/sqrt(
s);
3717 double gaps = (xH-xL)/
double(
n);
3718 for (
int i = 0; i <
n; i++)
3727 double xL=2*El/sqrt(
s);
3728 double xH=2*Eh/sqrt(
s);
3730 double gaps = (xH-xL)/
double(
n);
3731 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()