コード例 #1
0
ファイル: runVegas.c プロジェクト: leloulight/micro_omega_4
int runEvents(void)
{
    FILE * iprt = NULL;
    int i;

    i=imkmom(inP1,inP2);
//    if(veg_Ptr&&veg_Ptr->ndim!=i)clearGrid();
//    if(!veg_Ptr) veg_Ptr=vegas_init(i,50);    

    w_sess__(NULL);
/* ** open protocol and resulting files */
       
    {  char fname[50];
       sprintf(fname,"%sprt_%d",outputDir,nSess);
       iprt=fopen(fname,"a");
       if(ftell(iprt)==0) 
       { fprintf(iprt,"    CalcHEP kinematics module \n The session parameters:\n");
         w_sess__(iprt);
         fprintf(iprt,"===================================\n");   
       }
    }

/* **  initkinematics */


    { char fname[50];

      sprintf(fname,"%sevents_%d.txt",outputDir,nSess);

      hFill=0;
      generateEvents(veg_Ptr,func_2,fname, iprt);
    }
    fclose(iprt);
    return 0;
}
コード例 #2
0
ファイル: n_calchep.c プロジェクト: restrepo/micrOMEGAs
static void f10_key_prog (int x)
{
    if( mess_y_n(15,15," Quit session? ")) 
    {
        w_sess__(NULL);
        finish();
        sortie(0);
    }
}
コード例 #3
0
ファイル: n_calchep_.c プロジェクト: Omer80/wimps
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);
}
コード例 #4
0
ファイル: mc_menu.c プロジェクト: restrepo/CalcHEP
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();
   }
}
コード例 #5
0
ファイル: runVegas.c プロジェクト: leloulight/micro_omega_4
int runVegas(void)
{
    int i;
    double sd;
    double avgi;
    char mess[25];
    FILE * iprt = NULL;
    int mode=1;
    void * pscr=NULL;
    static int n_Line=7;

    i=imkmom(inP1,inP2);
    if(veg_Ptr&&veg_Ptr->ndim!=i)clearGrid();
    if(!veg_Ptr) veg_Ptr=vegas_init(i,50);     

    if(nin_int == 2) strcpy(mess, "Cross section[pb]");
      else           strcpy(mess, "   Width[Gev]    ");
    
/* ** save current session parameters */
     w_sess__(NULL);
/* ** open protocol and resulting files */
       
    {  char fname[50];
       sprintf(fname,"%sprt_%d",outputDir,nSess);
       iprt=fopen(fname,"a");
       if(ftell(iprt)==0) 
       { fprintf(iprt,"    CalcHEP kinematics module \n The session parameters:\n");
         w_sess__(iprt);
         fprintf(iprt,"===================================\n");   
       }
    }

/* **  initkinematics */

    while(correctHistList()) editHist();
    
/* *** Main cycle */
    if(!integral.old || n_Line==7)
    { n_Line=7;
      scrcolor(Blue, BGmain);
//    printLn(iprt,&n_Line," #IT  %20s Error %%    nCall   chi**2",mess); 
      printLn(iprt,&n_Line," #IT %s Error[%%]  nCalls   Eff.  chi^2",mess);
    }

    for(;;)
    {
        static int worn=1;
        char strmen[]="\030"
         " nSess  = N2_1          "
         " nCalls = N1_1          "
         " Set  Distributions     "
         "*Start integration      "
         " Display Distributions  "
         " Clear statistic        "
         " Freeze grid        OFF " 
	 " Clear  grid            "
	 " Event Cubes NCUBE      "
	 " Generate Events        ";

        improveStr(strmen,"N1_1","%d",integral.ncall[0]);
        improveStr(strmen,"N2_1","%d",integral.itmx[0]);
        improveStr(strmen,"NCUBE","%d",EventGrid);

        if(integral.freeze) improveStr(strmen,"OFF","ON");

        menu1(54,7,"",strmen,"n_veg_*",&pscr,&mode);
        switch(mode)
        {     
        case 0:
          if(iprt) fclose(iprt);
          return 0;           
        case 1:  
          correctInt(50,12,"Enter new value ",&integral.itmx[0],1); break;
        case 2: 
          correctLong(50,12,"Enter new value ",&integral.ncall[0],1); break;
        case 3:  editHist(); break;
        case 4:
          if(veg_Ptr->fMax && !integral.freeze)
          {  if(!mess_y_n(15,15,"You have event generator prepared.\n"
             " The  answer 'Y'  will start Vegas session \nwhich destroys it."
             " To save the event generator answer 'N' \nand set "
             " ' Freeze grid' ON")) break;
             else { free(veg_Ptr->fMax); veg_Ptr->fMax=NULL; veg_Ptr->nCubes=0;}  
          }
          for (i = 1; i <= integral.itmx[0]; ++i)                                       
          { double sum;
            char  errtxt[100]="";
            int k;

            if(integral.ncall[0]==0) break;
            nCall=0;                                                                  
            negPoints=0;                                                              
            badPoints=0; 
            hFill=1;  
            if(vegas_int(veg_Ptr, integral.ncall[0],1.5*(!integral.freeze), 
                 func_, &avgi, &sd)        
              ) break;
            integral.old=1;                                              
            negPoints/=nCall;                                                         
            badPoints/=nCall;                                                         
            integral.nCallTot+=nCall;                                                          
            scrcolor(FGmain,BGmain);                                                 
            printLn(iprt,&n_Line,"%4d   %12.4E %10.2E %8d %s",                     
                 ++integral.n_it, avgi,avgi? 100*sd/(double)fabs(avgi):0.,nCall,effInfo());
                                                                   
            if(negPoints<0) sprintf(errtxt+strlen(errtxt)," Negative points %.1G%%;",                
                                      -100*negPoints/(avgi-2*negPoints));             
            if(badPoints)  sprintf(errtxt+strlen(errtxt),                             
                 "Bad Precision %.1G%%;",100*badPoints/(avgi-2*negPoints));           
                                                                                      
            if(errtxt[0])                                                             
            {                                                                         
               scrcolor(Red,BGmain);                                                  
               printLn(iprt,&n_Line,"%s",errtxt);                                     
            }
                                                                                                                                                
            integral.s0+=sd*sd;                                                                  
            integral.s1+=avgi;                                                             
            integral.s2+=avgi*avgi;                                    
          } 
          
          
          integral.In=integral.s1/integral.n_it; 
          integral.dI=sqrt(integral.s0)/integral.n_it;
          if(integral.n_it<=1 || integral.s0==0 ) integral.khi2=0; else 
          integral.khi2=(integral.s2-integral.s1*integral.s1/integral.n_it)*integral.n_it/(integral.n_it-1)/fabs(integral.s0);  
          
          scrcolor(FGmain,BGmain);

          printLn(iprt,&n_Line," < >   %12.4E %10.2E %8d %7.7s %-7.1G" ,
                      integral.In, fabs(integral.In)? 100*integral.dI/(double)fabs(integral.In):0., integral.nCallTot, 
                                                              effInfo(),  integral.khi2);
          if(histTab.strings)
          { char  fname[20];
            FILE * d;
            sprintf(fname,"distr_%d",nSess);
            d=fopen(fname,"w");  
            wrt_hist2(d,Process);
            fclose(d);
          }
                    messanykey(54,11,"Integration is over");
/*          integral.freeze=0; */
          break;

        case 5: showHist(54,10,Process); break;
        case 6: clearStatistics(-1);
                messanykey(54,13,"Old results for integral\n"
                "and distributions\nare deleted.");
                break;
        case 7: integral.freeze=!integral.freeze; break; 
        case 8: if(!integral.freeze || mess_y_n(15,15,"The information for Event Generator will be lost\n OK?"))  
                { int ndim=veg_Ptr->ndim;
                  vegas_finish(veg_Ptr);
                  veg_Ptr=vegas_init(ndim,50);
                  messanykey(57,11,"OK");
                }   
                break;
        case 9: 
           if(correctLong(50,12,"Enter new value ",&EventGrid,1))
           { if(veg_Ptr->fMax) {free(veg_Ptr->fMax); veg_Ptr->fMax=NULL;veg_Ptr->nCubes=0;}} break;
        case 10: 
           if( !veg_Ptr || !veg_Ptr->fMax)
           { char * mess="Before event generation one has to launch  Vegas session with freezed grid\n"
                                           "to prepare generator";
                if(blind) { printf("%s\n",mess); sortie(200);}  else messanykey(4,13,mess);
           }    else    runEvents(); 
       }
    }    
}
コード例 #6
0
ファイル: runVegas.c プロジェクト: restrepo/CalcHEP
int runVegas(void)
{
    int i;
    double sd;
    double avgi;
    char mess[25];
    FILE * iprt = NULL;
    int mode=1;
    void * pscr=NULL;
    static int n_Line=0;
    
    if(blind) vegas_control=NULL; else  vegas_control=infoLine;
    i=imkmom(inP1,inP2);
    if(veg_Ptr&&veg_Ptr->dim!=i)clearGrid();
    if(!veg_Ptr) veg_Ptr=vegas_init(i,func_,50);     

    if(nin_int == 2) strcpy(mess, "Cross section[pb]");
      else           strcpy(mess, "   Width[Gev]    ");
    
/* ** save current session parameters */
     w_sess__(NULL);
/* ** open protocol and resulting files */
       
    {  char fname[50];
       sprintf(fname,"%sprt_%d",outputDir,nSess);
       iprt=fopen(fname,"a");
    }

/* **  initkinematics */

    while(correctHistList()) editHist();

    if(integral.old) { if(!n_Line)  n_Line=9;} else
    {
       w_sess__(iprt);
       n_Line=8;
    }
                           
/* *** Main cycle */

    for(;;)
    {
        int fz;
        char strmen[]="\030"
         " nSess  = N2_1          "
         " nCalls = N1_1          "
         " Set  Distributions     "
         "*Start integration      "
         " Display Distributions  "
         " Clear statistic        "
         " Freeze grid        OFF " 
	 " Clear  grid            "
	 " Event Cubes NCUBE      "
	 " Num. of events=NE      "
	 " Generate Events        ";
	 
        if(integral.freeze)
        {  fz=1;
           improveStr(strmen,"OFF","ON");
           improveStr(strmen,"NCUBE","%d",EventGrid);
        }  
        else
        {  fz=0;
           strmen[ 030*8+2]=0;
        }

        improveStr(strmen,"N1_1","%d",integral.ncall[fz]);
        improveStr(strmen,"N2_1","%d",integral.itmx[fz]);
        improveStr(strmen,"NE","%d",nEvents);
        menu1(54,7,"",strmen,"n_veg_*",&pscr,&mode);
        switch(mode)
        {     
        case 0:
           w_sess__(NULL);
          if(iprt) fclose(iprt);
          return 0;           
        case 1: correctInt(50,12,"Enter new value ", integral.itmx+fz,1);  break;
        case 2: correctLong(50,12,"Enter new value ",integral.ncall+fz,1);break;
        case 3:  editHist(); break;
        case 4:
          if(veg_Ptr->fMax && !integral.freeze) 
          {  free(veg_Ptr->fMax); veg_Ptr->fMax=NULL; veg_Ptr->evnCubes=0; }
          if(!veg_Ptr->fMax && integral.freeze)
          {  setEventCubes(veg_Ptr, EventGrid);
             EventGrid=veg_Ptr->evnCubes;
          }

          for (i = 1; i <= integral.itmx[fz]; ++i)                                       
          { char  errtxt[100]="";
            long nCall;
            if(integral.ncall[0]==0) break;                                                                  
            negPoints=0;                                                              
            badPoints=0; 
            hFill=1;   
            nCall=vegas_int(veg_Ptr, integral.ncall[fz],1.5*(!fz),nPROCSS,&avgi, &sd);
            if(nCall<0) { messanykey(10,10,"NaN in integrand"); break;}
            if(nCall==0) break;
            
            integral.old=1;                                              
            negPoints/=nCall;                                                         
            badPoints/=nCall;                                                         
            integral.nCallTot+=nCall;                                                          
            scrcolor(FGmain,BGmain);                                                 
            printLn(iprt,&n_Line,"%4d   %12.4E %10.2E %8d %s",                     
                 ++integral.n_it, avgi,avgi? 100*sd/(double)fabs(avgi):0.,nCall,effInfo());
                                                                   
            if(negPoints<0) sprintf(errtxt+strlen(errtxt)," Negative points %.1G%%;",                
                                      -100*negPoints/(avgi-2*negPoints));             
            if(badPoints)  sprintf(errtxt+strlen(errtxt),                             
                 "Bad Precision %.1G%%;",100*badPoints/(avgi-2*negPoints));           
                                                                                      
            if(errtxt[0])                                                             
            {                                                                         
               scrcolor(Red,BGmain);                                                  
               printLn(iprt,&n_Line,"%s",errtxt);                                     
            }
                                                                                                                                                
            integral.s0+=sd*sd;                                                                  
            integral.s1+=avgi;                                                             
            integral.s2+=avgi*avgi;                                    
          } 
          
          
          integral.In=integral.s1/integral.n_it; 
          integral.dI=sqrt(integral.s0)/integral.n_it;
          if(integral.n_it<=1 || integral.s0==0 ) integral.khi2=0; else 
          integral.khi2=(integral.s2-integral.s1*integral.s1/integral.n_it)*integral.n_it/(integral.n_it-1)/fabs(integral.s0);  
          
          scrcolor(FGmain,BGmain);

          printLn(iprt,&n_Line," < >   %12.4E %10.2E %8d %7.7s %-7.1G" ,
                      integral.In, fabs(integral.In)? 100*integral.dI/(double)fabs(integral.In):0., integral.nCallTot, 
                                                              effInfo(),  integral.khi2);
          if(histTab.strings)
          { char  fname[20];
            FILE * d;
            sprintf(fname,"distr_%d",nSess);
            d=fopen(fname,"w");  
            wrt_hist2(d,Process);
            fclose(d);
          }
                    messanykey(54,11,"Integration is over");
/*          integral.freeze=0; */
          break;

        case 5: showHist(54,10,Process); break;
        case 6: clearStatistics(-1);
                messanykey(54,13,"Old results for integral\n"
                "and distributions\nare deleted.");
                break;
        case 7: 
             if(veg_Ptr->fMax && integral.freeze) 
             {  if(mess_y_n(15,15,"You have event generator prepared.\n"
                " Setting the flag \"OFF\"  will destroy it."
                " Press 'Y' to confirm.")) integral.freeze=0; 
             } else  integral.freeze=!integral.freeze; 
             break; 
        case 8: if(!integral.freeze || mess_y_n(15,15,"The information for Event Generator will be lost\n OK?"))  
                { int ndim=veg_Ptr->dim;
                  vegas_finish(veg_Ptr);
                  veg_Ptr=vegas_init(ndim,func_,50);
                  messanykey(57,11,"OK");
                }   
                break;
        case 9: 
           if(correctLong(50,12,"Enter new value ",&EventGrid,1))
           { if(veg_Ptr->fMax) {free(veg_Ptr->fMax); veg_Ptr->fMax=NULL;}
             printf("EventGrid=%d\n",EventGrid);
             setEventCubes(veg_Ptr, EventGrid);
             EventGrid=veg_Ptr->evnCubes;  
           } break;
        case 10:  correctInt(50,15,"",&nEvents,1); break;
        case 11: 
           if( !veg_Ptr || !veg_Ptr->fMax)
           { char * mess="Before event generation one has to launch  Vegas session with freezed grid\n"
                                           "to prepare generator";
                if(blind) { printf("%s\n",mess); sortie(200);}  else messanykey(4,13,mess);
           } else  runEvents();
       }
    }    
}
コード例 #7
0
ファイル: mc_menu.c プロジェクト: Omer80/wimps
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();
   }
}