static int enter_h(int * y,char* name,int num,int scat) { int i,m,j=0; int redres; shortstr hadrch; char ** items; char * errpos=NULL; locateinbase(name,&j); if(j) { if(pseudop(j)) return -1; strcpy(hadrons[num].name,name); strcpy(hadrons[num].contents,name); hadrons[num].parton[0] = j; hadrons[num].pow = 1; if(!scat && num==0 && strcmp(prtclbase1[j].massidnt,"0")==0) { errTxt="Decay of massless particle."; return -1; } if(name[strlen(name)-1]=='%') { if( !scat || nout||strcmp(prtclbase1[j].massidnt,"0") || (prtclbase1[j].spin!=1 && prtclbase1[j].spin!=2) || strchr("LR",prtclbase1[j].hlp) ) { errTxt="This particle can not be polarized"; return -1; } else hadrons[num].polarized[0]=1; } else hadrons[num].polarized[0]=0; return 0; } for(i=0;i<num;i++) if(!strcmp(hadrons[i].name,name)) { strcpy(hadrons[num].name,name); strcpy(hadrons[num].contents,hadrons[i].contents); hadrons[num].pow=hadrons[i].pow; for(j=0;j<hadrons[num].pow;j++) { hadrons[num].parton[j]=hadrons[i].parton[j]; if(nout) hadrons[num].polarized[j]=0; else hadrons[num].polarized[j]=hadrons[i].polarized[j]; } return 0; } hadrch[0]=0; for(i=num;i<MAXINOUT;i++) if(!strcmp(hadrons[i].name,name)) { strcpy(hadrch,hadrons[i].contents); break; } if(*y>=maxRow()-1) { goto_xy(1,*y); clr_eol();} else (*y)++; do { m=errpos? errpos-hadrch+1: 0; do { char direction[100]; sprintf(direction,"composit '%s' consists of: ",name); redres=input(*y, "s_ent_2", direction, hadrch, m , SSTRLEN); if(redres==KB_ESC) return 1; } while (redres!=KB_ENTER && redres!=KB_ESC); if (redres == KB_ESC || strcmp(hadrch,"") == 0) return 1; items=stritems(" ,",hadrch); for(m=0,hadrons[num].pow=0; items[m]; m++) { char name[100]; if(hadrons[num].pow>=100) {errTxt="too many partons";break;} sscanf(items[m],"%[^ ,]",name); locateinbase(name,&j); if (j==0 || pseudop(j)) { errTxt= "This particle is absent in the model"; break;} if(!scat && num==0 && strcmp(prtclbase1[j].massidnt,"0")==0) { errTxt="Decay of massless particle."; break; } if(name[strlen(name)-1]=='%') { if( !scat || nout||strcmp(prtclbase1[j].massidnt,"0") || (prtclbase1[j].spin!=1 && prtclbase1[j].spin!=2) || strchr("LR",prtclbase1[j].hlp) ) { errTxt="This particle can not be polarized"; break; } else hadrons[num].polarized[hadrons[num].pow]=1; } else hadrons[num].polarized[hadrons[num].pow]=0; hadrons[num].parton[hadrons[num].pow++]=j; } errpos=items[m]; if(!errpos) { for(i=0;i<hadrons[num].pow;i++) for(j=i+1;j<hadrons[num].pow;j++) if(hadrons[num].parton[i]==hadrons[num].parton[j]) { errpos=items[j]; errTxt="duplicate parton"; } } strcpy(hadrons[num].name,name); strcpy(hadrons[num].contents,hadrch); free(items); } while(errpos); return 0; }
int viewresults(void) { int k,kmenu; void * pscr = NULL; shortstr newname; int dirStat=checkDir("results"); if(dirStat==0){messanykey(10,15,"directory RESULTS is empty"); return 1;} kmenu = 1; label_1: menu1(10,10,"","\010" " View " " Delete " " Rename ","s_res",&pscr,&kmenu); switch (kmenu) { case 0: return 0; case 1: viewDir("results"); break; case 2: if(dirStat==2) { char mess[]="Can not clean dir 'results' because it contains the LOCK file"; if(blind) { printf("%s\n",mess); sortie(102);} else { messanykey(3,13,mess); break;} } if ( mess_y_n( 6,13," Delete files ") ) system("rm -r results; mkdir results"); put_text(&pscr); return 1; case 3: strcpy(newname," "); while(1) { void * pscr3; get_text(1,maxRow(),maxCol(),maxRow(),&pscr3); goto_xy(1,maxRow()); print("Enter new name: "); k = str_redact(newname,1,30); if (k == KB_ESC) { goto_xy(1,24); clr_eol(); goto label_1; } if (k == KB_ENTER) { trim(newname); if(rename("results",newname)==0) { mkdir("results",-1); put_text(&pscr); put_text(&pscr3); return 1; } else messanykey(10,15," Can't rename the directory"); } put_text(&pscr3); } } goto label_1; }
static void show_spectrum(int X, int Y) { int i; char *menuP=malloc(2+22*(nModelParticles+2)); int mode=1; menuP[0]=22; menuP[1]=0; strcpy(menuP+1, " All Particles -> SLHA"); // sprintf(menuP++strlen(menuP)," Select.Particl-> SLHA"); for(i=0;i<nModelParticles;i++) { char *mass=ModelPrtcls[i].mass; char *name=ModelPrtcls[i].name; if(!strcmp(mass,"0")) sprintf(menuP+strlen(menuP)," %-6.6s Zero ",name); else sprintf(menuP+strlen(menuP)," %-6.6s %12.4E ",name,pMass(name)); } while(mode) { menu1(X,Y,"",menuP,"n_qnumbers",NULL, &mode); if(mode==1) writeSLHA(); else if(mode>1) { FILE*f=fopen("width.tmp","w"); int pos=mode-2; txtList LL=NULL; char *mass=ModelPrtcls[pos].mass; fprintf(f, "Patricle %s(%s), PDG = %d, Mass= ", ModelPrtcls[pos].name, ModelPrtcls[pos].aname, ModelPrtcls[pos].NPDG); if(strcmp(mass,"0")==0) fprintf(f, "Zero\n"); else { double width; fprintf(f,"%.3E ", pMass(ModelPrtcls[pos].name)); width=pWidth(ModelPrtcls[pos].name,&LL); fprintf(f," Width=%.2E\n",width); } fprintf(f,"Quantum numbers: "); { int spin=ModelPrtcls[pos].spin2; int q3=ModelPrtcls[pos].q3; fprintf(f," spin="); if(spin&1) fprintf(f,"%d/2, ",spin); else fprintf(f,"%d, ",spin/2); fprintf(f," charge(el.)="); if(q3!=3*(q3/3)) fprintf(f,"%d/3, ",q3);else fprintf(f,"%d ",q3/3); fprintf(f," color=%d\n",ModelPrtcls[pos].cdim); } if(LL) { txtList ll=LL; fprintf(f," Branchings & Decay channels:\n"); for(;ll;ll=ll->next) { char buff[100]; double br; sscanf(ll->txt,"%lf %[^\n]",&br,buff); fprintf(f," %.2E %s\n",br,buff); } } fclose(f); f=fopen("width.tmp","r"); showtext(2,Y,78, maxRow()-1,"Particle information",f); fclose(f); unlink("width.tmp"); } } free(menuP); return; }
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; } } }
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++; } int dim[3]; for(i=0;i<N;i++) dim[i]=nPoints; // 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", xLog, N, dim,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; }
void decay12(void) { int i, k,L; void * pscr=NULL; char * mlist; static int Branch=1; double Qstat; widths=(double*)malloc(sizeof(double)*nprc_int); if(Q==NULL) for(i=0;i<nModelVars;i++) if(strcmp(varNames[i],"Q")==0){ Q= varValues+i; break;} if(Q) Qstat=*Q; inmenutxt(&mlist); L=mlist[0]; sscanf(mlist+1,"%s",inParticle); for(k=1;k;) { char strmen[]="\030" " Incoming particle " " Show Branchings " " QCD Scale Q= Free " " Model parameters " " Constraints " " Parameter dependence " ; clrbox(1,13, maxCol(), maxRow()); nsubSel=0; decay12information(calcwidth12(),Branch); if(EffQmass) improveStr(strmen,"Free ","M1"); if(!Branch) improveStr(strmen,"Branchings","Partial widths"); menu1(54,4,"",strmen,"n_12_*",&pscr,&k); switch (k) { case 1: { if(strlen(mlist)>L+2) { void * pscr2=NULL; int k=1; menu1(56,5,"",mlist,"",&pscr2,&k); if(k) sscanf(mlist+(k-1)*L+1,"%s",inParticle); put_text(&pscr2); } } break; case 2: Branch=!Branch; break; case 3: EffQmass=!EffQmass; break; case 4: change_parameter(54,8,0); break; case 5: show_depend(54,8); break; case 6: { char proc[20]; char dimInfo[20]="Width [GeV]"; void * pscr=selectChan(); if(!pscr) break; if(nsubSel==0) sprintf(proc,"%s -> 2*x",inParticle); else { sprintf(proc," BR(%s -> %s %s)",inParticle, pinf_int(nsubSel,2,NULL,NULL), pinf_int(nsubSel,3,NULL,NULL)); dimInfo[0]=0; } paramdependence( calcwidth12,proc,dimInfo); put_text(&pscr); } break; } } free(widths); free(mlist); clrbox(1,1,53,16); clrbox(1,16,maxCol(),maxRow()); if(Q) *Q=Qstat; }