Exemple #1
0
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; 
      }
   }
}
Exemple #2
0
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;
}
Exemple #3
0
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 */
Exemple #4
0
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;    
      }
   }
}