44 using namespace starlightConstants;
49 : _nWbins (inputParametersInstance.nmbWBins() ),
50 _nYbins (inputParametersInstance.nmbRapidityBins() ),
51 _wMin (inputParametersInstance.minW() ),
52 _wMax (inputParametersInstance.maxW() ),
53 _yMax (inputParametersInstance.maxRapidity() ),
54 _beamLorentzGamma (inputParametersInstance.beamLorentzGamma() ),
56 _protonEnergy (inputParametersInstance.protonEnergy() ),
57 _electronEnergy (inputParametersInstance.electronEnergy() ),
58 _particleType (inputParametersInstance.prodParticleType() ),
59 _beamBreakupMode (inputParametersInstance.beamBreakupMode() ),
60 _backwardsProduction(inputParametersInstance.backwardsProduction()),
61 _productionMode (inputParametersInstance.productionMode() ),
62 _sigmaNucleus (_bbs.targetBeam().A() ),
63 _fixedQ2range (inputParametersInstance.fixedQ2Range() ),
64 _minQ2 (inputParametersInstance.minGammaQ2() ),
65 _maxQ2 (inputParametersInstance.maxGammaQ2() ),
66 _maxPhotonEnergy (inputParametersInstance.cmsMaxPhotonEnergy()),
67 _cmsMinPhotonEnergy(inputParametersInstance.cmsMinPhotonEnergy()),
68 _targetRadii (inputParametersInstance.targetRadius() ),
69 _maxW_GP (inputParametersInstance.maxW_GP() ),
70 _minW_GP (inputParametersInstance.minW_GP() )
216 cout <<
"No sigma constants parameterized for pid: "<<
_particleType
217 <<
" GammaAcrosssection"<<endl;
240 cout <<
"Neither narrow/wide resonance cross-section calculation.--Derived" << endl;
252 double Av,Wgp,cs,cvma;
260 double xg[6] = {0, 0.1488743390, 0.4333953941, 0.6794095683, 0.8650633667, 0.9739065285};
261 double ag[6] = {0, 0.2955242247, 0.2692667193, 0.2190863625, 0.1494513492, 0.0666713443};
268 double theta_e = acos(cos_theta_e);
270 double gamma_pt = E_prime*sin(theta_e);
271 double pz_squared = targetEgamma*targetEgamma - Q2 - gamma_pt*gamma_pt;
272 if( pz_squared < 0 || fabs(cos_theta_e) > 1 || 2.*targetEgamma/(Q2+W*W) <
_targetRadii)
274 double temp_pz = sqrt(pz_squared);
276 double Egamma = targetEgamma*cosh(beam_y) - temp_pz*sinh(beam_y);
309 }
else if ( beam == 2 ){
318 ax = 0.5 * (tmax - tmin);
319 bx = 0.5 * (tmax + tmin);
321 for (
int k = 1;
k < NGAUSS; ++
k) {
324 if( A_1 <= 1 && A_2 != 1){
326 }
else if(A_2 <=1 && A_1 != 1){
334 cout<<
"Something went wrong here, beam= "<<beam<<endl;
338 t = ax * (-xg[
k]) + bx;
339 if( A_1 <= 1 && A_2 != 1){
341 }
else if(A_2 <=1 && A_1 != 1){
349 cout<<
"Something went wrong here, beam= "<<beam<<endl;
353 csgA = 0.5 * (tmax - tmin) * csgA;
370 double Av,Wgp,cs,cvma;
376 double xg[6] = {0, 0.1488743390, 0.4333953941, 0.6794095683, 0.8650633667, 0.9739065285};
377 double ag[6] = {0, 0.2955242247, 0.2692667193, 0.2190863625, 0.1494513492, 0.0666713443};
407 ax = 0.5 * (tmax - tmin);
408 bx = 0.5 * (tmax + tmin);
410 for (
int k = 1;
k < NGAUSS; ++
k) {
413 if( A_1 <= 1 && A_2 != 1){
415 }
else if(A_2 <=1 && A_1 != 1){
423 cout<<
"Something went wrong here, beam= "<<beam<<endl;
427 t = ax * (-xg[
k]) + bx;
428 if( A_1 <= 1 && A_2 != 1){
430 }
else if(A_2 <=1 && A_1 != 1){
438 cout<<
"Something went wrong here, beam= "<<beam<<endl;
442 csgA = 0.5 * (tmax - tmin) * csgA;
455 return std::pow(mv2/(mv2+Q2),n);
473 double lEgamma,Emin,Emax;
474 static double lnEmax, lnEmin, dlnE;
475 double stepmult,energy,rZ;
476 int nbstep,nrstep,nphistep,nstep;
477 double bmin,bmax,bmult,biter,bold,integratedflux;
478 double fluxelement,deltar,riter;
479 double deltaphi,phiiter,dist;
480 static double dide[401];
485 double RNuc=0.,RSum=0.;
496 static int Icheck = 0;
497 static int Ibeam = 0;
504 double dlnb = (log(bmax)-log(bmin))/(1.*nbsteps);
506 double local_sum=0.0;
509 for (
int i = 0; i<=nbsteps;i++){
511 double bnn0 = bmin*exp(i*dlnb);
512 double bnn1 = bmin*exp((i+1)*dlnb);
513 double db = bnn1-bnn0;
515 double ppslope = 19.0;
516 double GammaProfile = exp(-bnn0*bnn0/(2.*
hbarc*
hbarc*ppslope));
517 double PofB0 = 1. - (1. - GammaProfile)*(1. - GammaProfile);
518 GammaProfile = exp(-bnn1*bnn1/(2.*
hbarc*
hbarc*ppslope));
519 double PofB1 = 1. - (1. - GammaProfile)*(1. - GammaProfile);
538 if( Icheck > 1 && beam == Ibeam )
goto L1000f;
563 dlnE=(lnEmax-lnEmin)/nstep;
565 printf(
"Calculating photon flux from Emin = %e GeV to Emax = %e GeV (CM frame) for source with Z = %3.0f \n", Emin, Emax, rZ);
567 stepmult= exp(log(Emax/Emin)/
double(nstep));
570 for (
int j = 1; j<=nstep;j++){
571 energy=energy*stepmult;
579 bmult=exp(log(bmax/bmin)/
double(nbstep));
590 double bmin = 0.7*RSum;
592 double dlnb = (log(bmax)-log(bmin))/(1.*nbsteps);
594 double local_sum=0.0;
597 for (
int i = 0; i<=nbsteps; i++){
599 double bnn0 = bmin*exp(i*dlnb);
600 double bnn1 = bmin*exp((i+1)*dlnb);
601 double db = bnn1-bnn0;
606 double loc_nofe0 = 0.0;
607 double loc_nofe1 = 0.0;
622 integratedflux = local_sum;
625 double localbmin = 0.0;
632 integratedflux =
nepoint(energy,localbmin);
636 for (
int jb = 1; jb<=nbstep;jb++){
641 if (biter > (10.*RNuc)){
650 fluxelement = (rZ*rZ*
alpha*energy)*
659 deltar=RNuc/double(nrstep);
662 for (
int jr =1; jr<=nrstep;jr++){
665 deltaphi=
pi/double(nphistep);
668 for(
int jphi=1;jphi<= nphistep;jphi++){
669 phiiter=(double(jphi)-0.5)*deltaphi;
672 dist=sqrt((biter+riter*
cos(phiiter))*(biter+riter*
673 cos(phiiter))+(riter*sin(phiiter))*(riter*sin(phiiter)));
675 flux_r = (rZ*rZ*
alpha*energy)*
682 fluxelement=fluxelement+flux_r*2.*deltaphi*riter*deltar;
687 fluxelement=fluxelement/(
pi*RNuc*RNuc);
690 fluxelement=fluxelement*2.*
pi*biter*(biter-bold);
697 integratedflux=integratedflux+fluxelement;
704 dide[j]=integratedflux*energy;
712 if (lEgamma < (lnEmin+dlnE) || lEgamma > lnEmax){
714 cout<<
" ERROR: Egamma outside defined range. Egamma= "<<Egamma
715 <<
" "<<lnEmax<<
" "<<(lnEmin+dlnE)<<endl;
719 Ilt = int((lEgamma-lnEmin)/dlnE);
721 lnElt = lnEmin + Ilt*dlnE;
723 flux_r = dide[Ilt] + ((lEgamma-lnElt)/dlnE)*(dide[Ilt+1]- dide[Ilt]);
724 flux_r = flux_r/Egamma;
739 if( _min != 0 || _max !=0){
748 double ln_min = std::log(Q2_min);
749 double ratio = std::log(Q2_max/Q2_min)/nstep;
754 for (
int ii = 0 ; ii< nstep; ++ii){
755 double x1 = std::exp(ln_min+(
double)ii*ratio);
756 double x3 = std::exp(ln_min+(
double)(ii+1)*ratio);
757 double x2 = (x3+x1)/2.;
759 g_int += (x3-x1)*(
g(Egamma,x3)+
g(Egamma,x1) +4.*
g(Egamma,x2));
778 if( _min != 0 || _max!=0){
787 double ln_min = std::log(Q2_min);
788 double ratio = std::log(Q2_max/Q2_min)/nstep;
790 for (
int ii = 0 ; ii< nstep; ++ii){
791 double x1 = std::exp(ln_min+(
double)ii*ratio);
792 double x3 = std::exp(ln_min+(
double)(ii+1)*ratio);
793 double x2 = (x3+x1)/2.;
816 std::pair<double,double>* to_ret =
new std::pair<double, double>(Q2min,Q2max);
821 double ratio = std::log(Q2max/Q2min)/(double)Nstep;
822 double ln_min = std::log(Q2min);
824 const double limit = 1E-9;
825 std::vector<double>Q2_array;
828 while( g_step>limit ){
829 double Q2 = std::exp(ln_min+iNstep*ratio);
832 g_step =
g(Egamma,Q2);
833 Q2_array.push_back(g_step);
836 if( std::exp(ln_min+iNstep*ratio) < Q2max)
837 Q2max = std::exp(ln_min+iNstep*ratio);
839 std::pair<double, double>* to_ret =
new std::pair<double, double>(Q2min,Q2max);
865 double to_ret =
alpha/(
pi) *( 1- ratio + ratio*ratio/2. - (1-ratio)*( fabs(minQ2/Q2)) );
871 return to_ret/( Egamma*fabs(Q2) );
887 double beta,X,C1,bracket,nepoint_r;
890 X = (bmin*Egamma)/(beta*_beamLorentzGamma*
hbarc);
900 nepoint_r = C1*(1./beta)*(1./beta)*(1./Egamma)*bracket;
915 if(Wgp < _minW_GP || Wgp >
_maxW_GP)
return 0;
923 double thresholdScaling = 1.0;
932 if(Wgp<WgpMax) thresholdScaling=(Wgp-WgpMin)/(WgpMax-WgpMin);
933 sigmagp_r=thresholdScaling*1.E-4*(5.0*exp(0.22*log(Wgp))+26.0*exp(-1.23*log(Wgp)));
943 if(Wgp<WgpMax) thresholdScaling=(Wgp-WgpMin)/(WgpMax-WgpMin);
944 sigmagp_r=thresholdScaling*1.E-4*(0.55*exp(0.22*log(Wgp))+18.0*exp(-1.92*log(Wgp)));
946 if(
_backwardsProduction)sigmagp_r=thresholdScaling*1.E-4*0.206*pow(((Wgp*Wgp-protonMass*protonMass)/(2.0*protonMass)),-2.7);
949 sigmagp_r=1.E-4*0.34*exp(0.22*log(Wgp));
955 sigmagp_r*=sigmagp_r;
956 sigmagp_r*=1.E-4*0.00406*exp(0.65*log(Wgp));
963 sigmagp_r*=sigmagp_r;
964 sigmagp_r*=1.E-4*0.00406*exp(0.65*log(Wgp));
974 sigmagp_r*=sigmagp_r;
975 sigmagp_r*=1.E-10*6.4*exp(0.74*log(Wgp));
982 sigmagp_r*=sigmagp_r;
983 sigmagp_r*=1.E-10*2.9*exp(0.74*log(Wgp));
990 sigmagp_r*=sigmagp_r;
991 sigmagp_r*=1.E-10*2.1*exp(0.74*log(Wgp));
993 default: cout<<
"!!! ERROR: Unidentified Vector Meson: "<<
_particleType <<endl;
1007 double b,bmax,Pint,arg,sigma_A_r;
1013 .0483076656877383162,.144471961582796493,
1014 .239287362252137075, .331868602282127650,
1015 .421351276130635345, .506899908932229390,
1016 .587715757240762329, .663044266930215201,
1017 .732182118740289680, .794483795967942407,
1018 .849367613732569970, .896321155766052124,
1019 .934906075937739689, .964762255587506430,
1020 .985611511545268335, .997263861849481564
1025 .0965400885147278006, .0956387200792748594,
1026 .0938443990808045654, .0911738786957638847,
1027 .0876520930044038111, .0833119242269467552,
1028 .0781938957870703065, .0723457941088485062,
1029 .0658222227763618468, .0586840934785355471,
1030 .0509980592623761762, .0428358980222266807,
1031 .0342738629130214331, .0253920653092620595,
1032 .0162743947309056706, .00701861000947009660
1040 if( A_1 == 1 && A_2 == 1)cout<<
" This is pp, you should not be here..."<<endl;
1045 for(
int IB=1;IB<=NGAUSS;IB++){
1047 b = 0.5*bmax*xg[IB]+0.5*bmax;
1049 if( A_1 == 1 && A_2 != 1){
1051 }
else if(A_2 == 1 && A_1 != 1){
1057 }
else if( beam==2 ){
1060 cout<<
" Something went wrong here, beam= "<<beam<<endl;
1068 sum=sum+2.*
pi*b*Pint*ag[IB];
1070 b = 0.5*bmax*(-xg[IB])+0.5*bmax;
1072 if( A_1 == 1 && A_2 != 1){
1074 }
else if(A_2 == 1 && A_1 != 1){
1083 cout<<
" Something went wrong here, beam= "<<beam<<endl;
1091 sum=sum+2.*
pi*b*Pint*ag[IB];
1123 const double termA2 = termA * termA;
1125 return C *
_ANORM *
_ANORM * termA2 / (termB * termB + termA2);
1133 double ppi=0.,ppi0=0.,GammaPrim,rat;
1175 ppi=sqrt(((W/2.)*(W/2.))-
mel*
mel);
1183 ppi=sqrt(((W/2.)*(W/2.))-
mel*
mel);
1199 ppi=sqrt(((W/2.)*(W/2.))-
mel*
mel);
1234 ppi=sqrt(((W/2.)*(W/2.))-
mel*
mel);
1238 if(ppi==0.&&ppi0==0.)
1239 cout<<
"Improper Gammaacrosssection::breitwigner, ppi&ppi0=0."<<endl;
1246 cc=_channelMass*GammaPrim;
1249 nrbw_r = (( (aa*bb)/(bb*bb+cc*cc) +
_BNORM)*( (aa*bb)/(bb*bb+cc*cc) +
_BNORM));
1252 nrbw_r = nrbw_r + (( (aa*cc)/(bb*bb+cc*cc) )*( (aa*cc)/(bb*bb+cc*cc) ));