Esempio n. 1
0
void n_comphep(void)
{
  clr_scr(FGmain,BGmain); 

  while(checkParam()) 
   if(mess_y_n(15,15, "Quit the session?"))
     {w_sess__(NULL); return;} else change_parameter(54,7,0);
  do
  { int err=monte_carlo_menu();
    switch(err)
    { case 1:printf("Energy is too small!\n"); sortie(123);
      case 2:printf("Can not evaluate cuts limlts\n"); sortie(124);
      case 3:printf("Can not evaluate regularization paremeters"); sortie(125);
    }
  }
  while(!mess_y_n(15,15,"Quit session?"));
 
  w_sess__(NULL);
}
Esempio n. 2
0
int monte_carlo_menu(void)
{
   static int r=0;
   int mode=1;
   void * pscr=NULL;
   void (*quit)(int)=f3_key[7];
   char menutxt[]="\030"
                  " Subprocess             "
                  " IN state               "
                  " Model parameters       "
                  " Constraints            "
                  " QCD  alpha & scales    "
                  " Breit-Wigner           "
	          " Aliases                "
	          " Cuts                   "
	          " Phase space mapping    "
                  " Monte Carlo simulation "
                  " Easy                   ";
                  
   if(nout_int!=2  ) menutxt[menutxt[0]*10+1]=0;
   if(nin_int==1)  improveStr(menutxt,"Easy", "Total width"); 
           else    improveStr(menutxt,"Easy", "1D integration");
 
   wrtprc_();
   for(;;)
   {  
      infor();
      f3_key[7]=quit;
      menu1(54,4,"",menutxt,"n_mc_*",&pscr, &mode);
      if(mode==1||mode==2||mode==3||mode==5||mode==7)f3_key[7]=NULL;

      switch (mode)
      { 
        case  0: return 0;
        case  1: r=r|3*sub_men__(); break;
        case  2: r=r|in_setting(); break;
        case  3: r=r|change_parameter(54,7,0);  break;
        case  4: { int modeC=1;
                   for(;;)
                   { char menuC[]="\030"
                     " All Constraints        " 
                     " Masses,Widths,Branching"; 
                     void * pscrC=NULL;
                     menu1(54,6,"",menuC,"n_constr_*",&pscrC, &modeC);
                     switch(modeC)
                     { case 0: break;
                       case 1: show_depend(54,7); break;
                       case 2: show_spectrum(54,9); break;
                     } 
                     if(!modeC) break;
                   } break;
                 }     
        case  5: r=r|qcdmen_();  break;
        case  6: r=r|w_men__();  break;
        case  7: do r=r|(3*edittable(1,4,&compTab,1,"n_comp",0)); while (fillCompositeArray());
	         break;     
        case  8: do r=r|(3*edittable(1,4,&cutTab,1,"n_cut",0)); while (fillCutArray()); 
                 break;             
        case  9: r=r|mappingMenu(); break;                      
        case  10: 
                 if(nout_int==1 && !sf_num[0] && !sf_num[1]  ) 
                 { if(blind)  return 1;                     
                   messanykey(15,15,"Phase space integration for 2->1 processes\n needs distribution functions.");
                   break;
                 }
                                                                        
                 
                 if(checkEnergy())   
                 { 
                    if(blind==1)
                    { char fname[50];
                     int i,j;
                     sprintf(fname,"events_%d.txt", nSess);
                     FILE * f=fopen(fname,"w");
                     fprintf(f,"#%s\n", VERSION_);
                     fprintf(f,"#Type %d -> %d\n", nin_int,nout_int);
                     fprintf(f,"#Initial_state ");
                     if(nin_int==1) fprintf(f," P1=0\n");
                     else
                     { fprintf(f," P1_3=0  P2_3=0\n");
                       wrt_sf__(f);
                     }  
                     fprintf(f,"#PROCESS  ");
                     for(i=1;i<=nin_int+nout_int; i++)
                     { int pcode;
                       char * pname=pinf_int(Nsub,i,NULL,&pcode);
                       fprintf(f," %d(%s)", pcode, pname);
                       if(i==nin_int)  fprintf(f," ->");
                     } 
                     fprintf(f,"\n");    
                     fprintf(f,"#MASSES ");
                     for(i=0;i<nin_int+nout_int;i++)
                     {  REAL m;
                        pinf_int(Nsub,i+1,&m,NULL); 
                        fprintf(f," %.10E", (double)m);
                     }   
                     fprintf(f,"\n");
  
                     fprintf(f,"#Cross_section(Width) %E\n",0.);
                    
                     fprintf(f,"#Number_of_events %10d\n",0);
                     fprintf(f,"#Sum_of_weights %12.4E %12.4E \n",0.,0.);
                     fprintf(f,"#Events  "); 
                     if(nin_int==2) fprintf(f,"     P1_3 [Gev]        P2_3 [Gev]   ");
                     for(i=1;i<=nout_int; i++) for(j=1;j<=3;j++) 
                          fprintf(f,"     P%d_%d [Gev]   ",i+nin_int,j);
                     integral.old=1;
                     fclose(f); 
                     return 1;
                   }
                            
                   messanykey(15,15,"Energy is too small!");                   
                   break;
                 }

                 if(fillCutArray()) 
                 { if(blind) return 2;
                   messanykey(15,15,"Can not evaluate cut limits"); 
                   break;
                 }  
        case 11:
                if(mode==11) 
                {  void (*f10_tmp)(int);
                   w_sess__(NULL);
                   f10_tmp=f3_key[7];
                   f3_key[7]=f10_key_prog_for22;
                   if(nin_int==1) decay12(); else
                   { REAL m1,m2, Pcm;
                     pinf_int(Nsub,1,&m1,NULL); 
                     pinf_int(Nsub,2,&m2,NULL);  
                     if(sf_num[0] && sf_mass[0]>m1) m1= sf_mass[0];
                     if(sf_num[1] && sf_mass[1]>m2) m2= sf_mass[1];
                     incomkin(m1,m2,inP1,inP2,NULL,&Pcm,NULL); 
                     if(sf_num[0]||sf_num[1]||nCuts)
                      messanykey(10,10,"Structure functions and cuts are ignored\n");                                       
                     cs_numcalc(Pcm);
                   }
                   f3_key[7]= f10_tmp;
                   r_sess__(NULL); 
                   break;
                } else if(fillRegArray()) 
                {  
                  if(blind) return 3;                
                   messanykey(15,15,
                       "Can not evaluate regularization paremeters");
                   break;    
                }
   
                if(mode==10)  runVegas(); 
                r=0;  
                break;
                 
      }
//printf("r=%d\n",r);      
      if(r) clearEventMax();
      if(r&2) clearGrid();
      if(r&1)newSession();
   }
}
Esempio n. 3
0
void  decay12(void)
{ 
   int  i, k,L;
   void * pscr=NULL; 
   char * mlist;
   static int Branch=1;

   widths=(double*)malloc(sizeof(double)*nprc_int);

   for(i=1;i<=nvar_int;i++)
   {   if(!strcmp(varName_int[i],"Q"))  Q=va_int+i;
       else if(!strcmp(varName_int[i],"GG")) GG=va_int+i;
   }
 
   if(GG)for(i=1;i<=nvar_int+nfunc_int;i++) 
      if(!strcmp(varName_int[i],"SC")){ SC=va_int+i; break;}
   
   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   "
         " Les Houches output     ";

      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;
        case 7: writeLesHdecays(); break; 
      } 
   }
   free(widths);
   free(mlist);   
   clrbox(1,1,53,16);
   clrbox(1,16,maxCol(),maxRow());
}
Esempio n. 4
0
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;
}
Esempio n. 5
0
int monte_carlo_menu(void)
{
   static int r=0;
   int mode=1;
   void * pscr=NULL;
   void * pscr_mem=NULL;
   void (*quit)(int)=f3_key[7];
   char menutxt[]="\030"
                  " Subprocess             "
                  " IN state               "
                  " Model parameters       "
                  " Constraints            "
                  " QCD coupling           "
                  " Breit-Wigner           "
	          " Aliases                "
	          " Cuts                   "
	          " Phase space mapping    "
                  " Monte Carlo simulation "
                  " Easy                   ";
                  
   if(nout_int!=2  ) menutxt[menutxt[0]*10+1]=0;
   if(nin_int==1)  improveStr(menutxt,"Easy", "Total width"); 
           else    improveStr(menutxt,"Easy", "1D intergration");
 
   get_text(1,10,80,24,&pscr_mem);
   wrtprc_();
   for(;;)
   {  
      infor();
      f3_key[7]=quit;
      menu1(54,4,"",menutxt,"n_mc_*",&pscr, &mode);
      if(mode==1||mode==2||mode==3||mode==5||mode==7)f3_key[7]=NULL;

      switch (mode)
      { 
        case  0: put_text(&pscr_mem); return 0;
        case  1: r=r|3*sub_men__(); break;
        case  2: r=r|in_setting(); break;
        case  3: r=r|change_parameter(54,7,0);  break;
        case  4: { int modeC=1;
                   for(;;)
                   { char menuC[]="\030"
                     " All Constraints        " 
                     " Masses,Widths,Branching"; 
                     void * pscrC=NULL;
                     menu1(54,6,"",menuC,"n_constr_*",&pscrC, &modeC);
                     switch(modeC)
                     { case 0: put_text(&pscr_mem); break;
                       case 1: show_depend(54,7); break;
                       case 2: show_spectrum(54,9); break;
                     } 
                     if(!modeC) break;
                   } break;
                 }     
        case  5: r=r|qcdmen_();  break;
        case  6: r=r|w_men__();  break;
        case  7: do r=r|(3*edittable(1,4,&compTab,1,"n_comp",0)); while (fillCompositeArray());
	         break;     
        case  8: do r=r|(3*edittable(1,4,&cutTab,1,"n_cut",0)); while (fillCutArray()); 
                 break;             
        case  9: r=r|mappingMenu(); break;                      
        case  10: 
                 if(nout_int==1 && !sf_num[0] && !sf_num[1]  ) 
                 { if(blind)  return 1;                     
                   messanykey(15,15,"Phase space integration for 2->1 processes\n needs distribution functions.");
                   break;
                 }
                                                                        
                 
                 if(checkEnergy())   
                 { if(blind)  return 1;                  
                   messanykey(15,15,"Energy is too small!");                   
                   break;
                 }

                 if(fillCutArray()) 
                 { if(blind) return 2;
                   messanykey(15,15,"Can not evaluate cuts limlts"); 
                   break;
                 }  
        case 11:
                if(mode==11) 
                {  void (*f10_tmp)(int);
                   w_sess__(NULL);
                   f10_tmp=f3_key[7];
                   f3_key[7]=f10_key_prog_for22;
                   if(nin_int==1) decay12(); else
                   { REAL m1,m2, Pcm;
                     pinf_int(Nsub,1,&m1,NULL); 
                     pinf_int(Nsub,2,&m2,NULL);  
                     incomkin(m1,m2,inP1,inP2,NULL,&Pcm,NULL); 
                     if(sf_num[0]||sf_num[1]||nCuts)
                      messanykey(10,10,"Structure functions and cuts are ignored\n");                                       
                     cs_numcalc(Pcm);
                   }
                   f3_key[7]= f10_tmp;
                   r_sess__(NULL); 
                   break;
                } else if(fillRegArray()) 
                {  
                  if(blind) return 3;                
                   messanykey(15,15,
                       "Can not evaluate regularization paremeters");
                   break;    
                }
   
                if(mode==10)  runVegas(); 
                r=0;  
                break;
                 
      }
      if(r) clearEventMax();
      if(r&2) clearGrid();
      if(r&1)newSession();
   }
}