124#include "TGraphErrors.h"
126#include "TPostScript.h"
128#include "TMultiGraph.h"
132 extern double dgauss_(
double (*fun)(
double*),
double *,
double *,
double *);
136 extern double divdif_(
float*,
float *,
int *,
float *,
int*);
140 extern void polint_(
float*,
float *,
int *,
float *,
float*);
144 extern void hadr5n12_(
float*,
float *,
float *,
float *,
float *,
float *);
155double EvtConExc::_xs0=0;
156double EvtConExc::_xs1=0;
157double EvtConExc::_er0=0;
158double EvtConExc::_er1=0;
159int EvtConExc::_nevt=0;
196 }
else if(
getNDaug()>2){std::cout<<
"Bad daughter specified"<<std::endl;abort();}
202 radflag=0;mydbg=
false;
207 std::cout<<
"The decay daughters are "<<std::endl;
209 std::cout<<std::endl;
211 radflag=0;mydbg=
false;
216 else if(
getNArg()==1){ _mode =
getArg(0);radflag=0;mydbg=
false;}
219 else{std::cout<<
"ConExc:umber of parameter should be 1,2 or 3, but you set "<<
getNArg()<<std::endl;::abort(); }
228 myfile =
new TFile(
"mydbg.root",
"RECREATE");
229 xs=
new TTree (
"xs",
"momentum of rad. gamma and hadrons");
230 xs->Branch(
"imode",&imode,
"imode/I");
231 xs->Branch(
"pgam",pgam,
"pgam[4]/D");
232 xs->Branch(
"phds",phds,
"phds[4]/D");
233 xs->Branch(
"ph1",ph1,
"ph1[4]/D");
234 xs->Branch(
"ph2",ph2,
"ph2[4]/D");
235 xs->Branch(
"mhds",&mhds,
"mhds/D");
236 xs->Branch(
"mass1",&mass1,
"mass1/D");
237 xs->Branch(
"mass2",&mass2,
"mass2/D");
238 xs->Branch(
"costheta",&costheta,
"costheta/D");
239 xs->Branch(
"cosp",&cosp,
"cosp/D");
240 xs->Branch(
"cosk",&cosk,
"cosk/D");
241 xs->Branch(
"sumxs",&sumxs,
"sumxs/D");
242 xs->Branch(
"selectmode",&selectmode,
"selectmode/D");
248 std::cout<<
"parent mass = "<<parentMass<<std::endl;
259 if(mx<mth){std::cout<<
"The CMS energy is lower than the threshold of the final states"<<std::endl;abort();}
260 }
else if(_mode == -2){
266 std::cout<<
"The specified mode is "<<_mode<<std::endl;
271 double Esig = 0.0001;
272 double x = 2*Egamcut/
_cms;
274 double mhscut = sqrt(
s*(1-
x));
277 float fe,fst2,fder,ferrder,fdeg,ferrdeg;
281 if(3.0943<
_cms &&
_cms<3.102) vph=1;
282 std::cout<<
"sum of leptonic, hadronic contributions(u,d,s,c,b) to vacuum polarization: "<<vph<<
" @"<<fe<<
"GeV"<<std::endl;
288 for(
int jj=1;jj<_ndaugs;jj++){
292 ISRXS.clear();ISRM.clear();ISRFLAG.clear();
293 for(
int ii=0;ii<3;ii++){
295 if(mx<mR || _mode !=74110)
continue;
296 double narRxs=
Ros_xs(mx,BR_ee[ii],ResId[ii]);
297 std::cout<<
"The corss section for gamma "<<
EvtPDL::name(ResId[ii]).c_str()<<
" is: "<< narRxs<<
"*Br (nb)."<<std::endl;
298 ISRXS.push_back(narRxs);
300 ISRFLAG.push_back(1.);
301 ISRID.push_back(ResId[ii]);
304 std::cout<<
"==========================================================================="<<std::endl;
308 EgamH = (
s-mhdL*mhdL)/2/sqrt(
s);
312 std::cout<<
"_er0= "<<_er0<<std::endl;
314 double xs1_err = _er1;
318 double xb= 2*Esig/
_cms;
325 double stp=(EgamH - Egamcut)/Nstp;
326 for(
int i=0;i<Nstp;i++){
327 double Eg0=EgamH - i*stp;
328 double Eg1=EgamH - (i+1)*stp;
334 double binwidth = mh2-mhi;
337 if(i>=1) AF[i]=AF[i-1]+xsi;
341 AA[598]=Egamcut; AA[599]=0;
343 AF[599]=AF[598]+ _xs0;
345 std::cout<<
"mhadL= "<<mhdL<<
" ecms "<<
_cms<<std::endl;
346 for(
int i=0;i<600;i++){
352 std::cout<<
"EgamH="<<EgamH<<
" "<<_xs0+_xs1<<
" AF[599]="<<AF[599]<<
" AF[598] "<<AF[598]<<std::endl;
359 double obsvXS = _xs0 + _xs1;
360 double obsvXS_er= _er0 + xs1_err;
361 double corr = obsvXS/bornXS;
362 double corr_er =corr*sqrt(bornXS_er*bornXS_er/bornXS/bornXS + obsvXS_er*obsvXS_er/obsvXS/obsvXS);
365 if(bornXS==0){std::cout<<
"EvtConExc::init : The Born cross section at this point is zero!"<<std::endl;abort();}
366 if(obsvXS==0){std::cout<<
"EvtConExc::init : The observed cross section at this point is zero!"<<std::endl;abort();}
371 std::cout<<
""<<std::endl;
372 std::cout<<
"========= Generation using cross section (Egamcut="<<Egamcut<<
" GeV) =============="<<std::endl;
373 std::cout<<
" sqrt(s)= "<<mx<<
" GeV "<<std::endl;
374 if(_mode>=0 || _mode ==-2 ){
375 std::cout<<
"The generated born cross section (sigma_b): "<<_xs0<<
"+/-"<<_er0<<
" in Unit "<<_unit.c_str()<<std::endl;
376 std::cout<<
"The generated radiative correction cross section (sigma_isr): "<<_xs1<<
"+/-"<<xs1_err<<
" in Unit "<<_unit.c_str()<<std::endl;
377 std::cout<<
"The Born process is sampled according to the ratio sigma_b/(sigma_b+sigma_isr)"<<std::endl;
378 std::cout<<
"The radiative correction factor f_ISR*f_vacuum= sigma_obs/sigma_born(s) = "<<corr<<
"+/-"<< fabs(corr_er)<<
","<<std::endl;
379 std::cout<<
"which is calcualted with these quantities:"<<std::endl;
380 std::cout<<
"the observed cross section is "<<obsvXS<<
"+/-"<< obsvXS_er<<_unit.c_str()<<std::endl;
381 std::cout<<
"and the Born cross section (s) is "<<bornXS<<
"+/-"<<bornXS_er<<_unit.c_str()<<std::endl;
382 std::cout<<
"and the vaccum polarziation factor (lep. + hadr.) 1/|1-Pi|^2= "<<vph<<std::endl;
384 std::cout<<
"==========================================================================="<<std::endl;
386 std::cout<<
"The generated born cross section (sigma_b): "<<_xs0<<
" *Br_ee"<<
" in Unit "<<_unit.c_str()<<std::endl;
387 std::cout<<
"The generated radiative correction cross section (sigma_isr): "<<_xs1<<
"*Br_ee in Unit "<<_unit.c_str()<<std::endl;
388 std::cout<<
"The Born process is sampled according to the ratio sigma_b/(sigma_b+sigma_isr)"<<std::endl;
389 std::cout<<
"The radiative correction factor sigma_obs/sigma_born(s) = (1+delta) = "<<corr<<
"+/-"<< fabs(corr_er)<<std::endl;
390 std::cout<<
"==========================================================================="<<std::endl;
392 std::cout<<std::endl;
393 std::cout<<std::endl;
400 if(_xs0 == 0 && _xs1==0){std::cout<<
"EvtConExc::ini() has zero cross section"<<std::endl;abort();}
402 std::cout<<std::endl;
403 std::cout<<std::endl;
406 if(mydbg && _mode!=74110){
408 double xx[10000],yy[10000],xer[10000],yer[10000];
409 for(
int i=0;i<nd;i++){
416 myth=
new TH1F(
"myth",
"Exp.data",200,xx[0],xx[nd]);
417 for(
int i=0;i<nd;i++){
418 myth->Fill(xx[i],yy[i]);
426 if(mydbg && _mode==74110 ){
428 double xx[10000],yy[10000],xer[10000],yer[10000],ysum[10000],yysum[10000];
429 for(
int i=0;i<nd;i++){
439 TGraphErrors *Gdt =
new TGraphErrors(nd,xx,yy,xer,yer);
441 myth=
new TH1F(
"myth",
"Exp.data",600,xlow,xhigh);
442 Xsum=
new TH1F(
"sumxs",
"sum of exclusive xs",600,xlow,xhigh);
443 double mstp=(xhigh-xlow)/600;
444 for(
int i=0;i<600;i++){
445 double mx=i*
mstp+xlow;
452 for(
int i=0;i<600;i++){
453 double mx=i*
mstp+xlow;
455 if(ysum[i]==0)
continue;
456 Xsum->Fill(mx,ysum[i]);
460 for(
int i=0;i<nd;i++){
468 TGraphErrors *Gsum =
new TGraphErrors(nd,xx,yysum,xer,yer);
470 double ex[600]={600*0};
471 double ey[600],ta[600];
472 double exz[600]={600*0};
473 double eyz[600]={600*0};
474 for(
int i=0;i<600;i++){
477 TGraphErrors *gr0 =
new TGraphErrors(600,MH,AF,ex,ey);
478 TGraphErrors *gr1 =
new TGraphErrors(600,MH,RadXS,exz,eyz);
479 TPostScript *ps =
new TPostScript(
"xsobs.ps",111);
480 TCanvas *c1 =
new TCanvas(
"c1",
"TGraphs for data",200,10,600,400);
483 gStyle->SetCanvasColor(0);
484 gStyle->SetStatBorderSize(1);
492 gr0->SetMarkerStyle(10);
494 gr0->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
495 gr0->GetYaxis()->SetTitle(
"observed cross section (nb)");
503 gr1->SetMarkerStyle(10);
505 gr1->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
506 gr1->GetYaxis()->SetTitle(
"Rad*BornXS");
510 TMultiGraph *mg =
new TMultiGraph();
511 mg->SetTitle(
"Exclusion graphs");
512 Gdt->SetMarkerStyle(2);
513 Gdt->SetMarkerSize(1);
514 Gsum->SetLineColor(2);
515 Gsum->SetLineWidth(1);
525 mg->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
526 mg->GetYaxis()->SetTitle(
"observed cross section (nb)");
534 Gdt->SetMarkerStyle(2);
536 Gdt->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
537 Gdt->GetYaxis()->SetTitle(
"observed cross section (nb)");
544 Gsum->SetMarkerStyle(2);
545 Gsum->SetMarkerSize(1);
547 Gsum->SetLineWidth(0);
548 Gsum->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
549 Gsum->GetYaxis()->SetTitle(
"observed cross section (nb)");
557 Gdt->SetMarkerStyle(2);
558 Gdt->SetMarkerSize(1);
559 Gdt->SetMaximum(8000.0);
560 Gsum->SetLineColor(2);
561 Gsum->SetLineWidth(1.5);
564 Gsum->GetXaxis()->SetTitle(
"M_{hadrons} (GeV)");
565 Gsum->GetYaxis()->SetTitle(
"cross section (nb)");
601 }
else if(mode ==6 ){
620 }
else if(mode ==10 ){
625 }
else if(mode ==11 ){
630 }
else if(mode ==12 ){
636 }
else if(mode ==13 ){
642 }
else if(mode ==14 ){
648 }
else if(mode ==15 ){
654 }
else if(mode ==16 ){
660 }
else if(mode ==17 ){
667 }
else if(mode ==18 ){
674 }
else if(mode ==19 ){
681 }
else if(mode ==20 ){
688 }
else if(mode ==21 ){
696 }
else if(mode ==22 ){
704 }
else if(mode == 23){
708 }
else if(mode == 24){
712 }
else if(mode == 25){
716 }
else if(mode == 26){
720 }
else if(mode == 27){
724 }
else if(mode == 28){
729 }
else if(mode == 29){
734 }
else if(mode == 30){
739 }
else if(mode == 31){
744 }
else if(mode == 32){
749 }
else if(mode == 33){
754 }
else if(mode == 34){
759 }
else if(mode == 35){
764 }
else if(mode == 36){
768 }
else if(mode == 37){
773 }
else if(mode == 38){
778 }
else if(mode == 39){
782 }
else if(mode == 40){
787 }
else if(mode == 41){
792 }
else if(mode == 42){
797 }
else if(mode == 43){
803 }
else if(mode == 44){
807 }
else if(mode == 45){
811 }
else if(mode == 46){
815 }
else if(mode == 47){
819 }
else if(mode == 48){
823 }
else if(mode == 49){
828 }
else if(mode == 50){
833 }
else if(mode == 51){
838 }
else if(mode == 65){
843 }
else if(mode == 66){
848 }
else if(mode == 67){
852 }
else if(mode == 68){
857 }
else if(mode == 69){
862 }
else if(mode == 70){
871 }
else if(mode == 72){
876 }
else if(mode == 73){
881 }
else if(mode == 74){
886 }
else if(mode == 75){
891 }
else if(mode == 76){
896 }
else if(mode == 77){
901 }
else if(mode == 78){
906 }
else if(mode == 79){
911 }
else if(mode == 80){
915 }
else if(mode == 81){
920 }
else if(mode == 82){
925 }
else if(mode == 83){
930 }
else if(mode == 84){
935 }
else if(mode == 90){
940 }
else if(mode == 91){
945 }
else if(mode == 92){
950 }
else if(mode == 93){
954 }
else if(mode == 94){
958 }
else if(mode == 95){
962 }
else if(mode == 96){
966 }
else if(mode == 74100){
969 }
else if(mode == 74101){
972 }
else if(mode == 74102){
975 }
else if(mode == 74103){
978 }
else if(mode == 74104){
981 }
else if(mode == 74105){
984 }
else if(mode == 74106){
987 }
else if(mode == 74107){
990 }
else if(mode == 74110){
996 _modeFlag.push_back(74110);
997 _modeFlag.push_back(0);
998 }
else if(mode == -1){
1000 for(
int i=0;i<nson;i++){ daugs[i]=son[i]; }
1001 std::cout<<
"The paraent particle: "<<
EvtPDL::name(pid)<<std::endl;
1002 }
else if(mode == -2){
1004 for(
int i=0;i<nson;i++){ daugs[i]=son[i]; }
1005 }
else if(mode == 10000){
1010 std::cout<<
"Bad mode_index number " <<mode<<
", please refer to the manual."<<std::endl;
1033 if(myvpho != p->
getId()){
1034 std::cout<<
"Parent needs to be vpho, but found "<<
EvtPDL::name(p->
getId())<<std::endl;
1043 std::vector<int> vmod; vmod.clear();
1044 int mn[78]={0,1,2,3,4,5,6,7,8,9,10,11,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,
1046 68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,
1047 90,91,92,93,94,95,96,
1048 74100,74101,74102,74103,74104,74105,74110};
1049 int mn2[79]={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,
1051 68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,
1052 90,91,92,93,94,95,96,
1053 74100,74101,74102,74103,74104,74105,74110};
1056 for(
int i=0;i<78;i++){vmod.push_back(mn[i]);}
1058 for(
int i=0;i<79;i++){vmod.push_back(mn2[i]);}
1066 if(pm <_xs0/(_xs0 + _xs1) ){
1070 _selectedMode = mymode;
1071 std::cout<<
"A selected mode is "<<mymode<<
" with Mhds= "<<mhds<<std::endl;
1082 for(
int i=0;i< _ndaugs;i++){
1088 if(totMass>p->
mass())
goto checkA;
1096 mydaugs[0]=daugs[0];
1103 for(
int i=0;i< 2;i++){
1110 if(totMass>p->
mass())
goto checkB;
1120 double xeng=1-mhds*mhds/(
_cms*
_cms);
1123 if(mydbg) mass2=mhds;
1130 if(mhds<2.3 && mymode==74110) {
goto ModeSelection;}
1131 std::cout<<
"A selected mode is "<<mymode<<
" with Mhds= "<<mhds<<std::endl;
1132 _selectedMode = mymode;
1150 mydaugs[0]=daugs[0];
1157 ISRphotonAng_sampling:
1160 for(
int i=0;i< 2;i++){
1166 if(totMass>p->
mass())
goto ISRphotonAng_sampling;
1169 if(!
checkdecay(p))
goto ISRphotonAng_sampling;
1173 if(maxflag==0) {
findMaxXS(mhds); maxflag=1;}
1176 double gx=vgam.
get(1);
1177 double gy=vgam.
get(2);
1178 double sintheta= sqrt(gx*gx+gy*gy)/vgam.
d3mag();
1186 pgam[0]=vgam.
get(0);
1187 pgam[1]=vgam.
get(1);
1188 pgam[2]=vgam.
get(2);
1189 pgam[3]=vgam.
get(3);
1191 phds[0]=vhds.
get(0);
1192 phds[1]=vhds.
get(1);
1193 phds[2]=vhds.
get(2);
1194 phds[3]=vhds.
get(3);
1195 costheta = vgam.
get(3)/vgam.
d3mag();
1196 selectmode = mymode;
1200 _modeFlag[1]= _selectedMode;
1212 if(pm <_xs0/(_xs0 + _xs1) ){
1221 double xeng=1-mhds*mhds/(
_cms*
_cms);
1224 for(
int i=0;i< 2;i++){
1230 SetP4(p,mhds,xeng,theta);
1239 if((_xs0 + _xs1)==0) {std::cout<<
"EvtConExc::zero total xsection"<<std::endl;::abort();}
1241 double xsratio = _xs0/(_xs0 + _xs1);
1244 if(
getNArg()==3 && radflag==1){iflag=1;xsratio=0;}
1245 else if(
getNArg()==3 && radflag==0) {iflag=0;xsratio=1;}
1253 for(
int i=0;i< _ndaugs;i++){
1265 if(!byn_ang)
goto angular_hadron;
1276 double xeng=1-mhdr*mhdr/(
_cms*
_cms);
1287 costheta =
cos(theta);
1291 for(
int i=0;i< 2;i++){
1297 SetP4(p,mhdr,xeng,theta);
1309 std::cout<<
"The decay chain: "<<std::endl;
1326 if(_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 ){
1329 }
else if(_mode ==6||_mode==45 || _mode==46 || _mode==70 || _mode==71|| _mode==93){
1332 }
else if(_mode==23 || _mode==24 || _mode==25 || _mode==26 || _mode==27 || _mode==36||_mode==47||_mode==48||_mode==68||_mode==69||_mode==72||_mode==73||_mode==80||_mode==94||_mode==95){
1349 for(
int ii=0;ii<nmc;ii++){
1351 int gamdaugs = _ndaugs+1;
1354 for(
int i=0;i<_ndaugs;i++){
1355 theDaugs[i] = daugs[i];
1357 theDaugs[_ndaugs]=gamId;
1361 for(
int i=0;i<gamdaugs;i++){
1370 double pmag = pgam.
d3mag();
1371 double pz = pgam.
get(3);
1372 double sintheta = sqrt( pmag*pmag - pz*pz)/pmag;
1373 double onedegree = 1./180.*3.1415926;
1375 if(pmag <El || pmag >Eh) {
goto loop;}
1381 if(thexs>maxXS) {maxXS=thexs;}
1382 double s = p_init.
mass2();
1383 double x = 2*pgam.
get(0)/sqrt(
s);
1410 double xL=2*El/sqrt(
s);
1411 double xH=2*Eh/sqrt(
s);
1412 for(
int i=0;i<nmc;i++){
1414 double x= xL+ (xH-xL)*rdm;
1423 double thexs= Rad2Xs*(xH-xL);
1432 std::cout<<
" "<<std::endl;
1442 if(!Rad2Xs)
return Rad2Xs;
1449 std::cout<<
" "<<std::endl;
1459 if(!Rad2Xs)
return Rad2Xs;;
1476 for(
int ii=0;ii<nmc;ii++){
1478 int gamdaugs = _ndaugs+1;
1481 for(
int i=0;i<_ndaugs;i++){
1482 theDaugs[i] = daugs[i];
1484 theDaugs[_ndaugs]=gamId;
1489 for(
int i=0;i<gamdaugs;i++){
1497 if(totm >= p_init.
get(0) )
goto loop;
1502 double costheta = p4gam.
get(3)/p4gam.
d3mag();
1503 double sintheta = sqrt(1-costheta*costheta);
1504 bool acut=(sintheta>0.04) && (sintheta<0.96);
1505 if(thexs>maxXS && acut ) {maxXS=thexs;}
1514 for(
int i=1;i<_ndaugs;i++){
1518 double mhs = p0.
mass();
1519 double egam = pgam.
get(0);
1520 double sin2theta = pgam.
get(3)/pgam.
d3mag();
1521 sin2theta = 1-sin2theta*sin2theta;
1524 double alpha = 1./137.;
1525 double pi = 3.1415926;
1526 double x = 2*egam/cms;
1531 double difxs = 2*mhs/cms/cms * wsx *xs;
1541 double xsratio = xs/maxXS;
1542 if(pm<xsratio){
return true;}
else{
return false;}
1547 double xs =
difgamXs( mhds,sintheta );
1548 double xsratio = xs/maxXS;
1549 if(pm<xsratio){
return true;}
else{
return false;}
1555 if(pm <xs/
XS_max) {
return true;}
else {
return false;}
1561 if(pm <xs/(xs0*1.1)) {
return true;}
else {
return false;}
1568 double costheta=
cos(theta);
1573 if(_mode ==96){
alpha=-0.34;}
1575 double ang = 1 +
alpha*costheta*costheta;
1578 if(pm< ang/myang) {
return true;}
else{
return false;}
1585 double costheta=
cos(theta);
1588 double ang = 1 - costheta*costheta;
1589 if(pm< ang/1.) {
return true;}
else{
return false;}
1596 double costheta=
cos(theta);
1599 double ang = 1 + costheta*costheta;
1600 if(pm< ang/2.) {
return true;}
else{
return false;}
1606 double alpha = 1./137.;
1607 double pi=3.1415926;
1608 double me = 0.5*0.001;
1609 double sme = sqrt(
s)/
me;
1610 double L = 2*log(sme);
1618 double alpha = 1./137.;
1619 double pi=3.1415926;
1620 double me = 0.5*0.001;
1621 double xi2 = 1.64493407;
1622 double xi3=1.2020569;
1623 double sme = sqrt(
s)/
me;
1624 double L = 2*log(sme);
1625 double beta = 2*
alpha/
pi*(L-1);
1626 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.;
1628 double Delta = 1 + ap *(1.5*L + 1./3.*
pi*
pi-2) + ap*ap *delta2;
1629 double wsx = Delta * beta * pow(
x,beta-1)-0.5*beta*(2-
x);
1630 double wsx2 = (2-
x)*( 3*log(1-
x)-4*log(
x) ) -4*log(1-
x)/
x-6+
x;
1631 wsx = wsx + beta*beta/8. *wsx2;
1632 double mymx = sqrt(
s*(1-
x));
1634 return wsx*
getVP(mymx);
1643 for(
int i=1;i<_ndaugs;i++){
1650 double mrg = cms - summass;
1652 double mhs = pm*mrg + summass;
1654 double s = cms * cms;
1655 double x = 2*Egam/cms;
1663 double difxs = 2*mhs/cms/cms * wsx *xs;
1672 double mhs = sqrt(
s*(1-
x));
1676 double difxs = wsx *xs;
1685 for(
int i=1;i<_ndaugs;i++){
1690 double mrg = cms - summass;
1692 double mhs = pm*mrg + summass;
1694 double s = cms * cms;
1695 double x = 1 - mhs*mhs/
s;
1702 double difxs = 2*mhs/cms/cms * wsx *xs;
1712 double psip_ee =7.73E-03;
1713 double jsi_ee =5.94*0.01;
1714 double phi_ee =2.954E-04;
1728 BR_ee.push_back(phi_ee);
1729 BR_ee.push_back(jsi_ee);
1730 BR_ee.push_back(psip_ee);
1735 ResId.push_back(phiId);
1736 ResId.push_back(jsiId);
1737 ResId.push_back(pspId);
1743 double pi=3.1415926;
1748 double sigma = 12*
pi*
pi*bree*width/
mass/
s;
1749 sigma *=
Rad2(
s, xv);
1750 double nbar = 3.89379304*100000;
1757 double s = cms * cms;
1758 double x = 1 - (*mhs)*(*mhs)/
s;
1765 double difxs = 2*dhs/cms/cms * wsx *xs;
1766 std::ofstream
oa;
oa<<
x<<std::endl;
1771 double s = cms * cms;
1772 double x = 1 - (*mhs)*(*mhs)/
s;
1777 double differ2 = 2*(*mhs)/cms/cms * wsx *xs;
1778 std::ofstream
oa;
oa<<
x<<std::endl;
1784 double s = cms * cms;
1785 double x = 1 - (*mhs)*(*mhs)/
s;
1792 double difxs = 2*dhs/cms/cms * wsx *xs;
1799 double s = cms * cms;
1800 double x = 1 - (*mhs)*(*mhs)/
s;
1805 double differ2 = 2*(*mhs)/cms/cms * wsx *xs;
1812 double alpha = 1./137.;
1813 double pi=3.1415926;
1814 double me = 0.5*0.001;
1815 double xi2 = 1.64493407;
1816 double xi3=1.2020569;
1817 double sme = sqrt(
s)/
me;
1818 double L = 2*log(sme);
1819 double beta = 2*
alpha/
pi*(L-1);
1820 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.;
1822 double Delta = 1 + ap *(1.5*L + 1./3.*
pi*
pi-2) + ap*ap *delta2;
1824 double beta2 = beta*beta;
1827 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 -
1828 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) +
1829 16*pow(beta,2)*
Li2(b))/32. ;
1830 double mymx = sqrt(
s*(1-b));
1832 return xs*
getVP(mymx);
1837 double li2= -
x +
x*
x/4. -
x*
x*
x/9;
1845 for(
int i=0;i<
n-1;i++){
1846 if(
x[i]>=
t &&
t>
x[i+1]) {n0=i;
break;}
1848 if(n0==-1) {
return 0.0;}
else{
1849 double k=(y[n0]-y[n0+1])/(
x[n0]-
x[n0+1]);
1850 z= y[n0+1]+k*(
t-
x[n0+1]);
1860 for(
int i=0;i<
n-1;i++){
1861 if(
x[i]>=
t &&
t>
x[i+1]) {n0=i;
break;}
1863 double xstotal=y[599];
1864 if(n0==-1) {
return 0;}
else{
1865 double p1=y[n0]/xstotal;
1866 double p2=y[n0+1]/xstotal;
1868 if(p1<pm && pm<=p2) {
return 1;}
else{
return 0;}
1875 if(
t==
x[
n-1] )
return y[
n-1];
1876 for(
int i=0;i<
n-1;i++){
1877 if(
x[i]<=
t &&
t<
x[i+1]) {n0=i;
break;}
1879 if(n0==-1) {
return 0.0;}
else{
1880 double k=(y[n0]-y[n0+1])/(
x[n0]-
x[n0+1]);
1881 z= y[n0+1]+k*(
t-
x[n0+1]);
1896 for(
int i=0;i<
n;i++){
1897 if((y[i]/xst)<pm && pm<=(y[i+1]/xst)){mybin=i+1;
break;}
1900 double mhd=
x[mybin-1]+(
x[mybin]-
x[mybin-1])*pm;
1902 if(mhd>
_cms) {std::cout<<
"selected mhd larger than Ecms "<<mhd<<
" > "<<
x[mybin]<<std::endl;abort();}
1904 std::cout<<
"the sample mhassrons is less than the low end of XS"<<mhd<<
" <"<<_mhdL<<std::endl;
1905 for(
int i=0;i<598;i++){std::cout<<i<<
" "<<
x[i]<<
" "<<y[i]<<std::endl;}
1913 double costheta=
cos(theta);
1915 double cos2=costheta*costheta;
1917 double me=0.51*0.001;
1919 double meE2=
me*
me/eb/eb;
1921 double hq1= meE2/2*costheta/(sin2+meE2*cos2);
1922 double hq2= -0.5*log((1+sqrt(1-meE2)*costheta)/(1-sqrt(1-meE2)*costheta));
1923 double hq3=
x*
x*costheta/2/(
x*
x-2*
x+2)*(1-meE2/(sin2+meE2*cos2));
1924 double hq=(L-1)/2.+hq1+hq2+hq3;
1930 double xx[180],yy[180];
1931 double dgr2rad=1./180.*3.1415926;
1935 for(
int i=6;i<=175;i++){
1940 for(
int j=0;j<=nc;j++){
1945 for(
int j=1;j<=nc;j++){
1946 if(yy[j-1]<pm && pm<=yy[j]){mypt=j;
break;}
1949 double mytheta= xx[mypt-1]+ (xx[mypt]-xx[mypt-1])*pm;
1955 double phi=2*3.1415926*pm;
1956 double gamE =
_cms/2*xeng;
1957 double hdrE = sqrt(mhdr*mhdr+gamE*gamE);
1958 double px = gamE*
sin(theta)*
cos(phi);
1959 double py = gamE*
sin(theta)*
sin(phi);
1960 double pz = gamE*
cos(theta);
1962 p4[0].
set(gamE,px,py,pz);
1963 p4[1].
set(hdrE,-px,-py,-pz);
1964 for(
int i=0;i<2;i++){
1972 double phi=2*3.1415926*pm;
1973 double gamE =
_cms/2*xeng;
1974 double hdrE = sqrt(mhdr*mhdr+gamE*gamE);
1975 double px = gamE*
sin(theta)*
cos(phi);
1976 double py = gamE*
sin(theta)*
sin(phi);
1977 double pz = gamE*
cos(theta);
1979 p4[0].
set(hdrE,px,py,pz);
1980 p4[1].
set(gamE,-px,-py,-pz);
1981 for(
int i=0;i<2;i++){
1990 for(
int i=0;i<90000;i++){
1993 double sin2theta =sqrt(1-
cos*
cos);
1994 double alpha = 1./137.;
1995 double pi = 3.1415926;
1998 double difxs = 2*mhds/
_cms/
_cms * wsx *xs;
1999 if(difxs>maxXS)maxXS=difxs;
2005 double sin2theta = sintheta*sintheta;
2006 double alpha = 1./137.;
2007 double pi = 3.1415926;
2010 double difxs = 2*mhds/
_cms/
_cms * wsx *xs;
2017 std::vector<double> vxs;vxs.clear();
2018 for (
int i=0;i<vmod.size();i++){
2026 if(imod==0) {vxs.push_back(myxs);}
2027 else if(imod==74110){
2028 double xcon = myxs - vxs[i-1];
2029 if(xcon<0) {xcon=vxs[i-1];}
else{xcon=myxs;}
2030 if(mhds<2.0) xcon=vxs[i-1];
2031 vxs.push_back(xcon);
2033 vxs.push_back(myxs+vxs[i-1]);
2039 double totxs = vxs[vxs.size()-1];
2043 if(pm <= vxs[0]/totxs)
return vmod[0];
2044 for(
int j=1;j<vxs.size();j++){
2045 double x0 = vxs[j-1]/totxs;
2046 double x1 = vxs[j]/totxs;
2047 if(x0<pm && pm<=x1)
return vmod[j];
2051 if(icount<10000)
goto mode_iter;
2054 for(
int i=0;i<vxs.size();i++){std::cout<<
"Random="<<pm<<
" Mode,Mhad "<<vmod[i]<<
", "<<mhds<<
" xs_i "<<vxs[i]<<
" xsi/totalxs "<<vxs[i]/totxs<<std::endl;}
2056 std::cout<<
"EvtConExc::selectMode can not find a mode with 100 iteration"<<std::endl;
2133 std::cout<<
"J/psi: "<<mjsi<<
" "<<wjsi<<std::endl;
2134 std::cout<<
"psipr: "<<mpsip<<
" "<<wpsip<<std::endl;
2135 std::cout<<
"psipp: "<<mpsipp<<
" "<<wpsipp<<std::endl;
2136 std::cout<<
"phi : "<<mphi<<
" "<<wphi<<std::endl;
2137 std::cout<<
"omega: "<<momega<<
" "<<womega<<std::endl;
2138 std::cout<<
"rho0 : "<<mrho0<<
" "<<wrho0<<std::endl;
2139 std::cout<<
"rho(3S)0: "<<mrho3s<<
" "<<wrho3s<<std::endl;
2140 std::cout<<
"omega(2S): "<<momega2s<<
" "<<womega2s<<std::endl;
2146 for(
int i=0;i<nson;i++){
2151 std::cout<<
"Zero mass!"<<std::endl;
2158 std::vector<int> vmod; vmod.clear();
2159 int mn[78]={0,1,2,3,4,5,6,7,8,9,10,11,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,
2161 68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,
2162 90,91,92,93,94,95,96,
2163 74100,74101,74102,74103,74104,74105,74110};
2164 int mn2[79]={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,
2166 68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,
2167 90,91,92,93,94,95,96,
2168 74100,74101,74102,74103,74104,74105,74110};
2170 for(
int i=0;i<78;i++){vmod.push_back(mn[i]);}
2172 for(
int i=0;i<79;i++){vmod.push_back(mn2[i]);}
2176 for(
int i=0;i<vmod.size();i++){
2177 int mymode = vmod[i];
2178 if(mymode ==74110)
continue;
2194 for(
int i=0;i<par->
getNDaug();i++){
2210 double angmax = 1+
alpha;
2211 double costheta =
cos(p4i.
theta());
2212 double ang=1+
alpha*costheta*costheta;
2213 double xratio = ang/angmax;
2217 if(xi>xratio)
return false;
2227 double u = 0.938/mx;
2229 double u2 = (1+u)*(1+u);
2230 double uu = u*(1+6*u);
2231 double alpha = (u2-uu)/(u2+uu);
2240 for(
int i=0;i<par->
getNDaug();i++){
2246 if(pdgcode==111 ||pdgcode==221 || pdgcode==331 ){
2250 double angmax = 1+
alpha;
2251 double costheta =
cos(p4i.
theta());
2252 double ang=1+
alpha*costheta*costheta;
2253 double xratio = ang/angmax;
2257 if(xi>xratio)
return false;
2268 double psippee,psipee,jsiee,
phiee,omegaee,
rhoee;
2269 double kev2Gev=0.000001;
2270 psippee=0.262*kev2Gev;
2271 psipee =2.36*kev2Gev;
2272 jsiee =5.55*kev2Gev;
2273 phiee=4.266*0.001*2.954*0.0001;
2274 omegaee=0.6*kev2Gev;
2280 double xpi=12*3.1415926*3.1415926;
2281 if(mxL<=3.0957 && 3.0957<=mxH || mxL<=3.0983 && 3.0983<=mxH) {
2284 }
else if(mxL<=3.6847 && 3.6847<=mxH || mxL<=3.6873 && 3.6873<=mxH){
2287 }
else if(mxL<=1.01906 && 1.01906<=mxH || mxL<= 1.01986 && 1.01986<=mxH){
2292 if(
_cms<=mv)
return -1.;
2293 double xv = 1-mv*mv/
s;
2294 sigv += xpi*widee/mv/
s*
Rad2(
s,xv);
2295 double unic = 3.89379304*100000;
2302 for(
int i=0;i<ISRXS.size();i++){
2303 if( (ISRM[i]-mhi)<binwidth && ISRFLAG[i]){ISRFLAG[i]=0; myxs = ISRXS[i];}
2310 double pm,mhdL,mhds;
2313 mhds = pm*(
_cms - mhdL)+mhdL;
2314 std::vector<double> sxs;
2315 for(
int i=0;i<ISRID.size();i++){
2316 double ri=ISRXS[i]/AF[598];
2319 for(
int j=0;j<sxs.size();j++){
2320 if(j>0) sxs[j] += sxs[j-1];
2326 for(
int j=1;j<sxs.size();j++){
2327 double x0 = sxs[j-1];
2339 for(
int i=0;i<4001;i++){
2343 if(xx<=mx && mx <x1){xx=x1; r1=y1; i1=y2; mytag=0;
break;}
2344 xx=x1; r1=y1; i1=y2;
2346 if(mytag==1){std::cout<<
"No vacuum polarization value found"<<std::endl;abort();}
2348 double thevp=
abs(1./(1-cvp));
2349 if(3.0933<mx && mx<3.1035)
return 1.;
2350 if(3.6810<mx && mx<3.6913)
return 1.;
2356 vpx.clear();vpr.clear();vpi.clear();
2361 std::string locvp=getenv(
"BESEVTGENROOT");
2362 locvp +=
"/share/vp.dat";
2363 ifstream m_inputFile;
2364 m_inputFile.open(locvp.c_str());
2369 for(
int i=0;i<4001;i++){
2370 m_inputFile>>vpx[i]>>vpr[i]>>vpi[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)
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)
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 * 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)
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)
bool hadron_angle_sampling(EvtVector4R ppi, EvtVector4R pcm)
bool gam_sampling(EvtParticle *p)
double Rad2(double s, double x)
void getName(std::string &name)
void decay(EvtParticle *p)
void SetP4(EvtParticle *part, double mhdr, double xeng, double theta)
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 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)
std::vector< double > getEr()
double getXsection(double mx)
std::vector< double > getYY()
std::vector< double > getXX()