int m_epp__ (int i,int*pString) { void *pscr = NULL; i--; for (;;) { char strmen[] = "\050" " Incoming particle mass = XXX " " Incoming particle charge = YYY " " |Q^2|max = ZZZ " " Pt cut of outgoing proton = VVV "; int mode; improveStr (strmen, "XXX", "%.10G GeV", xin[i]); improveStr (strmen, "YYY", "%d e", charge[i]); improveStr (strmen, "ZZZ", "%.8G GeV^2", q2_max[i]); improveStr (strmen, "VVV", "%.9G GeV", pt_min[i]); menu1 (38, 10, "", strmen, "n_sf_epp", &pscr, &mode); switch (mode) { case 0: return 1; case 1: correctDouble (40, 16, "Enter new value ", xin + i, 1);break; case 2: charge[i]*=-1;break; case 3: correctDouble (40, 16, "Enter new value ", q2_max +i,1);break; case 4: do {correctDouble (40, 16, "Enter new value ", pt_min +i,1);} while((pt_min[0]>sqrt(q2_max[0])&& pt_min[0]>Maxpt_min) || (pt_min[1]>sqrt(q2_max[1])&& pt_min[1]>Maxpt_min)); /* kinematic and q2 approximation limitation */ } } return 1; }
int m_isr__(int i, int*pString) { void * pscr=NULL; int mode =1; for(;;) { char strmen[]="\40" " ISR scale = XXX " " Beamstralung ON " " Bunch x+y sizes (nm)= YYY " " Bunch lenght (mm) = ZZZ " " Number of particles = NNN " " * N_cl = NCL " " * Upsilon = UPS "; if(scale<=1) improveStr(strmen,"XXX","%.2fS^.5",scale); else improveStr(strmen,"XXX","%.0fGeV",scale); calc_params(); if(bOn) { improveStr(strmen,"YYY","%.1f",xy_nm); improveStr(strmen,"ZZZ","%.3f",z_mm); improveStr(strmen,"NNN","%.1e",qTot); improveStr(strmen,"NCL","%.2f",b_ncl); improveStr(strmen,"UPS","%.2f",b_ips); } else { improveStr(strmen,"ON","%3.3s","OFF"); strmen[2*strmen[0]+1]=0; } menu1(46,10,"",strmen,"n_sf_isr",&pscr,&mode); switch(mode) { case 0: return 1; case 1: messanykey(45,16,"Value >1 is scale in GeV;\n" "Value <=1 is fraction of sqrt(S)"); correctDouble(45,16,"Enter value: ",&scale,1);break; case 2: bOn=!bOn; break; case 3: correctDouble(52,16,"Enter new value ",&xy_nm,1);break; case 4: correctDouble(52,16,"Enter new value ",&z_mm,1);break; case 5: correctDouble(52,16,"Enter new value ",&qTot,1);break; case 6: case 7: messanykey(10,10, "This parameter is a function of\n" "above ones and Sqrt(S)"); } } return 1; }
static int w_men__(void) { int key =1; void * pscr=NULL; L1: { char strmen[] ="\030" " BreitWigner range XXX " " T-channel widths YYY " " GI in t-channel ZZZ " " GI in s-channel WWW "; improveStr(strmen,"XXX","%.1f",*BWrange_int); improveStr(strmen,"YYY", (*twidth_int)? "ON" : "OFF"); improveStr(strmen,"ZZZ",(*gtwidth_int)? "ON" : "OFF"); improveStr(strmen,"WWW",(*gswidth_int)? "ON" : "OFF"); menu1(54,6,"",strmen,"n_width_*",&pscr ,&key); } switch(key) { case 0: return 0; case 1: correctDouble(40,18,"Breit-Wigner range = ",BWrange_int ,1); if(*BWrange_int<0) *BWrange_int=-*BWrange_int; if(*BWrange_int>999.9) *BWrange_int=999.9; break; case 2: *twidth_int = ! *twidth_int; break; case 3: *gtwidth_int =! *gtwidth_int; break; case 4: *gswidth_int =! *gswidth_int; break; } goto L1; } /* w_men__ */
static int changeParam(int X,int Y) { int n,ch; char txt[50]; static char fName[100]=""; double x; int pos; for(n=0,ch=0,pos=1;n>=-1;) { n=findParam(X-1,Y,1,0,nModelVars,"Change Parameter",&pos); if(pos==1) { FILE *f; struct stat buf; if(!findCalcHEPfile(fName)) continue; if(stat(fName,&buf) || !(S_ISREG(buf.st_mode)) ) { messanykey(10,17, "Not a regular file"); continue; } f=fopen(fName,"r"); if(f==NULL) { messanykey(10,17, "Can not open file"); continue; } for(;;) { char name[20]; char txt[40]; double val; int i; if(fscanf(f,"%s",name)!=1) break; if(name[0]=='#') { fscanf(f,"%*[^\n]"); continue;} for(i=0;i<nModelVars;i++) if(strcmp(name,varNames[i])==0) break; if(i==nModelVars) { sprintf(txt,"'%s' - unknown variable",name); messanykey(10,10,txt); } if(fscanf(f,"%lf",&val)!=1) { sprintf(txt," wrong defined number for '%s'",name); messanykey(10,10,txt); } else if(i<nModelVars) { varValues[i]=val; ch=1;} fscanf(f,"%*[^\n]"); } fclose(f); }else if(n>=0) { x=varValues[n]; sprintf(txt,"%s = ",varNames[n]); if(correctDouble(20,20,txt,&x,1)) { varValues[n]=x; ch=1; } } } return ch; }
static void f7_prog(int mode) { int pos=1; void *pscr=NULL; f3_key[4]=NULL; for(;;) { static double xMin=1E-5, xMax=1.0, q0 = 91.187,qMin=1.5,qMax=1.E4,x0=0.1; static int nPoints=100; static int both=1,LOG=1; int on[2]={0,0}; char strmen[]="\030" " x-Min = XXX " " x-Max = YYY " " q-Min = QXX " " q-Max = QYY " " Npoints = NNN " " q0 = QQQ " " x0 = xXX " " log scale argument LOG " " Display plot x*F(x) " " Display plot F(x) " " Display plot F(Q) " " both PDF1&PDF2 BOTH "; improveStr(strmen,"XXX","%.3E",xMin); improveStr(strmen,"YYY","%.3E",xMax); improveStr(strmen,"QXX","%.3E",qMin); improveStr(strmen,"QYY","%.3E",qMax); improveStr(strmen,"NNN","%d",nPoints); improveStr(strmen,"QQQ","%.2fGeV",q0); improveStr(strmen,"xXX","%.2E",x0); if(LOG) improveStr(strmen,"LOG","ON"); else improveStr(strmen,"LOG","OFF"); if(mode>2) both=1; if(both){ on[0]=1,on[1]=1;} else on[mode-1]=1; if(!sf_num[0]) on[0]=0; if(!sf_num[1]) on[1]=0; if(sf_num[0]==0 && sf_num[1]==0) return; if(both) improveStr(strmen,"BOTH","ON"); else improveStr(strmen,"BOTH","OFF"); menu1(54,10,"PDF plots",strmen,"n_pdf_plots_*",&pscr,&pos); switch(pos) { case 0: f3_key[4]=f7_prog; return; case 1: correctDouble(55,18,"xMin = ",&xMin,1); break; case 2: correctDouble(55,18,"xMax = ",&xMax,1); break; case 3: correctDouble(55,18,"qMin = ",&qMin,1); break; case 4: correctDouble(55,18,"qMax = ",&qMax,1); break; case 5: correctInt(50,18,"nPoints = ",&nPoints,1); break; case 6: correctDouble(50,18,"q0 = ",&q0,1); break; case 7: correctDouble(50,18,"x0 = ",&x0,1); break; case 8: LOG=!LOG; break; case 9: case 10: case 11: { double z1,z2; if(pos==11) {z1=qMin;z2=qMax;} else {z1=xMin;z2=xMax;} if(z1>=0 && (!LOG||(z2/z1>10) ) && z2>z1 && nPoints>=3 && nPoints<=150 ) { int l,i; double * df[2]={NULL,NULL}; double f[2][250]; char p_name[2][100], title[100]; char*xName; void * screen; get_text(1,1,maxCol(),maxRow(),&screen); // if(LOG) {z1=log10(z1); z2=log10(z2);} for(l=0;l<2; l++) if(on[l]) { double be=sf_be[l]; strFunName(l+1,p_name[l]); sprintf(p_name[l]+strlen(p_name[l]),"(%s)", pinf_int(Nsub,l+1,NULL,NULL)); // sprintf(p_name[l],"pdf%d(%s)", l+1,pinf_int(Nsub,l+1,NULL,NULL) ); for(i=0;i<nPoints;i++) { double x=x0,q=q0,z,al; al=(i+0.5)/(double)nPoints; if(LOG) z=pow(z1,1-al)*pow(z2,al); else z=z1+al*(z2-z1); if(pos==11) q=z; else x=z; f[l][i]=strfun_(l+1,x,q); if(pos==9) f[l][i]*=x; // if(pos==11) f[l][i]/=q*q; if(be!=1.) f[l][i]*=be*pow(1.-x,be-1.); } } // strcpy(title,"Incoming particle distribution"); title[0]=0; switch(pos) { case 9: sprintf(title+strlen(title)," x*F(x,Q=%.2E)",q0); break; case 10: sprintf(title+strlen(title)," F(x,Q= %.2E)",q0); break; case 11: sprintf(title+strlen(title)," F(x=%.2E,Q)",x0); break; } if(pos==11) xName="Q"; else xName="x"; if(on[0]&&on[1]) plot_N(title,z1,z2, xName, LOG, 2, nPoints, f[0],NULL,p_name[0],nPoints,f[1],NULL,p_name[1]); else { if(on[0]) l=0; else l=1; plot_N(title,z1,z2, xName, LOG,1, nPoints, f[l],NULL,p_name[l]); } put_text(&screen); } else messanykey(16,5," Correct input is \n" " 0<=xMin<xMax<=1,\n" " 3<=nPoints<=150"); } break; case 12: both=!both; break; } } }
static int in_setting(void) { int mode=1; void * pscr=NULL; double Pcm; void (*f7_tmp)(int)=f3_key[4]; char * f7_mess_tmp= f3_mess[4]; char sf_txt[STRSIZ]; REAL mass[2]; int i; int returnCode=0; if(nin_int == 1) return returnCode; for(i=0;i<2;i++) if(sf_num[i])mass[i]=sf_mass[i];else pinf_int(Nsub,i+1,mass+i,NULL); /* ** menu loop */ for(;;) { char strmen[] = "*" " S.F.1: First_structure_function " " S.F.2: Second_structure_function " " First particle momentum[GeV] = PPP1 " " Second particle momentum[GeV] = PPP2 " " FirstPol " " SecondPol "; Pcm=va_int[0]; strmen[0]=strlen(strmen)/6; if(is_polarized(1,Nsub)) improveStr(strmen,"FirstPol", "Helicity of first particle %.3G",(double)Helicity[0]); else improveStr(strmen,"FirstPol", "First particle unpolarized"); if(is_polarized(2,Nsub)) improveStr(strmen,"SecondPol","Helicity of second particle %.3G",(double)Helicity[1]); else improveStr(strmen,"SecondPol", "Second particle unpolarized"); strFunName(1,sf_txt); improveStr(strmen,"First","%-45.45s", sf_txt); strFunName(2,sf_txt); improveStr(strmen,"Second","%-45.45s",sf_txt); improveStr(strmen,"PPP1","%-10.4G",inP1); improveStr(strmen,"PPP2","%-10.4G",inP2); f3_key[4]=f7_prog; f3_mess[4]="Plot"; menu1(25,7,"",strmen,"n_in_*",&pscr,&mode); f3_key[4]= f7_tmp; f3_mess[4]=f7_mess_tmp; switch(mode) { case 0: for(i=0;i<2;i++) if(sf_num[i])mass[i]=sf_mass[i]; else pinf_int(Nsub,i+1,mass+i,NULL); if((mass[0]==0 && inP1<=0)|| (mass[1]==0 && inP2<=0)) messanykey(10,10,"For massless particle\nmomentum should be positive\n"); else { initStrFun(0); return returnCode; } break; case 1: case 2: if(sf_menu(mode)) { initStrFun(mode); returnCode=returnCode|3; } break; case 3: correctDouble(50,12,"Enter new value ",&inP1,1); returnCode=returnCode|1; break; case 4: correctDouble(50,12,"Enter new value ",&inP2,1); returnCode=returnCode|1; break; case 5: if(is_polarized(1,Nsub)) { double buf=Helicity[0]; int spin2; char txt[60]; (*pinfAux_int)(Nsub,1, &spin2,NULL,NULL,NULL); sprintf(txt, "Enter new value [%.1f,%.1f] :", -(spin2/2.),(spin2/2.)); correctDouble(40,12,txt,&buf,1); if(fabs(2*buf)>spin2) { messanykey( 10,10,"Helicity out of limits"); if(blind) exit(111); }else { Helicity[0]=buf; returnCode=returnCode|1; } } break; case 6: if(is_polarized(2,Nsub)) { double buf=Helicity[1]; int spin2; char txt[60]; (*pinfAux_int)(Nsub,2, &spin2,NULL,NULL,NULL); sprintf(txt, "Enter new value [%.1f,%.1f] :", -(spin2/2.),(spin2/2.)); correctDouble(40,12,txt,&buf,1); if(fabs(2*buf)>spin2) { messanykey( 10,10,"Helicity out of limits"); if(blind) exit(111); }else { Helicity[1]=buf; returnCode=returnCode|1; } } break; } } } /* in_setting */
void paramdependence(r_func ff, char* procname, char* resultname) { double minprm, maxprm; int npoints; double memprm, stepprm; unsigned count; double f[201]; int Esc=0,mPos=1; double prmval; char txt[100]; char name[20]; double *vPos; if(!selectParam(54,11,"Choose parameter",NULL,nin_int==2,1,0,&vPos,name,&mPos)) return; memprm=*vPos; minprm = memprm; maxprm = minprm; label1: sprintf(txt,"'%s' min=",name); if (!correctDouble(55,14,txt,&minprm,0)) return; label2: sprintf(txt,"'%s' max=",name); if (!correctDouble(55,15,txt,&maxprm,0)) { goto_xy(55,14); clr_eol(); goto label1; } if (maxprm <= minprm) { messanykey(55,17,"Range check error"); goto_xy(55,15); clr_eol(); goto label2; } label4: npoints = 101; if (correctInt(55,16,"Number of points= ",&npoints,0)) { if (npoints < 3) { messanykey(55,17,"Too few points!"); goto label4; } if (npoints > 201) { messanykey(55,17,"Too many points!"); goto label4; } } else { goto_xy(55,15); clr_eol(); goto label2; } goto_xy(55,14); clr_eol(); goto_xy(55,15); clr_eol(); goto_xy(55,16); clr_eol(); stepprm = (maxprm - minprm)/(npoints - 1); informline(0,npoints); stepprm = (maxprm - minprm) / (npoints - 1); prmval=minprm; err_code = 0; for(count = 1; count <= npoints; count++) { *vPos=prmval; err_code=checkParam(); if(err_code>1) break; f[count-1] = ff(); if(err_code>1) break; Esc=informline(count,npoints); if(Esc) break; prmval += stepprm; } if(err_code) errormessage(); strcpy(txt,name); if (err_code <=1 && Esc==0) plot_1(minprm,maxprm ,npoints,f,NULL,procname,txt,resultname); *vPos=memprm; calcFunc_int(); }
int qcdmen_(void) { void * pscr=NULL; int mode; int returnCode=0; initStrFun(0); L10:{ char strmen[]="\030" " parton dist. alpha OFF " " alpha(MZ)= ZZZZ " " nf = NF " " order= NNLO " " mb(mb)= MbMb " " Mtop(pole)= Mtp " " Alpha(Q) plot " " Qren = RRR " " Qpdf1= FF1 " " Qpdf2= FF2 " " Qshow= FFS "; if(alphaPDF) { int k=0; //printf("alphaPDF=%d sf_alpha[0]=%p sf_alpha[1]=%p\n", alphaPDF,sf_alpha[0],sf_alpha[1]); switch(alphaPDF) { case 1: if(sf_alpha[0]) k=1; else if(sf_alpha[1]) k=2; break; case 2: if(sf_alpha[1]) k=2; else if(sf_alpha[0]) k=1; break; } if(k) improveStr(strmen,"OFF","pdf%d",k); } improveStr(strmen,"ZZZZ","%.4f", alphaMZ); improveStr(strmen,"NF","%d",alphaNF); if(alphaOrder==1) improveStr(strmen,"NNLO","%-.4s","LO"); else if(alphaOrder==2) improveStr(strmen,"NNLO","%-.4s","NLO"); else alphaOrder=3; improveStr(strmen,"MbMb","%.3f", MbMb); improveStr(strmen,"Mtp","%.2f", Mtp); improveStr(strmen,"RRR","%-.16s", Rscale_str); improveStr(strmen,"FF1","%-.16s", F1scale_str); improveStr(strmen,"FF2","%-.16s", F2scale_str); improveStr(strmen,"FFS","%-.16s", Sscale_str); menu1(54,8,"QCD alpha",strmen,"n_alpha",&pscr,&mode); } switch (mode) { case 0: if(returnCode) init_alpha(); return returnCode; case 1: { char alphaMen[100]="\006" " OFF " " pdf1 " " pdf2 "; int k=0; menu1(54,12,"alpha",alphaMen,"",NULL,&k); if(k)alphaPDF=k-1; if(alphaPDF && !sf_alpha[alphaPDF-1]) messanykey(20,20,"WARNING! This pdf does not define alphaQCD "); } break; case 2: { double alphaMZ_old=alphaMZ; if(correctDouble(3,15,"Enter new value ",&alphaMZ,1)) returnCode=1; if(alphaMZ>0 && alphaMZ<0.3) returnCode=1; else { alphaMZ=alphaMZ_old; messanykey(5,15,"Your input is out of alphaMZ range"); } } break; case 3: { int NF_old=alphaNF; if(correctInt(3,15,"Enter new value ",&alphaNF,1)) { if(alphaNF<=6 && alphaNF>=3) returnCode=1; else { messanykey(5,15,"NF out of range"); alphaNF=NF_old;} } } break; case 4: { char lomen[]="\010" " LO " " NLO " " NNLO "; void *pscrlo=NULL; int k=0; menu1(52,12,"",lomen,"",&pscrlo,&k); if(k) { alphaOrder=k; returnCode=1; put_text(&pscrlo);} } break; case 5: correctDouble(3,15,"Enter new value ",&MbMb,1); break; case 6: correctDouble(3,15,"Enter new value ",&Mtp,1); break; case 7: { void * screen; int i; static double qMin=1, qMax=1000; static int nPoints=100; if(returnCode) init_alpha(); get_text(1,1,maxCol(),maxRow(),&screen); if(correctDouble(40 ,15 ,"Q_min=",&qMin,0)&& qMin>=0.5 && correctDouble(40 ,16 ,"Q_max=",&qMax,0)&& qMax>qMin && correctInt(33,17,"number of points=" ,&nPoints,0) && nPoints>3&& nPoints<=150) { double *f[3]={NULL,NULL,NULL}; double *ff[3]={NULL,NULL,NULL}; char buff[3][100]; char* Y[3]={buff[0],buff[1],buff[2]}; switch(alphaOrder) { case 1: sprintf(Y[0],"MSbar LO"); break; case 2: sprintf(Y[0],"MSbar NLO"); break; case 3: sprintf(Y[0],"MSbar NNLO"); break; default:sprintf(Y[0],"MSbar"); } int N,k; f[0]=(double*) malloc(nPoints*sizeof(double)); int xLog= (qMin>0 && qMax/qMin >10)? 1 : 0; for(i=0;i<nPoints;i++) { double z=(i+0.5)/(double)(nPoints),q; if(xLog) q=pow(qMin,1-z)*pow(qMax,z); else q=qMin*(1-z)+qMax*z; f[0][i]=alpha_0(q); // printf("i=%d %E\n",i,f[0][i]); } N=1; for(k=0;k<2;k++) if(sf_alpha[k]) { char buff[300]; strFunName(k+1,Y[N]); char *p=strstr(Y[N],"(proton"); if(p) p[0]=0; else { p=strstr(Y[N],"(anti-proton"); if(p) p[0]=0; } f[N]=(double*) malloc(nPoints*sizeof(double)); for(i=0;i<nPoints;i++) { double z=(i+0.5)/(double)(nPoints),q; if(xLog) q=pow(qMin,1-z)*pow(qMax,z); else q=qMin*(1-z)+qMax*z; f[N][i]=(*sf_alpha[k])(q); } N++; } // printf("N=%d Y[0]=%s\n Y[1]=%s\n Y[2]=%s\n", N,Y[0],Y[1],Y[2]); // plot_Nar(NULL, "Alpha(Q)", log10(qMin), log10(qMax),"log10(Q/GeV)", nPoints, N, f,ff,Y); plot_Nar(NULL, "Alpha(Q)", qMin,qMax,"Q/GeV", nPoints, xLog, N, f,ff,Y); for(k=0;k<N;k++) free(f[k]); } else messanykey(40,18, " Correct input is \n" " 0.5<= Q_min <Q_max\n" " number of points <=150 and >=4"); put_text(&screen); } break; case 8: { int npos=1,rc; do { char mess[200]; goto_xy(2,12); print("Renorm. scale: "); if(str_redact(Rscale_str,npos,60)==KB_ENTER) returnCode=1; goto_xy(2,12); clr_eol(); rc=initScales(Rscale_str,F1scale_str,F2scale_str,Sscale_str, mess); if(rc) messanykey(10,10,mess); } while(rc); } break; case 9: { int npos=1,rc; do { char mess[200]; goto_xy(2,12); print("Fct1.scale: "); if(str_redact(F1scale_str,npos,60)==KB_ENTER) returnCode=1; goto_xy(2,12); clr_eol(); rc=initScales(Rscale_str,F1scale_str,F2scale_str,Sscale_str, mess); if(rc) messanykey(10,10,mess); } while(rc); } break; case 10: { int npos=1,rc; do { char mess[200]; goto_xy(2,12); print("Fct1.scale: "); if(str_redact(F2scale_str,npos,60)==KB_ENTER) returnCode=1; goto_xy(2,12); clr_eol(); rc=initScales(Rscale_str,F1scale_str,F2scale_str,Sscale_str, mess); if(rc) messanykey(10,10,mess); } while(rc); } break; case 11: { int npos=1,rc; do { char mess[200]; goto_xy(2,12); print("Shworing scale: "); if(str_redact(Sscale_str,npos,60)==KB_ENTER) returnCode=1; goto_xy(2,12); clr_eol(); rc=initScales(Rscale_str,F1scale_str,F2scale_str,Sscale_str,mess); if(rc) messanykey(10,10,mess); } while(rc); } break; } goto L10; }
int cs_numcalc(double Pcm) { int k,l; void * pscr0=NULL; void * pscr = NULL; get_text(1,3,60,11,&pscr0); k=proces_1.nsub; sprintf(procname,"%s,%s ->%s,%s",pinf_int(k,1,NULL,NULL), pinf_int(k,2,NULL,NULL),pinf_int(k,3,NULL,NULL),pinf_int(k,4,NULL,NULL)); va_int[0]=Pcm; cos1=-0.999; cos2= 0.999; infotext(); writeinformation(); k = 1; l = 1; recalc = 1; do { char menuTxt[]="\030" " Change parameter " " Set precision " " Cos13(min) = cosmin " " Cos13(max) = cosmax " " Angular dependence " " Parameter dependence " " sigma*v plots "; if (recalc) { total_cs(); recalc = 0; if (err_code) errormessage(); } improveStr(menuTxt,"cosmin","%.6f",cos1); improveStr(menuTxt,"cosmax","%.6f",cos2); menu1(54,4,"",menuTxt,"n_22_*",&pscr,&k); switch (k) { case 0: break; case 1: if(change_parameter(54,5,1)) recalc=1; break; case 2: do { /* Precision */ recalc = correctDouble(1,23," Enter precision : ",&eps,1); if (eps < 1.E-10 || eps > 0.0011) messanykey(10,12,"Range check error"); } while (!(eps >= 1.E-10 && eps <= 0.03)); break; case 3: recalc=correctDouble(15,10,"Min[cos(p1,p3)]=",&cos1,1); break; case 4: recalc=correctDouble(15,10,"Max[cos(p1,p3)]=",&cos2,1); break; case 5: if(err_code>1) errormessage(); else drawgraph(); break; case 6: paramdependence(totcs,procname,"Cross Section [pb]"); break; case 7: paramdependence(vtotcs,procname,"v*sigma[pb]"); break; } /* switch */ if (k > 0) writeinformation(); } while (k != 0); put_text(&pscr0); return 0; }
static void show_dependence(int X, int Y) { void *pscr1=NULL; int i,mPos=1; REAL mem; int nc,ni,pos1,pos2; char txt[50]; for(pos1=1;;) { nc=findParam(X-1,Y,0,nModelVars,nModelFunc,"Constraint",&pos1); if(!pos1) return; for(pos2=1;;) { double xMin,xMax; int nPoints=100; sprintf(txt,"check \"%s\" depends on",varNames[nc]); ni=findParam(X-1,Y,0,0,nModelVars,txt,&pos2); mem=varValues[ni]; if(ni<0) break; xMin=varValues[ni] - fabs(varValues[ni] )/10; xMax=varValues[ni] + fabs(varValues[ni] )/10; for(;;) { int k3=0; char strmen[]="\026 " " x-Min = XXX " " x-Max = YYY " " Npoints = NNN " " Display "; improveStr(strmen,"XXX","%G",xMin); improveStr(strmen,"YYY","%G",xMax); improveStr(strmen,"NNN","%d",nPoints); sprintf(txt,"check %s(%s)",varNames[nc],varNames[ni]); menu1(X,Y+2,txt,strmen,"",NULL,&k3); if(!k3) break; switch(k3) { case 1: correctDouble(X,Y+12,"xMin = ",&xMin,1); break; case 2: correctDouble(X,Y+12,"xMax = ",&xMax,1); break; case 3: correctInt(X,Y+12,"nPoints = ",&nPoints,1); break; case 4: if( xMax>xMin && nPoints>=3 && nPoints<=150) { double dx=(xMax-xMin)/(nPoints-1); double f[150]; int i, NaN=0,Esc=0; informline(0,nPoints); for(i=0;i<nPoints;i++) { double x=xMin+i*dx; varValues[ni]=x; NaN=calcMainFunc(); if(NaN) { char mess[100]; sprintf(mess,"Can not evaluate constraints for %s=%G",varNames[ni], x); messanykey(16,5,mess); break; } f[i]=varValues[nc]; Esc=informline(i,nPoints); if(Esc) break; } varValues[ni]=mem; calcMainFunc(); if(!(NaN||Esc)) plot_1(xMin,xMax,nPoints,f,NULL,"Plot", varNames[ni], varNames[nc]); } else messanykey(16,5," Correct input is \n" " xMin<xMax,\n" " 3<=nPoints<=150"); break; } } } } }
static void f7_prog(int mode) { int pos=1; void *pscr=NULL; if(mode>2) { messanykey(10,15," Highlight the corresponding\n" "structure function"); return; } if(!sf_num[mode-1]) return; f3_key[4]=NULL; for(;;) { static double xMin=0.0, xMax=1.0, scale = 91.187; static int nPoints=100; double f[150]; char strmen[]="\030 " " x-Min = XXX " " x-Max = YYY " " Npoints = NNN " " QCD-scale= QQQ " " Display plot x*F(x) " " Display plot F(x) "; improveStr(strmen,"XXX","%.3f",xMin); improveStr(strmen,"YYY","%.3f",xMax); improveStr(strmen,"NNN","%d",nPoints); improveStr(strmen,"QQQ","%.1fGeV",scale); menu1(54,14,"",strmen,"n_alpha_view",&pscr,&pos); switch(pos) { case 0: f3_key[4]=f7_prog; return; case 1: correctDouble(55,18,"xMin = ",&xMin,1); break; case 2: correctDouble(55,18,"xMax = ",&xMax,1); break; case 3: correctInt(50,18,"nPoints = ",&nPoints,1); break; case 4: correctDouble(50,18,"QCD-scale = ",&scale,1); break; case 5: case 6: if(xMin>=0 && xMax>xMin && xMax<=1 && nPoints>=3 && nPoints<=150 && scale>0.5) { void * screen; double dx=(xMax-xMin)/(2*nPoints); double be=sf_be[mode-1]; int i; get_text(1,1,maxCol(),maxRow(),&screen); for(i=0;i<nPoints;i++) { double x=xMin+(i+0.5)*(xMax-xMin)/nPoints; f[i]=strfun_(mode,x,scale); if(pos==5) f[i]*=x; if(be!=1.) f[i]*=be*pow(1.-x,be-1.); } { char p_name[20], mess[STRSIZ]; strcpy(p_name,pinf_int(Nsub,mode,NULL,NULL)); if(pos==5) strcat(p_name,"(x)*x"); else strcat(p_name,"(x)"); strFunName(mode,mess); trim(mess); sprintf(mess+strlen(mess)," [QCD-scale = %.1f GeV]",scale); plot_1(xMin+dx,xMax-dx,nPoints,f,NULL,mess,"x",p_name); } put_text(&screen); } else messanykey(16,5," Correct input is \n" " 0<=xMin<xMax<=1,\n" " QCD-scale > 0.5 GeV\n" " 3<=nPoints<=150"); break; } } }